Commit d63feb8f by User

few changes

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