private void doInstallSystemApp(final String path) { progressSysapp.setAppName(getString(R.string.installing)); progressSysapp.setVisibility(View.VISIBLE); LogApi.logInstallSystemApp(path); final Handler h = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 1) { Toast.makeText( getActivity(), (msg.arg1 == 1 ? R.string.install_ok : R.string.install_fail), Toast.LENGTH_LONG) .show(); progressSysapp.setVisibility(View.GONE); doStartLoad(); } super.handleMessage(msg); } }; ApkUtils.installSystemApp(getActivity(), path, h); }
private void scanDeprecatedHostsT() { LogApi.logCleanDeprecatedHosts(); progressDeprecated.setAppName(getString(R.string.testing)); progressDeprecated.setVisibility(View.VISIBLE); itemScan.setEnabled(false); final Handler h = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 1) { progressDeprecated.setVisibility(View.GONE); itemScan.setEnabled(true); adapter.notifyDataSetChanged(); boolean ret = DIPairUtils.saveHosts(lstDeprecated); if (ret) { Toast.makeText(getActivity(), R.string.save_hosts_succ, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { Toast.makeText(getActivity(), R.string.save_hosts_error, Toast.LENGTH_LONG).show(); } } else if (msg.what == 2) { progressDeprecated.setProgress((String) msg.obj); } super.handleMessage(msg); } }; new Thread( new Runnable() { @Override public void run() { String ping = ""; int count = lstDeprecated.size(); for (int i = count - 1; i >= 0; i--) { Message msg = new Message(); msg.what = 2; msg.obj = lstDeprecated.get(i).ip; h.sendMessage(msg); ping = PingUtils.ping(lstDeprecated.get(i).ip); if (ping.equals("") || ping.equals("timeout")) { lstDeprecated.remove(i); } } h.sendEmptyMessage(1); } }) .start(); }
protected void doStartLoad() { progressSysapp.setAppName(getString(R.string.loading)); progressSysapp.setVisibility(View.VISIBLE); loader.startLoading(); }
private void doStartLoad() { progressDeprecated.setAppName(getString(R.string.loading)); progressDeprecated.setVisibility(View.VISIBLE); loader.startLoading(); }