@@ -45,14 +45,11 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
| 45 | 45 |
|
| 46 | 46 |
private String qrcode; |
| 47 | 47 |
|
| 48 |
- private Handler myHandler; |
|
| 49 |
- |
|
| 50 | 48 |
@Override |
| 51 | 49 |
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
| 52 | 50 |
super.onCreate(savedInstanceState); |
| 53 | 51 |
setContentView(R.layout.activity_printer_setting); |
| 54 | 52 |
unbinder = ButterKnife.bind(this); |
| 55 |
- myHandler = new Handler(); |
|
| 56 | 53 |
qrcode = getIntent().getStringExtra("qrcode");
|
| 57 | 54 |
if(TextUtils.isEmpty(qrcode)){
|
| 58 | 55 |
finish(); |
@@ -75,18 +72,11 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
| 75 | 72 |
protected void onResume() {
|
| 76 | 73 |
super.onResume(); |
| 77 | 74 |
presenter.start(); |
| 78 |
- myHandler.postDelayed(new Runnable() {
|
|
| 79 |
- @Override |
|
| 80 |
- public void run() {
|
|
| 81 |
- presenter.queryPrinterStatus(); |
|
| 82 |
- } |
|
| 83 |
- },1000); |
|
| 84 | 75 |
} |
| 85 | 76 |
|
| 86 | 77 |
@Override |
| 87 | 78 |
protected void onDestroy() {
|
| 88 | 79 |
presenter.stop(); |
| 89 |
- myHandler.removeCallbacksAndMessages(null); |
|
| 90 | 80 |
super.onDestroy(); |
| 91 | 81 |
} |
| 92 | 82 |
|
@@ -64,6 +64,11 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
| 64 | 64 |
view.onBluetoothEnabled(); |
| 65 | 65 |
view.onPairedDeviceDiscovered(queryPairedDevices()); |
| 66 | 66 |
discoverNewDevices(); |
| 67 |
+ if(Preferences.getInstance().isPrinterConnected()){
|
|
| 68 |
+ view.onPrinterStatusFetched(context.getString(R.string.printer_is_connected)); |
|
| 69 |
+ }else{
|
|
| 70 |
+ view.onPrinterStatusFetched(context.getString(R.string.click_to_query)); |
|
| 71 |
+ } |
|
| 67 | 72 |
}else{
|
| 68 | 73 |
view.onBluetoothDisabled(); |
| 69 | 74 |
view.showToast(context.getString(R.string.bt_is_disabled)); |
@@ -29,6 +29,7 @@ public class SplashPresenter implements SplashContract.Presenter {
|
||
| 29 | 29 |
|
| 30 | 30 |
@Override |
| 31 | 31 |
public void start() {
|
| 32 |
+ Preferences.getInstance().setPrinterConnected(false); |
|
| 32 | 33 |
if(TextUtils.isEmpty(Preferences.getInstance().getLensManId())){
|
| 33 | 34 |
mHandler.postDelayed(new Runnable() {
|
| 34 | 35 |
@Override |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 |
android:layout_width="match_parent" |
| 117 | 117 |
android:layout_height="match_parent" |
| 118 | 118 |
android:gravity="center_vertical" |
| 119 |
- android:text="@string/query_printer_processing" |
|
| 119 |
+ android:text="@string/click_to_query" |
|
| 120 | 120 |
android:textColor="@color/dark_grey" |
| 121 | 121 |
android:textSize="16sp" /> |
| 122 | 122 |
</LinearLayout> |
@@ -106,8 +106,6 @@ |
||
| 106 | 106 |
|
| 107 | 107 |
<string name="click_to_query">点击查询打印机状态</string> |
| 108 | 108 |
|
| 109 |
- <string name="query_printer_processing">正在查询打印机状态...</string> |
|
| 110 |
- |
|
| 111 | 109 |
<string name="go_check_printer">请检查打印机</string> |
| 112 | 110 |
|
| 113 | 111 |
<string name="printer_port_open_fail">打印机端口打开失败</string> |