增加 写入判断

master
wangh 4 months ago
parent f16dd3f01e
commit 935808a98e

@ -48,10 +48,7 @@
<activity
android:name=".WriteUserActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ConfigurationTableActivity"
@ -59,7 +56,10 @@
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

@ -48,6 +48,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
private List<ReadTyreNoResult> list;
private PopupMenu popupMenu;
private MyAlertDialog myAlertDialog;
@SuppressLint("UnspecifiedRegisterReceiverFlag")
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -72,7 +73,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
myAlertDialog.setDialogCall(this);
var power = SharedPreferencesUtils.getInt("power", 30);
Log.e("TAG", "记忆功率:" + power);
if (power!=30){
if (power != 30) {
rfidModel.setPower(power);
}
}
@ -131,13 +132,18 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
// 如果=1 直接是成功
if (body.getSaveFlag().equals("1")) {
Toast.makeText(WriteUserActivity.this, getString(R.string.binding_success), Toast.LENGTH_SHORT).show();
// Toast.makeText(WriteUserActivity.this, getString(R.string.binding_success), Toast.LENGTH_SHORT).show();
writeUserState = true;
writeUser(user, epcStr);
} else if (body.getSaveFlagCF().equals("0")) {// 等于0的情况属于绑定后写入失败可重新写入
writeUserState = true;
writeUser(user, epcStr);
return;
}else {
tipDialog.shouDialog(false, body.getSaveMessage());
}
tipDialog.shouDialog(false, body.getSaveMessage());
}
});
@ -230,7 +236,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
} else if (itemId == R.id.menu_configuration) {
startActivity(intent2);
} else if (itemId == R.id.menu_setPower) {
myAlertDialog.show(SharedPreferencesUtils.getInt("power",30));
myAlertDialog.show(SharedPreferencesUtils.getInt("power", 30));
}
@ -240,12 +246,12 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
@Override
public void returnData(int power) {
if (rfidModel.setPower(power)){
Toast.makeText(context, getString(R.string.tip_set_success), Toast.LENGTH_SHORT).show();
SharedPreferencesUtils.putInt("power",power);
myAlertDialog.dismiss();
return;
}
if (rfidModel.setPower(power)) {
Toast.makeText(context, getString(R.string.tip_set_success), Toast.LENGTH_SHORT).show();
SharedPreferencesUtils.putInt("power", power);
myAlertDialog.dismiss();
return;
}
Toast.makeText(context, getString(R.string.tip_set_failed), Toast.LENGTH_SHORT).show();
}
}

@ -12,7 +12,15 @@ public class MyResult {
private String ResultFlag;
private String SaveFlag;
private String SaveMessage;
private String SaveFlagCF;
public String getSaveFlagCF() {
return SaveFlagCF;
}
public void setSaveFlagCF(String saveFlagCF) {
SaveFlagCF = saveFlagCF;
}
public String getSaveFlag() {
return SaveFlag;

Loading…
Cancel
Save