Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba268d24 authored by Dave Kover's avatar Dave Kover Committed by Nir Bruderman
Browse files

Expose background colors for theming.

The background colors are currently defined as a hard coded array
in Utils.java.  This patch moves this array to cm_arrays.xml and
exposes the colors of the array in cm_colors.xml for theming

Change-Id: Id72867ee82edd28bc120223be96c34448d79f1ae
(cherry picked from commit 03a55376)
parent e92d70b4
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2012-2014 The CyanogenMod Project
     Copyright (C) 2012-2015 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -29,4 +29,31 @@
        <item>@string/alarm_type_playlist</item>
        <item>@string/alarm_type_random</item>
    </string-array>

    <array name="background_color_by_hour">
        <item>@color/hour_00</item>
        <item>@color/hour_01</item>
        <item>@color/hour_02</item>
        <item>@color/hour_03</item>
        <item>@color/hour_04</item>
        <item>@color/hour_05</item>
        <item>@color/hour_06</item>
        <item>@color/hour_07</item>
        <item>@color/hour_08</item>
        <item>@color/hour_09</item>
        <item>@color/hour_10</item>
        <item>@color/hour_11</item>
        <item>@color/hour_12</item>
        <item>@color/hour_13</item>
        <item>@color/hour_14</item>
        <item>@color/hour_15</item>
        <item>@color/hour_16</item>
        <item>@color/hour_17</item>
        <item>@color/hour_18</item>
        <item>@color/hour_19</item>
        <item>@color/hour_20</item>
        <item>@color/hour_21</item>
        <item>@color/hour_22</item>
        <item>@color/hour_23</item>
    </array>
</resources>
+45 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2015 The CyanogenMod Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<resources>

    <!--- Colors modify the background of the clock and change hourly -->
    <color name="hour_00">#212121</color><!-- Midnight -->
    <color name="hour_01">#27232e</color>
    <color name="hour_02">#2d253a</color>
    <color name="hour_03">#332847</color>
    <color name="hour_04">#382a53</color>
    <color name="hour_05">#3e2c5f</color>
    <color name="hour_06">#442e6c</color>
    <color name="hour_07">#393a7a</color>
    <color name="hour_08">#2e4687</color>
    <color name="hour_09">#235395</color>
    <color name="hour_10">#185fa2</color>
    <color name="hour_11">#0d6baf</color>
    <color name="hour_12">#0277bd</color><!-- Noon -->
    <color name="hour_13">#0d6cb1</color>
    <color name="hour_14">#1861a6</color>
    <color name="hour_15">#23569b</color>
    <color name="hour_16">#2d4a8f</color>
    <color name="hour_17">#383f84</color>
    <color name="hour_18">#433478</color>
    <color name="hour_19">#3d3169</color>
    <color name="hour_20">#382e5b</color>
    <color name="hour_21">#322b4d</color>
    <color name="hour_22">#2c273e</color>
    <color name="hour_23">#272430</color>

</resources>
+2 −2
Original line number Diff line number Diff line
@@ -1162,7 +1162,7 @@ public class AlarmClockFragment extends DeskClockFragment implements
        }

        private int getTintedBackgroundColor() {
            final int c = Utils.getCurrentHourColor();
            final int c = Utils.getCurrentHourColor(getActivity());
            final int red = Color.red(c) + (int) (TINTED_LEVEL * (255 - Color.red(c)));
            final int green = Color.green(c) + (int) (TINTED_LEVEL * (255 - Color.green(c)));
            final int blue = Color.blue(c) + (int) (TINTED_LEVEL * (255 - Color.blue(c)));
@@ -1393,7 +1393,7 @@ public class AlarmClockFragment extends DeskClockFragment implements
        private void turnOnDayOfWeek(ItemHolder holder, int dayIndex) {
            final Button dayButton = holder.dayButtons[dayIndex];
            dayButton.setActivated(true);
            dayButton.setTextColor(Utils.getCurrentHourColor());
            dayButton.setTextColor(Utils.getCurrentHourColor(getActivity()));
        }


+1 −1
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        } else {
            duration = getResources().getInteger(android.R.integer.config_longAnimTime);
        }
        final int currHourColor = Utils.getCurrentHourColor();
        final int currHourColor = Utils.getCurrentHourColor(this);
        if (mLastHourColor != currHourColor) {
            final ObjectAnimator animator = ObjectAnimator.ofInt(getWindow().getDecorView(),
                    "backgroundColor", mLastHourColor, currHourColor);
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ public class SettingsActivity extends PreferenceActivity
    @Override
    protected void onResume() {
        super.onResume();
        getWindow().getDecorView().setBackgroundColor(Utils.getCurrentHourColor());
        getWindow().getDecorView().setBackgroundColor(Utils.getCurrentHourColor(this));
        refresh();
    }

Loading