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) setContentView(R.layout.activity_add_source)
// TODO: input bubble cursor val scoop = Scoop.getInstance()
Scoop.getInstance() scoop.bind(this, Toppings.PRIMARY.value, toolbar)
.bind(this, Toppings.PRIMARY.value, toolbar) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
.bindStatusBar(this, Toppings.PRIMARY_DARK.value) scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
val drawable = nameInput.background val drawable = nameInput.background
drawable.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP) 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.Color
import android.graphics.drawable.GradientDrawable import android.graphics.drawable.GradientDrawable
import android.net.Uri import android.net.Uri
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.preference.PreferenceManager import android.preference.PreferenceManager
import android.support.v4.view.MenuItemCompat import android.support.v4.view.MenuItemCompat
@ -389,16 +390,21 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
private fun handleThemeBinding() { private fun handleThemeBinding() {
Scoop.getInstance() val scoop = Scoop.getInstance()
.bind(this, Toppings.PRIMARY.value, toolBar) scoop.bind(this, Toppings.PRIMARY.value, toolBar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.value) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
} }
private fun handleThemeUpdate() { private fun handleThemeUpdate() {
Scoop.getInstance() val scoop = Scoop.getInstance()
.update(Toppings.PRIMARY.value, appColors.colorPrimary) scoop.update(Toppings.PRIMARY.value, appColors.colorPrimary)
.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scoop.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark)
}
} }
private fun handleDrawer() { private fun handleDrawer() {

View File

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

View File

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

View File

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