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.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.TextView;
|
||||
@@ -34,7 +32,7 @@ import android.widget.TextView;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class AboutDialogFragment extends DialogFragment {
|
||||
public class AboutDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -66,7 +64,7 @@ public class AboutDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
fragmentActivity = getActivity();
|
||||
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.about, null);
|
||||
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.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
/**
|
||||
@@ -36,7 +35,7 @@ import android.support.v4.app.FragmentActivity;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ChooseAccountDialogFragment extends DialogFragment {
|
||||
public class ChooseAccountDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -93,7 +92,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
if (accounts.length == 0) {
|
||||
return new AlertDialog.Builder(fragmentActivity).setMessage(
|
||||
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.ResolveInfo;
|
||||
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.ShareCompat;
|
||||
import android.view.View;
|
||||
@@ -48,7 +46,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ChooseActivityDialogFragment extends DialogFragment {
|
||||
public class ChooseActivityDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -81,7 +79,7 @@ public class ChooseActivityDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
fragmentActivity = getActivity();
|
||||
packageManager = fragmentActivity.getPackageManager();
|
||||
List<DisplayInfo> displayInfos = getDisplayInfos();
|
||||
|
||||
+2
@@ -17,6 +17,7 @@
|
||||
package com.google.android.apps.mytracks.fragments;
|
||||
|
||||
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.StringUtils;
|
||||
import com.google.android.apps.mytracks.util.TrackIconUtils;
|
||||
@@ -172,6 +173,7 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
||||
}
|
||||
updateWeightContainer(weightContainer, position);
|
||||
weight.setText(weightValue);
|
||||
DialogUtils.setTitleDivier(activity, alertDialog);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+2
-3
@@ -23,14 +23,13 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
||||
/**
|
||||
* A DialogFragment to confirm delete.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ConfirmDeleteDialogFragment extends DialogFragment {
|
||||
public class ConfirmDeleteDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -80,7 +79,7 @@ public class ConfirmDeleteDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
final long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS);
|
||||
int titleId;
|
||||
int messageId;
|
||||
|
||||
+2
-3
@@ -25,7 +25,6 @@ import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ConfirmSyncDialogFragment extends DialogFragment {
|
||||
public class ConfirmSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -77,7 +76,7 @@ public class ConfirmSyncDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
String googleAccount = PreferencesUtils.getString(
|
||||
fragmentActivity, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
||||
String message = getString(
|
||||
|
||||
+2
-3
@@ -25,7 +25,6 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class DeleteMarkerDialogFragment extends DialogFragment {
|
||||
public class DeleteMarkerDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -74,7 +73,7 @@ public class DeleteMarkerDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
final FragmentActivity fragmentActivity = getActivity();
|
||||
final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS);
|
||||
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.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class EnableSyncDialogFragment extends DialogFragment {
|
||||
public class EnableSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -77,7 +76,7 @@ public class EnableSyncDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
return new AlertDialog.Builder(fragmentActivity).setMessage(R.string.sync_drive_enable_message)
|
||||
.setNegativeButton(R.string.generic_no, new OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,6 @@ 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;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
@@ -37,7 +36,7 @@ import android.widget.TextView;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class EulaDialogFragment extends DialogFragment {
|
||||
public class EulaDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -86,7 +85,7 @@ public class EulaDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
fragmentActivity = getActivity();
|
||||
|
||||
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
|
||||
|
||||
@@ -25,8 +25,6 @@ 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;
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
@@ -38,7 +36,7 @@ import android.widget.RadioGroup.OnCheckedChangeListener;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ExportDialogFragment extends DialogFragment {
|
||||
public class ExportDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Export types.
|
||||
@@ -82,7 +80,7 @@ public class ExportDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
FragmentActivity fragmentActivity = getActivity();
|
||||
|
||||
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.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
||||
/**
|
||||
* A DialogFragment to select a file type, gpx, kml, etc.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class FileTypeDialogFragment extends DialogFragment {
|
||||
public class FileTypeDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -82,7 +81,7 @@ public class FileTypeDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
int size = getArguments().getInt(KEY_SIZE);
|
||||
int optionId = getArguments().getInt(KEY_OPTION_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.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
/**
|
||||
@@ -32,7 +31,7 @@ import android.support.v4.app.FragmentActivity;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class FrequencyDialogFragment extends DialogFragment {
|
||||
public class FrequencyDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
public static final String FREQUENCY_DIALOG_TAG = "frequencyDialog";
|
||||
|
||||
@@ -55,7 +54,7 @@ public class FrequencyDialogFragment extends DialogFragment {
|
||||
private FragmentActivity fragmentActivity;
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
fragmentActivity = getActivity();
|
||||
|
||||
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.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -35,14 +33,14 @@ import android.widget.Toast;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class InstallEarthDialogFragment extends DialogFragment {
|
||||
public class InstallEarthDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
public static final String INSTALL_EARTH_DIALOG_TAG = "installEarthDialog";
|
||||
|
||||
private FragmentActivity fragmentActivity;
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
fragmentActivity = getActivity();
|
||||
return new AlertDialog.Builder(fragmentActivity).setMessage(
|
||||
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.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.util.SparseBooleanArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -37,7 +36,7 @@ import java.util.ArrayList;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class MergeDialogFragment extends DialogFragment {
|
||||
public class MergeDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
public static final String MERGE_DIALOG_TAG = "mergeDialog";
|
||||
|
||||
@@ -82,7 +81,7 @@ public class MergeDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
loadData();
|
||||
return new AlertDialog.Builder(getActivity()).setMultiChoiceItems(items, checkedItems, null)
|
||||
.setNegativeButton(R.string.generic_cancel, null)
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.view.View;
|
||||
@@ -43,7 +42,7 @@ import android.widget.Toast;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class ShareTrackDialogFragment extends DialogFragment {
|
||||
public class ShareTrackDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
|
||||
/**
|
||||
* Interface for caller of this dialog fragment.
|
||||
@@ -92,7 +91,7 @@ public class ShareTrackDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
protected Dialog createDialog() {
|
||||
fragmentActivity = getActivity();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDialogTitleDivider() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* API level 8 specific implementation of the {@link ApiAdapter}.
|
||||
*
|
||||
*
|
||||
* @author Bartlomiej Niechwiej
|
||||
*/
|
||||
public class Api8Adapter implements ApiAdapter {
|
||||
|
||||
private static final String TAG = Api8Adapter.class.getSimpleName();
|
||||
|
||||
|
||||
@Override
|
||||
public void applyPreferenceChanges(Editor editor) {
|
||||
editor.commit();
|
||||
@@ -101,7 +101,8 @@ public class Api8Adapter implements ApiAdapter {
|
||||
} catch (InvocationTargetException 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
|
||||
@@ -143,23 +144,28 @@ public class Api8Adapter implements ApiAdapter {
|
||||
public void invalidMenu(Activity activity) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean showEditTextClearButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setTabBackground(TabWidget tabWidget) {
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasDialogTitleDivider() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleSearchKey(MenuItem menuItem) {
|
||||
// Return false and allow the framework to handle the search key.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isGoogleFeedbackAvailable() {
|
||||
return false;
|
||||
@@ -172,13 +178,13 @@ public class Api8Adapter implements ApiAdapter {
|
||||
|
||||
@Override
|
||||
public void setAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId, int size) {
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void removeGlobalLayoutListener(
|
||||
ViewTreeObserver observer, OnGlobalLayoutListener listener) {
|
||||
observer.removeGlobalOnLayoutListener(listener);
|
||||
observer.removeGlobalOnLayoutListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,14 @@ public interface ApiAdapter {
|
||||
* @param tabWidget the tab widget
|
||||
*/
|
||||
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.
|
||||
* <p>
|
||||
|
||||
@@ -23,6 +23,10 @@ import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* Utilities for creating dialogs.
|
||||
@@ -101,4 +105,20 @@ public class DialogUtils {
|
||||
progressDialog.setTitle(R.string.generic_progress_title);
|
||||
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