Merge heads

This commit is contained in:
youtaol
2012-05-18 10:32:51 +08:00
parent 2be5a6732a
commit fb4f6bb91e
5 changed files with 28 additions and 20 deletions
+5
View File
@@ -581,6 +581,11 @@ limitations under the License.
translation_description="In the 'Terms of Service' dialog, the button to accept.">
Accept
</string>
<string name="eula_copyright_year"
translation_description="The copyright year in the 'Terms of Service'. See
http://m.google.com/toscountry. \u00A9 is the unicode value for the copyright symbol.">
\u00A92012
</string>
<string name="eula_decline"
translation_description="In the 'Terms of Service' dialog, the button to decline.">
Decline
+1
View File
@@ -25,6 +25,7 @@ limitations under the License.
android:title="@string/settings_recording_track_name" />
<com.google.android.apps.mytracks.AutoCompleteTextPreference
android:defaultValue=""
android:hint="@string/track_edit_activity_type_hint"
android:key="@string/default_activity_key"
android:summary="@string/settings_recording_default_activity_summary"
android:title="@string/settings_recording_default_activity" />
@@ -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);
}
}