Clean ups. Replaced deprecated getResources.getColor() with ContextCompat.getColor(this, int color)
This commit is contained in:
parent
48337bb7da
commit
c0e345fcef
9 changed files with 37 additions and 22 deletions
|
|
@ -21,6 +21,7 @@ import android.support.design.widget.AppBarLayout.OnOffsetChangedListener;
|
|||
import android.support.design.widget.NavigationView;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
|
@ -195,7 +196,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
new int[]{
|
||||
// 0,
|
||||
colorAccent,
|
||||
ThemeSingleton.get().darkTheme ? getResources().getColor(R.color.primary_text_default_material_dark) : getResources().getColor(R.color.primary_text_default_material_light)
|
||||
ThemeSingleton.get().darkTheme ? ContextCompat.getColor(this, R.color.primary_text_default_material_dark) : ContextCompat.getColor(this, R.color.primary_text_default_material_light)
|
||||
}
|
||||
));
|
||||
navigationView.setItemIconTintList(new ColorStateList(
|
||||
|
|
@ -207,7 +208,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
new int[]{
|
||||
// 0,
|
||||
colorAccent,
|
||||
ThemeSingleton.get().darkTheme ? getResources().getColor(R.color.secondary_text_default_material_dark) : getResources().getColor(R.color.secondary_text_default_material_light)
|
||||
ThemeSingleton.get().darkTheme ? ContextCompat.getColor(this, R.color.secondary_text_default_material_dark) : ContextCompat.getColor(this, R.color.secondary_text_default_material_light)
|
||||
}
|
||||
));
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
|
|
|
|||
|
|
@ -1156,8 +1156,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
@Override
|
||||
public void set(FloatingActionButton object, Integer value) {
|
||||
object.setBackgroundTintList(ColorStateList.valueOf(value));
|
||||
object.setRippleColor(shiftColorDown(value));
|
||||
object.getDrawable().setColorFilter(ColorUtil.getDrawableColorForBackground(object.getContext(), value), PorterDuff.Mode.SRC_IN);
|
||||
object.getDrawable().setColorFilter(ColorUtil.getFabDrawableColorForBackground(object.getContext(), value), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
});
|
||||
|
||||
int fabColor = getThemeColorAccent();
|
||||
int fabDrawableColor = ColorUtil.getDrawableColorForBackground(this, fabColor);
|
||||
int fabDrawableColor = ColorUtil.getFabDrawableColorForBackground(this, fabColor);
|
||||
fab.setBackgroundTintList(ColorStateList.valueOf(fabColor));
|
||||
fab.getDrawable().setColorFilter(fabDrawableColor, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue