forked from upstream-mirrors/OpenTracks
Set dialog title divider for dialogfragment
This commit is contained in:
@@ -23,8 +23,6 @@ import android.app.Activity;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -34,7 +32,7 @@ import android.widget.TextView;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class AboutDialogFragment extends DialogFragment {
|
public class AboutDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -66,7 +64,7 @@ public class AboutDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.about, null);
|
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.about, null);
|
||||||
TextView aboutVersion = (TextView) view.findViewById(R.id.about_version);
|
TextView aboutVersion = (TextView) view.findViewById(R.id.about_version);
|
||||||
|
|||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 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 android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract My Tracks DialogFragment.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
public abstract class AbstractMyTracksDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
final Dialog dialog = createDialog();
|
||||||
|
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
DialogUtils.setTitleDivier(getActivity(), dialog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Dialog createDialog();
|
||||||
|
}
|
||||||
+2
-3
@@ -28,7 +28,6 @@ import android.app.Dialog;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +35,7 @@ import android.support.v4.app.FragmentActivity;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ChooseAccountDialogFragment extends DialogFragment {
|
public class ChooseAccountDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -93,7 +92,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
if (accounts.length == 0) {
|
if (accounts.length == 0) {
|
||||||
return new AlertDialog.Builder(fragmentActivity).setMessage(
|
return new AlertDialog.Builder(fragmentActivity).setMessage(
|
||||||
R.string.send_google_no_account_message).setTitle(R.string.send_google_no_account_title)
|
R.string.send_google_no_account_message).setTitle(R.string.send_google_no_account_title)
|
||||||
|
|||||||
+2
-4
@@ -28,8 +28,6 @@ import android.content.pm.ActivityInfo;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.ShareCompat;
|
import android.support.v4.app.ShareCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -48,7 +46,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ChooseActivityDialogFragment extends DialogFragment {
|
public class ChooseActivityDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -81,7 +79,7 @@ public class ChooseActivityDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
packageManager = fragmentActivity.getPackageManager();
|
packageManager = fragmentActivity.getPackageManager();
|
||||||
List<DisplayInfo> displayInfos = getDisplayInfos();
|
List<DisplayInfo> displayInfos = getDisplayInfos();
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package com.google.android.apps.mytracks.fragments;
|
package com.google.android.apps.mytracks.fragments;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.apps.mytracks.util.TrackIconUtils;
|
import com.google.android.apps.mytracks.util.TrackIconUtils;
|
||||||
@@ -172,6 +173,7 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
updateWeightContainer(weightContainer, position);
|
updateWeightContainer(weightContainer, position);
|
||||||
weight.setText(weightValue);
|
weight.setText(weightValue);
|
||||||
|
DialogUtils.setTitleDivier(activity, alertDialog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -23,14 +23,13 @@ import android.app.Activity;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFragment to confirm delete.
|
* A DialogFragment to confirm delete.
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ConfirmDeleteDialogFragment extends DialogFragment {
|
public class ConfirmDeleteDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -80,7 +79,7 @@ public class ConfirmDeleteDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
final long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS);
|
final long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS);
|
||||||
int titleId;
|
int titleId;
|
||||||
int messageId;
|
int messageId;
|
||||||
|
|||||||
+2
-3
@@ -25,7 +25,6 @@ import android.app.Dialog;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ConfirmSyncDialogFragment extends DialogFragment {
|
public class ConfirmSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -77,7 +76,7 @@ public class ConfirmSyncDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
String googleAccount = PreferencesUtils.getString(
|
String googleAccount = PreferencesUtils.getString(
|
||||||
fragmentActivity, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
fragmentActivity, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
||||||
String message = getString(
|
String message = getString(
|
||||||
|
|||||||
+2
-3
@@ -25,7 +25,6 @@ import android.app.Activity;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class DeleteMarkerDialogFragment extends DialogFragment {
|
public class DeleteMarkerDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -74,7 +73,7 @@ public class DeleteMarkerDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
final FragmentActivity fragmentActivity = getActivity();
|
final FragmentActivity fragmentActivity = getActivity();
|
||||||
final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS);
|
final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS);
|
||||||
int titleId = markerIds.length > 1 ? R.string.generic_delete_selected_confirm_title
|
int titleId = markerIds.length > 1 ? R.string.generic_delete_selected_confirm_title
|
||||||
|
|||||||
+2
-3
@@ -25,7 +25,6 @@ import android.app.Dialog;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class EnableSyncDialogFragment extends DialogFragment {
|
public class EnableSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -77,7 +76,7 @@ public class EnableSyncDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
return new AlertDialog.Builder(fragmentActivity).setMessage(R.string.sync_drive_enable_message)
|
return new AlertDialog.Builder(fragmentActivity).setMessage(R.string.sync_drive_enable_message)
|
||||||
.setNegativeButton(R.string.generic_no, new OnClickListener() {
|
.setNegativeButton(R.string.generic_no, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.app.AlertDialog;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
@@ -37,7 +36,7 @@ import android.widget.TextView;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class EulaDialogFragment extends DialogFragment {
|
public class EulaDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -86,7 +85,7 @@ public class EulaDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
|
|
||||||
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
|
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import android.app.Activity;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
@@ -38,7 +36,7 @@ import android.widget.RadioGroup.OnCheckedChangeListener;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ExportDialogFragment extends DialogFragment {
|
public class ExportDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export types.
|
* Export types.
|
||||||
@@ -82,7 +80,7 @@ public class ExportDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
FragmentActivity fragmentActivity = getActivity();
|
FragmentActivity fragmentActivity = getActivity();
|
||||||
|
|
||||||
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.export, null);
|
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.export, null);
|
||||||
|
|||||||
@@ -26,14 +26,13 @@ import android.app.Dialog;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFragment to select a file type, gpx, kml, etc.
|
* A DialogFragment to select a file type, gpx, kml, etc.
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class FileTypeDialogFragment extends DialogFragment {
|
public class FileTypeDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -82,7 +81,7 @@ public class FileTypeDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
int size = getArguments().getInt(KEY_SIZE);
|
int size = getArguments().getInt(KEY_SIZE);
|
||||||
int optionId = getArguments().getInt(KEY_OPTION_ID);
|
int optionId = getArguments().getInt(KEY_OPTION_ID);
|
||||||
final int titleId = getArguments().getInt(KEY_TITLE_ID);
|
final int titleId = getArguments().getInt(KEY_TITLE_ID);
|
||||||
|
|||||||
+2
-3
@@ -24,7 +24,6 @@ import android.app.AlertDialog;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +31,7 @@ import android.support.v4.app.FragmentActivity;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class FrequencyDialogFragment extends DialogFragment {
|
public class FrequencyDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
public static final String FREQUENCY_DIALOG_TAG = "frequencyDialog";
|
public static final String FREQUENCY_DIALOG_TAG = "frequencyDialog";
|
||||||
|
|
||||||
@@ -55,7 +54,7 @@ public class FrequencyDialogFragment extends DialogFragment {
|
|||||||
private FragmentActivity fragmentActivity;
|
private FragmentActivity fragmentActivity;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
|
|
||||||
final int preferenceId = getArguments().getInt(KEY_PREFERENCE_ID);
|
final int preferenceId = getArguments().getInt(KEY_PREFERENCE_ID);
|
||||||
|
|||||||
+2
-4
@@ -25,8 +25,6 @@ import android.content.ActivityNotFoundException;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -35,14 +33,14 @@ import android.widget.Toast;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class InstallEarthDialogFragment extends DialogFragment {
|
public class InstallEarthDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
public static final String INSTALL_EARTH_DIALOG_TAG = "installEarthDialog";
|
public static final String INSTALL_EARTH_DIALOG_TAG = "installEarthDialog";
|
||||||
|
|
||||||
private FragmentActivity fragmentActivity;
|
private FragmentActivity fragmentActivity;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
return new AlertDialog.Builder(fragmentActivity).setMessage(
|
return new AlertDialog.Builder(fragmentActivity).setMessage(
|
||||||
R.string.track_detail_install_earth_message).setNegativeButton(R.string.generic_no, null)
|
R.string.track_detail_install_earth_message).setNegativeButton(R.string.generic_no, null)
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import android.app.Dialog;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -37,7 +36,7 @@ import java.util.ArrayList;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class MergeDialogFragment extends DialogFragment {
|
public class MergeDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
public static final String MERGE_DIALOG_TAG = "mergeDialog";
|
public static final String MERGE_DIALOG_TAG = "mergeDialog";
|
||||||
|
|
||||||
@@ -82,7 +81,7 @@ public class MergeDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
loadData();
|
loadData();
|
||||||
return new AlertDialog.Builder(getActivity()).setMultiChoiceItems(items, checkedItems, null)
|
return new AlertDialog.Builder(getActivity()).setMultiChoiceItems(items, checkedItems, null)
|
||||||
.setNegativeButton(R.string.generic_cancel, null)
|
.setNegativeButton(R.string.generic_cancel, null)
|
||||||
|
|||||||
+2
-3
@@ -27,7 +27,6 @@ import android.database.Cursor;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.widget.SimpleCursorAdapter;
|
import android.support.v4.widget.SimpleCursorAdapter;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -43,7 +42,7 @@ import android.widget.Toast;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ShareTrackDialogFragment extends DialogFragment {
|
public class ShareTrackDialogFragment extends AbstractMyTracksDialogFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for caller of this dialog fragment.
|
* Interface for caller of this dialog fragment.
|
||||||
@@ -92,7 +91,7 @@ public class ShareTrackDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
protected Dialog createDialog() {
|
||||||
fragmentActivity = getActivity();
|
fragmentActivity = getActivity();
|
||||||
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.share_track, null);
|
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.share_track, null);
|
||||||
|
|
||||||
|
|||||||
@@ -184,4 +184,9 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
tabWidget.getChildAt(i).setBackgroundResource(R.drawable.tab_indicator_mytracks);
|
tabWidget.getChildAt(i).setBackgroundResource(R.drawable.tab_indicator_mytracks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasDialogTitleDivider() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* API level 8 specific implementation of the {@link ApiAdapter}.
|
* API level 8 specific implementation of the {@link ApiAdapter}.
|
||||||
*
|
*
|
||||||
* @author Bartlomiej Niechwiej
|
* @author Bartlomiej Niechwiej
|
||||||
*/
|
*/
|
||||||
public class Api8Adapter implements ApiAdapter {
|
public class Api8Adapter implements ApiAdapter {
|
||||||
|
|
||||||
private static final String TAG = Api8Adapter.class.getSimpleName();
|
private static final String TAG = Api8Adapter.class.getSimpleName();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyPreferenceChanges(Editor editor) {
|
public void applyPreferenceChanges(Editor editor) {
|
||||||
editor.commit();
|
editor.commit();
|
||||||
@@ -101,7 +101,8 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
Log.d(TAG, "Unable to create insecure connection", e);
|
Log.d(TAG, "Unable to create insecure connection", e);
|
||||||
}
|
}
|
||||||
return bluetoothDevice.createRfcommSocketToServiceRecord(BluetoothConnectionManager.MY_TRACKS_UUID);
|
return bluetoothDevice.createRfcommSocketToServiceRecord(
|
||||||
|
BluetoothConnectionManager.MY_TRACKS_UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -143,23 +144,28 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
public void invalidMenu(Activity activity) {
|
public void invalidMenu(Activity activity) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showEditTextClearButton() {
|
public boolean showEditTextClearButton() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTabBackground(TabWidget tabWidget) {
|
public void setTabBackground(TabWidget tabWidget) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasDialogTitleDivider() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleSearchKey(MenuItem menuItem) {
|
public boolean handleSearchKey(MenuItem menuItem) {
|
||||||
// Return false and allow the framework to handle the search key.
|
// Return false and allow the framework to handle the search key.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGoogleFeedbackAvailable() {
|
public boolean isGoogleFeedbackAvailable() {
|
||||||
return false;
|
return false;
|
||||||
@@ -172,13 +178,13 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId, int size) {
|
public void setAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId, int size) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void removeGlobalLayoutListener(
|
public void removeGlobalLayoutListener(
|
||||||
ViewTreeObserver observer, OnGlobalLayoutListener listener) {
|
ViewTreeObserver observer, OnGlobalLayoutListener listener) {
|
||||||
observer.removeGlobalOnLayoutListener(listener);
|
observer.removeGlobalOnLayoutListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,14 @@ public interface ApiAdapter {
|
|||||||
* @param tabWidget the tab widget
|
* @param tabWidget the tab widget
|
||||||
*/
|
*/
|
||||||
public void setTabBackground(TabWidget tabWidget);
|
public void setTabBackground(TabWidget tabWidget);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if has dialog title divider.
|
||||||
|
* <p>
|
||||||
|
* Due to changes in API level 11.
|
||||||
|
*/
|
||||||
|
public boolean hasDialogTitleDivider();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the search key press. Returns true if handled.
|
* Handles the search key press. Returns true if handled.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ import android.app.Dialog;
|
|||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for creating dialogs.
|
* Utilities for creating dialogs.
|
||||||
@@ -101,4 +105,20 @@ public class DialogUtils {
|
|||||||
progressDialog.setTitle(R.string.generic_progress_title);
|
progressDialog.setTitle(R.string.generic_progress_title);
|
||||||
return progressDialog;
|
return progressDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setTitleDivier(Context context, Dialog dialog) {
|
||||||
|
if (ApiAdapterFactory.getApiAdapter().hasDialogTitleDivider()) {
|
||||||
|
try {
|
||||||
|
ViewGroup decorView = (ViewGroup) dialog.getWindow().getDecorView();
|
||||||
|
FrameLayout windowContentView = (FrameLayout) decorView.getChildAt(0);
|
||||||
|
FrameLayout contentView = (FrameLayout) windowContentView.getChildAt(0);
|
||||||
|
LinearLayout parentPanel = (LinearLayout) contentView.getChildAt(0);
|
||||||
|
LinearLayout topPanel = (LinearLayout) parentPanel.getChildAt(0);
|
||||||
|
View titleDivider = topPanel.getChildAt(2);
|
||||||
|
titleDivider.setBackgroundColor(context.getResources().getColor(R.color.holo_orange_dark));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Can safely ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user