Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f1c3af7 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Hide Preference title when empty.

Change-Id: I1c1d73f5a4647657c7da65c72192fbac061fe259
parent af92c532
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -497,24 +497,27 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
     * @see #onCreateView(ViewGroup)
     */
    protected void onBindView(View view) {
        TextView textView = (TextView) view.findViewById(com.android.internal.R.id.title); 
        if (textView != null) {
            textView.setText(getTitle());
        final TextView titleView = (TextView) view.findViewById(
                com.android.internal.R.id.title);
        if (titleView != null) {
            final CharSequence title = getTitle();
            if (!TextUtils.isEmpty(title)) {
                titleView.setText(title);
                titleView.setVisibility(View.VISIBLE);
            } else {
                titleView.setVisibility(View.GONE);
            }
        }

        textView = (TextView) view.findViewById(com.android.internal.R.id.summary);
        if (textView != null) {
        final TextView summaryView = (TextView) view.findViewById(
                com.android.internal.R.id.summary);
        if (summaryView != null) {
            final CharSequence summary = getSummary();
            if (!TextUtils.isEmpty(summary)) {
                if (textView.getVisibility() != View.VISIBLE) {
                    textView.setVisibility(View.VISIBLE);
                }
                
                textView.setText(getSummary());
                summaryView.setText(summary);
                summaryView.setVisibility(View.VISIBLE);
            } else {
                if (textView.getVisibility() != View.GONE) {
                    textView.setVisibility(View.GONE);
                }
                summaryView.setVisibility(View.GONE);
            }
        }