Skip to content

Commit fa51360

Browse files
committed
Add SlimRoms Recents app screen (Squashed) (1/2):
Included: Commit zsol#1: Add SlimRoms Recents app screen, (wip) (1/2): 22f78a4 Based on SlimRoms: Pulled out from "Slim framework": https://github.com/SlimRoms/frameworks_opt_slim Included additions by SlimRoms: - Option to use Slim- or Android recents - Option to show running tasks only - Option to show the panel on the left edge of the sreen, (on the right edge on rtl languages) - Panel scale - Favorites - Card expanded mode - Option to show the topmost task, too - Panel background color - Card background color - App title text color DarkKat additions/changes: - Header icon color, (disabled for now) - Disable panel background color for now - Disable card background color for now - Disable app title text color for now - Fixed default header icon colors, (colors are related to the header background, light colored icons on dark colored backgrounds dark colored icons on light colored backgrounds) TO-DO: - Enable custom colors - Add day/night theme support Commit zsol#2: SlimRoms Recents app screen part 2, (wip) (1/2): (day/night themes support, custom colors) ad91d5d - Add day/night theme support - Option to use theme or custom colors - Change card background color to the app activity primary color, (when available) - Enable custom panel background color - Add custom panel empty icon color - Enable custom card background color - Add custom card header background color - Add custom card header activated background color - Enable custom card header text color - Enable custom card header icon color Default colors (Use theme colors enabled): - Panel background color: - 0x80000000 (translucent black) - Panel empty icon color: - 0xbffffff, "secondary text material dark", (default for "normal icon state") - Card background color: - Uses the app activity primary color when available, otherwise the "background floating material" color of the current general theme - Card header background color: - Uses the app activity primary color when available, otherwise the "background floating material" color of the current general theme - Card header activated background color: - Uses a darker/lighter version of the Card header background color - Card header text color: - Uses the matching "primary text material" color, (related to the Card header background color) - Card header icon color: - Uses the matching "secondary text material" color, (default for "normal icon state") (related to the Card header background color) Default colors (Use theme colors disabled): - Panel background color: - 0x80000000 (translucent black) - Panel empty icon color: - 0xbffffff, "secondary text material dark", (default for "normal icon state") - Card background color: - Uses the "background floating material" color of the current general theme - Card header background color: - Uses the "background floating material" color of the current general theme - Card header activated background color: - Uses a darker/lighter version of the Card header background color - Card header text color: - Uses the "primary text material" color, of the current general theme - Card header icon color: - Uses the "secondary text material" color of the current general theme, (default for "normal icon state") TO-DO: - Use "real cards", (these cards are something between cards and tiles): - Use rounded corners - Overwork the "header only" layout - Use collapsed cards - Add a frame to the expanded card thumbnail, (the thumbnail should be always visible as an additional element) - Use the CardView class from the support library for the cards Commit zsol#3: SlimRoms Recents app screen part 3, (wip) (1/2): 74f6c3a - Change day theme panel background color: - Translucent white (#80ffffff) - Change day theme panel empty icon color: - Text color secondary, (default for dark icons on light backgrounds) (#8a000000) - Remove header background color - Remove header activated background color - Remove header icon color - Add action icon color - Add action ripple color - Remove scale factor - Add thumbnail aspect ratio: - 1 : 1 - 5 : 4 - 4 : 3 - 16 : 9 - Use Support CardView library instead of Cards library - Place actions in an action bar at the card bottom instead of the header reached via long click (the action bar will be shown even when the card is collapsed) - Add a frame to the expanded card thumbnail - Add Settings changes (colors, theme, options, ...) directly, instead of rebuilding the recents screen TO-DO: - Add an option to hide the action bar when the card is collapsed, (possibly also a header long click action to show/hide the action bar) - Add an option to use the app activity primary color for the card background in general, to have the same behavior when using theme or custom colors Commit #4: SlimRoms Recents app screen part 4, (wip) (1/2): 61ecac7 - Add an general option to auto colorize the cards, when enabled and the related activity contains a primary color, this color will be used as the card background color, all other card colors, (text, icon and ripple) will be set, related to the card background, automatically, (dark text, - icons and - ripple on light backgrounds and vise versa) this is the same behavior which was used before, when "use theme colors" for recents whas enabled. - Show/hide the card actions when the card is collapsed, the actions are always be visible when the card is expanded, when the card is collapsed, the actions can be shown/hidden on header long click, the actions visibility states will be stored per card during the session, (similar to the card expanded states)
1 parent 86a5f0d commit fa51360

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4897
-13
lines changed

core/java/android/provider/Settings.java

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3745,6 +3745,46 @@ public boolean validate(String value) {
37453745
public static final String STATUS_BAR_EXPANDED_RIPPLE_COLOR =
37463746
"status_bar_expanded_ripple_color";
37473747

3748+
/**
3749+
* Wether to use the primary activity color (when available) as background color for the card,
3750+
* also set all other card colors related to the primary activity color (when available)
3751+
*
3752+
* @hide
3753+
*/
3754+
public static final String SLIM_RECENTS_CARD_USE_AUTO_COLORS =
3755+
"colors_slim_recents_card_use_auto_colors";
3756+
3757+
/**
3758+
* Wether to use slim recents color values from global theme
3759+
* @hide
3760+
*/
3761+
public static final String SLIM_RECENTS_USE_THEME_COLORS =
3762+
"slim_recents_use_theme_colors";
3763+
3764+
/**
3765+
* Recent panel empty icon color
3766+
*
3767+
* @hide
3768+
*/
3769+
public static final String SLIM_RECENTS_PANEL_EMPTY_ICON_COLOR =
3770+
"slim_recents_panel_empty_icon_color";
3771+
3772+
/**
3773+
* Recent card ripple effect color
3774+
*
3775+
* @hide
3776+
*/
3777+
public static final String SLIM_RECENTS_CARD_RIPPLE_COLOR =
3778+
"slim_recents_card_ripple_color";
3779+
3780+
/**
3781+
* Recent card action icon color
3782+
*
3783+
* @hide
3784+
*/
3785+
public static final String SLIM_RECENTS_CARD_ACTION_ICON_COLOR =
3786+
"slim_recents_card_action_icon_color";
3787+
37483788
/**
37493789
* Whether to show the music visualizer on the lock screen
37503790
* @hide
@@ -4133,8 +4173,98 @@ public boolean validate(String value) {
41334173
*/
41344174
public static final String POWER_MENU_SHOW_ADVANCED_REBOOT = "power_menu_show_advanced_reboot";
41354175

4176+
/**
4177+
* Slim Rexents thumbnail aspect ratio
4178+
* 0 - 1 : 1
4179+
* 1 - 5 : 4
4180+
* 2 - 4 : 3
4181+
* 3 - 16 : 9
4182+
* default: 0
4183+
* @hide
4184+
*/
4185+
public static final String SLIM_RECENTS_THUMBNAIL_ASPECT_RATIO =
4186+
"slim_recents_thumbnail_aspect_ratio";
4187+
4188+
/**
4189+
* Whether to show actions when the card is collapsed
4190+
* @hide
4191+
*/
4192+
public static final String SLIM_RECENTS_SHOW_ACTIONS_WHEN_COLLAPSED =
4193+
"slim_recents_show_actions_when_collapsed";
4194+
41364195
// DarkKat additions end
41374196

4197+
// SlimRoms additions
4198+
4199+
/**
4200+
* Recent panel background color
4201+
*
4202+
* @hide
4203+
*/
4204+
public static final String SLIM_RECENTS_PANEL_BG_COLOR = "slim_recents_panel_bg_color";
4205+
4206+
/**
4207+
* Recent card background color
4208+
*
4209+
* @hide
4210+
*/
4211+
public static final String SLIM_RECENTS_CARD_BG_COLOR = "slim_recents_card_bg_color";
4212+
4213+
/**
4214+
* Recent card header text color
4215+
*
4216+
* @hide
4217+
*/
4218+
public static final String SLIM_RECENTS_CARD_HEADER_TEXT_COLOR = "slim_recents_card_header_text_color";
4219+
4220+
/**
4221+
* Whether to use slim recents
4222+
* @hide
4223+
*/
4224+
public static final String USE_SLIM_RECENTS = "use_slim_recents";
4225+
4226+
/**
4227+
* Recent panel expanded mode (auto = 0, always = 1, never = 2).
4228+
* default = 0.
4229+
*
4230+
* @hide
4231+
*/
4232+
public static final String SLIM_RECENTS_PANEL_EXPANDED_MODE =
4233+
"slim_recents_panel_expanded_mode";
4234+
4235+
/**
4236+
* Whether recent panel gravity is left or right (default = Gravity.RIGHT).
4237+
* @hide
4238+
*/
4239+
public static final String SLIM_RECENTS_PANEL_GRAVITY = "slim_recents_panel_gravity";
4240+
4241+
/**
4242+
* Whether to only show actually running tasks
4243+
* @hide
4244+
*/
4245+
public static final String SLIM_RECENTS_SHOW_RUNNING_TASKS = "slim_recents_show_running_tasks";
4246+
4247+
/**
4248+
* Recent panel: Show topmost task
4249+
*
4250+
* @hide
4251+
*/
4252+
public static final String SLIM_RECENTS_PANEL_SHOW_TOPMOST = "slim_recents_panel_show_topmost";
4253+
4254+
/**
4255+
* Amount of apps to show in recents
4256+
* @hide
4257+
*/
4258+
public static final String SLIM_RECENTS_MAX_APPS = "slim_recents_max_apps";
4259+
4260+
/**
4261+
* User favorite tasks for recent panel.
4262+
* @hide
4263+
*/
4264+
public static final String SLIM_RECENTS_PANEL_FAVORITES = "slim_recents_panel_favorites";
4265+
4266+
// SlimRoms additions end
4267+
41384268
/**
41394269
* IMPORTANT: If you add a new public settings you also have to add it to
41404270
* PUBLIC_SETTINGS below. If the new setting is hidden you have to add

core/java/com/android/internal/util/darkkat/ColorConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,7 @@ public class ColorConstants {
108108
public static final int QS_TILE_DISABLED_ALPHA = 97;
109109
public static final int QS_TILE_INACTIVE_ALPHA = 74;
110110
public static final int QS_TILE_UNAVAILABLE_ALPHA = 64;
111+
112+
// Slim recents
113+
public static final int SLIM_RECENTS_PANEL_BG_ALPHA = 128;
111114
}
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*
2+
* Copyright (C) 2016 DarkKat
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.android.internal.util.darkkat;
18+
19+
import android.content.Context;
20+
import android.graphics.Color;
21+
import android.provider.Settings;
22+
23+
public class SlimRecentsColorHelper {
24+
25+
public static int getPanelBackgroundColor(Context context) {
26+
int color;
27+
28+
if (ThemeHelper.slimRecentsUseThemeColors(context)) {
29+
color = ThemeHelper.getSlimRecentsPanelBgColor(context);
30+
} else {
31+
color = Settings.System.getInt(context.getContentResolver(),
32+
Settings.System.SLIM_RECENTS_PANEL_BG_COLOR,
33+
ThemeHelper.getSlimRecentsPanelBgColor(context));
34+
}
35+
36+
return (ColorConstants.SLIM_RECENTS_PANEL_BG_ALPHA << 24) | (color & 0x00ffffff);
37+
}
38+
39+
public static int getPanelEmptyIconColor(Context context) {
40+
int color;
41+
int alpha;
42+
43+
if (ThemeHelper.slimRecentsUseThemeColors(context)) {
44+
color = ThemeHelper.getSlimRecentsPanelEmptyIconColor(context);
45+
alpha = Color.alpha(color);
46+
} else {
47+
color = Settings.System.getInt(context.getContentResolver(),
48+
Settings.System.SLIM_RECENTS_PANEL_EMPTY_ICON_COLOR,
49+
ThemeHelper.getSlimRecentsPanelEmptyIconColor(context));
50+
if (ThemeHelper.getTheme(context) != ThemeHelper.THEME_MATERIAL_LIGHT) {
51+
alpha = ColorConstants.ICON_NORMAL_ALPHA_NIGHT;
52+
} else {
53+
alpha = ColorConstants.ICON_NORMAL_ALPHA_DAY;
54+
}
55+
}
56+
57+
return (alpha << 24) | (color & 0x00ffffff);
58+
}
59+
60+
public static int getCardBackgroundColor(Context context) {
61+
int color;
62+
63+
if (ThemeHelper.slimRecentsUseThemeColors(context)) {
64+
color = ThemeHelper.getColorBackgroundFloating(context);
65+
} else {
66+
color = Settings.System.getInt(context.getContentResolver(),
67+
Settings.System.SLIM_RECENTS_CARD_BG_COLOR,
68+
ThemeHelper.getColorBackgroundFloating(context));
69+
}
70+
71+
return (ColorConstants.FULLY_OPAQUE_ALPHA << 24) | (color & 0x00ffffff);
72+
}
73+
74+
public static int getCardRippleColor(Context context) {
75+
int color;
76+
int alpha;
77+
78+
if (ThemeHelper.slimRecentsUseThemeColors(context)) {
79+
color = ThemeHelper.getRippleColor(context);
80+
alpha = Color.alpha(color);
81+
} else {
82+
color = Settings.System.getInt(context.getContentResolver(),
83+
Settings.System.SLIM_RECENTS_CARD_RIPPLE_COLOR,
84+
ThemeHelper.getRippleColor(context));
85+
if (ThemeHelper.getTheme(context) != ThemeHelper.THEME_MATERIAL_LIGHT) {
86+
alpha = ColorConstants.HIGHTLIGHT_ALPHA_NIGHT;
87+
} else {
88+
alpha = ColorConstants.HIGHTLIGHT_ALPHA_DAY;
89+
}
90+
}
91+
92+
return (alpha << 24) | (color & 0x00ffffff);
93+
}
94+
95+
public static int getCardHeaderTextColor(Context context) {
96+
int color;
97+
int alpha;
98+
99+
if (ThemeHelper.slimRecentsUseThemeColors(context)) {
100+
color = ThemeHelper.getPrimaryTextColor(context);
101+
alpha = Color.alpha(color);
102+
} else {
103+
color = Settings.System.getInt(context.getContentResolver(),
104+
Settings.System.SLIM_RECENTS_CARD_HEADER_TEXT_COLOR,
105+
ThemeHelper.getPrimaryTextColor(context));
106+
if (ThemeHelper.getTheme(context) != ThemeHelper.THEME_MATERIAL_LIGHT) {
107+
alpha = ColorConstants.TEXT_PRIMARY_ALPHA_NIGHT;
108+
} else {
109+
alpha = ColorConstants.TEXT_PRIMARY_ALPHA_DAY;
110+
}
111+
}
112+
113+
return (alpha << 24) | (color & 0x00ffffff);
114+
}
115+
116+
public static int getCardActionIconColor(Context context) {
117+
int color;
118+
int alpha;
119+
120+
if (ThemeHelper.slimRecentsUseThemeColors(context)) {
121+
color = ThemeHelper.getIconColor(context);
122+
alpha = Color.alpha(color);
123+
} else {
124+
color = Settings.System.getInt(context.getContentResolver(),
125+
Settings.System.SLIM_RECENTS_CARD_ACTION_ICON_COLOR,
126+
ThemeHelper.getIconColor(context));
127+
if (ThemeHelper.getTheme(context) != ThemeHelper.THEME_MATERIAL_LIGHT) {
128+
alpha = ColorConstants.ICON_NORMAL_ALPHA_NIGHT;
129+
} else {
130+
alpha = ColorConstants.ICON_NORMAL_ALPHA_DAY;
131+
}
132+
}
133+
134+
return (alpha << 24) | (color & 0x00ffffff);
135+
}
136+
}

core/java/com/android/internal/util/darkkat/ThemeHelper.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ public static boolean statusBarExpandedUseThemeColors(Context context) {
4040
Settings.System.STATUS_BAR_EXPANDED_USE_THEME_COLORS, 1) == 1;
4141
}
4242

43-
// General
43+
public static boolean slimRecentsUseThemeColors(Context context) {
44+
return Settings.System.getInt(context.getContentResolver(),
45+
Settings.System.SLIM_RECENTS_USE_THEME_COLORS, 1) == 1;
46+
}
4447

48+
// General
4549
public static int getColorBackground(Context context) {
4650
if (getTheme(context) == THEME_DARKKAT) {
4751
return ColorConstants.DARKKAT_BLUE_GREY;
@@ -120,7 +124,6 @@ public static int getDividerColor(Context context) {
120124
}
121125

122126
// SystemUI
123-
124127
public static int getSystemUIPrimaryColor(Context context) {
125128
if (getTheme(context) == THEME_DARKKAT) {
126129
return ColorConstants.SYSTEMUI_PRIMARY_DARKKAT;
@@ -159,4 +162,30 @@ public static int getSystemUIRippleAccentColor(Context context) {
159162
return (ColorConstants.RIPPLE_ALPHA_COLORED << 24)
160163
| (getSystemUIAccentColor(context) & 0x00ffffff);
161164
}
165+
166+
// Slim recents
167+
public static int getSlimRecentsPanelBgColor(Context context) {
168+
if (getTheme(context) == THEME_DARKKAT) {
169+
return ColorConstants.DARKKAT_BLUE_GREY;
170+
} else if (getTheme(context) == THEME_MATERIAL_LIGHT) {
171+
return ColorConstants.WHITE;
172+
} else {
173+
return ColorConstants.BLACK;
174+
}
175+
}
176+
177+
public static int getSlimRecentsPanelEmptyIconColor(Context context) {
178+
int color;
179+
int alpha;
180+
181+
if (getTheme(context) == THEME_MATERIAL_LIGHT) {
182+
color = ColorConstants.BLACK;
183+
alpha = ColorConstants.ICON_NORMAL_ALPHA_DAY;
184+
} else {
185+
color = ColorConstants.WHITE;
186+
alpha = ColorConstants.ICON_NORMAL_ALPHA_NIGHT;
187+
}
188+
189+
return (alpha << 24) | (color & 0x00ffffff);
190+
}
162191
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2014-2017, SlimRoms Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<set xmlns:android="http://schemas.android.com/apk/res/android"
21+
android:interpolator="@android:anim/decelerate_interpolator">
22+
<translate android:fromXDelta="100%p" android:toXDelta="0"
23+
android:duration="@android:integer/config_recentDefaultDur"/>
24+
</set>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2014-2017 SlimRoms Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<set xmlns:android="http://schemas.android.com/apk/res/android"
21+
android:interpolator="@android:anim/decelerate_interpolator">
22+
<translate android:fromXDelta="-100%p" android:toXDelta="0"
23+
android:duration="@android:integer/config_recentDefaultDur"/>
24+
</set>

0 commit comments

Comments
 (0)