|
@@ -26,6 +26,8 @@ import android.widget.ListAdapter;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
+import androidx.annotation.NonNull;
|
|
|
+
|
|
|
import com.epson.iprint.prtlogger.Analytics;
|
|
|
import com.epson.memcardacc.DirectorySelecterActivity;
|
|
|
import com.epson.mobilephone.common.EpLog;
|
|
@@ -65,6 +67,7 @@ import epson.support.SupportActivity;
|
|
|
* 主页
|
|
|
*/
|
|
|
public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
+
|
|
|
private static final int EPS_COMM_BID = 2;
|
|
|
private static final int EPS_ERR_PRINTER_NOT_FOUND = -1300;
|
|
|
private static final int EPS_PRB_BYID = 1;
|
|
@@ -86,80 +89,83 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
boolean finishProbe;
|
|
|
private boolean mActivityForeground;
|
|
|
private ArrayList<Runnable> mForegroundRunnableList;
|
|
|
+
|
|
|
Handler mHandler = new Handler(new Handler.Callback() {
|
|
|
public boolean handleMessage(Message message) {
|
|
|
- EPLog.m313i(IprintHome.TAG, "HandlerCallback");
|
|
|
+
|
|
|
+ EPLog.m313i(TAG, "HandlerCallback");
|
|
|
+
|
|
|
switch (message.what) {
|
|
|
case 0:
|
|
|
- EPLog.m313i(IprintHome.TAG, "PROBE_PRINTER");
|
|
|
+ EPLog.m313i(TAG, "PROBE_PRINTER");
|
|
|
IprintHome iprintHome = IprintHome.this;
|
|
|
- iprintHome.finishProbe = false;
|
|
|
- if (iprintHome.task == null) {
|
|
|
+ finishProbe = false;
|
|
|
+ if (task == null) {
|
|
|
IprintHome iprintHome2 = IprintHome.this;
|
|
|
iprintHome2.task = new ProbePrinter();
|
|
|
- IprintHome.this.task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
|
|
|
- IprintHome.mHandler.sendEmptyMessage(1);
|
|
|
+ task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
|
|
|
+ mHandler.sendEmptyMessage(1);
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
case 1:
|
|
|
- EPLog.m313i(IprintHome.TAG, "UPDATE_PRINTER_STATUS");
|
|
|
- int[] unused = IprintHome.mPrinterStatus = IprintHome.mPrinter.getMPrinterInfor().getMStatus();
|
|
|
- EpLog.m69d("status " + IprintHome.mPrinterStatus);
|
|
|
- EpLog.m69d("printerLocation " + IprintHome.this.printerLocation);
|
|
|
- EpLog.m69d("finishProbe" + IprintHome.this.finishProbe);
|
|
|
+ EPLog.m313i(TAG, "UPDATE_PRINTER_STATUS");
|
|
|
+ int[] unused = mPrinterStatus = mPrinter.getMPrinterInfor().getMStatus();
|
|
|
+ EpLog.m69d("status " + mPrinterStatus);
|
|
|
+ EpLog.m69d("printerLocation " + printerLocation);
|
|
|
+ EpLog.m69d("finishProbe" + finishProbe);
|
|
|
String str = "";
|
|
|
- if (IprintHome.this.printerLocation == 1 && WiFiDirectManager.getConnectInfo(IprintHome.this.getApplicationContext(), WiFiDirectManager.DEVICE_TYPE_PRINTER) != null) {
|
|
|
- str = IprintHome.this.getString(R.string.wifi_direct_status);
|
|
|
- } else if (IprintHome.this.printerLocation == 1 || (IprintHome.this.printerLocation == 3 && Utils.isConnectedWifi(IprintHome.this.getApplicationContext()))) {
|
|
|
- if (IprintHome.this.finishProbe) {
|
|
|
- str = IprintHome.this.getString(R.string.printer_ready);
|
|
|
+ if (printerLocation == 1 && WiFiDirectManager.getConnectInfo(getApplicationContext(), WiFiDirectManager.DEVICE_TYPE_PRINTER) != null) {
|
|
|
+ str = getString(R.string.wifi_direct_status);
|
|
|
+ } else if (printerLocation == 1 || (printerLocation == 3 && Utils.isConnectedWifi(getApplicationContext()))) {
|
|
|
+ if (finishProbe) {
|
|
|
+ str = getString(R.string.printer_ready);
|
|
|
}
|
|
|
- } else if (IprintHome.this.printerLocation != 2 && (IprintHome.this.printerLocation != 3 || Utils.isConnectedWifi(IprintHome.this.getApplicationContext()))) {
|
|
|
- str = IprintHome.this.getString(R.string.not_select_status);
|
|
|
- } else if (!Utils.isOnline(IprintHome.this.getApplicationContext())) {
|
|
|
- str = IprintHome.this.getString(R.string.cannot_connect);
|
|
|
+ } else if (printerLocation != 2 && (printerLocation != 3 || Utils.isConnectedWifi(getApplicationContext()))) {
|
|
|
+ str = getString(R.string.not_select_status);
|
|
|
+ } else if (!Utils.isOnline(getApplicationContext())) {
|
|
|
+ str = getString(R.string.cannot_connect);
|
|
|
} else {
|
|
|
- str = IprintHome.this.getString(R.string.remote_can_connect);
|
|
|
+ str = getString(R.string.remote_can_connect);
|
|
|
}
|
|
|
- IprintHome.this.printerStatus.setText(str);
|
|
|
- EPLog.m313i(IprintHome.TAG, "Stt title: " + str);
|
|
|
+ printerStatus.setText(str);
|
|
|
+ EPLog.m313i(TAG, "Stt title: " + str);
|
|
|
break;
|
|
|
case 2:
|
|
|
- IprintHome.this.printerStatus.setText(IprintHome.this.getString(R.string.comm_error));
|
|
|
- EPLog.m313i(IprintHome.TAG, "Stt title: " + IprintHome.this.getString(R.string.comm_error));
|
|
|
+ printerStatus.setText(getString(R.string.comm_error));
|
|
|
+ EPLog.m313i(TAG, "Stt title: " + getString(R.string.comm_error));
|
|
|
break;
|
|
|
case 3:
|
|
|
- EPLog.m313i(IprintHome.TAG, "STATUS_ERROR");
|
|
|
+ EPLog.m313i(TAG, "STATUS_ERROR");
|
|
|
int[] intArray = message.getData().getIntArray("STATUS_ERROR");
|
|
|
if (intArray == null) {
|
|
|
- IprintHome.this.printerStatus.setText(IprintHome.this.getString(R.string.upon_error));
|
|
|
- EPLog.m313i(IprintHome.TAG, "Stt titlef: " + IprintHome.this.getString(R.string.upon_error));
|
|
|
+ printerStatus.setText(getString(R.string.upon_error));
|
|
|
+ EPLog.m313i(TAG, "Stt titlef: " + getString(R.string.upon_error));
|
|
|
break;
|
|
|
} else {
|
|
|
- EPLog.m313i(IprintHome.TAG, "statusError[0] : " + intArray[0]);
|
|
|
- EPLog.m313i(IprintHome.TAG, "statusError[1] : " + intArray[1]);
|
|
|
+ EPLog.m313i(TAG, "statusError[0] : " + intArray[0]);
|
|
|
+ EPLog.m313i(TAG, "statusError[1] : " + intArray[1]);
|
|
|
if (intArray[0] != 2 && intArray[0] != 1 && intArray[0] != 3) {
|
|
|
if (intArray[0] != 4 || (intArray[1] != 102 && intArray[1] != -1300)) {
|
|
|
- IprintHome.this.printerStatus.setText(IprintHome.this.getString(R.string.upon_error));
|
|
|
- EPLog.m313i(IprintHome.TAG, "Stt title: " + IprintHome.this.getString(R.string.upon_error));
|
|
|
+ printerStatus.setText(getString(R.string.upon_error));
|
|
|
+ EPLog.m313i(TAG, "Stt title: " + getString(R.string.upon_error));
|
|
|
break;
|
|
|
} else {
|
|
|
- IprintHome.this.printerStatus.setText(IprintHome.this.getString(R.string.comm_error));
|
|
|
- EPLog.m313i(IprintHome.TAG, "Stt title: " + IprintHome.this.getString(R.string.comm_error));
|
|
|
+ printerStatus.setText(getString(R.string.comm_error));
|
|
|
+ EPLog.m313i(TAG, "Stt title: " + getString(R.string.comm_error));
|
|
|
break;
|
|
|
}
|
|
|
} else {
|
|
|
- IprintHome.this.printerStatus.setText(IprintHome.this.getString(R.string.printer_ready));
|
|
|
- EPLog.m313i(IprintHome.TAG, "Stt title: " + IprintHome.this.getString(R.string.printer_ready));
|
|
|
+ printerStatus.setText(getString(R.string.printer_ready));
|
|
|
+ EPLog.m313i(TAG, "Stt title: " + getString(R.string.printer_ready));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- EPLog.m313i(IprintHome.TAG, DirectorySelecterActivity.PARAM_DEFAULT_DIR);
|
|
|
- IprintHome.this.printerName.setText(IprintHome.this.getString(R.string.printer_not_select));
|
|
|
- ((ImageView) IprintHome.this.findViewById(R.id.printer_icon)).setVisibility(View.GONE);
|
|
|
+ EPLog.m313i(TAG, DirectorySelecterActivity.PARAM_DEFAULT_DIR);
|
|
|
+ printerName.setText(getString(R.string.printer_not_select));
|
|
|
+ ((ImageView) findViewById(R.id.printer_icon)).setVisibility(View.GONE);
|
|
|
break;
|
|
|
}
|
|
|
return true;
|
|
@@ -209,10 +215,10 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
mActivityForeground = true;
|
|
|
findViewById(R.id.home_select_printer).setOnClickListener(new View.OnClickListener() {
|
|
|
public void onClick(View view) {
|
|
|
- Intent intent = new Intent(IprintHome.this, MaintainActivity.class);
|
|
|
+ Intent intent = new Intent(this, MaintainActivity.class);
|
|
|
intent.setAction("android.intent.action.VIEW");
|
|
|
- IprintHome.this.startActivity(intent);
|
|
|
- Analytics.sendAction(IprintHome.this.getApplicationContext(), Analytics.ACTION_ID_HOME_MAINTAIN);
|
|
|
+ startActivity(intent);
|
|
|
+ Analytics.sendAction(getApplicationContext(), Analytics.ACTION_ID_HOME_MAINTAIN);
|
|
|
}
|
|
|
});
|
|
|
if (bundle == null) {
|
|
@@ -228,12 +234,13 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
|
|
|
private void requestLocationPermission() {
|
|
|
- if (!this.bRejectLocationPermission && !ActivityRequestLocationPermission.canAccessWiFiInfo(this, 4) && BleWork.isStartBleProcess(this, true)) {
|
|
|
+ if (!bRejectLocationPermission && !ActivityRequestLocationPermission.canAccessWiFiInfo(this, 4) && BleWork.isStartBleProcess(this, true)) {
|
|
|
ActivityRequestLocationPermission.requestLocationPermission((Activity) this, 2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected void onActivityResult(int i, int i2, Intent intent) {
|
|
|
+ super.onActivityResult(i, i2, intent);
|
|
|
switch (i) {
|
|
|
case 1:
|
|
|
if (i2 != -1) {
|
|
@@ -368,7 +375,7 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
EpLog.m70d(TAG, "" + printerId + ":" + printerIp + ":" + printerLocation + ":" + printerSerial + ":" + deviceID);
|
|
|
updatePrinterIcon();
|
|
|
updateMenu();
|
|
|
- if (!(this.printerLocation == 1 && WiFiDirectManager.getConnectInfo(getApplicationContext(), WiFiDirectManager.DEVICE_TYPE_PRINTER) == null) && (this.printerLocation != 3 || !Utils.isConnectedWifi(getApplicationContext()))) {
|
|
|
+ if (!(printerLocation == 1 && WiFiDirectManager.getConnectInfo(getApplicationContext(), WiFiDirectManager.DEVICE_TYPE_PRINTER) == null) && (printerLocation != 3 || !Utils.isConnectedWifi(getApplicationContext()))) {
|
|
|
EpLog.m70d(TAG, "########################");
|
|
|
mHandler.sendEmptyMessage(1);
|
|
|
return;
|
|
@@ -378,20 +385,20 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
|
|
|
private void updatePrinterIcon() {
|
|
|
- if (this.printerName.getText().equals(getString(R.string.printer_not_select))) {
|
|
|
+ if (printerName.getText().equals(getString(R.string.printer_not_select))) {
|
|
|
((ImageView) findViewById(R.id.printer_icon)).setVisibility(View.GONE);
|
|
|
return;
|
|
|
}
|
|
|
((ImageView) findViewById(R.id.printer_icon)).setVisibility(View.VISIBLE);
|
|
|
- switch (this.printerLocation) {
|
|
|
+ switch (printerLocation) {
|
|
|
case 1:
|
|
|
- ((ImageView) findViewById(R.id.printer_icon)).setImageResource(R.C2136drawable.print_local);
|
|
|
+ ((ImageView) findViewById(R.id.printer_icon)).setImageResource(R.drawable.print_local);
|
|
|
return;
|
|
|
case 2:
|
|
|
- ((ImageView) findViewById(R.id.printer_icon)).setImageResource(R.C2136drawable.print_remote);
|
|
|
+ ((ImageView) findViewById(R.id.printer_icon)).setImageResource(R.drawable.print_remote);
|
|
|
return;
|
|
|
case 3:
|
|
|
- ((ImageView) findViewById(R.id.printer_icon)).setImageResource(R.C2136drawable.print_ip);
|
|
|
+ ((ImageView) findViewById(R.id.printer_icon)).setImageResource(R.drawable.print_ip);
|
|
|
return;
|
|
|
default:
|
|
|
return;
|
|
@@ -403,57 +410,57 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
|
|
|
protected void onPreExecute() {
|
|
|
- EPLog.m313i(IprintHome.TAG, "ProbePrinter onPreExecute");
|
|
|
- IprintHome.this.printerStatus.setText("");
|
|
|
+ EPLog.m313i(TAG, "ProbePrinter onPreExecute");
|
|
|
+ printerStatus.setText("");
|
|
|
}
|
|
|
|
|
|
protected Boolean doInBackground(Void... voidArr) {
|
|
|
- EPLog.m313i(IprintHome.TAG, "ProbePrinter doInBackground");
|
|
|
- IprintHome.mPrinter.doInitDriver(IprintHome.this, 2);
|
|
|
- if (IprintHome.this.printerLocation == 1 || IprintHome.this.printerLocation == 3) {
|
|
|
- if (IprintHome.this.printerId != null) {
|
|
|
- int doProbePrinter = IprintHome.mPrinter.doProbePrinter(60, IprintHome.this.printerId, IprintHome.this.printerIp, IprintHome.this.printerLocation);
|
|
|
+ EPLog.m313i(TAG, "ProbePrinter doInBackground");
|
|
|
+ mPrinter.doInitDriver(this, 2);
|
|
|
+ if (printerLocation == 1 || printerLocation == 3) {
|
|
|
+ if (printerId != null) {
|
|
|
+ int doProbePrinter = mPrinter.doProbePrinter(60, printerId, printerIp, printerLocation);
|
|
|
while (doProbePrinter != 0) {
|
|
|
try {
|
|
|
if (isCancelled()) {
|
|
|
break;
|
|
|
}
|
|
|
- IprintHome.mHandler.sendEmptyMessage(2);
|
|
|
+ mHandler.sendEmptyMessage(2);
|
|
|
Thread.sleep(10000);
|
|
|
- doProbePrinter = IprintHome.mPrinter.doProbePrinter(60, IprintHome.this.printerId, IprintHome.this.printerIp, IprintHome.this.printerLocation);
|
|
|
+ doProbePrinter = mPrinter.doProbePrinter(60, printerId, printerIp, printerLocation);
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
- IprintHome.this.finishProbe = true;
|
|
|
+ finishProbe = true;
|
|
|
if (isCancelled()) {
|
|
|
- EPLog.m313i(IprintHome.TAG, "Cancelled ProbePrinter");
|
|
|
+ EPLog.m313i(TAG, "Cancelled ProbePrinter");
|
|
|
return false;
|
|
|
}
|
|
|
- int doSetPrinter = IprintHome.mPrinter.doSetPrinter();
|
|
|
- EPLog.m313i(IprintHome.TAG, "Set Printer result: " + doSetPrinter);
|
|
|
+ int doSetPrinter = mPrinter.doSetPrinter();
|
|
|
+ EPLog.m313i(TAG, "Set Printer result: " + doSetPrinter);
|
|
|
if (doSetPrinter != 0) {
|
|
|
- IprintHome.mHandler.sendEmptyMessage(2);
|
|
|
+ mHandler.sendEmptyMessage(2);
|
|
|
return false;
|
|
|
}
|
|
|
while (!isCancelled()) {
|
|
|
try {
|
|
|
- int doGetStatus = IprintHome.mPrinter.doGetStatus();
|
|
|
- EPLog.m313i(IprintHome.TAG, "Printer Status result: " + doGetStatus);
|
|
|
+ int doGetStatus = mPrinter.doGetStatus();
|
|
|
+ EPLog.m313i(TAG, "Printer Status result: " + doGetStatus);
|
|
|
if (doGetStatus != 0) {
|
|
|
- IprintHome.mHandler.sendEmptyMessage(2);
|
|
|
+ mHandler.sendEmptyMessage(2);
|
|
|
} else {
|
|
|
- int[] unused = IprintHome.mPrinterStatus = IprintHome.mPrinter.getMPrinterInfor().getMStatus();
|
|
|
- if (IprintHome.mPrinterStatus[0] != 0) {
|
|
|
+ int[] unused = mPrinterStatus = mPrinter.getMPrinterInfor().getMStatus();
|
|
|
+ if (mPrinterStatus[0] != 0) {
|
|
|
Message message = new Message();
|
|
|
message.what = 3;
|
|
|
Bundle bundle = new Bundle();
|
|
|
- bundle.putIntArray("STATUS_ERROR", IprintHome.mPrinterStatus);
|
|
|
+ bundle.putIntArray("STATUS_ERROR", mPrinterStatus);
|
|
|
message.setData(bundle);
|
|
|
- IprintHome.mHandler.sendMessage(message);
|
|
|
+ mHandler.sendMessage(message);
|
|
|
} else {
|
|
|
- IprintHome.mHandler.sendEmptyMessage(1);
|
|
|
+ mHandler.sendEmptyMessage(1);
|
|
|
}
|
|
|
}
|
|
|
Thread.sleep(10000);
|
|
@@ -462,25 +469,25 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
e2.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- EPLog.m313i(IprintHome.TAG, "task Cancelled");
|
|
|
+ EPLog.m313i(TAG, "task Cancelled");
|
|
|
} else {
|
|
|
- int unused2 = IprintHome.this.printerLocation = 0;
|
|
|
+ int unused2 = printerLocation = 0;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public boolean cancelTask(boolean z) {
|
|
|
- EPLog.m313i(IprintHome.TAG, "ProbePrinter cancelTask IN");
|
|
|
- IprintHome.mPrinter.doCancelFindPrinter();
|
|
|
- EPLog.m313i(IprintHome.TAG, "ProbePrinter cancelTask OUT");
|
|
|
+ EPLog.m313i(TAG, "ProbePrinter cancelTask IN");
|
|
|
+ mPrinter.doCancelFindPrinter();
|
|
|
+ EPLog.m313i(TAG, "ProbePrinter cancelTask OUT");
|
|
|
return cancel(z);
|
|
|
}
|
|
|
|
|
|
protected void onPostExecute(Boolean bool) {
|
|
|
- EPLog.m313i(IprintHome.TAG, "ProbePrinter onPostExecute");
|
|
|
+ EPLog.m313i(TAG, "ProbePrinter onPostExecute");
|
|
|
if (bool.booleanValue()) {
|
|
|
- IprintHome.mHandler.sendEmptyMessage(1);
|
|
|
+ mHandler.sendEmptyMessage(1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -507,11 +514,11 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
return;
|
|
|
}
|
|
|
if (!iconTextArrayItem.showMenu) {
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(IprintHome.this);
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
builder.setTitle(iconTextArrayItem.menuId);
|
|
|
- if (IprintHome.this.printerLocation == 3) {
|
|
|
+ if (printerLocation == 3) {
|
|
|
builder.setMessage(R.string.CannotIPMes);
|
|
|
- } else if (IprintHome.this.printerLocation == 2) {
|
|
|
+ } else if (printerLocation == 2) {
|
|
|
builder.setMessage(R.string.CannotRemoteMes);
|
|
|
} else {
|
|
|
return;
|
|
@@ -521,41 +528,41 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
});
|
|
|
builder.show();
|
|
|
- } else if (IprintHome.this.getString(iconTextArrayItem.menuId).equalsIgnoreCase(IprintHome.this.getString(R.string.support_buy_ink))) {
|
|
|
- IprintHome.this.getBuyInkTask().execute(new Void[0]);
|
|
|
- Analytics.sendAction(IprintHome.this.getApplicationContext(), Analytics.ACTION_ID_HOME_BUY_INK);
|
|
|
+ } else if (getString(iconTextArrayItem.menuId).equalsIgnoreCase(getString(R.string.support_buy_ink))) {
|
|
|
+ getBuyInkTask().execute(new Void[0]);
|
|
|
+ Analytics.sendAction(getApplicationContext(), Analytics.ACTION_ID_HOME_BUY_INK);
|
|
|
} else if (iconTextArrayItem.menuId == R.string.ready_ink_button_name) {
|
|
|
- Analytics.sendAction(IprintHome.this.getApplicationContext(), Analytics.ACTION_ID_HOME_READY_INK);
|
|
|
- IprintHome.this.openReadyInkPage();
|
|
|
+ Analytics.sendAction(getApplicationContext(), Analytics.ACTION_ID_HOME_READY_INK);
|
|
|
+ openReadyInkPage();
|
|
|
} else {
|
|
|
- if (IprintHome.this.getString(iconTextArrayItem.menuId).equalsIgnoreCase(IprintHome.this.getString(R.string.FunctionName_iPrint_MoreApps))) {
|
|
|
+ if (getString(iconTextArrayItem.menuId).equalsIgnoreCase(getString(R.string.FunctionName_iPrint_MoreApps))) {
|
|
|
intent.setAction("android.intent.action.VIEW");
|
|
|
- intent.setData(Uri.parse(IprintHome.MORE_APP_URL));
|
|
|
- IprintHome.mIprintHomeLogging.countupMoreApp(IprintHome.this);
|
|
|
+ intent.setData(Uri.parse(MORE_APP_URL));
|
|
|
+ mIprintHomeLogging.countupMoreApp(this);
|
|
|
} else if (!iconTextArrayItem.ClassName.equalsIgnoreCase("")) {
|
|
|
if (!iconTextArrayItem.appId.equals("Creative") && !iconTextArrayItem.appId.equalsIgnoreCase("3DFramePrint") && !iconTextArrayItem.appId.equalsIgnoreCase("CameraCopy") && !iconTextArrayItem.appId.equalsIgnoreCase("MultiRollPrint") && !iconTextArrayItem.appId.equalsIgnoreCase("CardPrint") && !iconTextArrayItem.appId.equalsIgnoreCase("Nenga")) {
|
|
|
intent.setClassName(iconTextArrayItem.PackageName, iconTextArrayItem.ClassName);
|
|
|
- IprintHome.mIprintHomeLogging.sendUiTapData(IprintHome.this.getApplicationContext(), iconTextArrayItem.ClassName);
|
|
|
+ mIprintHomeLogging.sendUiTapData(getApplicationContext(), iconTextArrayItem.ClassName);
|
|
|
} else if (iconTextArrayItem.isInstall) {
|
|
|
intent.setAction(iconTextArrayItem.ClassName);
|
|
|
intent.setFlags(270532608);
|
|
|
- intent.putExtra(Constants.PRINTER_ID, IprintHome.this.printerId);
|
|
|
- intent.putExtra(Constants.PRINTER_IP, IprintHome.this.printerIp);
|
|
|
- intent.putExtra(Constants.PRINTER_NAME, IprintHome.this.deviceID);
|
|
|
- intent.putExtra("PRINTER_SERIAL", IprintHome.this.printerSerial);
|
|
|
+ intent.putExtra(Constants.PRINTER_ID, printerId);
|
|
|
+ intent.putExtra(Constants.PRINTER_IP, printerIp);
|
|
|
+ intent.putExtra(Constants.PRINTER_NAME, deviceID);
|
|
|
+ intent.putExtra("PRINTER_SERIAL", printerSerial);
|
|
|
intent.putExtra("Function", iconTextArrayItem.key);
|
|
|
- intent.putExtra("PRINTER_SSID", WiFiDirectManager.getConnectInfo(IprintHome.this.getApplicationContext(), WiFiDirectManager.DEVICE_TYPE_PRINTER));
|
|
|
- IprintHome.mIprintHomeLogging.countUpInstalledOtherApps(IprintHome.this, iconTextArrayItem);
|
|
|
+ intent.putExtra("PRINTER_SSID", WiFiDirectManager.getConnectInfo(getApplicationContext(), WiFiDirectManager.DEVICE_TYPE_PRINTER));
|
|
|
+ mIprintHomeLogging.countUpInstalledOtherApps(this, iconTextArrayItem);
|
|
|
} else {
|
|
|
intent.setAction("android.intent.action.VIEW");
|
|
|
intent.setData(Uri.parse(iconTextArrayItem.googleStoreUrl));
|
|
|
- IprintHome.mIprintHomeLogging.countUpNotInstalledOtherApps(IprintHome.this, iconTextArrayItem);
|
|
|
+ mIprintHomeLogging.countUpNotInstalledOtherApps(this, iconTextArrayItem);
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
|
- IprintHome.this.startActivity(intent);
|
|
|
+ startActivity(intent);
|
|
|
} catch (ActivityNotFoundException unused) {
|
|
|
- Toast.makeText(IprintHome.this, R.string.upon_error, 0).show();
|
|
|
+ Toast.makeText(this, R.string.upon_error, 0).show();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -568,10 +575,10 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
menudataAdapter.setContext(getApplicationContext());
|
|
|
menudataAdapter.parseJSONFile();
|
|
|
String str = deviceID;
|
|
|
- if (str == null || str.length() < 4 || MyPrinter.PRINTER_USB.equals(this.printerIp)) {
|
|
|
+ if (str == null || str.length() < 4 || MyPrinter.PRINTER_USB.equals(printerIp)) {
|
|
|
deviceID = "DEFAULT";
|
|
|
}
|
|
|
- ArrayList<IconTextArrayItem> MenuListfordeviceID = menudataAdapter.MenuListfordeviceID(this.deviceID, printerLocation, this);
|
|
|
+ ArrayList<IconTextArrayItem> MenuListfordeviceID = menudataAdapter.MenuListfordeviceID(deviceID, printerLocation, this);
|
|
|
int i = 0;
|
|
|
if (!isJapaneseDevice()) {
|
|
|
int i2 = 0;
|
|
@@ -592,7 +599,7 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
if (MenuListfordeviceID.get(i).appId.equalsIgnoreCase("Nenga")) {
|
|
|
MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
|
|
|
- if (curPrinter.getPrinterId() == null || curPrinter.getLang() != 1 || !isJapaneseDevice() || MyPrinter.PRINTER_USB.equals(this.printerIp)) {
|
|
|
+ if (curPrinter.getPrinterId() == null || curPrinter.getLang() != 1 || !isJapaneseDevice() || MyPrinter.PRINTER_USB.equals(printerIp)) {
|
|
|
MenuListfordeviceID.remove(i);
|
|
|
} else {
|
|
|
try {
|
|
@@ -635,16 +642,16 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
|
|
|
private void addReadyInkToMenuEnd(@NonNull List<IconTextArrayItem> list) {
|
|
|
- list.add(new IconTextArrayItem(R.C2136drawable.image_ready_ink, R.string.ready_ink_button_name, ""));
|
|
|
+ list.add(new IconTextArrayItem(R.drawable.image_ready_ink, R.string.ready_ink_button_name, ""));
|
|
|
}
|
|
|
|
|
|
private void addBuyInkToMenu(@NonNull List<IconTextArrayItem> list) {
|
|
|
IconTextArrayItem iconTextArrayItem;
|
|
|
- if (this.printerLocation == 0) {
|
|
|
- iconTextArrayItem = new IconTextArrayItem(R.C2136drawable.image_buyink_disabled, R.string.support_buy_ink, "");
|
|
|
+ if (printerLocation == 0) {
|
|
|
+ iconTextArrayItem = new IconTextArrayItem(R.drawable.image_buyink_disabled, R.string.support_buy_ink, "");
|
|
|
iconTextArrayItem.showMenu = false;
|
|
|
} else {
|
|
|
- iconTextArrayItem = new IconTextArrayItem(R.C2136drawable.image_buyink, R.string.support_buy_ink, "");
|
|
|
+ iconTextArrayItem = new IconTextArrayItem(R.drawable.image_buyink, R.string.support_buy_ink, "");
|
|
|
}
|
|
|
list.add(1, iconTextArrayItem);
|
|
|
}
|
|
@@ -654,14 +661,14 @@ public class IprintHome extends ActivityIACommon implements CommonDefine {
|
|
|
}
|
|
|
|
|
|
protected void onPreExecute() {
|
|
|
- if (IprintHome.this.task != null) {
|
|
|
- IprintHome.this.task.cancelTask(true);
|
|
|
- IprintHome.this.task = null;
|
|
|
+ if (task != null) {
|
|
|
+ task.cancelTask(true);
|
|
|
+ task = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected Void doInBackground(Void... voidArr) {
|
|
|
- IprintHome.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(BuyInkUrl.urlSupport(IprintHome.this.getApplicationContext(), CommonDefine.URL_INK))));
|
|
|
+ startActivity(new Intent("android.intent.action.VIEW", Uri.parse(BuyInkUrl.urlSupport(getApplicationContext(), CommonDefine.URL_INK))));
|
|
|
return null;
|
|
|
}
|
|
|
}
|