Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
339c248f81
7 changed files with 49 additions and 78 deletions
|
@ -509,7 +509,8 @@ public class AppInitializer implements IProgress {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlarmManager alarmMgr = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE);
|
AlarmManager alarmMgr = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE);
|
||||||
for (LocalIndexInfo fullMap : fullMaps) {
|
for (LocalIndexInfo fm : fullMaps) {
|
||||||
|
String fullMap = fm.getFileName();
|
||||||
if (!preferenceLiveUpdatesOn(fullMap, settings).get()) {
|
if (!preferenceLiveUpdatesOn(fullMap, settings).get()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import java.io.File;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.io.File;
|
public class LocalIndexInfo {
|
||||||
|
|
||||||
public class LocalIndexInfo implements Parcelable {
|
|
||||||
|
|
||||||
private LocalIndexType type;
|
private LocalIndexType type;
|
||||||
private String description = "";
|
private String description = "";
|
||||||
|
@ -166,27 +164,6 @@ public class LocalIndexInfo implements Parcelable {
|
||||||
return type.getBasename(this);
|
return type.getBasename(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(this.type == null ? -1 : this.type.ordinal());
|
|
||||||
dest.writeString(this.description);
|
|
||||||
dest.writeString(this.name);
|
|
||||||
dest.writeByte(backupedData ? (byte) 1 : (byte) 0);
|
|
||||||
dest.writeByte(corrupted ? (byte) 1 : (byte) 0);
|
|
||||||
dest.writeByte(notSupported ? (byte) 1 : (byte) 0);
|
|
||||||
dest.writeByte(loaded ? (byte) 1 : (byte) 0);
|
|
||||||
dest.writeString(this.subfolder);
|
|
||||||
dest.writeString(this.pathToData);
|
|
||||||
dest.writeString(this.fileName);
|
|
||||||
dest.writeByte(singleFile ? (byte) 1 : (byte) 0);
|
|
||||||
dest.writeInt(this.kbSize);
|
|
||||||
dest.writeByte(expanded ? (byte) 1 : (byte) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected LocalIndexInfo(Parcel in) {
|
protected LocalIndexInfo(Parcel in) {
|
||||||
int tmpType = in.readInt();
|
int tmpType = in.readInt();
|
||||||
|
@ -205,13 +182,5 @@ public class LocalIndexInfo implements Parcelable {
|
||||||
this.expanded = in.readByte() != 0;
|
this.expanded = in.readByte() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<LocalIndexInfo> CREATOR = new Creator<LocalIndexInfo>() {
|
|
||||||
public LocalIndexInfo createFromParcel(Parcel source) {
|
|
||||||
return new LocalIndexInfo(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalIndexInfo[] newArray(int size) {
|
|
||||||
return new LocalIndexInfo[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
|
@ -20,8 +20,8 @@ public class LiveUpdatesAlarmReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String fileName = intent.getAction();
|
String fileName = intent.getAction();
|
||||||
LocalIndexInfo localIndexInfo =
|
String localIndexInfo =
|
||||||
intent.getParcelableExtra(LiveUpdatesHelper.LOCAL_INDEX_INFO);
|
intent.getStringExtra(LiveUpdatesHelper.LOCAL_INDEX_INFO);
|
||||||
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||||
|
|
||||||
final OsmandApplication application = (OsmandApplication) context.getApplicationContext();
|
final OsmandApplication application = (OsmandApplication) context.getApplicationContext();
|
||||||
|
|
|
@ -32,7 +32,6 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.map.WorldRegion;
|
import net.osmand.map.WorldRegion;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -120,7 +119,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
if (!processing && InAppHelper.isSubscribedToLiveUpdates()) {
|
if (!processing && InAppHelper.isSubscribedToLiveUpdates()) {
|
||||||
final FragmentManager fragmentManager = getChildFragmentManager();
|
final FragmentManager fragmentManager = getChildFragmentManager();
|
||||||
LiveUpdatesSettingsDialogFragment
|
LiveUpdatesSettingsDialogFragment
|
||||||
.createInstance(adapter.getChild(groupPosition, childPosition))
|
.createInstance(adapter.getChild(groupPosition, childPosition).getFileName())
|
||||||
.show(fragmentManager, "settings");
|
.show(fragmentManager, "settings");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -271,7 +270,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(LocalIndexInfo info) {
|
public void add(LocalIndexInfo info) {
|
||||||
OsmandSettings.CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(info,
|
OsmandSettings.CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(info.getFileName(),
|
||||||
getSettings());
|
getSettings());
|
||||||
if (preference.get()) {
|
if (preference.get()) {
|
||||||
dataShouldUpdate.add(info);
|
dataShouldUpdate.add(info);
|
||||||
|
@ -284,7 +283,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
Set<LocalIndexInfo> changedSet = new HashSet<>();
|
Set<LocalIndexInfo> changedSet = new HashSet<>();
|
||||||
for (LocalIndexInfo localIndexInfo : dataShouldUpdate) {
|
for (LocalIndexInfo localIndexInfo : dataShouldUpdate) {
|
||||||
OsmandSettings.CommonPreference<Boolean> preference =
|
OsmandSettings.CommonPreference<Boolean> preference =
|
||||||
preferenceLiveUpdatesOn(localIndexInfo, getSettings());
|
preferenceLiveUpdatesOn(localIndexInfo.getFileName(), getSettings());
|
||||||
if (!preference.get()) {
|
if (!preference.get()) {
|
||||||
changedSet.add(localIndexInfo);
|
changedSet.add(localIndexInfo);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +293,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
changedSet.clear();
|
changedSet.clear();
|
||||||
for (LocalIndexInfo localIndexInfo : dataShouldNotUpdate) {
|
for (LocalIndexInfo localIndexInfo : dataShouldNotUpdate) {
|
||||||
OsmandSettings.CommonPreference<Boolean> preference =
|
OsmandSettings.CommonPreference<Boolean> preference =
|
||||||
preferenceLiveUpdatesOn(localIndexInfo, getSettings());
|
preferenceLiveUpdatesOn(localIndexInfo.getFileName(), getSettings());
|
||||||
if (preference.get()) {
|
if (preference.get()) {
|
||||||
changedSet.add(localIndexInfo);
|
changedSet.add(localIndexInfo);
|
||||||
}
|
}
|
||||||
|
@ -392,7 +391,8 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
private void enableLiveUpdates(boolean enable) {
|
private void enableLiveUpdates(boolean enable) {
|
||||||
AlarmManager alarmMgr = (AlarmManager) getActivity()
|
AlarmManager alarmMgr = (AlarmManager) getActivity()
|
||||||
.getSystemService(Context.ALARM_SERVICE);
|
.getSystemService(Context.ALARM_SERVICE);
|
||||||
for (LocalIndexInfo localIndexInfo : dataShouldUpdate) {
|
for (LocalIndexInfo li : dataShouldUpdate) {
|
||||||
|
String localIndexInfo = li.getFileName();
|
||||||
PendingIntent alarmIntent = getPendingIntent(getActivity(),
|
PendingIntent alarmIntent = getPendingIntent(getActivity(),
|
||||||
localIndexInfo);
|
localIndexInfo);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
@ -490,7 +490,8 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void bindLocalIndexInfo(final LocalIndexInfo item, boolean isLastChild) {
|
public void bindLocalIndexInfo(final LocalIndexInfo it, boolean isLastChild) {
|
||||||
|
final String item = it.getFileName();
|
||||||
OsmandApplication context = fragment.getMyActivity().getMyApplication();
|
OsmandApplication context = fragment.getMyActivity().getMyApplication();
|
||||||
final OsmandSettings.CommonPreference<Boolean> shouldUpdatePreference =
|
final OsmandSettings.CommonPreference<Boolean> shouldUpdatePreference =
|
||||||
preferenceLiveUpdatesOn(item, fragment.getSettings());
|
preferenceLiveUpdatesOn(item, fragment.getSettings());
|
||||||
|
@ -523,7 +524,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
view.setLayoutParams(layoutParams);
|
view.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
final String fileNameWithoutExtension =
|
final String fileNameWithoutExtension =
|
||||||
Algorithms.getFileNameWithoutExtension(new File(item.getFileName()));
|
Algorithms.getFileNameWithoutExtension(new File(item));
|
||||||
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
|
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
|
||||||
final long lastCheck = preferenceLastCheck(item, fragment.getSettings()).get();
|
final long lastCheck = preferenceLastCheck(item, fragment.getSettings()).get();
|
||||||
String lastCheckString = formatDateTime(fragment.getActivity(),
|
String lastCheckString = formatDateTime(fragment.getActivity(),
|
||||||
|
|
|
@ -32,45 +32,45 @@ public class LiveUpdatesHelper {
|
||||||
public static final int DEFAULT_LAST_CHECK = -1;
|
public static final int DEFAULT_LAST_CHECK = -1;
|
||||||
|
|
||||||
public static OsmandSettings.CommonPreference<Boolean> preferenceForLocalIndex(
|
public static OsmandSettings.CommonPreference<Boolean> preferenceForLocalIndex(
|
||||||
LocalIndexInfo item, OsmandSettings settings) {
|
String item, OsmandSettings settings) {
|
||||||
final String settingId = item.getFileName() + LIVE_UPDATES_ON_POSTFIX;
|
final String settingId = item + LIVE_UPDATES_ON_POSTFIX;
|
||||||
return settings.registerBooleanPreference(settingId, false);
|
return settings.registerBooleanPreference(settingId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OsmandSettings.CommonPreference<Boolean> preferenceLiveUpdatesOn(
|
public static OsmandSettings.CommonPreference<Boolean> preferenceLiveUpdatesOn(
|
||||||
LocalIndexInfo item, OsmandSettings settings) {
|
String item, OsmandSettings settings) {
|
||||||
final String settingId = item.getFileName() + LIVE_UPDATES_ON_POSTFIX;
|
final String settingId = item + LIVE_UPDATES_ON_POSTFIX;
|
||||||
return settings.registerBooleanPreference(settingId, false);
|
return settings.registerBooleanPreference(settingId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OsmandSettings.CommonPreference<Boolean> preferenceDownloadViaWiFi(
|
public static OsmandSettings.CommonPreference<Boolean> preferenceDownloadViaWiFi(
|
||||||
LocalIndexInfo item, OsmandSettings settings) {
|
String item, OsmandSettings settings) {
|
||||||
final String settingId = item.getFileName() + DOWNLOAD_VIA_WIFI_POSTFIX;
|
final String settingId = item + DOWNLOAD_VIA_WIFI_POSTFIX;
|
||||||
return settings.registerBooleanPreference(settingId, false);
|
return settings.registerBooleanPreference(settingId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OsmandSettings.CommonPreference<Integer> preferenceUpdateFrequency(
|
public static OsmandSettings.CommonPreference<Integer> preferenceUpdateFrequency(
|
||||||
LocalIndexInfo item, OsmandSettings settings) {
|
String item, OsmandSettings settings) {
|
||||||
final String settingId = item.getFileName() + UPDATE_TIMES_POSTFIX;
|
final String settingId = item + UPDATE_TIMES_POSTFIX;
|
||||||
return settings.registerIntPreference(settingId, UpdateFrequency.HOURLY.ordinal());
|
return settings.registerIntPreference(settingId, UpdateFrequency.HOURLY.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OsmandSettings.CommonPreference<Integer> preferenceTimeOfDayToUpdate(
|
public static OsmandSettings.CommonPreference<Integer> preferenceTimeOfDayToUpdate(
|
||||||
LocalIndexInfo item, OsmandSettings settings) {
|
String item, OsmandSettings settings) {
|
||||||
final String settingId = item.getFileName() + TIME_OF_DAY_TO_UPDATE_POSTFIX;
|
final String settingId = item + TIME_OF_DAY_TO_UPDATE_POSTFIX;
|
||||||
return settings.registerIntPreference(settingId, TimeOfDay.NIGHT.ordinal());
|
return settings.registerIntPreference(settingId, TimeOfDay.NIGHT.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OsmandSettings.CommonPreference<Long> preferenceLastCheck(
|
public static OsmandSettings.CommonPreference<Long> preferenceLastCheck(
|
||||||
LocalIndexInfo item, OsmandSettings settings) {
|
String item, OsmandSettings settings) {
|
||||||
final String settingId = item.getFileName() + LAST_UPDATE_ATTEMPT_ON_POSTFIX;
|
final String settingId = item + LAST_UPDATE_ATTEMPT_ON_POSTFIX;
|
||||||
return settings.registerLongPreference(settingId, DEFAULT_LAST_CHECK);
|
return settings.registerLongPreference(settingId, DEFAULT_LAST_CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNameToDisplay(LocalIndexInfo child, OsmandActionBarActivity activity) {
|
public static String getNameToDisplay(String child, OsmandActionBarActivity activity) {
|
||||||
return FileNameTranslationHelper.getFileName(activity,
|
return FileNameTranslationHelper.getFileName(activity,
|
||||||
activity.getMyApplication().getResourceManager().getOsmandRegions(),
|
activity.getMyApplication().getResourceManager().getOsmandRegions(),
|
||||||
child.getFileName());
|
child);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatDateTime(Context ctx, long dateTime) {
|
public static String formatDateTime(Context ctx, long dateTime) {
|
||||||
|
@ -80,9 +80,9 @@ public class LiveUpdatesHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PendingIntent getPendingIntent(@NonNull Context context,
|
public static PendingIntent getPendingIntent(@NonNull Context context,
|
||||||
@NonNull LocalIndexInfo localIndexInfo) {
|
@NonNull String localIndexInfo) {
|
||||||
Intent intent = new Intent(context, LiveUpdatesAlarmReceiver.class);
|
Intent intent = new Intent(context, LiveUpdatesAlarmReceiver.class);
|
||||||
final File file = new File(localIndexInfo.getFileName());
|
final File file = new File(localIndexInfo);
|
||||||
final String fileName = Algorithms.getFileNameWithoutExtension(file);
|
final String fileName = Algorithms.getFileNameWithoutExtension(file);
|
||||||
intent.putExtra(LOCAL_INDEX_INFO, localIndexInfo);
|
intent.putExtra(LOCAL_INDEX_INFO, localIndexInfo);
|
||||||
intent.setAction(fileName);
|
intent.setAction(fileName);
|
||||||
|
@ -159,8 +159,8 @@ public class LiveUpdatesHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runLiveUpdate(Context context, final LocalIndexInfo info, boolean forceUpdate) {
|
public static void runLiveUpdate(Context context, final String info, boolean forceUpdate) {
|
||||||
final String fnExt = Algorithms.getFileNameWithoutExtension(new File(info.getFileName()));
|
final String fnExt = Algorithms.getFileNameWithoutExtension(new File(info));
|
||||||
new PerformLiveUpdateAsyncTask(context, info, forceUpdate).execute(fnExt);
|
new PerformLiveUpdateAsyncTask(context, info, forceUpdate).execute(fnExt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
final LocalIndexInfo localIndexInfo = getArguments().getParcelable(LOCAL_INDEX);
|
final String localIndexInfo = getArguments().getString(LOCAL_INDEX);
|
||||||
|
|
||||||
View view = LayoutInflater.from(getActivity())
|
View view = LayoutInflater.from(getActivity())
|
||||||
.inflate(R.layout.dialog_live_updates_item_settings, null);
|
.inflate(R.layout.dialog_live_updates_item_settings, null);
|
||||||
|
@ -70,7 +70,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
regionNameTextView.setText(getNameToDisplay(localIndexInfo, getMyActivity()));
|
regionNameTextView.setText(getNameToDisplay(localIndexInfo, getMyActivity()));
|
||||||
final String fileNameWithoutExtension =
|
final String fileNameWithoutExtension =
|
||||||
Algorithms.getFileNameWithoutExtension(new File(localIndexInfo.getFileName()));
|
Algorithms.getFileNameWithoutExtension(new File(localIndexInfo));
|
||||||
final IncrementalChangesManager changesManager = getMyApplication().getResourceManager().getChangesManager();
|
final IncrementalChangesManager changesManager = getMyApplication().getResourceManager().getChangesManager();
|
||||||
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
|
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
|
||||||
String lastUpdateDate = formatDateTime(getActivity(), timestamp);
|
String lastUpdateDate = formatDateTime(getActivity(), timestamp);
|
||||||
|
@ -209,10 +209,10 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||||
return (AbstractDownloadActivity) this.getActivity();
|
return (AbstractDownloadActivity) this.getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LiveUpdatesSettingsDialogFragment createInstance(LocalIndexInfo localIndexInfo) {
|
public static LiveUpdatesSettingsDialogFragment createInstance(String localIndexInfo) {
|
||||||
LiveUpdatesSettingsDialogFragment fragment = new LiveUpdatesSettingsDialogFragment();
|
LiveUpdatesSettingsDialogFragment fragment = new LiveUpdatesSettingsDialogFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(LOCAL_INDEX, localIndexInfo);
|
args.putString(LOCAL_INDEX, localIndexInfo);
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
@ -221,14 +221,14 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
final LocalIndexInfo localIndexInfo = getArguments().getParcelable(LOCAL_INDEX);
|
final String localIndexInfo = getArguments().getString(LOCAL_INDEX);
|
||||||
final IncrementalChangesManager changesManager =
|
final IncrementalChangesManager changesManager =
|
||||||
getMyApplication().getResourceManager().getChangesManager();
|
getMyApplication().getResourceManager().getChangesManager();
|
||||||
final String fileNameWithoutExtension =
|
final String fileNameWithoutExtension =
|
||||||
Algorithms.getFileNameWithoutExtension(new File(localIndexInfo.getFileName()));
|
Algorithms.getFileNameWithoutExtension(new File(localIndexInfo));
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setMessage(getString(R.string.clear_updates_proposition_message)
|
builder.setMessage(getString(R.string.clear_updates_proposition_message)
|
||||||
+ getUpdatesSize(fileNameWithoutExtension, changesManager))
|
+ " " + getUpdatesSize(fileNameWithoutExtension, changesManager))
|
||||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
@ -244,10 +244,10 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClearUpdatesDialogFragment createInstance(LocalIndexInfo localIndexInfo) {
|
public static ClearUpdatesDialogFragment createInstance(String localIndexInfo) {
|
||||||
ClearUpdatesDialogFragment fragment = new ClearUpdatesDialogFragment();
|
ClearUpdatesDialogFragment fragment = new ClearUpdatesDialogFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(LOCAL_INDEX, localIndexInfo);
|
args.putString(LOCAL_INDEX, localIndexInfo);
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,11 @@ public class PerformLiveUpdateAsyncTask
|
||||||
@NonNull
|
@NonNull
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@NonNull
|
@NonNull
|
||||||
private final LocalIndexInfo localIndexInfo;
|
private final String localIndexInfo;
|
||||||
private final boolean forceUpdate;
|
private final boolean forceUpdate;
|
||||||
|
|
||||||
public PerformLiveUpdateAsyncTask(@NonNull Context context,
|
public PerformLiveUpdateAsyncTask(@NonNull Context context,
|
||||||
@NonNull LocalIndexInfo localIndexInfo,
|
@NonNull String localIndexInfo,
|
||||||
boolean forceUpdate) {
|
boolean forceUpdate) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.localIndexInfo = localIndexInfo;
|
this.localIndexInfo = localIndexInfo;
|
||||||
|
@ -133,7 +133,7 @@ public class PerformLiveUpdateAsyncTask
|
||||||
|
|
||||||
public static void tryRescheduleDownload(@NonNull Context context,
|
public static void tryRescheduleDownload(@NonNull Context context,
|
||||||
@NonNull OsmandSettings settings,
|
@NonNull OsmandSettings settings,
|
||||||
@NonNull LocalIndexInfo localIndexInfo) {
|
@NonNull String localIndexInfo) {
|
||||||
final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference =
|
final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference =
|
||||||
preferenceUpdateFrequency(localIndexInfo, settings);
|
preferenceUpdateFrequency(localIndexInfo, settings);
|
||||||
final Integer frequencyOrdinal = updateFrequencyPreference.get();
|
final Integer frequencyOrdinal = updateFrequencyPreference.get();
|
||||||
|
@ -144,7 +144,7 @@ public class PerformLiveUpdateAsyncTask
|
||||||
final Integer retriesLeft = settings.LIVE_UPDATES_RETRIES.get();
|
final Integer retriesLeft = settings.LIVE_UPDATES_RETRIES.get();
|
||||||
if (retriesLeft > 0) {
|
if (retriesLeft > 0) {
|
||||||
Intent intent = new Intent(context, LiveUpdatesAlarmReceiver.class);
|
Intent intent = new Intent(context, LiveUpdatesAlarmReceiver.class);
|
||||||
final File file = new File(localIndexInfo.getFileName());
|
final File file = new File(localIndexInfo);
|
||||||
final String fileName = Algorithms.getFileNameWithoutExtension(file);
|
final String fileName = Algorithms.getFileNameWithoutExtension(file);
|
||||||
intent.putExtra(LiveUpdatesHelper.LOCAL_INDEX_INFO, localIndexInfo);
|
intent.putExtra(LiveUpdatesHelper.LOCAL_INDEX_INFO, localIndexInfo);
|
||||||
intent.setAction(fileName);
|
intent.setAction(fileName);
|
||||||
|
|
Loading…
Reference in a new issue