diff --git a/MyTracks/src/com/google/android/apps/mytracks/TrackEditActivity.java b/MyTracks/src/com/google/android/apps/mytracks/TrackEditActivity.java index 3696b6590..9b8989b10 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/TrackEditActivity.java +++ b/MyTracks/src/com/google/android/apps/mytracks/TrackEditActivity.java @@ -179,7 +179,7 @@ public class TrackEditActivity extends AbstractMyTracksActivity implements Choos activityType.getText().toString(), description.getText().toString(), myTracksProviderUtils, trackRecordingServiceConnection, newWeight); - if (EulaUtils.hasShowEnableSync(TrackEditActivity.this)) { + if (EulaUtils.showEnableSync(TrackEditActivity.this)) { EulaUtils.setShowEnableSync(TrackEditActivity.this); if (PreferencesUtils.getBoolean(TrackEditActivity.this, R.string.drive_sync_key, PreferencesUtils.DRIVE_SYNC_DEFAULT)) { diff --git a/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java b/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java index 32a2e84de..c2f261b25 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java +++ b/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java @@ -651,7 +651,7 @@ public class TrackListActivity extends AbstractSendToGoogleActivity * Shows start up dialogs. */ public void showStartupDialogs() { - if (!EulaUtils.hasAcceptEula(this)) { + if (!EulaUtils.hasAcceptedEula(this)) { Fragment fragment = getSupportFragmentManager() .findFragmentByTag(EulaDialogFragment.EULA_DIALOG_TAG); if (fragment == null) { @@ -672,7 +672,7 @@ public class TrackListActivity extends AbstractSendToGoogleActivity @Override public void onEulaDone() { - if (EulaUtils.hasAcceptEula(this)) { + if (EulaUtils.hasAcceptedEula(this)) { showStartupDialogs(); return; } diff --git a/MyTracks/src/com/google/android/apps/mytracks/fragments/EulaDialogFragment.java b/MyTracks/src/com/google/android/apps/mytracks/fragments/EulaDialogFragment.java index 86ea581a2..1ee5053c3 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/fragments/EulaDialogFragment.java +++ b/MyTracks/src/com/google/android/apps/mytracks/fragments/EulaDialogFragment.java @@ -111,7 +111,7 @@ public class EulaDialogFragment extends AbstractMyTracksDialogFragment { }).setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - EulaUtils.setAcceptEula(getActivity()); + EulaUtils.setAcceptedEula(getActivity()); caller.onEulaDone(); } }); diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java index 8e9afe17f..ec03559d0 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java +++ b/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java @@ -30,46 +30,47 @@ public class EulaUtils { private static final String EULA_PREFERENCE_FILE = "eula"; // Accepting Google mobile terms of service - private static final String ACCEPT_EULA_PREFERENCE_KEY = "eula.google_mobile_tos_accepted"; + private static final String ACCEPTED_EULA_PREFERENCE_KEY = "eula.google_mobile_tos_accepted"; private static final String SHOW_ENABLE_SYNC_PREFERENCE_KEY = "showEnableSync"; - + private EulaUtils() {} /** - * Returns true if eula is accepted. + * Returns true if has accepted eula. + * * @param context the context */ - public static boolean hasAcceptEula(Context context) { - return getValue(context, ACCEPT_EULA_PREFERENCE_KEY, false); + public static boolean hasAcceptedEula(Context context) { + return getValue(context, ACCEPTED_EULA_PREFERENCE_KEY, false); } /** - * Sets to true that eula is accepted. + * Sets to true accepted eula. * * @param context the context */ - public static void setAcceptEula(Context context) { - setValue(context, ACCEPT_EULA_PREFERENCE_KEY, true); + public static void setAcceptedEula(Context context) { + setValue(context, ACCEPTED_EULA_PREFERENCE_KEY, true); } - + /** - * Returns true if show enable sync is needed. + * Returns true if should show enable sync. * - * @param context the context + * @param context the context */ - public static boolean hasShowEnableSync(Context context) { + public static boolean showEnableSync(Context context) { return getValue(context, SHOW_ENABLE_SYNC_PREFERENCE_KEY, true); } - + /** - * Sets to false that show enable sync is needed. + * Sets to false show enable sync. * * @param context the context */ public static void setShowEnableSync(Context context) { setValue(context, SHOW_ENABLE_SYNC_PREFERENCE_KEY, false); - } - + } + private static boolean getValue(Context context, String key, boolean defaultValue) { SharedPreferences sharedPreferences = context.getSharedPreferences( EULA_PREFERENCE_FILE, Context.MODE_PRIVATE);