diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index cfbabbf22c..caa71822c6 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1877,7 +1877,9 @@ public class OsmandSettings { - public final OsmandPreference NUMBER_OF_FREE_DOWNLOADS = new IntPreference("free_downloads_v2", 0).makeGlobal(); +// public final OsmandPreference NUMBER_OF_FREE_DOWNLOADS_V2 = new IntPreference("free_downloads_v2", 0).makeGlobal(); + + public final OsmandPreference NUMBER_OF_FREE_DOWNLOADS = new IntPreference("free_downloads_v3", 0).makeGlobal(); // For DashRateUsFragment public final OsmandPreference LAST_DISPLAY_TIME = @@ -1890,13 +1892,6 @@ public class OsmandSettings { .makeGlobal() .cache(); - public boolean checkFreeDownloadsNumberZero(){ - if(!settingsAPI.contains(globalPreferences,NUMBER_OF_FREE_DOWNLOADS.getId())){ - NUMBER_OF_FREE_DOWNLOADS.set(0); - return true; - } - return false; - } public enum DayNightMode { AUTO(R.string.daynight_mode_auto), diff --git a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java index f2b6071e24..c96c8f2f6f 100644 --- a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java @@ -1,6 +1,18 @@ package net.osmand.plus.development; +import java.text.SimpleDateFormat; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import net.osmand.plus.ApplicationMode; +import net.osmand.plus.OsmAndLocationSimulation; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.SettingsBaseActivity; +import net.osmand.plus.activities.actions.AppModeDialog; +import net.osmand.util.SunriseSunset; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.AlertDialog.Builder; @@ -14,24 +26,12 @@ import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceScreen; import android.view.View; -import net.osmand.plus.ApplicationMode; -import net.osmand.plus.OsmAndLocationSimulation; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.R; -import net.osmand.plus.activities.SettingsBaseActivity; -import net.osmand.plus.activities.actions.AppModeDialog; -import net.osmand.util.SunriseSunset; - -import java.text.SimpleDateFormat; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - //import net.osmand.plus.development.OsmandDevelopmentPlugin; public class SettingsDevelopmentActivity extends SettingsBaseActivity { + @SuppressLint("SimpleDateFormat") @Override public void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); @@ -143,7 +143,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { final Preference agpspref = new Preference(this); agpspref.setTitle(R.string.agps_info); if (settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get() != 0L) { - @SuppressLint("SimpleDateFormat") SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); agpspref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get()))); } else { @@ -157,7 +156,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { public boolean onPreferenceClick(Preference preference) { if(getMyApplication().getSettings().isInternetConnectionAvailable(true)) { getMyApplication().getLocationProvider().redownloadAGPS(); - @SuppressLint("SimpleDateFormat") SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); agpspref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get()))); } @@ -170,7 +168,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { pref = new Preference(this); pref.setTitle(R.string.day_night_info); if (sunriseSunset != null) { - @SuppressLint("SimpleDateFormat") SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); pref.setSummary(getString(R.string.day_night_info_description, prt.format(sunriseSunset.getSunrise()), prt.format(sunriseSunset.getSunset()))); @@ -185,9 +182,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { cat.addPreference(createCheckBoxPreference(settings.SHOULD_SHOW_FREE_VERSION_BANNER, R.string.show_free_version_banner, R.string.show_free_version_banner_description)); - cat.addPreference(createSeekBarPreference(settings.NUMBER_OF_FREE_DOWNLOADS, - R.string.free_downloads_used, R.string.free_downloads_used_description, - R.string.free_downloads_used, 5, 10)); } protected void availableProfileDialog() { diff --git a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java index d065c33996..d1238656f4 100644 --- a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java @@ -29,7 +29,7 @@ public class BaseDownloadActivity extends ActionBarProgressActivity implements D protected OsmandSettings settings; private static DownloadIndexesThread downloadListIndexThread; protected Set> fragSet = new HashSet<>(); - public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 10; + public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 5; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index 293a8748c2..98562bf7c2 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -256,12 +256,6 @@ public class DownloadActivity extends BaseDownloadActivity { public void updateBannerInProgress() { BasicProgressAsyncTask basicProgressAsyncTask = ctx.getDownloadThread().getCurrentRunningTask(); - final int countedDownloads = ctx.getDownloadThread().getCountedDownloads(); - updateProgress(countedDownloads, basicProgressAsyncTask); - } - - private void updateProgress(int countedDownloads, - BasicProgressAsyncTask basicProgressAsyncTask) { final boolean isFinished = basicProgressAsyncTask == null || basicProgressAsyncTask.getStatus() == AsyncTask.Status.FINISHED; if (isFinished) { @@ -272,7 +266,8 @@ public class DownloadActivity extends BaseDownloadActivity { String message = basicProgressAsyncTask.getDescription(); int percent = basicProgressAsyncTask.getProgressPercentage(); setMinimizedFreeVersionBanner(true); - updateAvailableDownloads(countedDownloads); + + updateAvailableDownloads(); downloadProgressLayout.setVisibility(View.VISIBLE); progressBar.setIndeterminate(indeterminate); if (indeterminate) { @@ -330,7 +325,8 @@ public class DownloadActivity extends BaseDownloadActivity { buttonsLinearLayout, freeVersionBannerTitle)); } - private void updateAvailableDownloads(int activeTasks) { + private void updateAvailableDownloads() { + int activeTasks = ctx.getDownloadThread().getCountedDownloads(); OsmandSettings settings = application.getSettings(); final Integer mapsDownloaded = settings.NUMBER_OF_FREE_DOWNLOADS.get() + activeTasks; downloadsLeftProgressBar.setProgress(mapsDownloaded);