Skip to content

Commit

Permalink
Fix timestamp displayed on the live updates screen
Browse files Browse the repository at this point in the history
  • Loading branch information
vshcherb committed Aug 10, 2016
1 parent 91e9cc6 commit bce3a3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 8 additions & 4 deletions OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
Expand Up @@ -33,7 +33,6 @@
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import net.osmand.map.WorldRegion;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
Expand Down Expand Up @@ -534,9 +533,14 @@ public void bindLocalIndexInfo(@NonNull final String item, boolean isLastChild)
Algorithms.getFileNameWithoutExtension(new File(item));
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
final long lastCheck = preferenceLastCheck(item, fragment.getSettings()).get();
String lastCheckString = formatDateTime(fragment.getActivity(),
lastCheck != DEFAULT_LAST_CHECK ? lastCheck : timestamp);
descriptionTextView.setText(context.getString(R.string.last_update, lastCheckString));
OsmandSettings.CommonPreference<Boolean> liveUpdateOn = preferenceLiveUpdatesOn(item, fragment.getSettings());
if(liveUpdateOn.get() && lastCheck != DEFAULT_LAST_CHECK) {
String lastCheckString = formatDateTime(fragment.getActivity(), lastCheck );
descriptionTextView.setText(context.getString(R.string.last_update, lastCheckString));
} else {
String lastCheckString = formatDateTime(fragment.getActivity(), timestamp );
descriptionTextView.setText(context.getString(R.string.last_map_change, lastCheckString));
}

if (!fragment.isProcessing() && InAppHelper.isSubscribedToLiveUpdates()) {
final View.OnClickListener clickListener = new View.OnClickListener() {
Expand Down
Expand Up @@ -75,15 +75,14 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
final IncrementalChangesManager changesManager = getMyApplication().getResourceManager().getChangesManager();
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
String lastUpdateDate = formatDateTime(getActivity(), timestamp);
final long lastCheck = preferenceLastCheck(fileName, getSettings()).get();
String lastCheckString = formatDateTime(getActivity(), lastCheck != DEFAULT_LAST_CHECK
? lastCheck : timestamp);
lastMapChangeTextView.setText(getString(R.string.last_map_change, lastUpdateDate));
final long lastCheck = preferenceLastCheck(fileName, getSettings()).get();


OsmandSettings.CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(fileName,
getSettings());
if (preference.get()) {
if (preference.get() && lastCheck != DEFAULT_LAST_CHECK) {
String lastCheckString = formatDateTime(getActivity(), lastCheck);
lastUpdateTextView.setText(getString(R.string.last_update, lastCheckString));
} else {
lastUpdateTextView.setVisibility(View.GONE);
Expand Down

0 comments on commit bce3a3c

Please sign in to comment.