import framework colors and always tint image buttons

This commit is contained in:
Adrian Ulrich 2015-04-13 16:55:39 +02:00
parent 12027036df
commit 3b084fcc02
4 changed files with 37 additions and 31 deletions

View File

@ -1,37 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 Christopher Eby <kreed@kreed.org>
Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<!-- framework colors -->
<color name="material_grey_300">#ffeeeeee</color>
<color name="material_grey_400">#bdbdbd</color>
<color name="material_grey_500">#ffa3a3a3</color>
<color name="material_grey_600">#ff757575</color>
<color name="material_grey_900">#ff212121</color>
<color name="button_material_light">#ffd6d7d7</color>
<!-- Color used in LibraryActivity list dividers -->
<color name="divider_color">#ffd6d7d7</color>
<color name="divider_color">@color/button_material_light</color>
<color name="overlay_background_color">#ffefefef</color>
<color name="overlay_foreground_color">#f000</color>
<color name="float_color">#ffd6d7d7</color>
<color name="float_color">@color/button_material_light</color>
<!-- Material design primary colors -->
<color name="vanillaPrimary">#607D8B</color>
<color name="vanillaPrimaryDark">#455A64</color>
<color name="vanillaAccent">#455A64</color>
<color name="material_grey_900">#ff212121</color>
<!-- now-playing screen buttons tint -->
<color name="controls_active">@color/vanillaPrimary</color>
<color name="controls_normal">@color/material_grey_600</color>
<!-- styling of the default cover bitmap -->
<color name="defaultcover_background">@color/overlay_background_color</color>

View File

@ -34,6 +34,10 @@ THE SOFTWARE.
<color name="defaultcover_gradient_end">#ff404040</color>
<color name="defaultcover_center">#88000000</color>
<!-- now-playing screen buttons tint -->
<color name="controls_active">@android:color/holo_blue_dark</color>
<color name="controls_normal">#fff5f5f5</color>
<!-- styles -->
<style name="Dialog" parent="android:Theme.Holo.Dialog" />
<style name="DialogMinWidth" parent="android:Theme.Holo.Dialog.MinWidth" />

View File

@ -417,9 +417,6 @@ public final class PlaybackService extends Service
Song.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_VANILLA, true) ? Song.mCoverLoadMode | Song.COVER_MODE_VANILLA : Song.mCoverLoadMode & ~(Song.COVER_MODE_VANILLA);
Song.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_SHADOW , true) ? Song.mCoverLoadMode | Song.COVER_MODE_SHADOW : Song.mCoverLoadMode & ~(Song.COVER_MODE_SHADOW);
// The 'light' (aka: material) theme is the default on Android 5.x
VanillaImageButton.mLightTheme = settings.getBoolean(PrefKeys.USE_LIGHT_THEME, Build.VERSION.SDK_INT >= 21);
mHeadsetOnly = settings.getBoolean(PrefKeys.HEADSET_ONLY, false);
mStockBroadcast = settings.getBoolean(PrefKeys.STOCK_BROADCAST, false);
mNotificationAction = createNotificationAction(settings);

View File

@ -26,20 +26,23 @@ import android.graphics.ColorFilter;
public class VanillaImageButton extends ImageButton {
public static boolean mLightTheme = false;
private Context mContext;
public VanillaImageButton(Context context) {
super(context);
mContext = context;
updateImageTint(-1);
}
public VanillaImageButton(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
updateImageTint(-1);
}
public VanillaImageButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
updateImageTint(-1);
}
@ -51,9 +54,8 @@ public class VanillaImageButton extends ImageButton {
private void updateImageTint(int resHint) {
boolean setFilter = mLightTheme == true;
int filterColor = R.color.controls_normal;
// These drawables should never be filtered:
switch (resHint) {
case R.drawable.repeat_active:
case R.drawable.repeat_current_active:
@ -61,14 +63,10 @@ public class VanillaImageButton extends ImageButton {
case R.drawable.shuffle_active:
case R.drawable.shuffle_album_active:
case R.drawable.random_active:
setFilter = false;
filterColor = R.color.controls_active;
}
if (setFilter == true) {
this.setColorFilter(Color.argb(255, 130, 130, 130));
} else {
this.setColorFilter(null);
}
this.setColorFilter(mContext.getResources().getColor(filterColor));
}
}