diff --git a/OsmAnd/res/layout/list_group_title_with_switch.xml b/OsmAnd/res/layout/list_group_title_with_switch.xml
new file mode 100644
index 0000000000..0e2584e9fd
--- /dev/null
+++ b/OsmAnd/res/layout/list_group_title_with_switch.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/live_updates_header.xml b/OsmAnd/res/layout/live_updates_header.xml
index e345e5c1f9..a72faaad0c 100644
--- a/OsmAnd/res/layout/live_updates_header.xml
+++ b/OsmAnd/res/layout/live_updates_header.xml
@@ -2,144 +2,114 @@
-
-
-
+ android:gravity="center"
+ android:minHeight="44dp">
-
-
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:text="Subscription"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="@dimen/default_desc_text_size"
+ app:typeface="@string/font_roboto_regular"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/local_index_live_updates_list_item.xml b/OsmAnd/res/layout/local_index_live_updates_list_item.xml
new file mode 100644
index 0000000000..3beaca7acb
--- /dev/null
+++ b/OsmAnd/res/layout/local_index_live_updates_list_item.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java
index b03151ee28..2f2c36bff0 100644
--- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java
+++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java
@@ -27,8 +27,7 @@ public class LocalIndexInfo implements Parcelable {
private boolean singleFile;
private int kbSize = -1;
- @NonNull
- private final WorldRegion worldRegion;
+ private WorldRegion worldRegion;
// UI state expanded
private boolean expanded;
@@ -46,10 +45,6 @@ public class LocalIndexInfo implements Parcelable {
kbSize = (int) ((f.length() + 512) >> 10);
}
this.backupedData = backuped;
-
- final String baseName = getBaseName().toLowerCase();
- WorldRegion worldRegion = app.getRegions().getRegionDataByDownloadName(baseName);
- this.worldRegion = worldRegion;
}
private String formatName(String name) {
@@ -66,10 +61,6 @@ public class LocalIndexInfo implements Parcelable {
this.type = type;
backupedData = backup;
this.subfolder = subfolder;
-
- final String baseName = getBaseName().toLowerCase();
- WorldRegion worldRegion = app.getRegions().getRegionDataByDownloadName(baseName);
- this.worldRegion = worldRegion;
}
public void setCorrupted(boolean corrupted) {
diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java
index 482d9aaa10..7c5675bca5 100644
--- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java
+++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java
@@ -25,6 +25,10 @@ import org.apache.commons.logging.Log;
import java.io.File;
import java.util.List;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
+
public class LiveUpdatesAlarmReceiver extends BroadcastReceiver {
private static final Log LOG = PlatformUtil.getLog(LiveUpdatesAlarmReceiver.class);
@@ -93,10 +97,10 @@ public class LiveUpdatesAlarmReceiver extends BroadcastReceiver {
private static void tryRescheduleDownload(Context context, OsmandSettings settings,
LocalIndexInfo localIndexInfo) {
final OsmandSettings.CommonPreference updateFrequencyPreference =
- preferenceUpdateTimes(localIndexInfo, settings);
+ preferenceUpdateFrequency(localIndexInfo, settings);
final Integer frequencyOrdinal = updateFrequencyPreference.get();
- if (LiveUpdatesSettingsDialogFragment.UpdateFrequencies.values()[frequencyOrdinal]
- == LiveUpdatesSettingsDialogFragment.UpdateFrequencies.HOURLY) {
+ if (UpdateFrequency.values()[frequencyOrdinal]
+ == UpdateFrequency.HOURLY) {
return;
}
final Integer retriesLeft = settings.LIVE_UPDATES_RETRIES.get();
@@ -118,19 +122,4 @@ public class LiveUpdatesAlarmReceiver extends BroadcastReceiver {
settings.LIVE_UPDATES_RETRIES.resetToDefault();
}
}
-
- private static OsmandSettings.CommonPreference preferenceDownloadViaWiFi(
- LocalIndexInfo item, OsmandSettings settings) {
- final String settingId = item.getFileName()
- + LiveUpdatesSettingsDialogFragment.DOWNLOAD_VIA_WIFI_POSTFIX;
- return settings.registerBooleanPreference(settingId, false);
- }
-
- private static OsmandSettings.CommonPreference preferenceUpdateTimes(
- LocalIndexInfo item, OsmandSettings settings) {
- final String settingId = item.getFileName()
- + LiveUpdatesSettingsDialogFragment.UPDATE_TIMES_POSTFIX;
- return settings.registerIntPreference(settingId,
- LiveUpdatesSettingsDialogFragment.UpdateFrequencies.HOURLY.ordinal());
- }
}
diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
index 16d7e2414c..3db272e5c3 100644
--- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
@@ -40,9 +40,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
+
public class LiveUpdatesFragment extends Fragment {
public static final String TITILE = "Live Updates";
- public static final String LIVE_UPDATES_ON_POSTFIX = "_live_updates_on";
public static final Comparator LOCAL_INDEX_INFO_COMPARATOR = new Comparator() {
@Override
public int compare(LocalIndexInfo lhs, LocalIndexInfo rhs) {
@@ -62,35 +65,18 @@ public class LiveUpdatesFragment extends Fragment {
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
listView = (ExpandableListView) view.findViewById(android.R.id.list);
- View header = inflater.inflate(R.layout.live_updates_header, listView, false);
+// View header = inflater.inflate(R.layout.live_updates_header, listView, false);
- final OsmandSettings settings = getMyActivity().getMyApplication().getSettings();
-
- final TextView onOffTextView = (TextView) header.findViewById(R.id.onOffTextView);
- int liveUpdatesStateId = settings.IS_LIVE_UPDATES_ON.get()
- ? R.string.shared_string_on : R.string.shared_string_off;
- onOffTextView.setText(liveUpdatesStateId);
-
- SwitchCompat liveUpdatesSwitch = (SwitchCompat) header.findViewById(R.id.liveUpdatesSwitch);
- liveUpdatesSwitch.setChecked(settings.IS_LIVE_UPDATES_ON.get());
- liveUpdatesSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- settings.IS_LIVE_UPDATES_ON.set(isChecked);
- int liveUpdatesStateId = isChecked ? R.string.shared_string_on
- : R.string.shared_string_off;
- onOffTextView.setText(liveUpdatesStateId);
-
- }
- });
-
- listView.addHeaderView(header);
adapter = new LocalIndexesAdapter(this);
listView.setAdapter(adapter);
new LoadLocalIndexTask(adapter, this).execute();
return view;
}
+ private OsmandSettings getSettings() {
+ return getMyActivity().getMyApplication().getSettings();
+ }
+
private AbstractDownloadActivity getMyActivity() {
return (AbstractDownloadActivity) getActivity();
}
@@ -100,6 +86,8 @@ public class LiveUpdatesFragment extends Fragment {
}
protected class LocalIndexesAdapter extends OsmandBaseExpandableListAdapter {
+ public static final int SHOULD_UPDATE_GROUP_POSITION = 0;
+ public static final int SHOULD_NOT_UPDATE_GROUP_POSITION = 1;
final ArrayList dataShouldUpdate = new ArrayList<>();
final ArrayList dataShouldNotUpdate = new ArrayList<>();
final LiveUpdatesFragment fragment;
@@ -111,8 +99,8 @@ public class LiveUpdatesFragment extends Fragment {
}
public void add(LocalIndexInfo info) {
- OsmandSettings.CommonPreference preference =
- preferenceForLocalIndex(LIVE_UPDATES_ON_POSTFIX, info);
+ OsmandSettings.CommonPreference preference = preferenceLiveUpdatesOn(info,
+ getSettings());
if (preference.get()) {
dataShouldUpdate.add(info);
} else {
@@ -124,7 +112,7 @@ public class LiveUpdatesFragment extends Fragment {
Set changedSet = new HashSet<>();
for (LocalIndexInfo localIndexInfo : dataShouldUpdate) {
OsmandSettings.CommonPreference preference =
- preferenceForLocalIndex(LIVE_UPDATES_ON_POSTFIX, localIndexInfo);
+ preferenceLiveUpdatesOn(localIndexInfo, getSettings());
if (!preference.get()) {
changedSet.add(localIndexInfo);
}
@@ -134,7 +122,7 @@ public class LiveUpdatesFragment extends Fragment {
changedSet.clear();
for (LocalIndexInfo localIndexInfo : dataShouldNotUpdate) {
OsmandSettings.CommonPreference preference =
- preferenceForLocalIndex(LIVE_UPDATES_ON_POSTFIX, localIndexInfo);
+ preferenceLiveUpdatesOn(localIndexInfo, getSettings());
if (preference.get()) {
changedSet.add(localIndexInfo);
}
@@ -172,7 +160,7 @@ public class LiveUpdatesFragment extends Fragment {
LocalFullMapsViewHolder viewHolder;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(ctx);
- convertView = inflater.inflate(R.layout.local_index_list_item, parent, false);
+ convertView = inflater.inflate(R.layout.local_index_live_updates_list_item, parent, false);
viewHolder = new LocalFullMapsViewHolder(convertView, fragment);
convertView.setTag(viewHolder);
} else {
@@ -182,7 +170,6 @@ public class LiveUpdatesFragment extends Fragment {
return convertView;
}
-
private String getNameToDisplay(LocalIndexInfo child) {
String mapName = FileNameTranslationHelper.getFileName(ctx,
fragment.getMyActivity().getMyApplication().getResourceManager().getOsmandRegions(),
@@ -196,7 +183,7 @@ public class LiveUpdatesFragment extends Fragment {
String group = getGroup(groupPosition);
if (v == null) {
LayoutInflater inflater = LayoutInflater.from(ctx);
- v = inflater.inflate(R.layout.download_item_list_section, parent, false);
+ v = inflater.inflate(R.layout.list_group_title_with_switch, parent, false);
}
TextView nameView = ((TextView) v.findViewById(R.id.section_name));
nameView.setText(group);
@@ -207,14 +194,32 @@ public class LiveUpdatesFragment extends Fragment {
Resources.Theme theme = ctx.getTheme();
theme.resolveAttribute(R.attr.ctx_menu_info_view_bg, typedValue, true);
v.setBackgroundColor(typedValue.data);
+
+ SwitchCompat liveUpdatesSwitch = (SwitchCompat) v.findViewById(R.id.liveUpdatesSwitch);
+ if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) {
+ liveUpdatesSwitch.setVisibility(View.VISIBLE);
+ OsmandApplication application = (OsmandApplication) ctx.getApplicationContext();
+ final OsmandSettings settings = application.getSettings();
+ liveUpdatesSwitch.setChecked(settings.IS_LIVE_UPDATES_ON.get());
+ liveUpdatesSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ settings.IS_LIVE_UPDATES_ON.set(isChecked);
+ int liveUpdatesStateId = isChecked ? R.string.shared_string_on
+ : R.string.shared_string_off;
+ }
+ });
+ } else {
+ liveUpdatesSwitch.setVisibility(View.GONE);
+ }
return v;
}
@Override
public int getChildrenCount(int groupPosition) {
- if (groupPosition == 0) {
+ if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) {
return dataShouldUpdate.size();
- } else if (groupPosition == 1) {
+ } else if (groupPosition == SHOULD_NOT_UPDATE_GROUP_POSITION) {
return dataShouldNotUpdate.size();
} else {
throw new IllegalArgumentException("unexpected group position:" + groupPosition);
@@ -223,9 +228,9 @@ public class LiveUpdatesFragment extends Fragment {
@Override
public String getGroup(int groupPosition) {
- if (groupPosition == 0) {
+ if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) {
return getString(R.string.live_updates_on);
- } else if (groupPosition == 1) {
+ } else if (groupPosition == SHOULD_NOT_UPDATE_GROUP_POSITION) {
return getString(R.string.live_updates_off);
} else {
throw new IllegalArgumentException("unexpected group position:" + groupPosition);
@@ -252,13 +257,17 @@ public class LiveUpdatesFragment extends Fragment {
return true;
}
- private OsmandSettings.CommonPreference preferenceForLocalIndex(String idPostfix,
- LocalIndexInfo item) {
- final OsmandApplication myApplication = fragment.getMyActivity().getMyApplication();
- final OsmandSettings settings = myApplication.getSettings();
- final String settingId = item.getFileName() + idPostfix;
- return settings.registerBooleanPreference(settingId, false);
- }
+
+ }
+
+ private static OsmandSettings.CommonPreference preferenceForLocalIndex(
+ String idPostfix,
+ LocalIndexInfo item,
+ LiveUpdatesFragment fragment) {
+ final OsmandApplication myApplication = fragment.getMyActivity().getMyApplication();
+ final OsmandSettings settings = myApplication.getSettings();
+ final String settingId = item.getFileName() + idPostfix;
+ return settings.registerBooleanPreference(settingId, false);
}
private void expandAllGroups() {
@@ -279,6 +288,7 @@ public class LiveUpdatesFragment extends Fragment {
private static class LocalFullMapsViewHolder {
private final ImageView icon;
private final TextView nameTextView;
+ private final TextView subheaderTextView;
private final TextView descriptionTextView;
private final ImageButton options;
private final LiveUpdatesFragment fragment;
@@ -287,6 +297,7 @@ public class LiveUpdatesFragment extends Fragment {
private LocalFullMapsViewHolder(View view, LiveUpdatesFragment context) {
icon = (ImageView) view.findViewById(R.id.icon);
nameTextView = (TextView) view.findViewById(R.id.nameTextView);
+ subheaderTextView = (TextView) view.findViewById(R.id.subheaderTextView);
descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
options = (ImageButton) view.findViewById(R.id.options);
this.view = view;
@@ -294,10 +305,21 @@ public class LiveUpdatesFragment extends Fragment {
}
public void bindLocalIndexInfo(final LocalIndexInfo item) {
- nameTextView.setText(item.getName());
- descriptionTextView.setText(item.getDescription());
OsmandApplication context = fragment.getMyActivity().getMyApplication();
+ final OsmandSettings.CommonPreference shouldUpdatePreference =
+ preferenceLiveUpdatesOn(item, fragment.getSettings());
+
+ nameTextView.setText(item.getName());
+ if (shouldUpdatePreference.get()) {
+ final Integer frequencyId = preferenceUpdateFrequency(item, fragment.getSettings()).get();
+ final UpdateFrequency frequency = UpdateFrequency.values()[frequencyId];
+ subheaderTextView.setText(frequency.toString());
+ } else {
+ subheaderTextView.setText(item.getSize() + "");
+ }
+ descriptionTextView.setText(item.getDescription());
icon.setImageDrawable(context.getIconsCache().getContentIcon(R.drawable.ic_map));
+
final View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java
new file mode 100644
index 0000000000..b628c194e1
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java
@@ -0,0 +1,56 @@
+package net.osmand.plus.liveupdates;
+
+import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.activities.LocalIndexInfo;
+
+/**
+ * Created by GaidamakUA on 12/18/15.
+ */
+public class LiveUpdatesHelper {
+ private static final String UPDATE_TIMES_POSTFIX = "_update_times";
+ private static final String TIME_OF_DAY_TO_UPDATE_POSTFIX = "_time_of_day_to_update";
+ private static final String DOWNLOAD_VIA_WIFI_POSTFIX = "_download_via_wifi";
+ private static final String LIVE_UPDATES_ON_POSTFIX = "_live_updates_on";
+
+
+ public static OsmandSettings.CommonPreference preferenceForLocalIndex(
+ LocalIndexInfo item, OsmandSettings settings) {
+ final String settingId = item.getFileName() + LIVE_UPDATES_ON_POSTFIX;
+ return settings.registerBooleanPreference(settingId, false);
+ }
+
+ public static OsmandSettings.CommonPreference preferenceLiveUpdatesOn(
+ LocalIndexInfo item, OsmandSettings settings) {
+ final String settingId = item.getFileName() + LIVE_UPDATES_ON_POSTFIX;
+ return settings.registerBooleanPreference(settingId, false);
+ }
+
+ public static OsmandSettings.CommonPreference preferenceDownloadViaWiFi(
+ LocalIndexInfo item, OsmandSettings settings) {
+ final String settingId = item.getFileName() + DOWNLOAD_VIA_WIFI_POSTFIX;
+ return settings.registerBooleanPreference(settingId, false);
+ }
+
+ public static OsmandSettings.CommonPreference preferenceUpdateFrequency(
+ LocalIndexInfo item, OsmandSettings settings) {
+ final String settingId = item.getFileName() + UPDATE_TIMES_POSTFIX;
+ return settings.registerIntPreference(settingId, UpdateFrequency.HOURLY.ordinal());
+ }
+
+ public static OsmandSettings.CommonPreference preferenceTimeOfDayToUpdate(
+ LocalIndexInfo item, OsmandSettings settings) {
+ final String settingId = item.getFileName() + TIME_OF_DAY_TO_UPDATE_POSTFIX;
+ return settings.registerIntPreference(settingId, TimesOfDay.NIGHT.ordinal());
+ }
+
+ public static enum TimesOfDay {
+ MORNING,
+ NIGHT
+ }
+
+ public enum UpdateFrequency {
+ HOURLY,
+ DAILY,
+ WEEKLY
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java
index 03a6f94fe9..fe6047e5d8 100644
--- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java
@@ -27,16 +27,21 @@ import net.osmand.util.Algorithms;
import java.io.File;
import java.util.Calendar;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimesOfDay;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
+import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
+
public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
+ private static final String LOCAL_INDEX = "local_index";
public static final String LOCAL_INDEX_INFO = "local_index_info";
- private static final String LOCAL_INDEX = "local_index";
- public static final String UPDATE_TIMES_POSTFIX = "_update_times";
- private static final String TIME_OF_DAY_TO_UPDATE_POSTFIX = "_time_of_day_to_update";
+
private static final int MORNING_UPDATE_TIME = 8;
private static final int NIGHT_UPDATE_TIME = 21;
private static final int SHIFT = 1000;
- public static final String DOWNLOAD_VIA_WIFI_POSTFIX = "_download_via_wifi";
@NonNull
@Override
@@ -57,13 +62,13 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
// countryNameTextView.setText(localIndexInfo.getWorldRegion().getLocaleName());
countryNameTextView.setVisibility(View.VISIBLE);
final OsmandSettings.CommonPreference liveUpdatePreference =
- preferenceForLocalIndex(localIndexInfo);
+ preferenceForLocalIndex(localIndexInfo, getSettings());
final OsmandSettings.CommonPreference downloadViaWiFiPreference =
- preferenceDownloadViaWiFi(localIndexInfo);
+ preferenceDownloadViaWiFi(localIndexInfo, getSettings());
final OsmandSettings.CommonPreference updateFrequencePreference =
- preferenceUpdateTimes(localIndexInfo);
+ preferenceUpdateFrequency(localIndexInfo, getSettings());
final OsmandSettings.CommonPreference timeOfDayPreference =
- preferenceTimeOfDayToUpdate(localIndexInfo);
+ preferenceTimeOfDayToUpdate(localIndexInfo, getSettings());
liveUpdatesSwitch.setChecked(liveUpdatePreference.get());
downloadOverWiFiSwitch.setChecked(downloadViaWiFiPreference.get());
@@ -73,7 +78,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
public void onClick(DialogInterface dialog, int which) {
final int updateFrequencyInt = updateFrequencySpinner.getSelectedItemPosition();
updateFrequencePreference.set(updateFrequencyInt);
- UpdateFrequencies updateFrequency = UpdateFrequencies.values()[updateFrequencyInt];
+ UpdateFrequency updateFrequency = UpdateFrequency.values()[updateFrequencyInt];
AlarmManager alarmMgr = (AlarmManager) getActivity()
.getSystemService(Context.ALARM_SERVICE);
@@ -129,7 +134,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
updateFrequencySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
- UpdateFrequencies updateFrequency = UpdateFrequencies.values()[position];
+ UpdateFrequency updateFrequency = UpdateFrequency.values()[position];
switch (updateFrequency) {
case HOURLY:
updateTimesOfDaySpinner.setVisibility(View.GONE);
@@ -166,26 +171,6 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
return (LiveUpdatesFragment) getParentFragment();
}
- private OsmandSettings.CommonPreference preferenceForLocalIndex(LocalIndexInfo item) {
- final String settingId = item.getFileName() + LiveUpdatesFragment.LIVE_UPDATES_ON_POSTFIX;
- return getSettings().registerBooleanPreference(settingId, false);
- }
-
- private OsmandSettings.CommonPreference preferenceDownloadViaWiFi(LocalIndexInfo item) {
- final String settingId = item.getFileName() + DOWNLOAD_VIA_WIFI_POSTFIX;
- return getSettings().registerBooleanPreference(settingId, false);
- }
-
- private OsmandSettings.CommonPreference preferenceUpdateTimes(LocalIndexInfo item) {
- final String settingId = item.getFileName() + UPDATE_TIMES_POSTFIX;
- return getSettings().registerIntPreference(settingId, UpdateFrequencies.HOURLY.ordinal());
- }
-
- private OsmandSettings.CommonPreference preferenceTimeOfDayToUpdate(LocalIndexInfo item) {
- final String settingId = item.getFileName() + TIME_OF_DAY_TO_UPDATE_POSTFIX;
- return getSettings().registerIntPreference(settingId, TimesOfDay.NIGHT.ordinal());
- }
-
private OsmandSettings getSettings() {
return getMyApplication().getSettings();
}
@@ -201,15 +186,4 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
fragment.setArguments(args);
return fragment;
}
-
- public static enum UpdateFrequencies {
- HOURLY,
- DAILY,
- WEEKLY
- }
-
- public static enum TimesOfDay {
- MORNING,
- NIGHT
- }
}