Skip to content

Commit b5b1c86

Browse files
maxwentemasek
authored andcommitted
[Framework] Add config to apply custom shadow on header images
To make text and status icons better visible with bright images if required. - Fix headershadow derp, thanks to @xyyx Change-Id: I393d7eb55425e72a953947f0ce0a2b33f5ed3ef8
1 parent fd66d77 commit b5b1c86

File tree

3 files changed

+207
-0
lines changed

3 files changed

+207
-0
lines changed

core/java/android/provider/Settings.java

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,6 +3818,14 @@ public boolean validate(String value) {
38183818
*/
38193819
public static final String STATUS_BAR_CUSTOM_HEADER = "status_bar_custom_header";
38203820

3821+
/**
3822+
*
3823+
* Whether to apply a shadow on top of the header image
3824+
* value is the alpha value of the shadow image is 0 -> no shadow -> 255 black
3825+
* @hide
3826+
*/
3827+
public static final String STATUS_BAR_CUSTOM_HEADER_SHADOW = "status_bar_custom_header_shadow";
3828+
38213829
/**
38223830
* Current active provider
38233831
* @hide
@@ -4454,6 +4462,186 @@ public boolean validate(String value) {
44544462
* @hide
44554463
*/
44564464
public static final String PA_PIE_BUTTON_COLOR = "pa_pie_button_color";
4465+
<<<<<<< HEAD
4466+
=======
4467+
4468+
/**
4469+
* @hide
4470+
*/
4471+
public static final String PA_PIE_SNAP_BACKGROUND = "pa_pie_snap_background";
4472+
4473+
/**
4474+
* @hide
4475+
*/
4476+
public static final String PA_PIE_BACKGROUND = "pa_pie_background";
4477+
4478+
/**
4479+
* @hide
4480+
*/
4481+
public static final String PA_PIE_SELECT = "pa_pie_select";
4482+
4483+
/**
4484+
* @hide
4485+
*/
4486+
public static final String PA_PIE_OUTLINES = "pa_pie_outlines";
4487+
4488+
/**
4489+
* @hide
4490+
*/
4491+
public static final String PA_PIE_STATUS_CLOCK = "pa_pie_status_clock";
4492+
4493+
/**
4494+
* @hide
4495+
*/
4496+
public static final String PA_PIE_STATUS = "pa_pie_status";
4497+
4498+
/**
4499+
* AOKP Custom System Animations
4500+
* @hide
4501+
*/
4502+
public static final String[] ACTIVITY_ANIMATION_CONTROLS = new String[] {
4503+
"activity_open",
4504+
"activity_close",
4505+
"task_open",
4506+
"task_close",
4507+
"task_to_front",
4508+
"task_to_back",
4509+
"wallpaper_open",
4510+
"wallpaper_close",
4511+
"wallpaper_intra_open",
4512+
"wallpaper_intra_close",
4513+
"task_open_behind",
4514+
};
4515+
public static final String ANIMATION_CONTROLS_DURATION = "animation_controls_duration";
4516+
4517+
public static final String ANIMATION_CONTROLS_NO_OVERRIDE = "animation_controls_no_override";
4518+
4519+
public static final String ANIMATION_CONTROLS_EXIT_ONLY = "animation_controls_exit_only";
4520+
4521+
public static final String ANIMATION_CONTROLS_REVERSE_EXIT = "animation_controls_reverse_exit";
4522+
4523+
/**
4524+
* ListView Animations
4525+
* 0 == None
4526+
* 1 == Wave (Left)
4527+
* 2 == Wave (Right)
4528+
* 3 == Scale
4529+
* 4 == Alpha
4530+
* 5 == Stack (Top)
4531+
* 6 == Stack (Bottom)
4532+
* 7 == Translate (Left)
4533+
* 8 == Translate (Right)
4534+
* @hide
4535+
*/
4536+
public static final String LISTVIEW_ANIMATION = "listview_animation";
4537+
4538+
/**
4539+
* ListView Interpolators
4540+
* 0 == None
4541+
* 1 == accelerate_interpolator
4542+
* 2 == decelerate_interpolator
4543+
* 3 == accelerate_decelerate_interpolator
4544+
* 4 == anticipate_interpolator
4545+
* 5 == overshoot_interpolator
4546+
* 6 == anticipate_overshoot_interpolator
4547+
* 7 == bounce_interpolator
4548+
* @hide
4549+
*/
4550+
public static final String LISTVIEW_INTERPOLATOR = "listview_interpolator";
4551+
4552+
/**
4553+
* Toast animations
4554+
*
4555+
* @hide
4556+
*/
4557+
public static final String TOAST_ANIMATION = "toast_animation";
4558+
4559+
/**
4560+
*
4561+
* @hide
4562+
*/
4563+
public static final String ANIMATION_IME_DURATION = "animation_ime_duration";
4564+
4565+
/**
4566+
*
4567+
* @hide
4568+
*/
4569+
public static final String ANIMATION_IME_ENTER = "animation_ime_enter";
4570+
4571+
/**
4572+
*
4573+
* @hide
4574+
*/
4575+
public static final String ANIMATION_IME_EXIT = "animation_ime_exit";
4576+
4577+
/**
4578+
*
4579+
* @hide
4580+
*/
4581+
public static final String ANIMATION_IME_INTERPOLATOR = "animation_ime_interpolator";
4582+
4583+
/**
4584+
* @hide
4585+
*/
4586+
public static final String PA_PIE_CHEVRON = "pa_pie_chevron";
4587+
4588+
/**
4589+
* @hide
4590+
*/
4591+
public static final String PA_PIE_ALWAYS_RIGHT = "pa_pie_always_right";
4592+
4593+
/**
4594+
* Defines the shortcuts to be shown on lockscreen
4595+
* Usage is like this: target:icon|target:icon|target:icon
4596+
* if :icon is not set, default application icon will be used
4597+
* @hide
4598+
*/
4599+
public static final String LOCKSCREEN_SHORTCUTS = "lockscreen_shortcuts";
4600+
4601+
/**
4602+
* Whether shorcuts open with normal or longpress
4603+
* @hide
4604+
*/
4605+
public static final String LOCKSCREEN_SHORTCUTS_LONGPRESS = "lockscreen_shortcuts_longpress";
4606+
4607+
/**
4608+
* Volume key controls ringtone or media sound stream
4609+
* @hide
4610+
*/
4611+
public static final String VOLUME_KEYS_CONTROL_RING_STREAM =
4612+
"volume_keys_control_ring_stream";
4613+
4614+
/**
4615+
* Enable built in CAF task manager
4616+
* @hide
4617+
*/
4618+
public static final String ENABLE_TASK_MANAGER = "enable_task_manager";
4619+
4620+
/**
4621+
* Enable vibration when double tapping the power button for camera
4622+
* @hide
4623+
*/
4624+
public static final String DOUBLE_TAP_VIBRATE = "double_tap_vibrate";
4625+
4626+
/**
4627+
* Whether to enable status and navigation bar color in battery saver mode.
4628+
*
4629+
* @hide
4630+
*/
4631+
public static final String BATTERY_SAVER_MODE_COLOR = "battery_save_mode_color";
4632+
4633+
/**
4634+
* Timeout for ambient display notification
4635+
* @hide
4636+
*/
4637+
public static final String DOZE_TIMEOUT = "doze_timeout";
4638+
4639+
/**
4640+
* Use pick up gesture sensor as doze pulse trigger
4641+
* @hide
4642+
*/
4643+
public static final String DOZE_TRIGGER_PICKUP = "doze_trigger_pickup";
4644+
>>>>>>> 2fd6ca2... [Framework] Add config to apply custom shadow on header images
44574645

44584646
/**
44594647
* @hide

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ protected void observe() {
607607
resolver.registerContentObserver(Settings.System.getUriFor(
608608
Settings.System.QS_NUM_TILE_ROWS), false, this,
609609
UserHandle.USER_ALL);
610+
resolver.registerContentObserver(Settings.System.getUriFor(
611+
Settings.System.STATUS_BAR_CUSTOM_HEADER_SHADOW), false, this,
612+
UserHandle.USER_ALL);
613+
610614
update();
611615
}
612616

packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import android.graphics.Outline;
3131
import android.graphics.Rect;
3232
import android.graphics.drawable.Animatable;
33+
import android.graphics.drawable.ColorDrawable;
3334
import android.graphics.drawable.Drawable;
3435
import android.graphics.drawable.RippleDrawable;
3536
import android.graphics.drawable.TransitionDrawable;
@@ -516,6 +517,7 @@ private void updateVisibilities() {
516517
mDockBatteryLevel.setForceShown(mExpanded && mShowBatteryTextExpanded);
517518
mDockBatteryLevel.setVisibility(View.VISIBLE);
518519
}
520+
applyHeaderBackgroundShadow();
519521
}
520522

521523
private void updateSignalClusterDetachment() {
@@ -1294,6 +1296,19 @@ private void setNotificationPanelHeaderBackground(final Drawable dw, final boole
12941296
} else {
12951297
mBackgroundImage.setImageDrawable(dw);
12961298
}
1299+
applyHeaderBackgroundShadow();
1300+
}
1301+
1302+
private void applyHeaderBackgroundShadow() {
1303+
final int headerShadow = Settings.System.getIntForUser(mContext.getContentResolver(),
1304+
Settings.System.STATUS_BAR_CUSTOM_HEADER_SHADOW, 0,
1305+
UserHandle.USER_CURRENT);
1306+
1307+
if (mBackgroundImage != null) {
1308+
ColorDrawable shadow = new ColorDrawable(Color.BLACK);
1309+
shadow.setAlpha(headerShadow);
1310+
mBackgroundImage.setForeground(shadow);
1311+
}
12971312
}
12981313

12991314
@Override

0 commit comments

Comments
 (0)