コード例 #1
1
  public void showDir(String dir) {

    try {
      File fDir = new File(dir);
      if (fDir.exists()) {
        File[] files = fDir.listFiles();
        if (files != null) {
          List<SysappSelectApkItem> list = new ArrayList<SysappSelectApkItem>();
          for (File f : files) {
            if (!f.getName().startsWith(".")) {
              if (f.isDirectory() || f.getName().endsWith(".apk")) {
                SysappSelectApkItem item = new SysappSelectApkItem();
                if (!f.isDirectory()) {
                  item.iconImg = ApkUtils.getIconFromPackage(getActivity(), f.getAbsolutePath());
                }
                item.icon = f.isDirectory() ? 1 : 0;
                item.filename = f.getName();
                item.level = ApkUtils.getAppLevel(f.getAbsolutePath(), "");
                list.add(item);
              }
            }
          }
          adapter = new SysappSelectApkAdapter(list, getActivity().getLayoutInflater());
        }
      }
    } catch (Throwable th) {
      adapter = null;
    }
  }
コード例 #2
0
  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);
  }
コード例 #3
0
ファイル: ApkUtils.java プロジェクト: Kcwind/root-tools
 public static void gotoApp(Context context, String namespace, String url) {
   if (ApkUtils.applicationInstalled(context, namespace)) {
     openApp(context, namespace);
     // ApkUtils.startApplication(namespace, activity);
   } else {
     openDownloadApp(context, url);
   }
 }
コード例 #4
0
 private void showReport() {
   List<DataappInfo> report = ApkUtils.getOperationLog();
   DataappReportAdapter adapter = new DataappReportAdapter(getActivity(), report);
   if (lvReport != null) {
     lvReport.setAdapter(adapter);
   }
   if (gvReport != null) {
     gvReport.setAdapter(adapter);
   }
 }
コード例 #5
0
ファイル: ApkUtils.java プロジェクト: Kcwind/root-tools
  public static int getAppLevel(String path, String ns) {
    File fApk = new File(path);
    String apkName = fApk.getName();

    int applevel = 3;
    if (ApkUtils.isAndroidApp(apkName)) {
      applevel = 0;
    }
    if (applevel == 3) {
      if (ApkUtils.isGoogleApp(ns)) {
        applevel = 1;
      }
    }
    if (applevel == 3) {
      if (ApkUtils.isHtcApp(ns)) {
        applevel = 2;
      }
    }
    return applevel;
  }
コード例 #6
0
 @Override
 public List<EnableappInfo> loadInBackground() {
   return ApkUtils.getEnabledApplications(getContext());
 }
コード例 #7
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   RecommandInfo item = lstRecommand.get(position);
   ApkUtils.gotoApp(getActivity(), item.packageName, item.downloadUrl);
 }