Skip to content

Commit

Permalink
feat: use material toolbar at manage space activity
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO authored and david-allison committed Nov 15, 2023
1 parent 3f67d1d commit d708d97
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.ichi2.anki.ui.windows.managespace
import android.os.Bundle
import com.ichi2.anki.AnkiActivity
import com.ichi2.anki.R
import com.ichi2.themes.setTransparentStatusBar

class ManageSpaceActivity : AnkiActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -29,11 +30,8 @@ class ManageSpaceActivity : AnkiActivity() {

super.onCreate(savedInstanceState)
setContentView(R.layout.activity_manage_space)
setTransparentStatusBar()

enableToolbar().apply {
setHomeButtonEnabled(true)
setDisplayHomeAsUpEnabled(true)
setTitle(R.string.pref__manage_space__screen_title)
}
enableToolbar().setDisplayHomeAsUpEnabled(true)
}
}
49 changes: 45 additions & 4 deletions AnkiDroid/src/main/res/layout/activity_manage_space.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This program is free software; you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by the Free Software
~ Foundation; either version 3 of the License, or (at your option) any later
~ version.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY
~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
~ PARTICULAR PURPOSE. See the GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:fitsSystemWindows="true"
tools:context=".ui.windows.managespace.ManageSpaceActivity">

<include layout="@layout/toolbar" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
style="?collapsingToolbarLayoutMediumStyle"
android:layout_width="match_parent"
android:layout_height="?collapsingToolbarLayoutMediumSize"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:toolbarId="@id/toolbar"
app:title="@string/pref__manage_space__screen_title">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:navigationContentDescription="@string/abc_action_bar_up_description"
app:navigationIcon="?attr/homeAsUpIndicator"
/>

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

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

<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
android:name="com.ichi2.anki.ui.windows.managespace.ManageSpaceFragment"
/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit d708d97

Please sign in to comment.