Commit 2db04546 by User

added keyboard open searchbybarcode

parent 40384fd7
...@@ -2,8 +2,6 @@ package w.soulofpluto.posstock; ...@@ -2,8 +2,6 @@ package w.soulofpluto.posstock;
import com.squareup.okhttp.RequestBody; import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response; import com.squareup.okhttp.Response;
import org.json.JSONObject;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
...@@ -15,24 +13,23 @@ import retrofit2.http.Path; ...@@ -15,24 +13,23 @@ import retrofit2.http.Path;
* Created by Ramesh on 05/09/20. * Created by Ramesh on 05/09/20.
*/ */
public interface ApiService { public interface ApiService{
//String BASE_URL = "https://aeebe1.emporter.eu/pos_actions/"; //String BASE_URL = "https://aeebe1.emporter.eu/pos_actions/";
//String Token = "41f34d7009db337f6213be52f7151108"; //String Token = "41f34d7009db337f6213be52f7151108";
//String StoreId = "980"; //String StoreId = "980";
/*@Headers({"Pos-Access-Token:" + Token,"Pos-User-Access-Store-Id:"+StoreId, /*@Headers({"Pos-Access-Token:" + Token,"Pos-User-Access-Store-Id:"+StoreId,
"Accept: application/json","Content-Type:multipart/form-data"})*/ "Accept: application/json","Content-Type:multipart/form-data"})*/
/*@Multipart /*@Multipart
@POST("uploadBarcodeImages") @POST("uploadBarcodeImages")
Call<ResponseBody> uploadMultiple( Call<ResponseBody> uploadMultiple(@Part("Pos-Access-Token") RequestBody token,
@Part("Pos-Access-Token") RequestBody token, @Part("Pos-User-Access-Store-Id") RequestBody storeId,
@Part("Pos-User-Access-Store-Id") RequestBody storeId, @Part("barcode") RequestBody barcode,
@Part("barcode") RequestBody barcode, @Part List<MultipartBody.Part> files);*/
@Part List<MultipartBody.Part> files);*/
@Headers({"Content-type: application/json"}) @Headers({"Content-type: application/json"})
@POST("/login/doLogin") @POST("/login/doLogin")
Call<Response> login(@Body RequestBody body); Call<Response> login(@Body RequestBody body);
@GET("/login/getStoresMappedToUser/{id}") @GET("/login/getStoresMappedToUser/{id}")
Call<Response> getStoreId(@Path("id") String id); Call<Response> getStoreId(@Path("id") String id);
} }
...@@ -9,25 +9,21 @@ import android.view.Gravity; ...@@ -9,25 +9,21 @@ import android.view.Gravity;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
import com.squareup.okhttp.MediaType; import com.squareup.okhttp.MediaType;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import java.io.IOException; import java.io.IOException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.StringTokenizer;
/* /*
Create by Ramesh Babu Create by Ramesh Babu
*/ */
public class Constants{ public class Constants{
//public static String BASE_URL = "http://182.18.167.139/"; //public static String BASE_URL = "http://182.18.167.139/";
public static String BASE_URL = "http://posapi.plutokm.com/"; public static String BASE_URL = "http://posapi.plutokm.com/";
//public static String BASE_URL = "https://7fad42.emporter.eu/"; //public static String BASE_URL = "https://7fad42.emporter.eu/";
public static String Logout = Constants.BASE_URL + "/login/doLogout/"; public static String Logout = Constants.BASE_URL + "/login/doLogout/";
public static String Login = Constants.BASE_URL + "/login/doLogin"; public static String Login = Constants.BASE_URL + "/login/doLogin";
...@@ -54,6 +50,7 @@ public class Constants{ ...@@ -54,6 +50,7 @@ public class Constants{
public static String Plan_Id = "<font color=#3700B3><b>PLAN ID : </b></font>"; public static String Plan_Id = "<font color=#3700B3><b>PLAN ID : </b></font>";
public static String Name = "<font color=#3700B3><b>NAME : </b></font>"; public static String Name = "<font color=#3700B3><b>NAME : </b></font>";
public static String VERSION = "1.1"; public static String VERSION = "1.1";
public static int Value = 7;
public static ProgressDialog progressDialog; public static ProgressDialog progressDialog;
public static void getToast(Context context, String data){ public static void getToast(Context context, String data){
......
...@@ -10,8 +10,6 @@ import android.view.MenuItem; ...@@ -10,8 +10,6 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
...@@ -23,49 +21,42 @@ import com.squareup.okhttp.Response; ...@@ -23,49 +21,42 @@ import com.squareup.okhttp.Response;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/* /*
Create by Ramesh Babu Create by Ramesh Babu
*/ */
public class DashBoardActivity extends AppCompatActivity implements View.OnClickListener { public class DashBoardActivity extends AppCompatActivity implements View.OnClickListener {
Toolbar dashboad_toolbar; Toolbar dashboard_toolbar;
Button stock_audit,rack_qty,searchby_barcode; Button stock_audit,rack_qty,searchby_barcode;
TextView version; TextView version;
PreferenceManager preferenceManager; PreferenceManager preferenceManager;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard); setContentView(R.layout.activity_dashboard);
stock_audit = findViewById(R.id.stock_audit); stock_audit = findViewById(R.id.stock_audit);
rack_qty = findViewById(R.id.rack_qty); rack_qty = findViewById(R.id.rack_qty);
searchby_barcode = findViewById(R.id.searchby_barcode); searchby_barcode = findViewById(R.id.searchby_barcode);
dashboad_toolbar = findViewById(R.id.dashboard_toolbar); dashboard_toolbar= findViewById(R.id.dashboard_toolbar);
version = findViewById(R.id.version); version = findViewById(R.id.version);
preferenceManager= new PreferenceManager(this); preferenceManager= new PreferenceManager(this);
setSupportActionBar(dashboad_toolbar); setSupportActionBar(dashboard_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.dashboard)); getSupportActionBar().setTitle(getResources().getString(R.string.dashboard));
stock_audit.setOnClickListener(this); stock_audit.setOnClickListener(this);
rack_qty.setOnClickListener(this); rack_qty.setOnClickListener(this);
searchby_barcode.setOnClickListener(this); searchby_barcode.setOnClickListener(this);
version.setText(Html.fromHtml(Constants.Ver_Text +Constants.VERSION)); version.setText(Html.fromHtml(Constants.Ver_Text +Constants.VERSION));
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu){ public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu, menu); getMenuInflater().inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){ public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch(item.getItemId()){ switch(item.getItemId()){
/*case android.R.id.home:
finish();
break;*/
case R.id.dashboard_logout: case R.id.dashboard_logout:
if(Constants.isNetworkAvailable(DashBoardActivity.this)){ if(Constants.isNetworkAvailable(DashBoardActivity.this)){
Logout(Constants.Logout+preferenceManager.getUserId()); Logout(Constants.Logout+preferenceManager.getUserId());
...@@ -99,7 +90,7 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick ...@@ -99,7 +90,7 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
if(response.isSuccessful()){ if(response.isSuccessful()){
String res = response.body().string(); String res = response.body().string();
Log.e("Dashboard Logout ", res); Log.e("Dashboard Logout ", res);
try { try{
JSONObject jsonObject = new JSONObject(res); JSONObject jsonObject = new JSONObject(res);
if(jsonObject.has("success")){ if(jsonObject.has("success")){
if(jsonObject.getInt("success") == 1){ if(jsonObject.getInt("success") == 1){
...@@ -112,19 +103,19 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick ...@@ -112,19 +103,19 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg")); Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg"));
} }
} }
} catch (JSONException e) { }catch(JSONException e){
e.printStackTrace(); e.printStackTrace();
}catch (NullPointerException np){ }catch (NullPointerException np){
np.printStackTrace(); np.printStackTrace();
} }
} }
} }
}); });
} }
@Override @Override
public void onClick(View view){ public void onClick(View view){
switch (view.getId()){ switch(view.getId()){
case R.id.stock_audit: case R.id.stock_audit:
Intent in_main = new Intent(this,MainActivity.class); Intent in_main = new Intent(this,MainActivity.class);
startActivity(in_main); startActivity(in_main);
...@@ -147,20 +138,20 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick ...@@ -147,20 +138,20 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
super.onBackPressed(); super.onBackPressed();
}else{ }else{
AlertDialog alert = new AlertDialog.Builder(this) AlertDialog alert = new AlertDialog.Builder(this)
.setTitle("Are you sure you want to close this app") .setTitle("Are you sure you want to close this app")
//.setMessage("Are you sure to Exit") //.setMessage("Are you sure to Exit")
.setPositiveButton("Yes", new DialogInterface.OnClickListener(){ .setPositiveButton("Yes", new DialogInterface.OnClickListener(){
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i){
finish(); finish();
} }
}) })
.setNegativeButton("No", new DialogInterface.OnClickListener(){ .setNegativeButton("No", new DialogInterface.OnClickListener(){
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i){
} }
}) })
.show(); .show();
} }
} }
} }
package w.soulofpluto.posstock; package w.soulofpluto.posstock;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
...@@ -13,13 +11,11 @@ import android.os.Looper; ...@@ -13,13 +11,11 @@ import android.os.Looper;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import com.squareup.okhttp.Callback; import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request; import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody; import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response; import com.squareup.okhttp.Response;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -28,7 +24,6 @@ import java.text.SimpleDateFormat; ...@@ -28,7 +24,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON; import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.getDateWithOffset; import static w.soulofpluto.posstock.Constants.getDateWithOffset;
...@@ -37,6 +32,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -37,6 +32,7 @@ public class MainActivity extends AppCompatActivity {
RecyclerView plans_list; RecyclerView plans_list;
PreferenceManager preferenceManager; PreferenceManager preferenceManager;
ArrayList<Plans> plansArrayList; ArrayList<Plans> plansArrayList;
@Override @Override
protected void onCreate(Bundle savedInstanceState){ protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -49,6 +45,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -49,6 +45,7 @@ public class MainActivity extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(getResources().getString(R.string.test)+ " UserId : " +preferenceManager.getUserId()); getSupportActionBar().setTitle(getResources().getString(R.string.test)+ " UserId : " +preferenceManager.getUserId());
} }
@Override @Override
protected void onStart(){ protected void onStart(){
if(Constants.isNetworkAvailable(MainActivity.this)){ if(Constants.isNetworkAvailable(MainActivity.this)){
...@@ -59,6 +56,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -59,6 +56,7 @@ public class MainActivity extends AppCompatActivity {
} }
super.onStart(); super.onStart();
} }
public void Logout(String Url){ public void Logout(String Url){
final OkHttpClient client = new OkHttpClient(); final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS); client.setConnectTimeout(250, TimeUnit.SECONDS);
...@@ -101,14 +99,16 @@ public class MainActivity extends AppCompatActivity { ...@@ -101,14 +99,16 @@ public class MainActivity extends AppCompatActivity {
} }
}); });
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu){ public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu,menu); getMenuInflater().inflate(R.menu.menu,menu);
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){ public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){ switch(item.getItemId()){
case android.R.id.home: case android.R.id.home:
finish(); finish();
break; break;
...@@ -123,18 +123,19 @@ public class MainActivity extends AppCompatActivity { ...@@ -123,18 +123,19 @@ public class MainActivity extends AppCompatActivity {
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
private void FetchData(String Url){ private void FetchData(String Url){
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
try{ try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date(); Date todayDate = new Date();
Date from = getDateWithOffset(-7, new Date()); Date from = getDateWithOffset(-Constants.Value, new Date());
String fromdate = currentDate.format(from); String fromDate = currentDate.format(from);
String thisDate = currentDate.format(todayDate); String thisDate = currentDate.format(todayDate);
Log.e("Last date",fromdate); Log.e("Last date",fromDate);
object.put(getResources().getString(R.string.auditstatus),"In Progress"); object.put(getResources().getString(R.string.auditstatus),"In Progress");
object.put(getResources().getString(R.string.fromdate),fromdate); object.put(getResources().getString(R.string.fromdate),fromDate);
object.put(getResources().getString(R.string.todate),thisDate); object.put(getResources().getString(R.string.todate),thisDate);
object.put(getResources().getString(R.string.android_version),Constants.VERSION); object.put(getResources().getString(R.string.android_version),Constants.VERSION);
} }
...@@ -186,7 +187,6 @@ public class MainActivity extends AppCompatActivity { ...@@ -186,7 +187,6 @@ public class MainActivity extends AppCompatActivity {
JSONObject jsonObject = jsonArray.getJSONObject(i); JSONObject jsonObject = jsonArray.getJSONObject(i);
Plans plans = new Plans(); Plans plans = new Plans();
plans.setPlanId(String.valueOf(jsonObject.getInt("id"))); plans.setPlanId(String.valueOf(jsonObject.getInt("id")));
plans.setName(jsonObject.getString("stock_audit_name")); plans.setName(jsonObject.getString("stock_audit_name"));
plans.setDivision(Constants.convertString(jsonObject.getString("item_divisions"))); plans.setDivision(Constants.convertString(jsonObject.getString("item_divisions")));
plans.setSection(Constants.convertString(jsonObject.getString("item_sections"))); plans.setSection(Constants.convertString(jsonObject.getString("item_sections")));
......
...@@ -87,7 +87,7 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem ...@@ -87,7 +87,7 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date(); Date todayDate = new Date();
Date from = getDateWithOffset(-7, new Date()); Date from = getDateWithOffset(-Constants.Value, new Date());
String fromDate = currentDate.format(from); String fromDate = currentDate.format(from);
String thisDate = currentDate.format(todayDate); String thisDate = currentDate.format(todayDate);
Log.e("Last date",fromDate); Log.e("Last date",fromDate);
......
...@@ -64,10 +64,11 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset; ...@@ -64,10 +64,11 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
}else{ }else{
Constants.getToast(SearchByBarcode.this,getResources().getString(R.string.connection)); Constants.getToast(SearchByBarcode.this,getResources().getString(R.string.connection));
} }
searchbybarcode_spinner.setOnItemSelectedListener(this); searchbybarcode_spinner.setOnItemSelectedListener(this);
/*
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
searchby_barcode.setShowSoftInputOnFocus(false); searchby_barcode.setShowSoftInputOnFocus(false);
} }*/
searchby_barcode.addTextChangedListener(new Checked()); searchby_barcode.addTextChangedListener(new Checked());
} }
...@@ -95,9 +96,9 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset; ...@@ -95,9 +96,9 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
Log.e("Search", object.toString()); Log.e("Search", object.toString());
RequestBody body = RequestBody.create(JSON, object.toString()); RequestBody body = RequestBody.create(JSON, object.toString());
final OkHttpClient client = new OkHttpClient(); final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS); client.setConnectTimeout(25, TimeUnit.SECONDS);
client.setReadTimeout(250, TimeUnit.SECONDS); client.setReadTimeout(25, TimeUnit.SECONDS);
client.setWriteTimeout(250, TimeUnit.SECONDS); client.setWriteTimeout(25, TimeUnit.SECONDS);
Request request = new Request.Builder() Request request = new Request.Builder()
.url(Constants.BarcodeSearch) .url(Constants.BarcodeSearch)
.post(body) .post(body)
...@@ -191,19 +192,26 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset; ...@@ -191,19 +192,26 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
@Override @Override
public void onTextChanged(CharSequence val, int i, int i1, int i2){ public void onTextChanged(CharSequence val, int i, int i1, int i2){
try{ try{
if(Constants.isNetworkAvailable(SearchByBarcode.this)){ if(Constants.isNetworkAvailable(SearchByBarcode.this)) {
if(val.toString().contains("\n")){ if(val.toString().length() > 0) {
if(Constants.isNetworkAvailable(SearchByBarcode.this)){ if(planid.equalsIgnoreCase("0")) {
if(planid.equalsIgnoreCase("0")){ Constants.getToast(SearchByBarcode.this, "Choose Plan Id");
Constants.getToast(SearchByBarcode.this,"Choose Plan Id"); searchby_barcode.setText("");
searchby_barcode.setText(""); }
}else{ if (val.toString().contains("\n")) {
getBarcodeCheck(planid,searchby_barcode.getText().toString().replace("\n", "")); if (Constants.isNetworkAvailable(SearchByBarcode.this)) {
} if (planid.equalsIgnoreCase("0")) {
Constants.getToast(SearchByBarcode.this, "Choose Plan Id");
searchby_barcode.setText("");
} else {
getBarcodeCheck(planid, searchby_barcode.getText().toString().replace("\n", ""));
Constants.ProgressDialogShow(SearchByBarcode.this);
}
} else {
Constants.getToast(SearchByBarcode.this, getResources().getString(R.string.connection));
}
} }
} }
}else{
Constants.getToast(SearchByBarcode.this, getResources().getString(R.string.connection));
} }
}catch(NullPointerException np){ }catch(NullPointerException np){
np.printStackTrace(); np.printStackTrace();
...@@ -220,7 +228,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset; ...@@ -220,7 +228,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date(); Date todayDate = new Date();
Date from = getDateWithOffset(-7, new Date()); Date from = getDateWithOffset(-Constants.Value, new Date());
String fromDate = currentDate.format(from); String fromDate = currentDate.format(from);
String thisDate = currentDate.format(todayDate); String thisDate = currentDate.format(todayDate);
Log.e("Last date",fromDate); Log.e("Last date",fromDate);
...@@ -234,9 +242,9 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset; ...@@ -234,9 +242,9 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
Log.e("Searchby object ====>",object.toString()); Log.e("Searchby object ====>",object.toString());
RequestBody body = RequestBody.create(JSON,object.toString()); RequestBody body = RequestBody.create(JSON,object.toString());
final OkHttpClient client = new OkHttpClient(); final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS); client.setConnectTimeout(25, TimeUnit.SECONDS);
client.setReadTimeout(250, TimeUnit.SECONDS); client.setReadTimeout(25, TimeUnit.SECONDS);
client.setWriteTimeout(250, TimeUnit.SECONDS); client.setWriteTimeout(25, TimeUnit.SECONDS);
Request request = new Request.Builder() Request request = new Request.Builder()
.url(Url) .url(Url)
.post(body) .post(body)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment