Center apps Preference title when there is no summary
Hide apps Preference summary when a summary is empty then its title will be vertically centered. Bug: 229646669 Test: manual visual Settings -> Apps -> See all apps Settings -> Notifications -> App settings Settings -> Storage -> Apps Settings -> System -> Language & input -> App Languages Change-Id: I6fceba243e2ccac9ea180b940b571da07e1ba805
This commit is contained in:
@@ -87,10 +87,17 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
|
|||||||
|
|
||||||
void setSummary(CharSequence summary) {
|
void setSummary(CharSequence summary) {
|
||||||
mSummary.setText(summary);
|
mSummary.setText(summary);
|
||||||
|
updateSummaryVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSummary(@StringRes int summary) {
|
void setSummary(@StringRes int summary) {
|
||||||
mSummary.setText(summary);
|
mSummary.setText(summary);
|
||||||
|
updateSummaryVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSummaryVisibility() {
|
||||||
|
// Hide an empty summary and then title will be vertically centered.
|
||||||
|
mSummary.setVisibility(TextUtils.isEmpty(mSummary.getText()) ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEnabled(boolean isEnabled) {
|
void setEnabled(boolean isEnabled) {
|
||||||
|
Reference in New Issue
Block a user