private void initViews() { mListView = (AppStoreListView) getActivity().findViewById(R.id.normal_list_grid); mListView.setPullRefreshEnable(false); mListView.setPullLoadEnable(false); groupTextView = (TextView) getActivity().findViewById(R.id.group_name); updateAllLayout = (RelativeLayout) getActivity().findViewById(R.id.update_all_layout); updateAllTextView = (TextView) getActivity().findViewById(R.id.update_all); ignoreTextView = (TextView) getActivity().findViewById(R.id.view_ignore); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == UpdateAppsListAdapter.GENERAL_APPS_INSTALL_REQUEST && resultCode == Activity.RESULT_CANCELED) { mListView.setAdapter(updateAppListAdapter); updateAppListAdapter.notifyDataSetChanged(); } }
@Override public void handleMessage(Message msg) { switch (msg.what) { case HANDLE_UPDATE_APP: updateAppListAdapter = new UpdateAppsListAdapter( getActivity(), appListDataSource, mHandler, application); mListView.setAdapter(updateAppListAdapter); updateAppListAdapter.notifyDataSetChanged(); dismissLoading(); break; case GENERAL_APPS_INSTALL_REQUEST: File file = (File) msg.obj; // Env.install(getActivity(), file, GENERAL_APPS_INSTALL_REQUEST); if (file.exists()) { /*Intent intent = new Intent(Intent.ACTION_VIEW); try { Runtime.getRuntime().exec("chmod 655 " + file.toString()); } catch (IOException e) { e.printStackTrace(); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); if (isAdded() && getActivity() != null) { getActivity().startActivityForResult(intent, GENERAL_APPS_INSTALL_REQUEST); }*/ if (isAdded() && getActivity() != null) { Env.install(getActivity(), file, GENERAL_APPS_INSTALL_REQUEST); } } else { ToastUtil.showToast(application, R.string.str_apk_download_failure); } break; default: break; } }