Example #1
0
  @Override
  public void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    // Sync the toggle state after onRestoreInstanceState has occurred.
    TileCache fileSystemTileCache = this.mapView.getFileSystemTileCache();

    Log.v(
        "PERSISTENCE",
        "capacity"
            + fileSystemTileCache.getCapacity()
            + ",persistence:"
            + fileSystemTileCache.isPersistent());
    if (mDrawerToggle != null) {
      mDrawerToggle.syncState();
    }
  }
Example #2
0
  /**
   * Load tile caching preferences used sharedPreferences : * TileCachePersistence * TileCacheSize
   */
  public void loadPersistencePreferences() {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean persistent = sharedPreferences.getBoolean("TileCachePersistence", true);
    Log.v(
        "PERSISTENCE",
        "cache size:"
            + sharedPreferences.getInt("TileCacheSize", FILE_SYSTEM_CACHE_SIZE_DEFAULT)
            + ",persistent"
            + persistent);
    int capacity =
        Math.min(
            sharedPreferences.getInt("TileCacheSize", FILE_SYSTEM_CACHE_SIZE_DEFAULT),
            FILE_SYSTEM_CACHE_SIZE_MAX);
    TileCache fileSystemTileCache = this.mapView.getFileSystemTileCache();

    fileSystemTileCache.setPersistent(persistent);
    fileSystemTileCache.setCapacity(capacity);
    // text size
    String textScaleDefault = getString(R.string.preferences_text_scale_default);
    this.mapView.setTextScale(
        Float.parseFloat(sharedPreferences.getString("mapTextScale", textScaleDefault)));
  }