Loading packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java +16 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ public class FooterPreference extends Preference { static final int ORDER_FOOTER = Integer.MAX_VALUE - 1; @VisibleForTesting View.OnClickListener mLearnMoreListener; @VisibleForTesting int mIconVisibility = View.VISIBLE; private CharSequence mContentDescription; private CharSequence mLearnMoreText; private CharSequence mLearnMoreContentDescription; Loading Loading @@ -84,6 +86,9 @@ public class FooterPreference extends Preference { } else { learnMore.setVisibility(View.GONE); } View icon = holder.itemView.findViewById(R.id.icon_frame); icon.setVisibility(mIconVisibility); } @Override Loading Loading @@ -165,6 +170,17 @@ public class FooterPreference extends Preference { } } /** * Set visibility of footer icon. */ public void setIconVisibility(int iconVisibility) { if (mIconVisibility == iconVisibility) { return; } mIconVisibility = iconVisibility; notifyChanged(); } private void init() { setLayoutResource(R.layout.preference_footer); if (getIcon() == null) { Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/FooterPreferenceTest.java +9 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; import androidx.preference.PreferenceViewHolder; Loading Loading @@ -86,4 +87,11 @@ public class FooterPreferenceTest { assertThat(mFooterPreference.mLearnMoreListener).isNotNull(); } @Test public void setIconVisibility_shouldReturnSameVisibilityType() { mFooterPreference.setIconVisibility(View.GONE); assertThat(mFooterPreference.mIconVisibility).isEqualTo(View.GONE); } } Loading
packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java +16 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ public class FooterPreference extends Preference { static final int ORDER_FOOTER = Integer.MAX_VALUE - 1; @VisibleForTesting View.OnClickListener mLearnMoreListener; @VisibleForTesting int mIconVisibility = View.VISIBLE; private CharSequence mContentDescription; private CharSequence mLearnMoreText; private CharSequence mLearnMoreContentDescription; Loading Loading @@ -84,6 +86,9 @@ public class FooterPreference extends Preference { } else { learnMore.setVisibility(View.GONE); } View icon = holder.itemView.findViewById(R.id.icon_frame); icon.setVisibility(mIconVisibility); } @Override Loading Loading @@ -165,6 +170,17 @@ public class FooterPreference extends Preference { } } /** * Set visibility of footer icon. */ public void setIconVisibility(int iconVisibility) { if (mIconVisibility == iconVisibility) { return; } mIconVisibility = iconVisibility; notifyChanged(); } private void init() { setLayoutResource(R.layout.preference_footer); if (getIcon() == null) { Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/FooterPreferenceTest.java +9 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; import androidx.preference.PreferenceViewHolder; Loading Loading @@ -86,4 +87,11 @@ public class FooterPreferenceTest { assertThat(mFooterPreference.mLearnMoreListener).isNotNull(); } @Test public void setIconVisibility_shouldReturnSameVisibilityType() { mFooterPreference.setIconVisibility(View.GONE); assertThat(mFooterPreference.mIconVisibility).isEqualTo(View.GONE); } }