Use tabs for advanced options

pull/156/head
M66B 5 years ago
parent 00fc2bc02e
commit 2072fc24f6

@ -36,6 +36,8 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
public class FragmentOptions extends FragmentBase {
private ViewPager pager;
private PagerAdapter adapter;
@ -76,6 +78,12 @@ public class FragmentOptions extends FragmentBase {
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(pager);
}
private class PagerAdapter extends FragmentStatePagerAdapter {
public PagerAdapter(FragmentManager fm) {
super(fm);

@ -13,11 +13,10 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.viewpager.widget.PagerTitleStrip
style="@style/PagerTitleStripStyle"
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:padding="12dp" />
app:tabMode="scrollable" />
</androidx.viewpager.widget.ViewPager>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -6,8 +6,6 @@
<attr name="colorDrawerScrim" format="reference" />
<attr name="colorDrawerText" format="reference" />
<attr name="colorDrawerBackground" format="reference" />
<attr name="colorPagerStripeText" format="reference" />
<attr name="colorPagerStripeBackground" format="reference" />
<attr name="activatableItemBackground" format="reference" />
<style name="AppThemeLight" parent="Base.Theme.AppCompat.Light.DarkActionBar">
@ -26,9 +24,6 @@
<item name="colorDrawerText">@color/lightColorDrawerText</item>
<item name="colorDrawerBackground">@color/lightColorDrawerBackground</item>
<item name="colorPagerStripeText">@color/lightColorDrawerText</item>
<item name="colorPagerStripeBackground">@color/lightColorDrawerBackground</item>
<item name="activatableItemBackground">@drawable/activatable_item_background_light</item>
<item name="android:checkboxStyle">@style/checkboxStyle</item>
@ -54,9 +49,6 @@
<item name="colorDrawerText">@color/darkColorDrawerText</item>
<item name="colorDrawerBackground">@color/darkColorDrawerBackground</item>
<item name="colorPagerStripeText">@color/darkColorDrawerText</item>
<item name="colorPagerStripeBackground">@color/darkColorDrawerBackground</item>
<item name="activatableItemBackground">@drawable/activatable_item_background_dark</item>
<item name="android:checkboxStyle">@style/checkboxStyle</item>
@ -110,10 +102,4 @@
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Small</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="PagerTitleStripStyle">
<item name="android:textColor">?colorPagerStripeText</item>
<item name="android:textSize">18sp</item>
<item name="android:background">?colorPagerStripeBackground</item>
</style>
</resources>

Loading…
Cancel
Save