forked from upstream-mirrors/OpenTracks
Merge heads
This commit is contained in:
@@ -35,6 +35,7 @@ public class EulaDialogFragment extends DialogFragment {
|
||||
|
||||
public static final String EULA_DIALOG_TAG = "eulaDialog";
|
||||
private static final String KEY_HAS_ACCEPTED = "hasAccepted";
|
||||
private static final String GOOGLE_URL = "m.google.com";
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link EulaDialogFragment}.
|
||||
@@ -61,7 +62,7 @@ public class EulaDialogFragment extends DialogFragment {
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
||||
.setMessage(EulaUtils.getEulaMessage(getActivity()))
|
||||
.setMessage(getEulaText())
|
||||
.setTitle(R.string.eula_title);
|
||||
|
||||
if (hasAccepted) {
|
||||
@@ -84,11 +85,25 @@ public class EulaDialogFragment extends DialogFragment {
|
||||
}
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exits the application.
|
||||
*/
|
||||
private void exitApp() {
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the EULA text.
|
||||
*
|
||||
*/
|
||||
private String getEulaText() {
|
||||
return getString(R.string.eula_date)
|
||||
+ "\n\n"
|
||||
+ getString(R.string.eula_body, GOOGLE_URL)
|
||||
+ "\n\n"
|
||||
+ getString(R.string.eula_footer, GOOGLE_URL)
|
||||
+ "\n\n"
|
||||
+ getString(R.string.eula_copyright_year);
|
||||
}
|
||||
}
|
||||
@@ -173,6 +173,10 @@ public class SaveAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
||||
return false;
|
||||
}
|
||||
int count = cursor.getCount();
|
||||
if (count == 0) {
|
||||
messageId = R.string.sd_card_save_error_no_track;
|
||||
return false;
|
||||
}
|
||||
int idIndex = cursor.getColumnIndexOrThrow(TracksColumns._ID);
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (isCancelled()) {
|
||||
|
||||
@@ -15,17 +15,13 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.util;
|
||||
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Utilities for EULA.
|
||||
*
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class EulaUtils {
|
||||
@@ -35,9 +31,6 @@ public class EulaUtils {
|
||||
// Accepting Google mobile terms of service
|
||||
private static final String EULA_PREFERENCE_KEY = "eula.google_mobile_tos_accepted";
|
||||
|
||||
// Google's mobile page
|
||||
private static final String HOST_NAME = "m.google.com";
|
||||
|
||||
private EulaUtils() {}
|
||||
|
||||
public static boolean getEulaValue(Context context) {
|
||||
@@ -53,14 +46,4 @@ public class EulaUtils {
|
||||
editor.putBoolean(EULA_PREFERENCE_KEY, true);
|
||||
ApiAdapterFactory.getApiAdapter().applyPreferenceChanges(editor);
|
||||
}
|
||||
|
||||
public static String getEulaMessage(Context context) {
|
||||
return context.getString(R.string.eula_date)
|
||||
+ "\n\n"
|
||||
+ context.getString(R.string.eula_body, HOST_NAME)
|
||||
+ "\n\n"
|
||||
+ context.getString(R.string.eula_footer, HOST_NAME)
|
||||
+ "\n\n"
|
||||
+ "©" + Calendar.getInstance().get(Calendar.YEAR);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user