Fix banner tip buttons visibility and update incompatible tip
Fix the battery settings banner tip buttons visibility not reset issue and update the incompatible charging tip into the colored primary button Bug: 246960554 Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.* Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.widget.CardPreferenceTest Change-Id: I9b72fccc7838d974d3b60d0f9684780841623cbb
This commit is contained in:
@@ -30,9 +30,7 @@ import com.google.android.material.card.MaterialCardView;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Preference that wrapped by {@link MaterialCardView}, only support to set icon, title and summary
|
||||
*/
|
||||
/** Preference that wrapped by {@link MaterialCardView} */
|
||||
public class CardPreference extends Preference {
|
||||
|
||||
private View.OnClickListener mPrimaryBtnClickListener = null;
|
||||
@@ -76,6 +74,12 @@ public class CardPreference extends Preference {
|
||||
setSecondaryButtonVisible(mSecondaryButtonVisible);
|
||||
}
|
||||
|
||||
/** Clear layout state if needed */
|
||||
public void resetLayoutState() {
|
||||
setPrimaryButtonVisible(false);
|
||||
setSecondaryButtonVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to be invoked when the primary button is clicked.
|
||||
*
|
||||
@@ -140,6 +144,15 @@ public class CardPreference extends Preference {
|
||||
updateButtonGroupsVisibility();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text of content description on primary button.
|
||||
*
|
||||
* @param text text for the content description
|
||||
*/
|
||||
public void setPrimaryButtonContentDescription(String text) {
|
||||
mPrimaryButton.ifPresent(button -> button.setContentDescription(text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text of content description on secondary button.
|
||||
*
|
||||
|
Reference in New Issue
Block a user