Optimized NavigationBar.

Added BottomNavigationView.
Removed FloatingActionButton.
This commit is contained in:
2022-04-13 19:32:28 +08:00
parent e34451ea47
commit 43c6fd91db
27 changed files with 447 additions and 179 deletions

View File

@@ -4,7 +4,8 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:fitsSystemWindows="false"
android:background="?attr/app_background"
tools:openDrawer="start">
<include

View File

@@ -1,6 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/windowSplashScreenBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="288dp"
android:layout_height="288dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/ic_launcher"
android:contentDescription="LOGO" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,6 +2,7 @@
<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/main_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
@@ -22,13 +23,4 @@
<include layout="@layout/content_main" />
<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="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email"
android:contentDescription="@string/fab" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,20 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_home"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:orientation="vertical"
tools:context=".ui.home.HomeFragment">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/fold_layouts_linear_layout"
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/bottom_nav_view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:orientation="vertical">
</LinearLayout>
app:labelVisibilityMode="selected"
app:itemTextColor="?attr/app_on_theme"
app:itemIconTint="?attr/app_on_theme"
android:background="?attr/app_theme"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottom_nav_view_pager"
app:menu="@menu/bottom_nav_menu" />
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_home_tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:orientation="vertical"
tools:context=".ui.home.HomeFragment">
<LinearLayout
android:id="@+id/fold_layouts_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="10dp"
android:paddingBottom="10dp" />
</ScrollView>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_home_tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:orientation="vertical"
tools:context=".ui.home.tools.ToolsFragment">
<LinearLayout
android:id="@+id/fold_layouts_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="10dp"
android:paddingBottom="10dp" />
</ScrollView>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home_tools"
android:icon="@drawable/ic_menu_home"
android:orderInCategory="0"
android:title="@string/menu_home_tools" />
<item
android:id="@+id/nav_home_fav"
android:icon="@drawable/ic_menu_home"
android:orderInCategory="1"
android:title="@string/menu_home_fav" />
</menu>

View File

@@ -9,6 +9,8 @@
<string name="action_settings">设置</string>
<string name="menu_home">主页</string>
<string name="menu_home_tools">工具</string>
<string name="menu_home_fav">收藏</string>
<string name="menu_theme">主题</string>
<string name="menu_setting">设置</string>
<string name="menu_about">关于</string>
@@ -18,7 +20,6 @@
<string name="shortcutLongLabel">氧工具</string>
<string name="shortcutShortLabel">氧工具</string>
<string name="fab">浮动按钮</string>
<string name="init_tools_failed">初始化工具集失败</string>
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
</resources>

View File

@@ -9,6 +9,8 @@
<string name="action_settings">设置</string>
<string name="menu_home">主页</string>
<string name="menu_home_tools">工具</string>
<string name="menu_home_fav">收藏</string>
<string name="menu_theme">主题</string>
<string name="menu_setting">设置</string>
<string name="menu_about">关于</string>
@@ -18,7 +20,6 @@
<string name="shortcutLongLabel">氧工具</string>
<string name="shortcutShortLabel">氧工具</string>
<string name="fab">浮动按钮</string>
<string name="init_tools_failed">初始化工具集失败</string>
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
</resources>

View File

@@ -9,6 +9,8 @@
<string name="action_settings">设置</string>
<string name="menu_home">主页</string>
<string name="menu_home_tools">工具</string>
<string name="menu_home_fav">收藏</string>
<string name="menu_theme">主题</string>
<string name="menu_setting">设置</string>
<string name="menu_about">关于</string>
@@ -18,7 +20,6 @@
<string name="shortcutLongLabel">氧工具</string>
<string name="shortcutShortLabel">氧工具</string>
<string name="fab">浮动按钮</string>
<string name="init_tools_failed">初始化工具集失败</string>
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
</resources>

View File

@@ -5,5 +5,4 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="nav_header_vertical_spacing">8dp</dimen>
<dimen name="nav_header_height">176dp</dimen>
<dimen name="fab_margin">16dp</dimen>
</resources>

View File

@@ -9,6 +9,8 @@
<string name="action_settings">Settings</string>
<string name="menu_home">Home</string>
<string name="menu_home_tools">Tools</string>
<string name="menu_home_fav">Favorite</string>
<string name="menu_theme">Theme</string>
<string name="menu_setting">Setting</string>
<string name="menu_about">About</string>
@@ -20,7 +22,6 @@
<string name="arrow_icon" translatable="false"><![CDATA[>]]></string>
<string name="fab">Fab</string>
<string name="init_tools_failed">Failed to initialize tools</string>
<string name="activity_class_not_found">Can not load tool, it may be damaged</string>
</resources>

View File

@@ -15,6 +15,7 @@
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="app_theme">@color/default_app_theme</item>
<item name="app_on_theme">@color/default_app_on_theme</item>
@@ -31,15 +32,19 @@
<item name="tools_button_ripple">@color/default_tools_button_ripple</item>
</style>
<style name="Theme.OxygenToolbox.Full" parent="Theme.OxygenToolbox.Default">
<item name="android:windowTranslucentStatus">true</item>
</style>
<style name="Theme.OxygenToolbox.SplashActivity" parent="Theme.OxygenToolbox.Full">
</style>
<style name="Theme.OxygenToolbox.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/default_app_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher</item>
<item name="windowSplashScreenAnimationDuration">0</item>
<item name="postSplashScreenTheme">@style/Theme.OxygenToolbox.Default</item>
</style>
<style name="Theme.OxygenToolbox.Full" parent="Theme.OxygenToolbox.Default">
<item name="android:windowFullscreen">true</item>
<item name="postSplashScreenTheme">@style/Theme.OxygenToolbox.SplashActivity</item>
</style>
<style name="Theme.OxygenToolbox.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />