Commit d63feb8f by User

few changes

parent 2db04546
......@@ -366,7 +366,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public void run(){
try{
Constants.getToast(PlanDetails.this, object.getString(getResources().getString(R.string.msg)));
Dologin();
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
......@@ -404,10 +404,9 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
object.put(getResources().getString(R.string.barcode_upload), Barcode);
object.put(getResources().getString(R.string.rule_id) , Id);
object.put(getResources().getString(R.string.quantity_upload),qty);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
object.put(getResources().getString(R.string.rule_id), Id);
object.put(getResources().getString(R.string.quantity_upload), qty);
object.put(getResources().getString(R.string.android_version), Constants.VERSION);
}
} catch (JSONException e) {
e.printStackTrace();
......@@ -470,7 +469,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public void run() {
try{
Constants.getToast(PlanDetails.this, object.getString(getResources().getString(R.string.msg)));
Dologin();
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
......@@ -534,7 +533,6 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
object.put(getResources().getString(R.string.rule_id), plans.getPlanId());
object.put(getResources().getString(R.string.quantity_upload), plans.getQty());
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
......@@ -593,13 +591,13 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public void run() {
try {
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.msg)));
Dologin();
DoLogin();
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}else{
} else{
runOnUiThread(new Runnable() {
@Override
public void run() {
......@@ -614,7 +612,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}
} catch (JSONException e) {
e.printStackTrace();
}catch (NullPointerException np){
} catch (NullPointerException np){
np.printStackTrace();
}
}
......@@ -626,16 +624,16 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
runOnUiThread(new Runnable() {
@Override
public void run() {
if (list.size() > 0) {
count.setText("Scanned Items : " + list.size());
} else {
count.setText("Scanned Items : 0 ");
if(list.size() > 0) {
count.setText("Scanned Items : " + list.size());
}else {
count.setText("Scanned Items : 0 ");
}
}
});
}
private void Dologin(){
private void DoLogin(){
dialog = new Dialog(PlanDetails.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_session);
......@@ -643,23 +641,23 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog.show();
final TextView userid = dialog.findViewById(R.id.relogin_userid);
final TextView userId = dialog.findViewById(R.id.relogin_userid);
final TextView pass = dialog.findViewById(R.id.relogin_pass);
final Button relogin = dialog.findViewById(R.id.relogin_submit);
userid.setText(preferenceManager.getUserId());
final Button reLogin = dialog.findViewById(R.id.relogin_submit);
userId.setText(preferenceManager.getUserId());
//pass.setText(preferenceManager.getPassword());
relogin.setOnClickListener(new View.OnClickListener() {
reLogin.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(TextUtils.isEmpty(pass.getText().toString())){
Constants.getToast(PlanDetails.this,"Please Enter Password");
Constants.getToast(PlanDetails.this,getResources().getString(R.string.enterPassword));
}else{
doLogin(preferenceManager.getUserId(), Constants.getSHA256(pass.getText().toString()));
Constants.ProgressDialogShow(PlanDetails.this);
}
}else{
Constants.getToast(PlanDetails.this,getResources().getString(R.string.connection));
Constants.getToast(PlanDetails.this,getResources().getString(R.string.connection));
}
}
});
......@@ -693,7 +691,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public void onFailure(Request request, IOException e){
if(e.getCause() != null && e.getCause() instanceof UnknownHostException){
}else{
Log.e("error ====>" , e.getMessage());
Log.e("error ====>" , e.getMessage());
}
Constants.ProgressDialogDismiss();
}
......
......@@ -64,7 +64,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
}else{
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){
searchby_barcode.setShowSoftInputOnFocus(false);
......@@ -109,11 +109,11 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable() {
runOnUiThread(new Runnable(){
@Override
public void run() {
Constants.getToast(SearchByBarcode.this, e.getMessage());
Constants.ProgressDialogDismiss();
public void run(){
Constants.getToast(SearchByBarcode.this, e.getMessage());
Constants.ProgressDialogDismiss();
}
});
}
......@@ -129,7 +129,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
public void run(){
try{
final JSONObject object = new JSONObject(Response);
if (response.code() == 200) {
if(response.code() == 200) {
if (object.has(getResources().getString(R.string.success))) {
if(object.getInt(getResources().getString(R.string.success)) == 1) {
Log.e("Length",String.valueOf(getResources().getString(R.string.data).length()));
......@@ -141,14 +141,14 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
}else{
searchby_barcode.setText("");
try{
JSONObject jsonObject = object.getJSONObject(getResources().getString(R.string.data));
searchbybarcode_rack.setText(Html.fromHtml(Constants.Id) + jsonObject.getString("rack_id") + "\n"
JSONObject jsonObject = object.getJSONObject(getResources().getString(R.string.data));
searchbybarcode_rack.setText(Html.fromHtml(Constants.Id) + jsonObject.getString("rack_id") + "\n"
+ (Html.fromHtml(Constants.Barcode) + jsonObject.getString("barcode")) + "\n"
+ (Html.fromHtml(Constants.From) + jsonObject.getString("scanning_start_at")) + "\n"
+ (Html.fromHtml(Constants.To) + jsonObject.getString("scanning_end_at")));
}catch(JSONException e){
e.printStackTrace();
}
}catch(JSONException e){
e.printStackTrace();
}
}
}
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
......
......@@ -23,6 +23,7 @@
<string name="spalsh">Splash Screen</string>
<string name="userId">Employee Id</string>
<string name="userIdPassword">Password</string>
<string name="enterPassword">Please Enter Password</string>
<string name="stockaudit"> Stock Audit Plans </string>
<string name="rackreport"> Rack Wise Qty </string>
<string name="searchbarcode"> SEARCH BY BARCODE </string>
......
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