Enum values extracted as resources.
This commit is contained in:
parent
08f3a64a21
commit
56c3ff9ecd
3 changed files with 37 additions and 7 deletions
|
@ -2141,4 +2141,9 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="update_time">Update time</string>
|
||||
<string name="updates_size_pattern">"Updates: %s"</string>
|
||||
<string name="last_map_change">"Last map change: %s"</string>
|
||||
<string name="hourly">Hourly</string>
|
||||
<string name="daily">Daily</string>
|
||||
<string name="weekly">Weekly</string>
|
||||
<string name="morning">Morning</string>
|
||||
<string name="Night">Night</string>
|
||||
</resources>
|
|
@ -310,9 +310,9 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
final UpdateFrequency frequency = UpdateFrequency.values()[frequencyId];
|
||||
final TimeOfDay timeOfDay = TimeOfDay.values()[timeOfDateToUpdateId];
|
||||
subheaderTextView.setVisibility(View.VISIBLE);
|
||||
String subheaderText = frequency.toString();
|
||||
String subheaderText = fragment.getString(frequency.getLocalizedId());
|
||||
if (frequency != UpdateFrequency.HOURLY) {
|
||||
subheaderText += " • " + timeOfDay.toString();
|
||||
subheaderText += " • " + fragment.getString(timeOfDay.getLocalizedId());
|
||||
}
|
||||
subheaderTextView.setText(subheaderText);
|
||||
subheaderTextView.setTextColor(fragment.getActivity().getResources()
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.liveupdates;
|
|||
import android.content.Context;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
|
@ -65,13 +66,37 @@ public class LiveUpdatesHelper {
|
|||
}
|
||||
|
||||
public static enum TimeOfDay {
|
||||
MORNING,
|
||||
NIGHT
|
||||
MORNING(R.string.morning),
|
||||
NIGHT(R.string.Night);
|
||||
private final int localizedId;
|
||||
|
||||
TimeOfDay(int localizedId) {
|
||||
this.localizedId = localizedId;
|
||||
}
|
||||
|
||||
public int getLocalizedId() {
|
||||
return localizedId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public enum UpdateFrequency {
|
||||
HOURLY,
|
||||
DAILY,
|
||||
WEEKLY
|
||||
HOURLY(R.string.hourly),
|
||||
DAILY(R.string.daily),
|
||||
WEEKLY(R.string.weekly);
|
||||
private final int localizedId;
|
||||
|
||||
UpdateFrequency(int localizedId) {
|
||||
this.localizedId = localizedId;
|
||||
}
|
||||
|
||||
public int getLocalizedId() {
|
||||
return localizedId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue