Loading packages/SettingsLib/ActionButtonsPreference/src/com/android/settingslib/widget/ActionButtonsPreference.java +53 −1 Original line number Diff line number Diff line Loading @@ -272,6 +272,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button1. */ public ActionButtonsPreference setButton1Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton1Info.mContentDescription)) { mButton1Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button1. */ Loading Loading @@ -337,6 +349,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button2. */ public ActionButtonsPreference setButton2Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton2Info.mContentDescription)) { mButton2Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button2. */ Loading Loading @@ -402,6 +426,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button3. */ public ActionButtonsPreference setButton3Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton3Info.mContentDescription)) { mButton3Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button3. */ Loading Loading @@ -467,6 +503,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button4. */ public ActionButtonsPreference setButton4Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton4Info.mContentDescription)) { mButton4Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button4. */ Loading Loading @@ -536,6 +584,7 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD private TextView mTextView; private LinearLayout mActionLayout; private CharSequence mText; private CharSequence mContentDescription; private Drawable mIcon; private View.OnClickListener mListener; private boolean mIsEnabled = true; Loading @@ -553,13 +602,16 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD mTextView.setOnClickListener(mListener); mActionLayout.setEnabled(mIsEnabled); mActionLayout.setOnClickListener(mListener); mActionLayout.setContentDescription(mText); mActionLayout.setContentDescription( TextUtils.isEmpty(mContentDescription) ? mText : mContentDescription); } else { mButton.setText(mText); mButton.setCompoundDrawablesWithIntrinsicBounds( null /* left */, mIcon /* top */, null /* right */, null /* bottom */); mButton.setOnClickListener(mListener); mButton.setEnabled(mIsEnabled); mButton.setContentDescription( TextUtils.isEmpty(mContentDescription) ? mText : mContentDescription); } if (shouldBeVisible()) { Loading Loading
packages/SettingsLib/ActionButtonsPreference/src/com/android/settingslib/widget/ActionButtonsPreference.java +53 −1 Original line number Diff line number Diff line Loading @@ -272,6 +272,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button1. */ public ActionButtonsPreference setButton1Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton1Info.mContentDescription)) { mButton1Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button1. */ Loading Loading @@ -337,6 +349,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button2. */ public ActionButtonsPreference setButton2Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton2Info.mContentDescription)) { mButton2Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button2. */ Loading Loading @@ -402,6 +426,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button3. */ public ActionButtonsPreference setButton3Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton3Info.mContentDescription)) { mButton3Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button3. */ Loading Loading @@ -467,6 +503,18 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD return this; } /** * Sets the content description in button4. */ public ActionButtonsPreference setButton4Description(@StringRes int textResId) { final String newDescription = getContext().getString(textResId); if (!TextUtils.equals(newDescription, mButton4Info.mContentDescription)) { mButton4Info.mContentDescription = newDescription; notifyChanged(); } return this; } /** * Sets the drawable to be displayed above of text in button4. */ Loading Loading @@ -536,6 +584,7 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD private TextView mTextView; private LinearLayout mActionLayout; private CharSequence mText; private CharSequence mContentDescription; private Drawable mIcon; private View.OnClickListener mListener; private boolean mIsEnabled = true; Loading @@ -553,13 +602,16 @@ public class ActionButtonsPreference extends Preference implements GroupSectionD mTextView.setOnClickListener(mListener); mActionLayout.setEnabled(mIsEnabled); mActionLayout.setOnClickListener(mListener); mActionLayout.setContentDescription(mText); mActionLayout.setContentDescription( TextUtils.isEmpty(mContentDescription) ? mText : mContentDescription); } else { mButton.setText(mText); mButton.setCompoundDrawablesWithIntrinsicBounds( null /* left */, mIcon /* top */, null /* right */, null /* bottom */); mButton.setOnClickListener(mListener); mButton.setEnabled(mIsEnabled); mButton.setContentDescription( TextUtils.isEmpty(mContentDescription) ? mText : mContentDescription); } if (shouldBeVisible()) { Loading