diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index b4548110..fe4e9000 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/build.gradle b/app/build.gradle index 6f561bad..790731f8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,8 +20,8 @@ android { defaultConfig { minSdkVersion project.minSdkVersion targetSdkVersion project.targetSdkVersion - versionName "8.2.2" - versionCode 114 + versionName "8.3.0" + versionCode 115 vectorDrawables.useSupportLibrary = true } @@ -150,7 +150,9 @@ dependencies { implementation 'com.github.QuadFlask:colorpicker:0.0.15' - implementation 'androidx.webkit:webkit:1.3.0-rc02' + implementation 'androidx.webkit:webkit:1.3.0' + + implementation 'com.github.kizitonwose.colorpreference:support:1.1.0' // memory leak analysis final def leakCanaryVersion = '2.4' diff --git a/app/src/main/java/com/cookiegames/smartcookie/MainActivity.kt b/app/src/main/java/com/cookiegames/smartcookie/MainActivity.kt index beb31610..78cf828d 100644 --- a/app/src/main/java/com/cookiegames/smartcookie/MainActivity.kt +++ b/app/src/main/java/com/cookiegames/smartcookie/MainActivity.kt @@ -39,7 +39,8 @@ class MainActivity : BrowserActivity() { override fun onNewIntent(intent: Intent) = if (intent.action == INTENT_PANIC_TRIGGER) { - panicClean() + // TODO: investigate why this is here and why removing it fixes an intent issue + //panicClean() } else { handleNewIntent(intent) super.onNewIntent(intent) diff --git a/app/src/main/java/com/cookiegames/smartcookie/browser/activity/BrowserActivity.kt b/app/src/main/java/com/cookiegames/smartcookie/browser/activity/BrowserActivity.kt index bc864bcd..1e9d140f 100644 --- a/app/src/main/java/com/cookiegames/smartcookie/browser/activity/BrowserActivity.kt +++ b/app/src/main/java/com/cookiegames/smartcookie/browser/activity/BrowserActivity.kt @@ -1379,10 +1379,15 @@ abstract class BrowserActivity : ThemableBrowserActivity(), BrowserView, UIContr tabBackground?.tint(userPreferences.colorNavbar) toolbar_layout.setBackgroundColor(userPreferences.colorNavbar) currentUiColor = userPreferences.colorNavbar + searchBackground?.background?.tint( Utils.mixTwoColors(Color.WHITE, userPreferences.colorNavbar, 0.25f) ) + backgroundDrawable.color = userPreferences.colorNavbar + + window.setBackgroundDrawable(backgroundDrawable) + } //Reset theme without needing a restart else if(userPreferences.navbarColChoice == ChooseNavbarCol.NONE){ var currentColor = Color.WHITE diff --git a/app/src/main/java/com/cookiegames/smartcookie/settings/activity/SettingsActivity.kt b/app/src/main/java/com/cookiegames/smartcookie/settings/activity/SettingsActivity.kt index 9f917b66..de170857 100644 --- a/app/src/main/java/com/cookiegames/smartcookie/settings/activity/SettingsActivity.kt +++ b/app/src/main/java/com/cookiegames/smartcookie/settings/activity/SettingsActivity.kt @@ -3,21 +3,56 @@ */ package com.cookiegames.smartcookie.settings.activity +import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.MenuItem import androidx.appcompat.app.ActionBar import androidx.appcompat.app.AppCompatActivity +import com.cookiegames.smartcookie.preference.UserPreferences import androidx.appcompat.widget.Toolbar +import com.cookiegames.smartcookie.AppTheme import com.cookiegames.smartcookie.R +import com.cookiegames.smartcookie.di.injector import com.cookiegames.smartcookie.settings.fragment.SettingsFragment +import com.cookiegames.smartcookie.utils.ThemeUtils +import javax.inject.Inject class SettingsActivity : AppCompatActivity() { + private var themeId: AppTheme = AppTheme.LIGHT + @Inject + internal lateinit var userPreferences: UserPreferences + + override fun onCreate(savedInstanceState: Bundle?) { + injector.inject(this) super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) + themeId = userPreferences.useTheme + val toolbar: Toolbar = findViewById(R.id.toolbar) + + // set the theme + when (themeId) { + AppTheme.LIGHT -> { + setTheme(R.style.Theme_SettingsTheme) + window.setBackgroundDrawable(ColorDrawable(ThemeUtils.getPrimaryColor(this))) + toolbar.setBackgroundColor(ThemeUtils.getPrimaryColor(this)) + } + AppTheme.DARK -> { + setTheme(R.style.Theme_SettingsTheme_Dark) + window.setBackgroundDrawable(ColorDrawable(ThemeUtils.getPrimaryColorDark(this))) + toolbar.setBackgroundColor(ThemeUtils.getPrimaryColorDark(this)) + } + AppTheme.BLACK -> { + setTheme(R.style.Theme_SettingsTheme_Black) + window.setBackgroundDrawable(ColorDrawable(ThemeUtils.getPrimaryColorDark(this))) + toolbar.setBackgroundColor(ThemeUtils.getPrimaryColorDark(this)) + } + } + + try { setSupportActionBar(toolbar) val actionBar: ActionBar? = getSupportActionBar() diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index e35cd8e5..7297e7a1 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -3,19 +3,19 @@ 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="@color/white"> + android:layout_height="match_parent"> + android:background="?toolbarSettingsBackground"/>