feat: use dark theme

This commit is contained in:
urko 2025-02-18 19:15:11 +01:00
parent f70e9b79f0
commit f9a76afaa7
6 changed files with 34 additions and 10 deletions

View File

@ -27,6 +27,7 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("debug")
}
}
compileOptions {

View File

@ -19,8 +19,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/wittrail_logo_back"
android:supportsRtl="true"
android:theme="@style/Theme.WittrailAndroid"
tools:targetApi="31">
android:theme="@style/Theme.WittrailAndroid.Dark"
tools:targetApi="31">
<service
android:name="CameraXRecordingService"
android:foregroundServiceType="camera|microphone"
@ -31,10 +31,9 @@
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.WittrailAndroid">
android:theme="@style/Theme.WittrailAndroid.Dark">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

View File

@ -12,6 +12,7 @@ import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
@ -37,6 +38,7 @@ class MainActivity : AppCompatActivity() {
@RequiresApi(Build.VERSION_CODES.O)
override fun onCreate(savedInstanceState: Bundle?) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Original colors -->
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
@ -8,4 +9,12 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#FF0000</color>
<!-- Dark theme colors -->
<color name="dark_primary">#121212</color>
<color name="dark_primary_variant">#1F1B24</color>
<color name="dark_accent">#BB86FC</color>
<color name="dark_background">#000000</color>
<color name="dark_surface">#121212</color>
<color name="dark_on_primary">#FFFFFF</color>
</resources>

View File

@ -1,9 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="Theme.WittrailAndroid" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<!-- Customize your theme here. -->
<!-- Dark theme for your application -->
<style name="Theme.WittrailAndroid.Dark" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Window background -->
<item name="android:windowBackground">@color/dark_background</item>
<item name="android:colorBackground">@color/dark_background</item>
<!-- Primary brand color -->
<item name="colorPrimary">@color/red</item>
<!-- Primary brand color variant -->
<item name="colorPrimaryDark">@color/red</item>
<!-- Accent color -->
<item name="colorAccent">@color/dark_accent</item>
<!-- Surface and onPrimary colors can be used by Material components -->
<item name="android:textColorPrimary">@color/red</item>
</style>
<!-- Base application theme -->
<style name="Theme.WittrailAndroid" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your light theme here -->
</style>
</resources>

View File

@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.7.3" apply false
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}