forked from upstream-mirrors/quik
Replace getActivity() with context
After some research, I found out that DateFormat.is24HourFormat actually accepts Context.
This commit is contained in:
@@ -55,7 +55,7 @@ public abstract class DateFormatter {
|
|||||||
|
|
||||||
public static SimpleDateFormat accountFor24HourTime(Context context, SimpleDateFormat input) { //pass in 12 hour time. If needed, change to 24 hr.
|
public static SimpleDateFormat accountFor24HourTime(Context context, SimpleDateFormat input) { //pass in 12 hour time. If needed, change to 24 hr.
|
||||||
SharedPreferences prefs = MainActivity.getPrefs(context);
|
SharedPreferences prefs = MainActivity.getPrefs(context);
|
||||||
boolean isUsing24HourTime = prefs.getBoolean(SettingsFragment.TIMESTAMPS_24H, DateFormat.is24HourFormat(getActivity()));
|
boolean isUsing24HourTime = prefs.getBoolean(SettingsFragment.TIMESTAMPS_24H, DateFormat.is24HourFormat(context));
|
||||||
|
|
||||||
if (isUsing24HourTime) {
|
if (isUsing24HourTime) {
|
||||||
return new SimpleDateFormat(input.toPattern().replace('h', 'H').replaceAll(" a", ""));
|
return new SimpleDateFormat(input.toPattern().replace('h', 'H').replaceAll(" a", ""));
|
||||||
|
|||||||
Reference in New Issue
Block a user