Fix line break in Opening links app list summary.

- the installed app list is using the app preference layout, which has
the appendix field to the right of the app title and summary. The
appendix and title/summary each has weight 1 to take up half of the
screen width. However, the appendix field is not used in the Opening
links page at all, so that field should be set to GONE to let the
title/summary takes up the whole available width.

Change-Id: Ia066a60dcd0a4c1d8562bd47e173378b49912d18
Fixes: 77954267
Test: visual and make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2018-05-03 15:43:58 -07:00
parent 21ca611203
commit 4db6f3dfb5
2 changed files with 26 additions and 0 deletions

View File

@@ -268,6 +268,7 @@ public class ManageDomainUrls extends SettingsPreferenceFragment
});
}
super.onBindViewHolder(holder);
holder.itemView.findViewById(R.id.appendix).setVisibility(View.GONE);
}
private CharSequence getDomainsSummary(String packageName) {

View File

@@ -17,9 +17,16 @@
package com.android.settings.applications;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ProgressBar;
import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -54,4 +61,22 @@ public class ManageDomainUrlsTest {
assertThat(pref.getLayoutResource()).isEqualTo(R.layout.preference_app);
}
@Test
public void onBindViewHolder_shouldSetAppendixViewToGone() {
mAppEntry.info = new ApplicationInfo();
mAppEntry.info.packageName = "com.android.settings.test";
mAppEntry.icon = mock(Drawable.class);
final ManageDomainUrls.DomainAppPreference pref =
new ManageDomainUrls.DomainAppPreference(mContext, null, mAppEntry);
final View holderView = mock(View.class);
final View appendixView = mock(View.class);
when(holderView.findViewById(R.id.summary_container)).thenReturn(mock(View.class));
when(holderView.findViewById(android.R.id.progress)).thenReturn(mock(ProgressBar.class));
when(holderView.findViewById(R.id.appendix)).thenReturn(appendixView);
pref.onBindViewHolder(PreferenceViewHolder.createInstanceForTests(holderView));
verify(appendixView).setVisibility(View.GONE);
}
}