Update date for map in dialog
This commit is contained in:
parent
ef0088696f
commit
e4d30dacef
3 changed files with 9 additions and 6 deletions
|
@ -27,5 +27,5 @@
|
||||||
<string name="hint_value">Value</string>
|
<string name="hint_value">Value</string>
|
||||||
<string name="live_updates_on">Live updates on</string>
|
<string name="live_updates_on">Live updates on</string>
|
||||||
<string name="live_updates_off">Live updates off</string>
|
<string name="live_updates_off">Live updates off</string>
|
||||||
<string name="last_check_date">"Last check date: %s"</string>
|
<string name="map_update_date">"Map update date: %s"</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -40,7 +40,6 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatDateTime;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
|
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
|
||||||
|
|
||||||
|
@ -79,10 +78,9 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||||
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);
|
||||||
OsmandSettings.CommonPreference<Long> lastCheckPreference = preferenceLastCheck(localIndexInfo, getSettings());
|
final long mapTimestamp = changesManager.getMapTimestamp(fileNameWithoutExtension);
|
||||||
String lastCheckDate = formatDateTime(getActivity(), lastCheckPreference.get());
|
String lastCheckDate = formatDateTime(getActivity(), mapTimestamp);
|
||||||
String lastCheck = lastCheckPreference.get() != -1 ? lastCheckDate : lastUpdateDate;
|
lastCheckTextView.setText(getString(R.string.map_update_date, lastCheckDate));
|
||||||
lastCheckTextView.setText(getString(R.string.last_check_date, lastCheck));
|
|
||||||
lastUpdateTextView.setText(getString(R.string.update_date_pattern, lastUpdateDate));
|
lastUpdateTextView.setText(getString(R.string.update_date_pattern, lastUpdateDate));
|
||||||
final OsmandSettings.CommonPreference<Boolean> liveUpdatePreference =
|
final OsmandSettings.CommonPreference<Boolean> liveUpdatePreference =
|
||||||
preferenceForLocalIndex(localIndexInfo, getSettings());
|
preferenceForLocalIndex(localIndexInfo, getSettings());
|
||||||
|
|
|
@ -370,6 +370,11 @@ public class IncrementalChangesManager {
|
||||||
return getTimestamp(ruf);
|
return getTimestamp(ruf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getMapTimestamp(String fileName) {
|
||||||
|
RegionUpdateFiles ruf = regions.get(fileName.toLowerCase());
|
||||||
|
return ruf.mainFileInit;
|
||||||
|
}
|
||||||
|
|
||||||
private long getTimestamp(RegionUpdateFiles ruf) {
|
private long getTimestamp(RegionUpdateFiles ruf) {
|
||||||
long timestamp = ruf.mainFileInit;
|
long timestamp = ruf.mainFileInit;
|
||||||
for (RegionUpdate ru : ruf.monthUpdates.values()) {
|
for (RegionUpdate ru : ruf.monthUpdates.values()) {
|
||||||
|
|
Loading…
Reference in a new issue