Center apps Preference title when there is no summary am: 3cb8171f4f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/18426345

Change-Id: I97bc32891465de1a07aa2c6e5f87d00cba91cd54
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Arc Wang
2022-05-18 20:22:39 +00:00
committed by Automerger Merge Worker

View File

@@ -95,10 +95,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) {