Skip to content

Commit

Permalink
feat: do not use CardView for TabLayout's parent
Browse files Browse the repository at this point in the history
  • Loading branch information
aikrq committed Dec 24, 2024
1 parent 5937395 commit 9348c0c
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 141 deletions.
46 changes: 16 additions & 30 deletions app/src/main/res/layout/activity_about_app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,26 @@
app:title="@string/about_title" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

<com.google.android.material.card.MaterialCardView
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="10dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:shapeAppearance="?attr/shapeAppearanceCornerExtraLarge"
app:strokeWidth="0.5dp">
android:layout_height="wrap_content">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_team_title" />

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_changelog_title" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_team_title" />

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_beta_changes_title" />
</com.google.android.material.tabs.TabLayout>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_changelog_title" />

</com.google.android.material.card.MaterialCardView>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_beta_changes_title" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager2.widget.ViewPager2
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/layout/design.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="wrap_content" />

Expand Down
22 changes: 3 additions & 19 deletions app/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,10 @@
android:id="@+id/toolbar"
layout="@layout/toolbar" />

<com.google.android.material.card.MaterialCardView
android:id="@+id/mainTabsCard"
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:shapeAppearance="?attr/shapeAppearanceCornerExtraLarge"
app:strokeWidth="0.5dp">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.card.MaterialCardView>
android:layout_height="wrap_content" />

</com.google.android.material.appbar.AppBarLayout>

Expand Down
22 changes: 4 additions & 18 deletions app/src/main/res/layout/manage_font.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,12 @@
app:title="Font Manager" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

<com.google.android.material.card.MaterialCardView
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:shapeAppearance="?attr/shapeAppearanceCornerExtraLarge"
app:strokeWidth="0.5dp">
android:layout_height="wrap_content" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.card.MaterialCardView>
</com.google.android.material.appbar.AppBarLayout>d
</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
Expand Down
45 changes: 14 additions & 31 deletions app/src/main/res/layout/manage_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
app:title="@string/design_actionbar_title_manager_image" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
Expand All @@ -37,27 +41,6 @@
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<com.google.android.material.card.MaterialCardView
android:id="@+id/mainTabsCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="10dp"
android:clickable="true"
android:focusable="true"
android:layout_marginBottom="12dp"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:cardCornerRadius="18dp"
app:strokeWidth="0.5dp">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.card.MaterialCardView>

<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_marginHorizontal="12dp"
Expand All @@ -73,16 +56,16 @@
app:layout_anchor="@id/contentLayout"
app:layout_anchorGravity="bottom|end">

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_mtrl_add"
android:visibility="gone"
tools:ignore="ContentDescription"
tools:visibility="visible" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_mtrl_add"
android:visibility="gone"
tools:ignore="ContentDescription"
tools:visibility="visible" />

<com.google.android.material.card.MaterialCardView
android:id="@+id/layout_btn_import"
Expand Down
20 changes: 3 additions & 17 deletions app/src/main/res/layout/manage_sound.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,11 @@
app:title="Sound Manager" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

<com.google.android.material.card.MaterialCardView
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:shapeAppearance="?attr/shapeAppearanceCornerExtraLarge"
app:strokeWidth="0.5dp">
android:layout_height="wrap_content" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.card.MaterialCardView>
</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager.widget.ViewPager
Expand Down
27 changes: 6 additions & 21 deletions app/src/main/res/layout/manage_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@
app:navigationIcon="?attr/homeAsUpIndicator"
app:title="@string/design_actionbar_title_manager_view" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
android:id="@+id/contentLayout"
Expand All @@ -39,26 +44,6 @@
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<com.google.android.material.card.MaterialCardView
android:id="@+id/mainTabsCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="10dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:cardCornerRadius="18dp"
app:strokeWidth="0.5dp">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.card.MaterialCardView>

<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<item name="switchPreferenceCompatStyle">
@style/Preference.SketchwarePro.SwitchPreferenceCompat
</item>
<item name="tabStyle">@style/TabLayoutStyle</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.SketchwarePro.BottomSheetDialog</item>

<!-- Type styles. -->
Expand Down

0 comments on commit 9348c0c

Please sign in to comment.