From c864835de938e90e57b3e884def56805a409d834 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Sun, 25 Oct 2015 15:48:07 +0200 Subject: [PATCH] Preference added. --- .../plus/download/DownloadActivity.java | 12 ------ .../plus/download/ui/ItemViewHolder.java | 43 +++++++++++-------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index 10423a529c..2f4bbe784d 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -521,16 +521,4 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl messageTextView.setText(R.string.device_memory); } - - - private void initSettingsIfFirstMap(IndexItem item) { - OsmandSettings.CommonPreference isFirstMapDownloadedPreference = - getMyApplication().getSettings() - .registerBooleanPreference(FIRST_MAP_DOWNLOADED, false).makeGlobal(); - boolean wasFirstMapDownloaded = isFirstMapDownloadedPreference.get(); - if (!wasFirstMapDownloaded) { -// item.ge - isFirstMapDownloadedPreference.set(true); - } - } } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java index 9c226cf189..1b98a90221 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java @@ -1,23 +1,5 @@ package net.osmand.plus.download.ui; -import java.io.File; -import java.text.DateFormat; - -import net.osmand.access.AccessibleToast; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.R; -import net.osmand.plus.Version; -import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; -import net.osmand.plus.activities.LocalIndexInfo; -import net.osmand.plus.download.DownloadActivity; -import net.osmand.plus.download.DownloadActivityType; -import net.osmand.plus.download.DownloadResourceGroup; -import net.osmand.plus.download.DownloadResources; -import net.osmand.plus.download.IndexItem; -import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask; -import net.osmand.plus.helpers.FileNameTranslationHelper; -import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; -import net.osmand.plus.srtmplugin.SRTMPlugin; import android.annotation.SuppressLint; import android.app.AlertDialog.Builder; import android.content.DialogInterface; @@ -37,6 +19,26 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; +import net.osmand.access.AccessibleToast; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.Version; +import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; +import net.osmand.plus.activities.LocalIndexInfo; +import net.osmand.plus.download.DownloadActivity; +import net.osmand.plus.download.DownloadActivityType; +import net.osmand.plus.download.DownloadResourceGroup; +import net.osmand.plus.download.DownloadResources; +import net.osmand.plus.download.IndexItem; +import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask; +import net.osmand.plus.helpers.FileNameTranslationHelper; +import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; +import net.osmand.plus.srtmplugin.SRTMPlugin; + +import java.io.File; +import java.text.DateFormat; + public class ItemViewHolder { protected final TextView nameTextView; @@ -45,6 +47,7 @@ public class ItemViewHolder { protected final ImageView rightImageButton; protected final Button rightButton; protected final ProgressBar progressBar; + private final OsmandSettings.CommonPreference isFirstMapDownloadedPreference; private boolean srtmDisabled; private boolean srtmNeedsInstallation; @@ -64,7 +67,6 @@ public class ItemViewHolder { private DateFormat dateFormat; - private enum RightButtonAction { DOWNLOAD, @@ -92,6 +94,9 @@ public class ItemViewHolder { textColorPrimary = typedValue.data; theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true); textColorSecondary = typedValue.data; + + isFirstMapDownloadedPreference = context.getMyApplication().getSettings() + .registerBooleanPreference(DownloadActivity.FIRST_MAP_DOWNLOADED, false).makeGlobal(); } public void setShowRemoteDate(boolean showRemoteDate) {