Skip to content

Commit

Permalink
Fixed a bug with tabs opened from another app closing incorrectly, im…
Browse files Browse the repository at this point in the history
…proved color mode, fixed a bug with settings themes not working correctly & updated version code
  • Loading branch information
CookieJarApps committed Sep 12, 2020
1 parent 8b34bae commit f5bb436
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
8 changes: 5 additions & 3 deletions app/build.gradle
Expand Up @@ -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
}

Expand Down Expand Up @@ -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'
Expand Down
Expand Up @@ -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)
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_settings.xml
Expand Up @@ -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">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?toolbarSettingsBackground"
>

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"/>
android:background="?toolbarSettingsBackground"/>


</com.google.android.material.appbar.AppBarLayout>
Expand Down

0 comments on commit f5bb436

Please sign in to comment.