Fix timestamp displayed on the live updates screen

This commit is contained in:
Victor Shcherb 2016-08-10 10:17:25 +02:00
parent 91e9cc6aca
commit bce3a3c1c6
2 changed files with 11 additions and 8 deletions

View file

@ -33,7 +33,6 @@ import android.widget.ImageButton;
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;
@ -534,9 +533,14 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
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() {

View file

@ -75,15 +75,14 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
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);