mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
Remove confirm play in earth dialog
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/ScrollView" >
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="2dp" >
|
||||
<TextView
|
||||
android:autoLink="web"
|
||||
android:id="@+id/confirm_dialog_message"
|
||||
style="@style/TextMedium" />
|
||||
<CheckBox
|
||||
android:id="@+id/confirm_dialog_check_box"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/generic_do_not_show_again"
|
||||
style="@style/TextMedium" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -62,7 +62,6 @@ limitations under the License.
|
||||
<string name="ant_speed_distance_monitor_id_key">antSpeedDistanceMonitorId</string>
|
||||
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
|
||||
<string name="bluetooth_sensor_key">bluetoothSensor</string>
|
||||
<string name="confirm_play_earth_key">confirmPlayEarth</string>
|
||||
<string name="drive_deleted_list_key">driveDeletedList</string>
|
||||
<string name="drive_largest_change_id_key">driveLargestChangeId</string>
|
||||
<string name="drive_sync_key">driveSync</string>
|
||||
|
||||
@@ -788,11 +788,6 @@ limitations under the License.
|
||||
%1$s description. E.g., 'At the top'.">
|
||||
Description: %1$s
|
||||
</string>
|
||||
<string name="generic_do_not_show_again"
|
||||
translation_description="When showing a confirmation message, the message in the footer checkbox
|
||||
to not show the message again.">
|
||||
Do not show this again.
|
||||
</string>
|
||||
<string name="generic_error_title"
|
||||
translation_description="The title on an alert dialog indicating error.">
|
||||
Error
|
||||
@@ -2289,15 +2284,6 @@ limitations under the License.
|
||||
translation_description="In the track detail page, the title of the tab showing the map.">
|
||||
Map
|
||||
</string>
|
||||
<string name="track_detail_play_confirm_message"
|
||||
translation_description="The confirmation message when playing a track in Google Earth.">
|
||||
This will save your track to external storage.
|
||||
</string>
|
||||
<string name="track_detail_play_confirm_title"
|
||||
translation_description="When playing a track in Google Earth, the title of the confirmation
|
||||
dialog.">
|
||||
Play in Google Earth?
|
||||
</string>
|
||||
<string name="track_detail_stats_tab"
|
||||
translation_description="In the track detail page, the title of the tab showing the stats.">
|
||||
Stats
|
||||
|
||||
@@ -22,8 +22,6 @@ import com.google.android.apps.mytracks.fragments.ChooseAccountDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.ChooseAccountDialogFragment.ChooseAccountCaller;
|
||||
import com.google.android.apps.mytracks.fragments.ConfirmDeleteDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.ConfirmDeleteDialogFragment.ConfirmDeleteCaller;
|
||||
import com.google.android.apps.mytracks.fragments.ConfirmPlayDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.ConfirmPlayDialogFragment.ConfirmPlayCaller;
|
||||
import com.google.android.apps.mytracks.fragments.ConfirmSyncDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.ConfirmSyncDialogFragment.ConfirmSyncCaller;
|
||||
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
||||
@@ -71,7 +69,7 @@ import java.io.IOException;
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActivity implements
|
||||
ChooseAccountCaller, ConfirmSyncCaller, CheckPermissionCaller, ShareTrackCaller, ConfirmPlayCaller,
|
||||
ChooseAccountCaller, ConfirmSyncCaller, CheckPermissionCaller, ShareTrackCaller,
|
||||
ConfirmDeleteCaller {
|
||||
|
||||
private static final String TAG = AbstractMyTracksActivity.class.getSimpleName();
|
||||
@@ -362,35 +360,24 @@ public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActiv
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm playing tracks in Google Earth.
|
||||
* Play track in Google Earth.
|
||||
*
|
||||
* @param trackIds the track ids
|
||||
*/
|
||||
protected void confirmPlay(long[] trackIds) {
|
||||
protected void playTrack(long[] trackIds) {
|
||||
AnalyticsUtils.sendPageViews(this, AnalyticsUtils.ACTION_PLAY);
|
||||
if (GoogleEarthUtils.isEarthInstalled(this)) {
|
||||
if (PreferencesUtils.getBoolean(
|
||||
this, R.string.confirm_play_earth_key, PreferencesUtils.CONFIRM_PLAY_EARTH_DEFAULT)) {
|
||||
ConfirmPlayDialogFragment.newInstance(trackIds)
|
||||
.show(getSupportFragmentManager(), ConfirmPlayDialogFragment.CONFIRM_PLAY_DIALOG_TAG);
|
||||
} else {
|
||||
onConfirmPlayDone(trackIds);
|
||||
}
|
||||
Intent intent = IntentUtils.newIntent(this, SaveActivity.class)
|
||||
.putExtra(SaveActivity.EXTRA_TRACK_IDS, trackIds)
|
||||
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML)
|
||||
.putExtra(SaveActivity.EXTRA_PLAY_TRACK, true);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
new InstallEarthDialogFragment().show(
|
||||
getSupportFragmentManager(), InstallEarthDialogFragment.INSTALL_EARTH_DIALOG_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmPlayDone(long[] trackIds) {
|
||||
Intent intent = IntentUtils.newIntent(this, SaveActivity.class)
|
||||
.putExtra(SaveActivity.EXTRA_TRACK_IDS, trackIds)
|
||||
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML)
|
||||
.putExtra(SaveActivity.EXTRA_PLAY_TRACK, true);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
protected void deleteTrack(long[] trackIds) {
|
||||
ConfirmDeleteDialogFragment.newInstance(trackIds)
|
||||
.show(getSupportFragmentManager(), ConfirmDeleteDialogFragment.CONFIRM_DELETE_DIALOG_TAG);
|
||||
|
||||
@@ -346,7 +346,7 @@ public class SearchListActivity extends AbstractSendToGoogleActivity implements
|
||||
Intent intent;
|
||||
switch (itemId) {
|
||||
case R.id.list_context_menu_play:
|
||||
confirmPlay(new long[] {trackId});
|
||||
playTrack(new long[] {trackId});
|
||||
return true;
|
||||
case R.id.list_context_menu_share:
|
||||
shareTrack(trackId);
|
||||
|
||||
@@ -420,7 +420,7 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity implements
|
||||
}
|
||||
return true;
|
||||
case R.id.track_detail_play:
|
||||
confirmPlay(new long[] {trackId});
|
||||
playTrack(new long[] {trackId});
|
||||
return true;
|
||||
case R.id.track_detail_share:
|
||||
shareTrack(trackId);
|
||||
|
||||
@@ -777,7 +777,7 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
|
||||
private boolean handleContextItem(int itemId, long[] trackIds) {
|
||||
switch (itemId) {
|
||||
case R.id.list_context_menu_play:
|
||||
confirmPlay(trackIds);
|
||||
playTrack(trackIds);
|
||||
return true;
|
||||
case R.id.list_context_menu_share:
|
||||
shareTrack(trackIds[0]);
|
||||
|
||||
-106
@@ -1,106 +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.apps.mytracks.util.DialogUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* A DialogFragment to confirm playing a track.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ConfirmPlayDialogFragment extends DialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public interface ConfirmPlayCaller {
|
||||
|
||||
/**
|
||||
* Called when confirm play is done.
|
||||
*/
|
||||
public void onConfirmPlayDone(long[] trackIds);
|
||||
}
|
||||
|
||||
public static final String CONFIRM_PLAY_DIALOG_TAG = "confirmPlayDialog";
|
||||
|
||||
private static final String KEY_TRACK_IDS = "trackIds";
|
||||
|
||||
private CheckBox checkBox;
|
||||
|
||||
public static ConfirmPlayDialogFragment newInstance(long[] trackIds) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLongArray(KEY_TRACK_IDS, trackIds);
|
||||
|
||||
ConfirmPlayDialogFragment confirmDialogFragment = new ConfirmPlayDialogFragment();
|
||||
confirmDialogFragment.setArguments(bundle);
|
||||
return confirmDialogFragment;
|
||||
}
|
||||
|
||||
private ConfirmPlayCaller caller;
|
||||
private FragmentActivity fragmentActivity;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
try {
|
||||
caller = (ConfirmPlayCaller) activity;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(
|
||||
activity.toString() + " must implement " + ConfirmPlayCaller.class.getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
fragmentActivity = getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.confirm_dialog, null);
|
||||
TextView textView = (TextView) view.findViewById(R.id.confirm_dialog_message);
|
||||
textView.setText(R.string.track_detail_play_confirm_message);
|
||||
checkBox = (CheckBox) view.findViewById(R.id.confirm_dialog_check_box);
|
||||
|
||||
return DialogUtils.createConfirmationDialog(fragmentActivity,
|
||||
R.string.track_detail_play_confirm_title, view, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS);
|
||||
PreferencesUtils.setBoolean(
|
||||
fragmentActivity, R.string.confirm_play_earth_key, !checkBox.isChecked());
|
||||
caller.onConfirmPlayDone(trackIds);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,6 @@ public class PreferenceBackupHelper {
|
||||
doNotBackup.add(context.getString(R.string.ant_speed_distance_monitor_id_key));
|
||||
doNotBackup.add(context.getString(R.string.auto_resume_track_current_retry_key));
|
||||
doNotBackup.add(context.getString(R.string.bluetooth_sensor_key));
|
||||
doNotBackup.add(context.getString(R.string.confirm_play_earth_key));
|
||||
doNotBackup.add(context.getString(R.string.drive_deleted_list_key));
|
||||
doNotBackup.add(context.getString(R.string.drive_largest_change_id_key));
|
||||
doNotBackup.add(context.getString(R.string.drive_sync_key));
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Utilities for creating dialogs.
|
||||
@@ -44,22 +43,16 @@ public class DialogUtils {
|
||||
*/
|
||||
public static Dialog createConfirmationDialog(
|
||||
Context context, int titleId, String message, DialogInterface.OnClickListener okListener) {
|
||||
return createConfirmationDialog(context, titleId, message, null, okListener);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
||||
.setCancelable(true)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setMessage(message)
|
||||
.setNegativeButton(R.string.generic_no, null)
|
||||
.setPositiveButton(R.string.generic_yes, okListener)
|
||||
.setTitle(titleId);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a confirmation dialog.
|
||||
*
|
||||
* @param context the context
|
||||
* @param titleId the title
|
||||
* @param view the view
|
||||
* @param okListener the listener when OK is clicked
|
||||
*/
|
||||
public static Dialog createConfirmationDialog(
|
||||
Context context, int titleId, View view, DialogInterface.OnClickListener okListener) {
|
||||
return createConfirmationDialog(context, titleId, null, view, okListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a spinner progress dialog.
|
||||
*
|
||||
@@ -85,21 +78,6 @@ public class DialogUtils {
|
||||
return createProgressDialog(false, context, messageId, onCancelListener, formatArgs);
|
||||
}
|
||||
|
||||
private static Dialog createConfirmationDialog(Context context, int titleId, String message,
|
||||
View view, DialogInterface.OnClickListener okListener) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).setCancelable(true)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert).setNegativeButton(R.string.generic_no, null)
|
||||
.setPositiveButton(R.string.generic_yes, okListener).setTitle(titleId);
|
||||
if (message != null) {
|
||||
builder.setMessage(message);
|
||||
}
|
||||
if (view != null) {
|
||||
builder.setView(view);
|
||||
}
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a progress dialog.
|
||||
*
|
||||
|
||||
@@ -57,8 +57,6 @@ public class PreferencesUtils {
|
||||
public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
|
||||
public static final String CHART_X_AXIS_DEFAULT = "DISTANCE";
|
||||
|
||||
public static final boolean CONFIRM_PLAY_EARTH_DEFAULT = true;
|
||||
|
||||
public static final String DEFAULT_ACTIVITY_DEFAULT = "";
|
||||
|
||||
public static final String DRIVE_DELETED_LIST_DEFAULT = "";
|
||||
|
||||
Reference in New Issue
Block a user