forked from upstream-mirrors/OpenTracks
merge heads
This commit is contained in:
@@ -708,6 +708,10 @@ limitations under the License.
|
|||||||
%1$s name. E.g., 'Track 1'.">
|
%1$s name. E.g., 'Track 1'.">
|
||||||
Name: %1$s
|
Name: %1$s
|
||||||
</string>
|
</string>
|
||||||
|
<string name="generic_no"
|
||||||
|
translation_description="The text on a button to say no.">
|
||||||
|
No
|
||||||
|
</string>
|
||||||
<string name="generic_ok"
|
<string name="generic_ok"
|
||||||
translation_description="The text on a button to say ok.">
|
translation_description="The text on a button to say ok.">
|
||||||
OK
|
OK
|
||||||
@@ -732,7 +736,11 @@ limitations under the License.
|
|||||||
translation_description="The title on an alert dialog indicating success.">
|
translation_description="The title on an alert dialog indicating success.">
|
||||||
Success
|
Success
|
||||||
</string>
|
</string>
|
||||||
|
<string name="generic_yes"
|
||||||
|
translation_description="The text on a button to say yes.">
|
||||||
|
Yes
|
||||||
|
</string>
|
||||||
|
|
||||||
<!-- Gps -->
|
<!-- Gps -->
|
||||||
<string name="gps_google_location_settings"
|
<string name="gps_google_location_settings"
|
||||||
translation_description="In Android, the Google location settings to modify location settings
|
translation_description="In Android, the Google location settings to modify location settings
|
||||||
@@ -3081,16 +3089,4 @@ limitations under the License.
|
|||||||
completion suggestion for a waypoint.">
|
completion suggestion for a waypoint.">
|
||||||
waypoint
|
waypoint
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Welcome -->
|
|
||||||
<string name="welcome_message"
|
|
||||||
translation_description="The message of the welcome dialog. Note that \n is the newline
|
|
||||||
character.">
|
|
||||||
Welcome to My Tracks. Use this app to record your GPS tracks, aggregate your stats over time,
|
|
||||||
and share your paths with friends.\n\nHappy Exploring,\nThe My Tracks Team
|
|
||||||
</string>
|
|
||||||
<string name="welcome_title"
|
|
||||||
translation_description="The title of the welcome dialog.">
|
|
||||||
Welcome to My Tracks
|
|
||||||
</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import com.google.android.apps.mytracks.fragments.EnableSyncDialogFragment;
|
|||||||
import com.google.android.apps.mytracks.fragments.EnableSyncDialogFragment.EnableSyncCaller;
|
import com.google.android.apps.mytracks.fragments.EnableSyncDialogFragment.EnableSyncCaller;
|
||||||
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
|
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.EulaDialogFragment.EulaCaller;
|
import com.google.android.apps.mytracks.fragments.EulaDialogFragment.EulaCaller;
|
||||||
import com.google.android.apps.mytracks.fragments.WelcomeDialogFragment;
|
|
||||||
import com.google.android.apps.mytracks.fragments.WelcomeDialogFragment.WelcomeCaller;
|
|
||||||
import com.google.android.apps.mytracks.io.file.ImportActivity;
|
import com.google.android.apps.mytracks.io.file.ImportActivity;
|
||||||
import com.google.android.apps.mytracks.io.file.SaveActivity;
|
import com.google.android.apps.mytracks.io.file.SaveActivity;
|
||||||
import com.google.android.apps.mytracks.io.file.TrackFileFormat;
|
import com.google.android.apps.mytracks.io.file.TrackFileFormat;
|
||||||
@@ -98,7 +96,7 @@ import java.util.Locale;
|
|||||||
* @author Leif Hendrik Wilden
|
* @author Leif Hendrik Wilden
|
||||||
*/
|
*/
|
||||||
public class TrackListActivity extends AbstractSendToGoogleActivity
|
public class TrackListActivity extends AbstractSendToGoogleActivity
|
||||||
implements EulaCaller, WelcomeCaller, EnableSyncCaller, ConfirmCaller, DeleteOneTrackCaller {
|
implements EulaCaller, EnableSyncCaller, ConfirmCaller, DeleteOneTrackCaller {
|
||||||
|
|
||||||
private static final String TAG = TrackListActivity.class.getSimpleName();
|
private static final String TAG = TrackListActivity.class.getSimpleName();
|
||||||
private static final String START_GPS_KEY = "start_gps_key";
|
private static final String START_GPS_KEY = "start_gps_key";
|
||||||
@@ -692,13 +690,6 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
|
|||||||
EulaDialogFragment.newInstance(false)
|
EulaDialogFragment.newInstance(false)
|
||||||
.show(getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG);
|
.show(getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG);
|
||||||
}
|
}
|
||||||
} else if (EulaUtils.getShowWelcome(this)) {
|
|
||||||
Fragment fragment = getSupportFragmentManager()
|
|
||||||
.findFragmentByTag(WelcomeDialogFragment.WELCOME_DIALOG_TAG);
|
|
||||||
if (fragment == null) {
|
|
||||||
new WelcomeDialogFragment().show(
|
|
||||||
getSupportFragmentManager(), WelcomeDialogFragment.WELCOME_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
|
||||||
@@ -719,12 +710,6 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWelcomeDone() {
|
|
||||||
EulaUtils.setShowWelcome(this);
|
|
||||||
showStartupDialogs();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkGooglePlayServices() {
|
private void checkGooglePlayServices() {
|
||||||
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
|
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
|
||||||
if (code != ConnectionResult.SUCCESS) {
|
if (code != ConnectionResult.SUCCESS) {
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ public class ConfirmDialogFragment extends DialogFragment {
|
|||||||
checkBox = (CheckBox) view.findViewById(R.id.confirm_dialog_check_box);
|
checkBox = (CheckBox) view.findViewById(R.id.confirm_dialog_check_box);
|
||||||
|
|
||||||
return new AlertDialog.Builder(fragmentActivity).setNegativeButton(
|
return new AlertDialog.Builder(fragmentActivity).setNegativeButton(
|
||||||
android.R.string.cancel, null)
|
R.string.generic_no, null)
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.generic_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
int confirmId = getArguments().getInt(KEY_CONFIRM_ID);
|
int confirmId = getArguments().getInt(KEY_CONFIRM_ID);
|
||||||
|
|||||||
+2
-2
@@ -79,12 +79,12 @@ public class EnableSyncDialogFragment extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
return new AlertDialog.Builder(fragmentActivity).setMessage(R.string.enable_sync_message)
|
return new AlertDialog.Builder(fragmentActivity).setMessage(R.string.enable_sync_message)
|
||||||
.setNegativeButton(R.string.generic_cancel, new OnClickListener() {
|
.setNegativeButton(R.string.generic_no, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
caller.onEnableSyncDone(false);
|
caller.onEnableSyncDone(false);
|
||||||
}
|
}
|
||||||
}).setPositiveButton(R.string.generic_ok, new OnClickListener() {
|
}).setPositiveButton(R.string.generic_yes, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
caller.onEnableSyncDone(true);
|
caller.onEnableSyncDone(true);
|
||||||
|
|||||||
+3
-2
@@ -46,8 +46,8 @@ public class InstallEarthDialogFragment extends DialogFragment {
|
|||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
return new AlertDialog.Builder(fragmentActivity)
|
return new AlertDialog.Builder(fragmentActivity)
|
||||||
.setMessage(R.string.track_detail_install_earth_message)
|
.setMessage(R.string.track_detail_install_earth_message)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(R.string.generic_no, null)
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.generic_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL));
|
Intent intent = new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL));
|
||||||
@@ -60,6 +60,7 @@ public class InstallEarthDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.setTitle(R.string.generic_confirm_title)
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012 Google Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations under
|
|
||||||
* the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
|
||||||
|
|
||||||
import com.google.android.maps.mytracks.R;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A DialogFrament to show the welcome info.
|
|
||||||
*
|
|
||||||
* @author Jimmy Shih
|
|
||||||
*/
|
|
||||||
public class WelcomeDialogFragment extends DialogFragment {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for caller of this dialog fragment.
|
|
||||||
*
|
|
||||||
* @author Jimmy Shih
|
|
||||||
*/
|
|
||||||
public interface WelcomeCaller {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when choose account is done.
|
|
||||||
*/
|
|
||||||
public void onWelcomeDone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String WELCOME_DIALOG_TAG = "welcomeDialog";
|
|
||||||
|
|
||||||
private WelcomeCaller caller;
|
|
||||||
private FragmentActivity fragmentActivity;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(Activity activity) {
|
|
||||||
super.onAttach(activity);
|
|
||||||
try {
|
|
||||||
caller = (WelcomeCaller) activity;
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
throw new ClassCastException(
|
|
||||||
activity.toString() + " must implement " + WelcomeCaller.class.getSimpleName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
fragmentActivity = getActivity();
|
|
||||||
return new AlertDialog.Builder(fragmentActivity).setPositiveButton(
|
|
||||||
R.string.generic_ok, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
caller.onWelcomeDone();
|
|
||||||
}
|
|
||||||
}).setTitle(R.string.welcome_title).setMessage(R.string.welcome_message).create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface arg0) {
|
|
||||||
caller.onWelcomeDone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -235,7 +235,7 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
|
|||||||
final String newValue = bundle.getString(ACCOUNT_NAME_KEY);
|
final String newValue = bundle.getString(ACCOUNT_NAME_KEY);
|
||||||
alertDialog.setMessage(
|
alertDialog.setMessage(
|
||||||
getString(R.string.settings_google_account_confirm_message, googleAccount));
|
getString(R.string.settings_google_account_confirm_message, googleAccount));
|
||||||
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(android.R.string.ok),
|
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.generic_yes),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface d, int button) {
|
public void onClick(DialogInterface d, int button) {
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ public class DialogUtils {
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
.setNegativeButton(android.R.string.cancel, cancelListener)
|
.setNegativeButton(R.string.generic_no, cancelListener)
|
||||||
.setPositiveButton(android.R.string.ok, okListener)
|
.setPositiveButton(R.string.generic_yes, okListener)
|
||||||
.setTitle(R.string.generic_confirm_title);
|
.setTitle(R.string.generic_confirm_title);
|
||||||
if (messageId != -1) {
|
if (messageId != -1) {
|
||||||
builder.setMessage(messageId);
|
builder.setMessage(messageId);
|
||||||
|
|||||||
@@ -30,7 +30,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_ENABLE_SYNC_PREFERENCE_KEY = "showEnableSync";
|
private static final String SHOW_ENABLE_SYNC_PREFERENCE_KEY = "showEnableSync";
|
||||||
|
|
||||||
private EulaUtils() {}
|
private EulaUtils() {}
|
||||||
@@ -43,14 +42,6 @@ public class EulaUtils {
|
|||||||
setValue(context, ACCEPT_EULA_PREFERENCE_KEY, true);
|
setValue(context, ACCEPT_EULA_PREFERENCE_KEY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getShowWelcome(Context context) {
|
|
||||||
return getValue(context, SHOW_WELCOME_PREFERENCE_KEY, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setShowWelcome(Context context) {
|
|
||||||
setValue(context, SHOW_WELCOME_PREFERENCE_KEY, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean getShowEnableSync(Context context) {
|
public static boolean getShowEnableSync(Context context) {
|
||||||
return getValue(context, SHOW_ENABLE_SYNC_PREFERENCE_KEY, true);
|
return getValue(context, SHOW_ENABLE_SYNC_PREFERENCE_KEY, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user