forked from upstream-mirrors/OpenTracks
Do not show the check units dialog on startup.
Use imperial for US. Use metrics for others.
This commit is contained in:
@@ -22,7 +22,6 @@ import com.google.android.apps.mytracks.content.TrackDataListener;
|
|||||||
import com.google.android.apps.mytracks.content.TrackDataType;
|
import com.google.android.apps.mytracks.content.TrackDataType;
|
||||||
import com.google.android.apps.mytracks.content.TracksColumns;
|
import com.google.android.apps.mytracks.content.TracksColumns;
|
||||||
import com.google.android.apps.mytracks.content.Waypoint;
|
import com.google.android.apps.mytracks.content.Waypoint;
|
||||||
import com.google.android.apps.mytracks.fragments.CheckUnitsDialogFragment;
|
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteAllTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteAllTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment.DeleteOneTrackCaller;
|
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment.DeleteOneTrackCaller;
|
||||||
@@ -163,7 +162,8 @@ public class TrackListActivity extends FragmentActivity implements DeleteOneTrac
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
|
boolean isRecording = recordingTrackId
|
||||||
|
!= PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
|
||||||
updateMenuItems(isRecording);
|
updateMenuItems(isRecording);
|
||||||
resourceCursorAdapter.notifyDataSetChanged();
|
resourceCursorAdapter.notifyDataSetChanged();
|
||||||
trackController.update(isRecording, recordingTrackPaused);
|
trackController.update(isRecording, recordingTrackPaused);
|
||||||
@@ -595,13 +595,6 @@ public class TrackListActivity extends FragmentActivity implements DeleteOneTrac
|
|||||||
new WelcomeDialogFragment().show(
|
new WelcomeDialogFragment().show(
|
||||||
getSupportFragmentManager(), WelcomeDialogFragment.WELCOME_DIALOG_TAG);
|
getSupportFragmentManager(), WelcomeDialogFragment.WELCOME_DIALOG_TAG);
|
||||||
}
|
}
|
||||||
} else if (EulaUtils.getShowCheckUnits(this)) {
|
|
||||||
Fragment fragment = getSupportFragmentManager()
|
|
||||||
.findFragmentByTag(CheckUnitsDialogFragment.CHECK_UNITS_DIALOG_TAG);
|
|
||||||
if (fragment == null) {
|
|
||||||
new CheckUnitsDialogFragment().show(
|
|
||||||
getSupportFragmentManager(), CheckUnitsDialogFragment.CHECK_UNITS_DIALOG_TAG);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Before the welcome sequence, the empty view is not visible so that it
|
* Before the welcome sequence, the empty view is not visible so that it
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks.fragments;
|
|||||||
|
|
||||||
import com.google.android.apps.mytracks.TrackListActivity;
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
import com.google.android.apps.mytracks.util.EulaUtils;
|
import com.google.android.apps.mytracks.util.EulaUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@@ -27,6 +28,8 @@ import android.os.Bundle;
|
|||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFragment to show EULA.
|
* A DialogFragment to show EULA.
|
||||||
*
|
*
|
||||||
@@ -84,6 +87,9 @@ public class EulaDialogFragment extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
EulaUtils.setAcceptEula(activity);
|
EulaUtils.setAcceptEula(activity);
|
||||||
|
Locale locale = Locale.getDefault();
|
||||||
|
PreferencesUtils.setBoolean(
|
||||||
|
activity, R.string.metric_units_key, !Locale.US.equals(Locale.getDefault()));
|
||||||
TrackListActivity trackListActivity = (TrackListActivity) activity;
|
TrackListActivity trackListActivity = (TrackListActivity) activity;
|
||||||
trackListActivity.showStartupDialogs();
|
trackListActivity.showStartupDialogs();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public class EulaUtils {
|
|||||||
// Accepting Google mobile terms of service
|
// Accepting Google mobile terms of service
|
||||||
private static final String ACCEPT_EULA_PREFERENCE_KEY = "eula.google_mobile_tos_accepted";
|
private static final String ACCEPT_EULA_PREFERENCE_KEY = "eula.google_mobile_tos_accepted";
|
||||||
private static final String SHOW_WELCOME_PREFERENCE_KEY = "showWelcome";
|
private static final String SHOW_WELCOME_PREFERENCE_KEY = "showWelcome";
|
||||||
private static final String SHOW_CHECK_UNITS_PREFERENCE_KEY = "showCheckUnits";
|
|
||||||
|
|
||||||
private EulaUtils() {}
|
private EulaUtils() {}
|
||||||
|
|
||||||
@@ -51,14 +50,6 @@ public class EulaUtils {
|
|||||||
setValue(context, SHOW_WELCOME_PREFERENCE_KEY, false);
|
setValue(context, SHOW_WELCOME_PREFERENCE_KEY, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getShowCheckUnits(Context context) {
|
|
||||||
return getValue(context, SHOW_CHECK_UNITS_PREFERENCE_KEY, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setShowCheckUnits(Context context) {
|
|
||||||
setValue(context, SHOW_CHECK_UNITS_PREFERENCE_KEY, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean getValue(Context context, String key, boolean defaultValue) {
|
private static boolean getValue(Context context, String key, boolean defaultValue) {
|
||||||
SharedPreferences sharedPreferences = context.getSharedPreferences(
|
SharedPreferences sharedPreferences = context.getSharedPreferences(
|
||||||
EULA_PREFERENCE_FILE, Context.MODE_PRIVATE);
|
EULA_PREFERENCE_FILE, Context.MODE_PRIVATE);
|
||||||
|
|||||||
Reference in New Issue
Block a user