Loading core/java/android/preference/RingtonePreference.java +28 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public class RingtonePreference extends Preference implements private int mRingtoneType; private boolean mShowDefault; private boolean mShowSilent; private int mDialogStyle; private int mRequestCode; private int mSubscriptionID = 0; /* Sub-1 by default */ Loading @@ -62,6 +63,8 @@ public class RingtonePreference extends Preference implements true); mShowSilent = a.getBoolean(com.android.internal.R.styleable.RingtonePreference_showSilent, true); mDialogStyle = a.getResourceId( com.android.internal.R.styleable.RingtonePreference_dialogStyle, 0); a.recycle(); } Loading Loading @@ -158,6 +161,27 @@ public class RingtonePreference extends Preference implements mShowSilent = showSilent; } /** * Returns the resource id style of the ringtone dialog. * * @return The resource id of the style * @hide */ public int getDialogStyle() { return mDialogStyle; } /** * Sets the resource id style of the ringtone dialog. * * @param dialogStyle The resource id of the style. * @see RingtoneManager#EXTRA_RINGTONE_DIALOG_THEME * @hide */ public void setDialogStyle(int dialogStyle) { mDialogStyle = dialogStyle; } @Override protected void onClick() { // Launch the ringtone picker Loading Loading @@ -193,6 +217,10 @@ public class RingtonePreference extends Preference implements RingtoneManager.getDefaultUri(getRingtoneType())); } } if (mDialogStyle != 0) { ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DIALOG_THEME, mDialogStyle); } ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent); ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, mRingtoneType); Loading core/res/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6509,6 +6509,9 @@ <attr name="showDefault" format="boolean" /> <!-- Whether to show an item for 'Silent'. --> <attr name="showSilent" format="boolean" /> <!-- The style of the ringtone dialog. @hide --> <attr name="dialogStyle" format="reference" /> </declare-styleable> <!-- Base attributes available to VolumePreference. --> Loading media/java/android/media/RingtoneManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,16 @@ public class RingtoneManager { public static final String EXTRA_RINGTONE_PICKED_URI = "android.intent.extra.ringtone.PICKED_URI"; /** * Set the resource id theme to use for the dialog picker activity.<br/> * The default theme is <code>com.android.internal.R.Theme_Holo_Dialog_Alert</code>. * * @see #ACTION_RINGTONE_PICKER * @hide */ public static final String EXTRA_RINGTONE_DIALOG_THEME = "android.intent.extra.ringtone.DIALOG_THEME"; // Make sure the column ordering and then ..._COLUMN_INDEX are in sync private static final String[] INTERNAL_COLUMNS = new String[] { Loading packages/SettingsProvider/src/com/android/providers/settings/ProfilePickerActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import android.app.ProfileManager; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.Theme; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; Loading Loading @@ -82,6 +85,21 @@ public final class ProfilePickerActivity extends AlertActivity implements Intent intent = getIntent(); // Set custom theme int themeExtra = intent.getIntExtra(ProfileManager.EXTRA_PROFILE_DIALOG_THEME, 0); if (themeExtra != 0) { try { Resources resources = getPackageManager().getResourcesForApplication( getCallingPackage()); Theme theme = resources.newTheme(); theme.applyStyle(themeExtra, true); getTheme().setTo(theme); } catch (NameNotFoundException e) { // Resource not available. Fall-through default theme } } if (savedInstanceState != null) { mClickedPos = savedInstanceState.getInt(SAVE_CLICKED_POS, -1); } Loading Loading
core/java/android/preference/RingtonePreference.java +28 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public class RingtonePreference extends Preference implements private int mRingtoneType; private boolean mShowDefault; private boolean mShowSilent; private int mDialogStyle; private int mRequestCode; private int mSubscriptionID = 0; /* Sub-1 by default */ Loading @@ -62,6 +63,8 @@ public class RingtonePreference extends Preference implements true); mShowSilent = a.getBoolean(com.android.internal.R.styleable.RingtonePreference_showSilent, true); mDialogStyle = a.getResourceId( com.android.internal.R.styleable.RingtonePreference_dialogStyle, 0); a.recycle(); } Loading Loading @@ -158,6 +161,27 @@ public class RingtonePreference extends Preference implements mShowSilent = showSilent; } /** * Returns the resource id style of the ringtone dialog. * * @return The resource id of the style * @hide */ public int getDialogStyle() { return mDialogStyle; } /** * Sets the resource id style of the ringtone dialog. * * @param dialogStyle The resource id of the style. * @see RingtoneManager#EXTRA_RINGTONE_DIALOG_THEME * @hide */ public void setDialogStyle(int dialogStyle) { mDialogStyle = dialogStyle; } @Override protected void onClick() { // Launch the ringtone picker Loading Loading @@ -193,6 +217,10 @@ public class RingtonePreference extends Preference implements RingtoneManager.getDefaultUri(getRingtoneType())); } } if (mDialogStyle != 0) { ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DIALOG_THEME, mDialogStyle); } ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent); ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, mRingtoneType); Loading
core/res/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6509,6 +6509,9 @@ <attr name="showDefault" format="boolean" /> <!-- Whether to show an item for 'Silent'. --> <attr name="showSilent" format="boolean" /> <!-- The style of the ringtone dialog. @hide --> <attr name="dialogStyle" format="reference" /> </declare-styleable> <!-- Base attributes available to VolumePreference. --> Loading
media/java/android/media/RingtoneManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,16 @@ public class RingtoneManager { public static final String EXTRA_RINGTONE_PICKED_URI = "android.intent.extra.ringtone.PICKED_URI"; /** * Set the resource id theme to use for the dialog picker activity.<br/> * The default theme is <code>com.android.internal.R.Theme_Holo_Dialog_Alert</code>. * * @see #ACTION_RINGTONE_PICKER * @hide */ public static final String EXTRA_RINGTONE_DIALOG_THEME = "android.intent.extra.ringtone.DIALOG_THEME"; // Make sure the column ordering and then ..._COLUMN_INDEX are in sync private static final String[] INTERNAL_COLUMNS = new String[] { Loading
packages/SettingsProvider/src/com/android/providers/settings/ProfilePickerActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import android.app.ProfileManager; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.Theme; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; Loading Loading @@ -82,6 +85,21 @@ public final class ProfilePickerActivity extends AlertActivity implements Intent intent = getIntent(); // Set custom theme int themeExtra = intent.getIntExtra(ProfileManager.EXTRA_PROFILE_DIALOG_THEME, 0); if (themeExtra != 0) { try { Resources resources = getPackageManager().getResourcesForApplication( getCallingPackage()); Theme theme = resources.newTheme(); theme.applyStyle(themeExtra, true); getTheme().setTo(theme); } catch (NameNotFoundException e) { // Resource not available. Fall-through default theme } } if (savedInstanceState != null) { mClickedPos = savedInstanceState.getInt(SAVE_CLICKED_POS, -1); } Loading