Merge pull request #80 from lacerta-doc/improve/bottom_nav_color

システムナビゲーションの色をUIにあわせるようにした
This commit is contained in:
ろむねこ 2024-01-19 15:02:32 +09:00 committed by GitHub
commit 46f119b531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 75 additions and 0 deletions

View File

@ -1,11 +1,13 @@
package one.nem.lacerta; package one.nem.lacerta;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.navigation.NavController; import androidx.navigation.NavController;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.NavigationUI; import androidx.navigation.ui.NavigationUI;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast; import android.widget.Toast;
@ -36,6 +38,8 @@ public class MainActivity extends AppCompatActivity {
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
} }

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.Lacerta" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorOnPrimary</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">@color/colorOnSecondary</item>
<item name="colorSurface">@color/colorSurface</item>
<item name="colorOnSurface">@color/colorOnSurface</item>
<item name="colorSurfaceVariant">@color/colorSurfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/colorOnSurfaceVariant</item>
<item name="colorSurfaceInverse">@color/colorSurfaceInverse</item>
<item name="colorOnSurfaceInverse">@color/colorOnSurfaceInverse</item>
<item name="colorPrimaryInverse">@color/colorPrimaryInverse</item>
<item name="colorPrimaryContainer">@color/colorPrimaryContainer</item>
<item name="colorOnPrimaryContainer">@color/colorOnPrimaryContainer</item>
<item name="colorSecondaryContainer">@color/colorSecondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/colorOnSecondaryContainer</item>
<item name="colorTertiary">@color/colorTertiary</item>
<item name="colorOnTertiary">@color/colorOnTertiary</item>
<item name="colorTertiaryContainer">@color/colorTertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/colorOnTertiaryContainer</item>
<item name="colorError">@color/colorError</item>
<item name="colorOnError">@color/colorOnError</item>
<item name="colorErrorContainer">@color/colorErrorContainer</item>
<item name="colorOnErrorContainer">@color/colorOnErrorContainer</item>
<item name="colorOutline">@color/colorOutline</item>
<item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
</resources>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.Lacerta" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorOnPrimary</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">@color/colorOnSecondary</item>
<item name="colorSurface">@color/colorSurface</item>
<item name="colorOnSurface">@color/colorOnSurface</item>
<item name="colorSurfaceVariant">@color/colorSurfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/colorOnSurfaceVariant</item>
<item name="colorSurfaceInverse">@color/colorSurfaceInverse</item>
<item name="colorOnSurfaceInverse">@color/colorOnSurfaceInverse</item>
<item name="colorPrimaryInverse">@color/colorPrimaryInverse</item>
<item name="colorPrimaryContainer">@color/colorPrimaryContainer</item>
<item name="colorOnPrimaryContainer">@color/colorOnPrimaryContainer</item>
<item name="colorSecondaryContainer">@color/colorSecondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/colorOnSecondaryContainer</item>
<item name="colorTertiary">@color/colorTertiary</item>
<item name="colorOnTertiary">@color/colorOnTertiary</item>
<item name="colorTertiaryContainer">@color/colorTertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/colorOnTertiaryContainer</item>
<item name="colorError">@color/colorError</item>
<item name="colorOnError">@color/colorOnError</item>
<item name="colorErrorContainer">@color/colorErrorContainer</item>
<item name="colorOnErrorContainer">@color/colorOnErrorContainer</item>
<item name="colorOutline">@color/colorOutline</item>
<item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</resources>

View File

@ -28,6 +28,7 @@
<item name="colorOutline">@color/colorOutline</item> <item name="colorOutline">@color/colorOutline</item>
<item name="colorOnBackground">@color/colorOnBackground</item> <item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">true</item>
</style> </style>