Fix double divider in Apps & notifications page

- The second divider is shown after we set a background to the pinned
  header.
- Fix it by simply hiding the pinned header instead of its inner views.

Fixes: 133231218
Test: robotest, visual
Change-Id: I53add6f01930299425ce96d23350f9f066e85145
This commit is contained in:
Jason Chiu
2019-06-05 17:31:31 +08:00
parent 64fec889df
commit cfa36dbaeb
3 changed files with 29 additions and 15 deletions

View File

@@ -29,6 +29,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.Preference;
@@ -187,6 +188,24 @@ public class SettingsPreferenceFragmentTest {
verify(workOnlyCategory).setVisible(false);
}
@Test
public void showPinnedHeader_shouldBeVisible() {
mFragment.mPinnedHeaderFrameLayout = new FrameLayout(mContext);
mFragment.showPinnedHeader(true);
assertThat(mFragment.mPinnedHeaderFrameLayout.getVisibility()).isEqualTo(View.VISIBLE);
}
@Test
public void hidePinnedHeader_shouldBeInvisible() {
mFragment.mPinnedHeaderFrameLayout = new FrameLayout(mContext);
mFragment.showPinnedHeader(false);
assertThat(mFragment.mPinnedHeaderFrameLayout.getVisibility()).isEqualTo(View.INVISIBLE);
}
public static class TestFragment extends SettingsPreferenceFragment {
@Override