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

Commit dc6c7db5 authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Make AppPreference summary and appendix stack vertically"

parents 1930893e 174205a9
Loading
Loading
Loading
Loading
+22 −27
Original line number Diff line number Diff line
@@ -48,37 +48,32 @@
        android:paddingTop="16dp"
        android:paddingBottom="16dp">

        <TextView android:id="@android:id/title"
        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                  android:singleLine="true"
                  android:textAppearance="?android:attr/textAppearanceListItem"
            android:ellipsize="marquee"
                  android:fadingEdge="horizontal"/>
            android:fadingEdge="horizontal"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceListItem"/>

        <LinearLayout
            android:id="@+id/summary_container"
        <TextView
            android:id="@android:id/summary"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone">
            <TextView android:id="@android:id/summary"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
            android:textAppearance="?android:attr/textAppearanceSmall"
                      android:textAlignment="viewStart"
            android:textColor="?android:attr/textColorSecondary"/>

            <TextView android:id="@+id/appendix"
                      android:layout_width="0dp"
        <TextView
            android:id="@+id/appendix"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
                      android:layout_weight="1"
            android:ellipsize="end"
            android:maxLines="1"
            android:textAppearance="?android:attr/textAppearanceSmall"
                      android:textAlignment="viewEnd"
            android:textColor="?android:attr/textColorSecondary"
                      android:maxLines="1"
                      android:ellipsize="end"/>
        </LinearLayout>
            android:visibility="gone"/>

        <ProgressBar
            android:id="@android:id/progress"
            style="?android:attr/progressBarStyleHorizontal"
+0 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.settingslib.widget.apppreference;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ProgressBar;
@@ -52,8 +51,6 @@ public class AppPreference extends Preference {
    public void onBindViewHolder(PreferenceViewHolder view) {
        super.onBindViewHolder(view);

        view.findViewById(R.id.summary_container)
                .setVisibility(TextUtils.isEmpty(getSummary()) ? View.GONE : View.VISIBLE);
        final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
        if (mProgressVisible) {
            progress.setProgress(mProgress);
+0 −18
Original line number Diff line number Diff line
@@ -56,24 +56,6 @@ public class AppPreferenceTest {
                .isEqualTo(View.VISIBLE);
    }

    @Test
    public void setSummary_showSummaryContainer() {
        mPref.setSummary("test");
        mPref.onBindViewHolder(mHolder);

        assertThat(mHolder.findViewById(R.id.summary_container).getVisibility())
                .isEqualTo(View.VISIBLE);
    }

    @Test
    public void noSummary_hideSummaryContainer() {
        mPref.setSummary(null);
        mPref.onBindViewHolder(mHolder);

        assertThat(mHolder.findViewById(R.id.summary_container).getVisibility())
                .isEqualTo(View.GONE);
    }

    @Test
    public void foobar_testName() {
        float iconSize = mContext.getResources().getDimension(R.dimen.secondary_app_icon_size);