Added theme switch

This commit is contained in:
2022-08-07 14:29:07 +08:00
parent 77337d86f3
commit 3357c75c3f
51 changed files with 916 additions and 205 deletions

View File

@@ -4,18 +4,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/libraries_page"
android:layout_width="match_parent"
android:background="?attr/app_background"
android:layout_height="match_parent"
android:background="?attr/app_background_theme"
tools:context=".ui.about.LibrariesActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:theme="@style/Theme.OxygenToolbox.AppBarOverlay"
app:layout_constraintEnd_toEndOf="parent"
android:theme="@style/Theme.OxygenToolbox.AppBarOverlay">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
@@ -30,9 +30,8 @@
android:id="@+id/libraries_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/app_bar_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
</androidx.recyclerview.widget.RecyclerView>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_bar_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -4,8 +4,7 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:background="?attr/app_background"
android:background="?attr/app_background_theme"
tools:openDrawer="start">
<include
@@ -18,6 +17,5 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="?attr/app_background"/>
android:background="?attr/app_background_theme" />
</androidx.drawerlayout.widget.DrawerLayout>

View File

@@ -1,19 +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">
android:layout_height="match_parent"
android:background="?attr/windowSplashScreenBackground">
<ImageView
android:id="@+id/imageView"
android:layout_width="288dp"
android:layout_height="288dp"
android:contentDescription="LOGO"
android:src="@drawable/ic_launcher"
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" />
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -21,6 +21,6 @@
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
<include layout="@layout/app_content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@android:color/transparent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/bottom_radius_background"
android:gravity="center_vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/basic_tools_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>

View File

@@ -15,7 +15,7 @@
android:layout_marginRight="10dp"
android:paddingHorizontal="5dp"
android:paddingBottom="2dp"
android:background="@drawable/bottom_radius_background"
android:background="@drawable/background_bottom_radius"
android:gravity="center_vertical">
</com.fatapp.oxygentoolbox.layout.AutoLinefeedLayout>

View File

@@ -25,7 +25,8 @@
android:layout_weight="6"
android:gravity="center_vertical"
android:textColor="?attr/app_text_theme"
android:textSize="18sp" />
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/arrow_icon"

View File

@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:background="?attr/app_background_theme"
tools:context=".ui.about.AboutFragment">
<androidx.appcompat.widget.AppCompatImageView
@@ -23,6 +23,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/about_icon_text_margin"
android:text="@string/app_full_name"
android:textColor="?attr/app_text_theme"
android:textSize="@dimen/default_text_size"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
@@ -35,6 +36,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/about_text_text_margin"
android:text="@string/nav_header_subtitle"
android:textColor="@color/app_secondary_text"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -45,6 +47,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/about_text_text_margin"
android:textColor="@color/app_secondary_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_desc" />

View File

@@ -3,7 +3,7 @@
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:background="?attr/app_background_theme">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/bottom_nav_view_pager"

View File

@@ -4,7 +4,7 @@
android:id="@+id/fragment_home_tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:background="?attr/app_background_theme"
android:orientation="vertical"
tools:context=".ui.home.HomeFragment">

View File

@@ -4,7 +4,7 @@
android:id="@+id/fragment_home_tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:background="?attr/app_background_theme"
android:orientation="vertical"
tools:context=".ui.home.tools.ToolsFragment">

View File

@@ -1,38 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background"
android:padding="15dp"
android:background="?attr/app_background_theme"
tools:context=".ui.theme.ThemeFragment">
<LinearLayout
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/theme_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/setting_dark_mode"
android:textColor="?attr/app_text_theme"
android:textSize="@dimen/default_text_size" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/theme_dark_mode_spinner"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:entries="@array/setting_dark_theme_selects_array"
android:spinnerMode="dropdown"
android:theme="@style/ThemeSpinner" />
</LinearLayout>
</LinearLayout>
</ScrollView>
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -8,6 +8,7 @@
android:layout_marginTop="@dimen/library_item_card_margin_vertical"
android:layout_marginEnd="@dimen/library_item_card_margin_horizontal"
android:layout_marginBottom="@dimen/library_item_card_margin_vertical"
android:background="?attr/app_on_background_theme"
android:clickable="true"
android:focusable="true">
@@ -29,6 +30,8 @@
android:paddingEnd="@dimen/library_item_card_inner_padding"
android:paddingRight="@dimen/library_item_card_inner_padding"
android:textAppearance="?textAppearanceHeadline5"
android:textColor="?attr/app_text_theme"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/library_creator"
app:layout_constraintEnd_toStartOf="@+id/library_version"
app:layout_constraintHorizontal_weight="1"
@@ -47,6 +50,7 @@
android:paddingEnd="@dimen/library_item_card_inner_padding"
android:paddingRight="@dimen/library_item_card_inner_padding"
android:textAppearance="?textAppearanceSubtitle1"
android:textColor="?attr/app_second_text_theme"
app:layout_constraintBottom_toTopOf="@+id/library_description_divider"
app:layout_constraintEnd_toStartOf="@+id/library_version"
app:layout_constraintStart_toStartOf="parent"
@@ -62,6 +66,7 @@
android:paddingTop="@dimen/library_item_card_inner_padding"
android:paddingEnd="@dimen/library_item_card_inner_padding"
android:textAppearance="?textAppearanceBody2"
android:textColor="?attr/app_second_text_theme"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="@id/library_name"
app:layout_constraintEnd_toEndOf="parent"
@@ -73,9 +78,9 @@
android:id="@+id/library_description_divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginVertical="@dimen/library_item_card_divider_padding_vertical"
android:layout_marginHorizontal="@dimen/library_item_card_divider_padding_horizontal"
android:background="?attr/app_background"
android:layout_marginVertical="@dimen/library_item_card_divider_padding_vertical"
android:background="?attr/app_divider_theme"
app:layout_constraintBottom_toTopOf="@id/library_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -89,6 +94,7 @@
android:layout_marginRight="@dimen/library_item_card_inner_padding"
android:maxLines="20"
android:textAppearance="?textAppearanceBody2"
android:textColor="?attr/app_text_theme"
app:layout_constraintBottom_toTopOf="@id/library_bottom_divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -99,9 +105,9 @@
android:id="@+id/library_bottom_divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginVertical="@dimen/library_item_card_divider_padding_vertical"
android:layout_marginHorizontal="@dimen/library_item_card_divider_padding_horizontal"
android:background="?attr/app_background"
android:layout_marginVertical="@dimen/library_item_card_divider_padding_vertical"
android:background="?attr/app_divider_theme"
app:layout_constraintBottom_toTopOf="@id/library_license"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -119,6 +125,7 @@
android:paddingRight="@dimen/library_item_card_inner_padding"
android:paddingBottom="@dimen/library_item_card_inner_padding"
android:textAppearance="?textAppearanceBody1"
android:textColor="?attr/app_text_theme"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/theme_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/primary_color"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:padding="10dp"
android:background="@drawable/background_top_radius"
android:orientation="horizontal">
<TextView
android:id="@+id/color_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/setting_theme"
android:textColor="?attr/app_on_theme"/>
<View
android:id="@+id/check"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/selector_themes"/>
</LinearLayout>
<View
android:id="@+id/primary_dark_color"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/background_no_radius" />
<View
android:id="@+id/primary_light_color"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/background_no_radius" />
<View
android:id="@+id/accent_color"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/background_bottom_radius" />
</LinearLayout>