Fixed issue on pre lolipop devices.

This commit is contained in:
Amine Bou 2018-05-31 12:42:06 +02:00
parent 6c293f4cac
commit db014fe13d
5 changed files with 35 additions and 20 deletions

View File

@ -44,10 +44,11 @@ class AddSourceActivity : AppCompatActivity() {
setContentView(R.layout.activity_add_source)
// TODO: input bubble cursor
Scoop.getInstance()
.bind(this, Toppings.PRIMARY.value, toolbar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
val scoop = Scoop.getInstance()
scoop.bind(this, Toppings.PRIMARY.value, toolbar)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
val drawable = nameInput.background
drawable.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)

View File

@ -6,6 +6,7 @@ import android.content.SharedPreferences
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.view.MenuItemCompat
@ -389,16 +390,21 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
}
private fun handleThemeBinding() {
Scoop.getInstance()
.bind(this, Toppings.PRIMARY.value, toolBar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
val scoop = Scoop.getInstance()
scoop.bind(this, Toppings.PRIMARY.value, toolBar)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
}
private fun handleThemeUpdate() {
Scoop.getInstance()
.update(Toppings.PRIMARY.value, appColors.colorPrimary)
.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark)
val scoop = Scoop.getInstance()
scoop.update(Toppings.PRIMARY.value, appColors.colorPrimary)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark)
}
}
private fun handleDrawer() {

View File

@ -3,6 +3,7 @@ package apps.amine.bou.readerforselfoss
import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.app.FragmentManager
@ -62,9 +63,11 @@ class ReaderActivity : AppCompatActivity() {
setContentView(R.layout.activity_reader)
Scoop.getInstance()
.bind(this, Toppings.PRIMARY.value, toolBar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
val scoop = Scoop.getInstance()
scoop.bind(this, Toppings.PRIMARY.value, toolBar)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
setSupportActionBar(toolBar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)

View File

@ -2,6 +2,7 @@ package apps.amine.bou.readerforselfoss
import android.content.Intent
import android.content.res.ColorStateList
import android.os.Build
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v7.app.AppCompatActivity
@ -29,9 +30,11 @@ class SourcesActivity : AppCompatActivity() {
setContentView(R.layout.activity_sources)
Scoop.getInstance()
.bind(this, Toppings.PRIMARY.value, toolbar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
val scoop = Scoop.getInstance()
scoop.bind(this, Toppings.PRIMARY.value, toolbar)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)

View File

@ -1,6 +1,7 @@
package apps.amine.bou.readerforselfoss.settings;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.annotation.LayoutRes;
@ -48,10 +49,11 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
AppBarLayout bar = (AppBarLayout) LayoutInflater.from(this).inflate(R.layout.settings_toolbar, root, false);
Toolbar toolbar = bar.findViewById(R.id.toolbar);
// TODO: all switches
Scoop.getInstance()
.bind(this, Toppings.PRIMARY.getValue(), toolbar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.getValue());
Scoop scoop = Scoop.getInstance();
scoop.bind(this, Toppings.PRIMARY.getValue(), toolbar);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.getValue());
}
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);