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); }
@Override public void onLoadComplete(Loader<List<SysappInfo>> loader, List<SysappInfo> data) { Log.e("SysappFragment", "onLoadComplete"); listSysappAll.clear(); listSysappAll.addAll(data); sysappAdapter.setNewList(listSysappAll); progressSysapp.setVisibility(View.GONE); }
@Override public void onLoadComplete(Loader<List<HostRecordInfo>> loader, List<HostRecordInfo> data) { lstDeprecated.clear(); if (data != null) { lstDeprecated.addAll(data); } adapter.setNewList(lstDeprecated); progressDeprecated.setVisibility(View.GONE); }
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(); }