Пример #1
0
  private void updateLocalVersions() {
    if (NavigineApp.Navigation == null) return;

    for (int i = 0; i < mInfoList.size(); ++i) {
      LocationInfo info = mInfoList.get(i);
      String versionStr = LocationLoader.getLocalVersion(NavigineApp.AppContext, info.title);
      if (versionStr != null) {
        // Log.d(TAG, info.title + ": " + versionStr);
        info.localModified = versionStr.endsWith("+");
        if (info.localModified) versionStr = versionStr.substring(0, versionStr.length() - 1);
        try {
          info.localVersion = Integer.parseInt(versionStr);
        } catch (Throwable e) {
        }
      } else {
        info.localVersion = -1;

        String mapFile = NavigineApp.Settings.getString("map_file", "");
        if (mapFile.equals(info.archiveFile)) {
          NavigineApp.Navigation.loadArchive(null);
          SharedPreferences.Editor editor = NavigineApp.Settings.edit();
          editor.putString("map_file", "");
          editor.commit();
        }
      }
    }
    mAdapter.updateList();
  }
Пример #2
0
  private void deleteLocation(LocationInfo info) {
    if (NavigineApp.Navigation == null) return;

    if (info != null) {
      try {
        (new File(info.archiveFile)).delete();
        info.localVersion = -1;
        info.localModified = false;

        String locationDir = LocationLoader.getLocationDir(mContext, info.title);
        File dir = new File(locationDir);
        File[] files = dir.listFiles();
        for (int i = 0; i < files.length; ++i) files[i].delete();
        dir.delete();

        String mapFile = NavigineApp.Settings.getString("map_file", "");
        if (mapFile.equals(info.archiveFile)) {
          NavigineApp.Navigation.loadArchive(null);
          SharedPreferences.Editor editor = NavigineApp.Settings.edit();
          editor.putString("map_file", "");
          editor.commit();
        }

        mAdapter.updateList();
      } catch (Throwable e) {
        Log.e(TAG, Log.getStackTraceString(e));
      }
    }
  }
 void setSystemBundles(BundlesState state, LocationInfo info) {
   BundleInfo systemBundleInfo = state.getSystemBundle();
   if (systemBundleInfo == null) {
     // TODO Log
     // throw new IllegalStateException("There is no systemBundle.\n");
     return;
   }
   if (state.isFullySupported())
     if (!this.checkResolve(systemBundleInfo, state)) {
       printoutUnsatisfiedConstraints(systemBundleInfo, state);
       return;
     }
   info.systemBundleLocation = systemBundleInfo.getLocation();
   BundleInfo[] fragments = state.getSystemFragmentedBundles();
   info.systemFragmentedBundleLocations = new URI[fragments.length];
   for (int i = 0; i < fragments.length; i++)
     info.systemFragmentedBundleLocations[i] = fragments[i].getLocation();
 }
 void setPrerequisiteBundles(
     BundleInfo configuratorBundleInfo, BundlesState state, LocationInfo info) {
   if (state.isFullySupported())
     if (!this.checkResolve(configuratorBundleInfo, state)) {
       printoutUnsatisfiedConstraints(configuratorBundleInfo, state);
       return;
     }
   BundleInfo[] prerequisites = state.getPrerequisteBundles(configuratorBundleInfo);
   info.prerequisiteLocations = new URI[prerequisites.length];
   for (int i = 0; i < prerequisites.length; i++)
     info.prerequisiteLocations[i] = prerequisites[i].getLocation();
   return;
 }