This commit is contained in:
Alex Sytnyk 2018-07-20 15:24:17 +03:00
parent ba8668c13e
commit 12748cb857
2 changed files with 18 additions and 3 deletions

View file

@ -1,13 +1,17 @@
package net.osmand.plus;
import java.util.List;
import android.app.backup.BackupAgentHelper;
import android.app.backup.BackupDataInput;
import android.app.backup.FileBackupHelper;
import android.app.backup.SharedPreferencesBackupHelper;
import android.content.Context;
import android.os.ParcelFileDescriptor;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
import java.io.IOException;
import java.util.List;
/**
* Requires android API from android-8
*/
@ -30,4 +34,13 @@ public class OsmandBackupAgent extends BackupAgentHelper {
FileBackupHelper fileBackupHelper = new FileBackupHelper(this, FavouritesDbHelper.FILE_TO_BACKUP, "../databases/" + MapMarkersDbHelper.DB_NAME);
addHelper("osmand.files", fileBackupHelper);
}
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
super.onRestore(data, appVersionCode, newState);
getSharedPreferences(OsmandSettings.getSharedPreferencesName(null), Context.MODE_PRIVATE)
.edit()
.putInt(OsmandSettings.NUMBER_OF_FREE_DOWNLOADS_ID, 0)
.apply();
}
}

View file

@ -613,6 +613,8 @@ public class OsmandSettings {
}
///////////// PREFERENCES classes ////////////////
public static final String NUMBER_OF_FREE_DOWNLOADS_ID = "free_downloads_v3";
// this value string is synchronized with settings_pref.xml preference name
private final OsmandPreference<String> PLUGINS = new StringPreference("enabled_plugins", MapillaryPlugin.ID).makeGlobal();
@ -2508,7 +2510,7 @@ public class OsmandSettings {
// public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS_V2 = new IntPreference("free_downloads_v2", 0).makeGlobal();
public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS = new IntPreference("free_downloads_v3", 0).makeGlobal();
public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS = new IntPreference(NUMBER_OF_FREE_DOWNLOADS_ID, 0).makeGlobal();
// For DashRateUsFragment
public final OsmandPreference<Long> LAST_DISPLAY_TIME =