Merge "Update System UI to use theme colors." into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cac2dd8ce8
@@ -753,4 +753,15 @@ easier.
|
||||
|
||||
<!-- DeviceDefault theme for the default system theme. -->
|
||||
<style name="Theme.DeviceDefault.System" parent="Theme.DeviceDefault.Light.DarkActionBar" />
|
||||
|
||||
<style name="ThemeOverlay.DeviceDefault" />
|
||||
|
||||
<style name="ThemeOverlay.DeviceDefault.Accent">
|
||||
<item name="colorAccent">@color/accent_device_default_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.DeviceDefault.Accent.Light">
|
||||
<item name="colorAccent">@color/accent_device_default_light</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.android.settingslib;
|
||||
|
||||
import android.annotation.ColorInt;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
@@ -8,6 +9,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.pm.Signature;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -154,6 +156,14 @@ public class Utils {
|
||||
return statusString;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int getColorAccent(Context context) {
|
||||
TypedArray ta = context.obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
|
||||
@ColorInt int colorAccent = ta.getColor(0, 0);
|
||||
ta.recycle();
|
||||
return colorAccent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a package is a "system package", in which case certain things (like
|
||||
* disabling notifications or disabling the package altogether) should be disallowed.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true"
|
||||
android:color="@*android:color/material_deep_teal_500" />
|
||||
android:color="?android:attr/colorAccent" />
|
||||
<item android:color="@android:color/black"
|
||||
android:alpha=".54" />
|
||||
</selector>
|
||||
20
packages/SystemUI/res/color/qs_detail_progress_track.xml
Normal file
20
packages/SystemUI/res/color/qs_detail_progress_track.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 The Android Open Source 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.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- I really don't want to define this, but the View that uses this asset uses both the
|
||||
light and dark accent colors. -->
|
||||
<item android:alpha="0.6" android:drawable="@*android:color/accent_device_default_light" />
|
||||
</selector>
|
||||
@@ -17,6 +17,6 @@
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:color="@color/current_user_border_color" />
|
||||
<item android:state_activated="true" android:color="?android:attr/colorAccent" />
|
||||
<item android:color="@android:color/transparent" />
|
||||
</selector>
|
||||
@@ -17,7 +17,7 @@
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:color="@color/current_user_border_color" />
|
||||
<item android:state_activated="true" android:color="?android:attr/colorAccent" />
|
||||
<item android:state_enabled="false" android:color="@color/qs_tile_disabled_color" />
|
||||
<item android:color="#66ffffff" /> <!-- 40% white -->
|
||||
</selector>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
<!-- Copyright (C) 2016 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -13,11 +13,6 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/fab_ripple">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/fab_shape" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.25" android:color="?android:attr/colorAccent" />
|
||||
</selector>
|
||||
@@ -15,5 +15,5 @@
|
||||
~ limitations under the License
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/system_primary_color" />
|
||||
<solid android:color="?android:attr/colorPrimary" />
|
||||
</shape>
|
||||
|
||||
@@ -20,7 +20,7 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:pathData="m18.250000,12.000000a6.250000,6.250000 0.000000,1.000000 1.000000,-12.500000 0.000000,6.250000 6.250000,0.000000 1.000000,1.000000 12.500000,0.000000z"
|
||||
android:fillColor="@color/system_primary_color" />
|
||||
android:fillColor="?android:attr/colorPrimary" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M20.000000,8.700000L20.000000,4.000000L15.300000,4.000000L12.000000,0.700000 8.700000,4.000000L4.000000,4.000000L4.000000,8.700000L0.700000,12.000000 4.000000,15.300000L4.000000,20.000000L8.700000,20.000000L12.000000,23.299999 15.300000,20.000000L20.000000,20.000000L20.000000,15.300000L23.299999,12.000000 20.000000,8.700000zM12.000000,18.000000C8.700000,18.000000 6.000000,15.300000 6.000000,12.000000 6.000000,8.700000 8.700000,6.000000 12.000000,6.000000c3.300000,0.000000 6.000000,2.700000 6.000000,6.000000 0.000000,3.300000 -2.700000,6.000000 -6.000000,6.000000zM12.000000,8.000000c-2.200000,0.000000 -4.000000,1.800000 -4.000000,4.000000 0.000000,2.200000 1.800000,4.000000 4.000000,4.000000 2.200000,0.000000 4.000000,-1.800000 4.000000,-4.000000 0.000000,-2.200000 -1.800000,-4.000000 -4.000000,-4.000000z"/>
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
-->
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<shape>
|
||||
<solid android:color="@color/system_primary_color"/>
|
||||
<solid android:color="?android:attr/colorPrimary"/>
|
||||
</shape>
|
||||
</inset>
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
-->
|
||||
<transition xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/qs_detail_transition" />
|
||||
<item android:drawable="@color/system_primary_color" />
|
||||
<item android:drawable="?android:attr/colorPrimary" />
|
||||
</transition>
|
||||
|
||||
@@ -15,5 +15,5 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
-->
|
||||
<transition xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/qs_detail_transition" />
|
||||
<item android:drawable="@color/system_primary_color" />
|
||||
<item android:drawable="?android:attr/colorPrimary" />
|
||||
</transition>
|
||||
@@ -17,5 +17,5 @@
|
||||
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?android:attr/colorControlHighlight" >
|
||||
<item android:drawable="@color/system_primary_color"/>
|
||||
<item android:drawable="?android:attr/colorPrimary"/>
|
||||
</ripple>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval" >
|
||||
|
||||
<solid android:color="@color/system_accent_color" />
|
||||
<solid android:color="?android:attr/colorAccent" />
|
||||
|
||||
<size
|
||||
android:height="@dimen/screen_pinning_nav_highlight_size"
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?android:attr/colorControlHighlight">
|
||||
<item android:drawable="@color/switch_bar_background" />
|
||||
<item android:drawable="@color/system_secondary_color" />
|
||||
</ripple>
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<solid android:color="@color/system_primary_color" />
|
||||
<solid android:color="?android:attr/colorPrimary" />
|
||||
</shape>
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
<corners android:radius="@dimen/borderless_button_radius" />
|
||||
|
||||
<solid android:color="@color/zen_introduction_message_background" />
|
||||
<solid android:color="?android:attr/colorAccent" />
|
||||
|
||||
</shape>
|
||||
@@ -26,7 +26,8 @@
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@*android:dimen/notification_content_margin_start"
|
||||
android:paddingEnd="8dp"
|
||||
android:background="@color/notification_guts_bg_color">
|
||||
android:background="@color/notification_guts_bg_color"
|
||||
android:theme="@*android:style/Theme.DeviceDefault.Light">
|
||||
|
||||
<!-- header -->
|
||||
<LinearLayout
|
||||
@@ -145,8 +146,8 @@
|
||||
android:focusable="true"
|
||||
android:background="#00ffffff"
|
||||
android:progressBackgroundTint="@color/notification_guts_secondary_slider_color"
|
||||
android:thumbTint="@color/notification_guts_slider_color"
|
||||
android:progressTint="@color/notification_guts_slider_color"
|
||||
android:thumbTint="?android:attr/colorAccent"
|
||||
android:progressTint="?android:attr/colorAccent"
|
||||
style="@android:style/Widget.Material.SeekBar.Discrete"
|
||||
android:tickMarkTint="@android:color/black" />
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:theme="@android:style/Theme.DeviceDefault.Light">
|
||||
|
||||
<include
|
||||
android:layout_width="@dimen/screen_pinning_request_width"
|
||||
@@ -32,7 +33,7 @@
|
||||
android:id="@+id/spacer"
|
||||
android:layout_width="@dimen/screen_pinning_request_width"
|
||||
android:layout_height="18dp"
|
||||
android:background="@color/screen_pinning_request_bg" />
|
||||
android:background="?android:attr/colorAccent" />
|
||||
|
||||
<include
|
||||
android:layout_width="@dimen/screen_pinning_request_width"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
android:id="@+id/screen_pinning_buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/screen_pinning_request_button_height"
|
||||
android:background="@color/screen_pinning_request_bg" >
|
||||
android:background="?android:attr/colorAccent">
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/screen_pinning_request_side_width"
|
||||
@@ -42,7 +42,8 @@
|
||||
android:layout_height="@dimen/screen_pinning_request_button_height"
|
||||
android:layout_weight="0"
|
||||
android:paddingStart="@dimen/screen_pinning_request_frame_padding"
|
||||
android:paddingEnd="@dimen/screen_pinning_request_frame_padding" >
|
||||
android:paddingEnd="@dimen/screen_pinning_request_frame_padding"
|
||||
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/screen_pinning_back_bg_light"
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
android:id="@+id/screen_pinning_buttons"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="@dimen/screen_pinning_request_button_height"
|
||||
android:background="@color/screen_pinning_request_bg"
|
||||
android:orientation="vertical" >
|
||||
android:background="?android:attr/colorAccent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_height="@dimen/screen_pinning_request_side_width"
|
||||
@@ -82,7 +82,8 @@
|
||||
android:id="@+id/screen_pinning_back_group"
|
||||
android:layout_height="@dimen/screen_pinning_request_button_width"
|
||||
android:layout_width="@dimen/screen_pinning_request_button_height"
|
||||
android:layout_weight="0" >
|
||||
android:layout_weight="0"
|
||||
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/screen_pinning_back_bg_light"
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
android:layout_height="@dimen/screen_pinning_request_width"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="right|center_vertical"
|
||||
android:orientation="horizontal" >
|
||||
android:orientation="horizontal"
|
||||
android:theme="@android:style/Theme.DeviceDefault.Light">
|
||||
|
||||
<include
|
||||
android:layout_width="360dp"
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
android:id="@+id/screen_pinning_text_area"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/screen_pinning_request_bg"
|
||||
android:gravity="center_vertical" >
|
||||
android:background="?android:attr/colorAccent"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/screen_pinning_title"
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright 2012, The Android Open Source 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.
|
||||
-->
|
||||
|
||||
<!-- Extends RelativeLayout -->
|
||||
<com.android.systemui.statusbar.phone.StatusBarHeaderView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/header"
|
||||
android:layout_width="@dimen/notification_panel_width"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:layout_gravity="@integer/notification_panel_layout_gravity"
|
||||
android:baselineAligned="false"
|
||||
android:elevation="4dp"
|
||||
android:background="@drawable/notification_header_bg"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
>
|
||||
|
||||
<com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch"
|
||||
android:layout_width="@dimen/multi_user_switch_width_collapsed"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/ripple_drawable" >
|
||||
<ImageView android:id="@+id/multi_user_avatar"
|
||||
android:layout_width="@dimen/multi_user_avatar_expanded_size"
|
||||
android:layout_height="@dimen/multi_user_avatar_expanded_size"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerInside"/>
|
||||
</com.android.systemui.statusbar.phone.MultiUserSwitch>
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
|
||||
android:id="@+id/settings_button_container"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_toStartOf="@id/multi_user_switch">
|
||||
|
||||
<com.android.systemui.statusbar.phone.SettingsButton android:id="@+id/settings_button"
|
||||
style="@android:style/Widget.Material.Button.Borderless"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/ripple_drawable"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:contentDescription="@string/accessibility_desc_settings" />
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView android:id="@+id/tuner_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="36dp"
|
||||
android:tint="#4DFFFFFF"
|
||||
android:tintMode="src_in"
|
||||
android:visibility="invisible"
|
||||
android:src="@drawable/tuner" />
|
||||
|
||||
</com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/system_icons_super_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:layout_toStartOf="@id/multi_user_switch"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/ripple_drawable"
|
||||
android:paddingEnd="4dp" >
|
||||
<FrameLayout android:id="@+id/system_icons_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/status_bar_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
>
|
||||
<include layout="@layout/system_icons" />
|
||||
</FrameLayout>
|
||||
<TextView android:id="@+id/battery_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/header_battery_margin_expanded"
|
||||
android:paddingEnd="@dimen/battery_level_padding_end"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="@dimen/battery_level_text_size"
|
||||
android:importantForAccessibility="noHideDescendants"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_emergency_calls_only"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/system_icons_super_container"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:visibility="gone"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.EmergencyCallsOnly"
|
||||
android:text="@*android:string/emergency_calls_only"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/date_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/clock_collapsed_bottom_margin"
|
||||
android:layout_alignParentBottom="true">
|
||||
<com.android.systemui.statusbar.policy.DateView android:id="@+id/date_collapsed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
|
||||
android:layout_below="@id/clock"
|
||||
systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.policy.DateView android:id="@+id/date_expanded"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
|
||||
android:layout_below="@id/clock"
|
||||
systemui:datePattern="eeeeMMMMd"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/split_clock_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_above="@id/date_group"
|
||||
android:id="@+id/clock"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedButton android:id="@+id/alarm_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toEndOf="@id/date_group"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:drawableStart="@drawable/ic_access_alarms_small"
|
||||
android:textColor="#64ffffff"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<include
|
||||
android:id="@+id/qs_detail_header"
|
||||
layout="@layout/qs_detail_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:id="@+id/qs_detail_header_progress"
|
||||
android:src="@drawable/indeterminate_anim"
|
||||
android:alpha="0"
|
||||
android:background="@color/qs_detail_progress_track"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_debug_info"
|
||||
android:visibility="invisible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:textSize="11dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#00A040"
|
||||
android:padding="2dp"
|
||||
/>
|
||||
|
||||
</com.android.systemui.statusbar.phone.StatusBarHeaderView>
|
||||
@@ -22,7 +22,8 @@
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:clickable="true"
|
||||
android:gravity="center">
|
||||
android:gravity="center"
|
||||
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent">
|
||||
|
||||
<TextView android:id="@+id/switch_text"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -42,7 +43,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@null"
|
||||
android:theme="@style/ThemeOverlay.SwitchBar" />
|
||||
android:background="@null" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp"
|
||||
android:text="@string/volume_zen_end_now"
|
||||
android:textColor="@color/system_accent_color"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textAppearance="@style/TextAppearance.QS.DetailButton" />
|
||||
|
||||
</com.android.systemui.volume.ZenFooter>
|
||||
@@ -40,7 +40,8 @@
|
||||
android:layout_marginEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="@drawable/zen_introduction_message_background" >
|
||||
android:background="@drawable/zen_introduction_message_background"
|
||||
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent.Light">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/zen_introduction_confirm"
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
<color name="batterymeter_charge_color">#FFFFFFFF</color>
|
||||
<color name="batterymeter_bolt_color">#FFFFFFFF</color>
|
||||
<color name="qs_batterymeter_frame_color">#FF404040</color>
|
||||
<color name="system_primary_color">#ff263238</color><!-- blue grey 900 -->
|
||||
|
||||
<!-- TODO: use a theme color for this and delete it -->
|
||||
<color name="system_secondary_color">#ff37474F</color><!-- blue grey 800 -->
|
||||
<color name="system_accent_color">#ff80CBC4</color><!-- deep teal 200 -->
|
||||
|
||||
<color name="system_warning_color">#fff4511e</color><!-- deep orange 600 -->
|
||||
<color name="qs_text">#FFFFFFFF</color>
|
||||
<color name="qs_tile_divider">#29ffffff</color><!-- 16% white -->
|
||||
@@ -41,7 +42,6 @@
|
||||
<color name="qs_detail_button">#FFB0BEC5</color><!-- 100% blue grey 200 -->
|
||||
<color name="qs_detail_button_white">#B3FFFFFF</color><!-- 70% white -->
|
||||
<color name="qs_detail_transition">#66FFFFFF</color>
|
||||
<color name="qs_detail_progress_track">#99009688</color><!-- 60% deep teal 500 -->
|
||||
<color name="data_usage_secondary">#99FFFFFF</color><!-- 60% white -->
|
||||
<color name="data_usage_graph_track">#33FFFFFF</color><!-- 20% white -->
|
||||
<color name="data_usage_graph_warning">#FFFFFFFF</color>
|
||||
@@ -99,15 +99,11 @@
|
||||
<!-- The color of the ripples on the tinted notifications -->
|
||||
<color name="notification_ripple_tinted_color">#30ffffff</color>
|
||||
|
||||
<!-- The color of the circle around the primary user in the user switcher -->
|
||||
<color name="current_user_border_color">@color/system_accent_color</color>
|
||||
|
||||
<!-- The color of the gear shown behind a notification -->
|
||||
<color name="notification_gear_color">#ff757575</color>
|
||||
|
||||
<!-- The "inside" of a notification, reached via longpress -->
|
||||
<color name="notification_guts_bg_color">#eeeeee</color>
|
||||
<color name="notification_guts_slider_color">@*android:color/material_deep_teal_500</color>
|
||||
<color name="notification_guts_disabled_slider_color">@*android:color/material_grey_300</color>
|
||||
<color name="notification_guts_secondary_slider_color">#858383</color>
|
||||
<color name="notification_guts_icon_tint">#8a000000</color>
|
||||
@@ -126,8 +122,6 @@
|
||||
<!-- Shadow color for the furthest pixels around the fake shadow for recents. -->
|
||||
<color name="fake_shadow_end_color">#03000000</color>
|
||||
|
||||
<color name="screen_pinning_nav_icon_highlight_outer">#4080cbc4</color><!-- 25% deep teal 200 -->
|
||||
<color name="screen_pinning_request_bg">#ff009688</color><!-- deep teal 500 -->
|
||||
<color name="screen_pinning_request_window_bg">#80000000</color>
|
||||
|
||||
<color name="segmented_buttons_background">#14FFFFFF</color><!-- 8% white -->
|
||||
@@ -142,14 +136,10 @@
|
||||
<color name="light_mode_icon_color_dual_tone_background">#4dffffff</color>
|
||||
<color name="light_mode_icon_color_dual_tone_fill">#ffffff</color>
|
||||
|
||||
<color name="zen_introduction_message_background">#ff009688</color><!-- deep teal 500 -->
|
||||
<color name="volume_icon_color">#ffffffff</color>
|
||||
<color name="volume_settings_icon_color">#7fffffff</color>
|
||||
<color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 -->
|
||||
|
||||
<color name="fab_ripple">#1fffffff</color><!-- 12% white -->
|
||||
<color name="fab_shape">#ff009688</color><!-- Teal 500 -->
|
||||
|
||||
<color name="docked_divider_background">#ff000000</color>
|
||||
<color name="docked_divider_handle">#ffffff</color>
|
||||
<drawable name="forced_resizable_background">#59000000</drawable>
|
||||
@@ -167,10 +157,8 @@
|
||||
<color name="qs_tile_tint_active">#ffffffff</color>
|
||||
|
||||
<color name="switch_bar_background">#ff37474f</color>
|
||||
<color name="switch_accent_color">#ff7fcac3</color>
|
||||
|
||||
<!-- Keyboard shortcuts colors -->
|
||||
<color name="ksh_system_group_color">@color/material_deep_teal_500</color>
|
||||
<color name="ksh_application_group_color">#fff44336</color>
|
||||
<color name="ksh_keyword_color">#d9000000</color>
|
||||
<color name="ksh_key_item_color">@color/material_grey_600</color>
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
<style name="TextAppearance.QS.DetailItemSecondary">
|
||||
<item name="android:textSize">@dimen/qs_detail_item_secondary_text_size</item>
|
||||
<item name="android:textColor">@color/system_accent_color</item>
|
||||
<item name="android:textColor">?android:attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.QS.Introduction">
|
||||
@@ -177,7 +177,7 @@
|
||||
|
||||
<style name="TextAppearance.QS.DataUsage.Usage">
|
||||
<item name="android:textSize">@dimen/qs_data_usage_usage_text_size</item>
|
||||
<item name="android:textColor">@color/system_accent_color</item>
|
||||
<item name="android:textColor">?android:attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.QS.DataUsage.Secondary">
|
||||
@@ -217,19 +217,13 @@
|
||||
<style name="Animation.StatusBar">
|
||||
</style>
|
||||
|
||||
<style name="systemui_theme" parent="@android:style/Theme.DeviceDefault">
|
||||
<item name="android:colorPrimary">@color/system_primary_color</item>
|
||||
<item name="android:colorControlActivated">@color/system_accent_color</item>
|
||||
</style>
|
||||
<style name="systemui_theme" parent="@android:style/Theme.DeviceDefault" />
|
||||
|
||||
<style name="systemui_theme_remote_input" parent="@android:style/Theme.DeviceDefault.Light">
|
||||
<item name="android:colorAccent">@color/remote_input_accent</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.SystemUI.Dialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog">
|
||||
<item name="android:colorPrimary">@color/system_primary_color</item>
|
||||
<item name="android:colorControlActivated">@color/system_accent_color</item>
|
||||
</style>
|
||||
<style name="Theme.SystemUI.Dialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog" />
|
||||
|
||||
<style name="Theme.SystemUI.Dialog.Alert" parent="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert" />
|
||||
|
||||
@@ -320,12 +314,12 @@
|
||||
<item name="android:layout_height">48dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TunerSettings" parent="@android:style/Theme.Material.Settings">
|
||||
<style name="TunerSettings" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="preferenceTheme">@style/TunerPreferenceTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="TunerPreferenceTheme" parent="@android:style/Theme.Material.Settings">
|
||||
<style name="TunerPreferenceTheme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="dropdownPreferenceStyle">@style/Preference.DropDown.Material</item>
|
||||
</style>
|
||||
|
||||
@@ -341,16 +335,16 @@
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.NotificationGuts.Secondary">
|
||||
<item name="android:alpha">.54</item>
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.NotificationGuts.Primary">
|
||||
<item name="android:alpha">.87</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.NotificationGuts.Radio">
|
||||
<item name="android:alpha">.87</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.NotificationGuts.Button">
|
||||
@@ -358,11 +352,7 @@
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textColor">@*android:color/material_deep_teal_500</item>
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.SwitchBar" parent="@android:style/ThemeOverlay">
|
||||
<item name="android:colorAccent">@color/switch_accent_color</item>
|
||||
<item name="android:textColor">?android:attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="edit_theme" parent="@android:style/Theme.Material">
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class DataUsageGraph extends View {
|
||||
@@ -45,7 +46,7 @@ public class DataUsageGraph extends View {
|
||||
super(context, attrs);
|
||||
final Resources res = context.getResources();
|
||||
mTrackColor = context.getColor(R.color.data_usage_graph_track);
|
||||
mUsageColor = context.getColor(R.color.system_accent_color);
|
||||
mUsageColor = Utils.getColorAccent(context);
|
||||
mOverlimitColor = context.getColor(R.color.system_warning_color);
|
||||
mWarningColor = context.getColor(R.color.data_usage_graph_warning);
|
||||
mMarkerWidth = res.getDimensionPixelSize(R.dimen.data_usage_graph_marker_width);
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.settingslib.net.DataUsageController;
|
||||
import com.android.systemui.FontSizeUtils;
|
||||
import com.android.systemui.R;
|
||||
@@ -64,7 +65,7 @@ public class DataUsageDetailView extends LinearLayout {
|
||||
final Resources res = mContext.getResources();
|
||||
final int titleId;
|
||||
final long bytes;
|
||||
int usageColor = R.color.system_accent_color;
|
||||
int usageColor = 0;
|
||||
final String top;
|
||||
String bottom = null;
|
||||
if (info.usageLevel < info.warningLevel || info.limitLevel <= 0) {
|
||||
@@ -92,6 +93,10 @@ public class DataUsageDetailView extends LinearLayout {
|
||||
usageColor = R.color.system_warning_color;
|
||||
}
|
||||
|
||||
if (usageColor == 0) {
|
||||
usageColor = Utils.getColorAccent(mContext);
|
||||
}
|
||||
|
||||
final TextView title = (TextView) findViewById(android.R.id.title);
|
||||
title.setText(titleId);
|
||||
final TextView usage = (TextView) findViewById(R.id.usage_text);
|
||||
|
||||
@@ -58,6 +58,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.app.AssistUtils;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.recents.Recents;
|
||||
|
||||
@@ -117,7 +118,7 @@ public final class KeyboardShortcuts {
|
||||
private KeyCharacterMap mKeyCharacterMap;
|
||||
|
||||
private KeyboardShortcuts(Context context) {
|
||||
this.mContext = new ContextThemeWrapper(context, android.R.style.Theme_Material_Light);
|
||||
this.mContext = new ContextThemeWrapper(context, android.R.style.Theme_DeviceDefault_Light);
|
||||
this.mPackageManager = AppGlobals.getPackageManager();
|
||||
loadResources(context);
|
||||
}
|
||||
@@ -587,7 +588,7 @@ public final class KeyboardShortcuts {
|
||||
R.layout.keyboard_shortcuts_category_title, keyboardShortcutsLayout, false);
|
||||
categoryTitle.setText(group.getLabel());
|
||||
categoryTitle.setTextColor(group.isSystemGroup()
|
||||
? mContext.getColor(R.color.ksh_system_group_color)
|
||||
? Utils.getColorAccent(mContext)
|
||||
: mContext.getColor(R.color.ksh_application_group_color));
|
||||
keyboardShortcutsLayout.addView(categoryTitle);
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
|
||||
}
|
||||
|
||||
private void bindSlider(final View importanceSlider, final boolean systemApp) {
|
||||
mActiveSliderTint = loadColorStateList(R.color.notification_guts_slider_color);
|
||||
mActiveSliderTint = ColorStateList.valueOf(Utils.getColorAccent(mContext));
|
||||
mInactiveSliderTint = loadColorStateList(R.color.notification_guts_disabled_slider_color);
|
||||
|
||||
mImportanceSummary = ((TextView) importanceSlider.findViewById(R.id.summary));
|
||||
|
||||
@@ -1,842 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source 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
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.MathUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.android.keyguard.KeyguardStatusView;
|
||||
import com.android.systemui.BatteryMeterView;
|
||||
import com.android.systemui.FontSizeUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.qs.QSPanel;
|
||||
import com.android.systemui.qs.QSPanel.Callback;
|
||||
import com.android.systemui.qs.QSTile;
|
||||
import com.android.systemui.qs.QSTile.DetailAdapter;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.EmergencyListener;
|
||||
import com.android.systemui.statusbar.policy.NextAlarmController;
|
||||
import com.android.systemui.statusbar.policy.UserInfoController;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
/**
|
||||
* The view to manage the header area in the expanded status bar.
|
||||
*/
|
||||
public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnClickListener,
|
||||
BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback,
|
||||
EmergencyListener {
|
||||
|
||||
private boolean mExpanded;
|
||||
private boolean mListening;
|
||||
|
||||
private ViewGroup mSystemIconsContainer;
|
||||
private View mSystemIconsSuperContainer;
|
||||
private View mDateGroup;
|
||||
private View mClock;
|
||||
private TextView mTime;
|
||||
private TextView mAmPm;
|
||||
private MultiUserSwitch mMultiUserSwitch;
|
||||
private ImageView mMultiUserAvatar;
|
||||
private TextView mDateCollapsed;
|
||||
private TextView mDateExpanded;
|
||||
private LinearLayout mSystemIcons;
|
||||
private View mSignalCluster;
|
||||
private SettingsButton mSettingsButton;
|
||||
private View mSettingsContainer;
|
||||
private View mQsDetailHeader;
|
||||
private TextView mQsDetailHeaderTitle;
|
||||
private Switch mQsDetailHeaderSwitch;
|
||||
private ImageView mQsDetailHeaderProgress;
|
||||
private TextView mEmergencyCallsOnly;
|
||||
private TextView mBatteryLevel;
|
||||
private TextView mAlarmStatus;
|
||||
|
||||
private boolean mShowEmergencyCallsOnly;
|
||||
private boolean mAlarmShowing;
|
||||
private AlarmManager.AlarmClockInfo mNextAlarm;
|
||||
|
||||
private int mCollapsedHeight;
|
||||
private int mExpandedHeight;
|
||||
|
||||
private int mMultiUserExpandedMargin;
|
||||
private int mMultiUserCollapsedMargin;
|
||||
|
||||
private int mClockMarginBottomExpanded;
|
||||
private int mClockMarginBottomCollapsed;
|
||||
private int mMultiUserSwitchWidthCollapsed;
|
||||
private int mMultiUserSwitchWidthExpanded;
|
||||
|
||||
private int mClockCollapsedSize;
|
||||
private int mClockExpandedSize;
|
||||
|
||||
/**
|
||||
* In collapsed QS, the clock and avatar are scaled down a bit post-layout to allow for a nice
|
||||
* transition. These values determine that factor.
|
||||
*/
|
||||
private float mClockCollapsedScaleFactor;
|
||||
private float mAvatarCollapsedScaleFactor;
|
||||
|
||||
private ActivityStarter mActivityStarter;
|
||||
private BatteryController mBatteryController;
|
||||
private NextAlarmController mNextAlarmController;
|
||||
private QSPanel mQSPanel;
|
||||
|
||||
private final Rect mClipBounds = new Rect();
|
||||
|
||||
private boolean mCaptureValues;
|
||||
private boolean mSignalClusterDetached;
|
||||
private final LayoutValues mCollapsedValues = new LayoutValues();
|
||||
private final LayoutValues mExpandedValues = new LayoutValues();
|
||||
private final LayoutValues mCurrentValues = new LayoutValues();
|
||||
|
||||
private float mCurrentT;
|
||||
private boolean mShowingDetail;
|
||||
private boolean mDetailTransitioning;
|
||||
|
||||
private boolean mAllowExpand = true;
|
||||
|
||||
public StatusBarHeaderView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mSystemIconsSuperContainer = findViewById(R.id.system_icons_super_container);
|
||||
mSystemIconsContainer = (ViewGroup) findViewById(R.id.system_icons_container);
|
||||
mSystemIconsSuperContainer.setOnClickListener(this);
|
||||
mDateGroup = findViewById(R.id.date_group);
|
||||
mClock = findViewById(R.id.clock);
|
||||
mTime = (TextView) findViewById(R.id.time_view);
|
||||
mAmPm = (TextView) findViewById(R.id.am_pm_view);
|
||||
mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
|
||||
mMultiUserAvatar = (ImageView) findViewById(R.id.multi_user_avatar);
|
||||
mDateCollapsed = (TextView) findViewById(R.id.date_collapsed);
|
||||
mDateExpanded = (TextView) findViewById(R.id.date_expanded);
|
||||
mSettingsButton = (SettingsButton) findViewById(R.id.settings_button);
|
||||
mSettingsContainer = findViewById(R.id.settings_button_container);
|
||||
mSettingsButton.setOnClickListener(this);
|
||||
mQsDetailHeader = findViewById(R.id.qs_detail_header);
|
||||
mQsDetailHeader.setAlpha(0);
|
||||
mQsDetailHeaderTitle = (TextView) mQsDetailHeader.findViewById(android.R.id.title);
|
||||
mQsDetailHeaderSwitch = (Switch) mQsDetailHeader.findViewById(android.R.id.toggle);
|
||||
mQsDetailHeaderProgress = (ImageView) findViewById(R.id.qs_detail_header_progress);
|
||||
mEmergencyCallsOnly = (TextView) findViewById(R.id.header_emergency_calls_only);
|
||||
mBatteryLevel = (TextView) findViewById(R.id.battery_level);
|
||||
mAlarmStatus = (TextView) findViewById(R.id.alarm_status);
|
||||
mAlarmStatus.setOnClickListener(this);
|
||||
mSignalCluster = findViewById(R.id.signal_cluster);
|
||||
mSystemIcons = (LinearLayout) findViewById(R.id.system_icons);
|
||||
loadDimens();
|
||||
updateVisibilities();
|
||||
updateClockScale();
|
||||
updateAvatarScale();
|
||||
addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right,
|
||||
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if ((right - left) != (oldRight - oldLeft)) {
|
||||
// width changed, update clipping
|
||||
setClipping(getHeight());
|
||||
}
|
||||
boolean rtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
mTime.setPivotX(rtl ? mTime.getWidth() : 0);
|
||||
mTime.setPivotY(mTime.getBaseline());
|
||||
updateAmPmTranslation();
|
||||
}
|
||||
});
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRect(mClipBounds);
|
||||
}
|
||||
});
|
||||
requestCaptureValues();
|
||||
|
||||
// RenderThread is doing more harm than good when touching the header (to expand quick
|
||||
// settings), so disable it for this view
|
||||
((RippleDrawable) getBackground()).setForceSoftware(true);
|
||||
((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true);
|
||||
((RippleDrawable) mSystemIconsSuperContainer.getBackground()).setForceSoftware(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
if (mCaptureValues) {
|
||||
if (mExpanded) {
|
||||
captureLayoutValues(mExpandedValues);
|
||||
} else {
|
||||
captureLayoutValues(mCollapsedValues);
|
||||
}
|
||||
mCaptureValues = false;
|
||||
updateLayoutValues(mCurrentT);
|
||||
}
|
||||
mAlarmStatus.setX(mDateGroup.getLeft() + mDateCollapsed.getRight());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
FontSizeUtils.updateFontSize(mBatteryLevel, R.dimen.battery_level_text_size);
|
||||
FontSizeUtils.updateFontSize(mEmergencyCallsOnly,
|
||||
R.dimen.qs_emergency_calls_only_text_size);
|
||||
FontSizeUtils.updateFontSize(mDateCollapsed, R.dimen.qs_date_collapsed_size);
|
||||
FontSizeUtils.updateFontSize(mDateExpanded, R.dimen.qs_date_collapsed_size);
|
||||
FontSizeUtils.updateFontSize(mAlarmStatus, R.dimen.qs_date_collapsed_size);
|
||||
FontSizeUtils.updateFontSize(this, android.R.id.title, R.dimen.qs_detail_header_text_size);
|
||||
FontSizeUtils.updateFontSize(this, android.R.id.toggle, R.dimen.qs_detail_header_text_size);
|
||||
FontSizeUtils.updateFontSize(mAmPm, R.dimen.qs_time_collapsed_size);
|
||||
FontSizeUtils.updateFontSize(this, R.id.empty_time_view, R.dimen.qs_time_expanded_size);
|
||||
|
||||
mEmergencyCallsOnly.setText(com.android.internal.R.string.emergency_calls_only);
|
||||
|
||||
mClockCollapsedSize = getResources().getDimensionPixelSize(R.dimen.qs_time_collapsed_size);
|
||||
mClockExpandedSize = getResources().getDimensionPixelSize(R.dimen.qs_time_expanded_size);
|
||||
mClockCollapsedScaleFactor = (float) mClockCollapsedSize / (float) mClockExpandedSize;
|
||||
|
||||
updateClockScale();
|
||||
updateClockCollapsedMargin();
|
||||
}
|
||||
|
||||
private void updateClockCollapsedMargin() {
|
||||
Resources res = getResources();
|
||||
int padding = res.getDimensionPixelSize(R.dimen.clock_collapsed_bottom_margin);
|
||||
int largePadding = res.getDimensionPixelSize(
|
||||
R.dimen.clock_collapsed_bottom_margin_large_text);
|
||||
float largeFactor = (MathUtils.constrain(getResources().getConfiguration().fontScale, 1.0f,
|
||||
FontSizeUtils.LARGE_TEXT_SCALE) - 1f) / (FontSizeUtils.LARGE_TEXT_SCALE - 1f);
|
||||
mClockMarginBottomCollapsed = Math.round((1 - largeFactor) * padding + largeFactor * largePadding);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
private void requestCaptureValues() {
|
||||
mCaptureValues = true;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
private void loadDimens() {
|
||||
mCollapsedHeight = getResources().getDimensionPixelSize(R.dimen.status_bar_header_height);
|
||||
mExpandedHeight = getResources().getDimensionPixelSize(
|
||||
R.dimen.status_bar_header_height_expanded);
|
||||
mMultiUserExpandedMargin =
|
||||
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_expanded_margin);
|
||||
mMultiUserCollapsedMargin =
|
||||
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_collapsed_margin);
|
||||
mClockMarginBottomExpanded =
|
||||
getResources().getDimensionPixelSize(R.dimen.clock_expanded_bottom_margin);
|
||||
updateClockCollapsedMargin();
|
||||
mMultiUserSwitchWidthCollapsed =
|
||||
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_collapsed);
|
||||
mMultiUserSwitchWidthExpanded =
|
||||
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_expanded);
|
||||
mAvatarCollapsedScaleFactor =
|
||||
getResources().getDimensionPixelSize(R.dimen.multi_user_avatar_collapsed_size)
|
||||
/ (float) mMultiUserAvatar.getLayoutParams().width;
|
||||
mClockCollapsedSize = getResources().getDimensionPixelSize(R.dimen.qs_time_collapsed_size);
|
||||
mClockExpandedSize = getResources().getDimensionPixelSize(R.dimen.qs_time_expanded_size);
|
||||
mClockCollapsedScaleFactor = (float) mClockCollapsedSize / (float) mClockExpandedSize;
|
||||
|
||||
}
|
||||
|
||||
public void setActivityStarter(ActivityStarter activityStarter) {
|
||||
mActivityStarter = activityStarter;
|
||||
}
|
||||
|
||||
public void setBatteryController(BatteryController batteryController) {
|
||||
mBatteryController = batteryController;
|
||||
((BatteryMeterView) findViewById(R.id.battery)).setBatteryController(batteryController);
|
||||
}
|
||||
|
||||
public void setNextAlarmController(NextAlarmController nextAlarmController) {
|
||||
mNextAlarmController = nextAlarmController;
|
||||
}
|
||||
|
||||
public int getCollapsedHeight() {
|
||||
return mCollapsedHeight;
|
||||
}
|
||||
|
||||
public int getExpandedHeight() {
|
||||
return mAllowExpand ? mExpandedHeight : mCollapsedHeight;
|
||||
}
|
||||
|
||||
public void setListening(boolean listening) {
|
||||
if (listening == mListening) {
|
||||
return;
|
||||
}
|
||||
mListening = listening;
|
||||
updateListeners();
|
||||
}
|
||||
|
||||
public void setExpanded(boolean expanded) {
|
||||
if (!mAllowExpand) {
|
||||
expanded = false;
|
||||
}
|
||||
boolean changed = expanded != mExpanded;
|
||||
mExpanded = expanded;
|
||||
if (changed) {
|
||||
updateEverything();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEverything() {
|
||||
updateHeights();
|
||||
updateVisibilities();
|
||||
updateSystemIconsLayoutParams();
|
||||
updateClickTargets();
|
||||
updateMultiUserSwitch();
|
||||
updateClockScale();
|
||||
updateAvatarScale();
|
||||
updateClockLp();
|
||||
requestCaptureValues();
|
||||
}
|
||||
|
||||
private void updateHeights() {
|
||||
int height = mExpanded ? mExpandedHeight : mCollapsedHeight;
|
||||
ViewGroup.LayoutParams lp = getLayoutParams();
|
||||
if (lp.height != height) {
|
||||
lp.height = height;
|
||||
setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVisibilities() {
|
||||
mDateCollapsed.setVisibility(mExpanded && mAlarmShowing ? View.VISIBLE : View.INVISIBLE);
|
||||
mDateExpanded.setVisibility(mExpanded && mAlarmShowing ? View.INVISIBLE : View.VISIBLE);
|
||||
mAlarmStatus.setVisibility(mExpanded && mAlarmShowing ? View.VISIBLE : View.INVISIBLE);
|
||||
mSettingsContainer.setVisibility(mExpanded ? View.VISIBLE : View.INVISIBLE);
|
||||
mQsDetailHeader.setVisibility(mExpanded && mShowingDetail? View.VISIBLE : View.INVISIBLE);
|
||||
if (mSignalCluster != null) {
|
||||
updateSignalClusterDetachment();
|
||||
}
|
||||
mEmergencyCallsOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly ? VISIBLE : GONE);
|
||||
mBatteryLevel.setVisibility(mExpanded ? View.VISIBLE : View.GONE);
|
||||
mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(
|
||||
TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
private void updateSignalClusterDetachment() {
|
||||
boolean detached = mExpanded;
|
||||
if (detached != mSignalClusterDetached) {
|
||||
if (detached) {
|
||||
getOverlay().add(mSignalCluster);
|
||||
} else {
|
||||
reattachSignalCluster();
|
||||
}
|
||||
}
|
||||
mSignalClusterDetached = detached;
|
||||
}
|
||||
|
||||
private void reattachSignalCluster() {
|
||||
getOverlay().remove(mSignalCluster);
|
||||
mSystemIcons.addView(mSignalCluster, 1);
|
||||
}
|
||||
|
||||
private void updateSystemIconsLayoutParams() {
|
||||
RelativeLayout.LayoutParams lp = (LayoutParams) mSystemIconsSuperContainer.getLayoutParams();
|
||||
int rule = mExpanded
|
||||
? mSettingsContainer.getId()
|
||||
: mMultiUserSwitch.getId();
|
||||
if (rule != lp.getRules()[RelativeLayout.START_OF]) {
|
||||
lp.addRule(RelativeLayout.START_OF, rule);
|
||||
mSystemIconsSuperContainer.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateListeners() {
|
||||
if (mListening) {
|
||||
mBatteryController.addStateChangedCallback(this);
|
||||
mNextAlarmController.addStateChangedCallback(this);
|
||||
} else {
|
||||
mBatteryController.removeStateChangedCallback(this);
|
||||
mNextAlarmController.removeStateChangedCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAvatarScale() {
|
||||
if (mExpanded) {
|
||||
mMultiUserAvatar.setScaleX(1f);
|
||||
mMultiUserAvatar.setScaleY(1f);
|
||||
} else {
|
||||
mMultiUserAvatar.setScaleX(mAvatarCollapsedScaleFactor);
|
||||
mMultiUserAvatar.setScaleY(mAvatarCollapsedScaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateClockScale() {
|
||||
mTime.setTextSize(TypedValue.COMPLEX_UNIT_PX, mExpanded
|
||||
? mClockExpandedSize
|
||||
: mClockCollapsedSize);
|
||||
mTime.setScaleX(1f);
|
||||
mTime.setScaleY(1f);
|
||||
updateAmPmTranslation();
|
||||
}
|
||||
|
||||
private void updateAmPmTranslation() {
|
||||
boolean rtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
mAmPm.setTranslationX((rtl ? 1 : -1) * mTime.getWidth() * (1 - mTime.getScaleX()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
|
||||
String percentage = NumberFormat.getPercentInstance().format((double) level / 100.0);
|
||||
mBatteryLevel.setText(percentage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerSaveChanged(boolean isPowerSave) {
|
||||
// could not care less
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextAlarmChanged(AlarmManager.AlarmClockInfo nextAlarm) {
|
||||
mNextAlarm = nextAlarm;
|
||||
if (nextAlarm != null) {
|
||||
mAlarmStatus.setText(KeyguardStatusView.formatNextAlarm(getContext(), nextAlarm));
|
||||
}
|
||||
mAlarmShowing = nextAlarm != null;
|
||||
updateEverything();
|
||||
requestCaptureValues();
|
||||
}
|
||||
|
||||
private void updateClickTargets() {
|
||||
mMultiUserSwitch.setClickable(mExpanded);
|
||||
mMultiUserSwitch.setFocusable(mExpanded);
|
||||
mSystemIconsSuperContainer.setClickable(mExpanded);
|
||||
mSystemIconsSuperContainer.setFocusable(mExpanded);
|
||||
mAlarmStatus.setClickable(mNextAlarm != null && mNextAlarm.getShowIntent() != null);
|
||||
}
|
||||
|
||||
private void updateClockLp() {
|
||||
int marginBottom = mExpanded
|
||||
? mClockMarginBottomExpanded
|
||||
: mClockMarginBottomCollapsed;
|
||||
LayoutParams lp = (LayoutParams) mDateGroup.getLayoutParams();
|
||||
if (marginBottom != lp.bottomMargin) {
|
||||
lp.bottomMargin = marginBottom;
|
||||
mDateGroup.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMultiUserSwitch() {
|
||||
int marginEnd;
|
||||
int width;
|
||||
if (mExpanded) {
|
||||
marginEnd = mMultiUserExpandedMargin;
|
||||
width = mMultiUserSwitchWidthExpanded;
|
||||
} else {
|
||||
marginEnd = mMultiUserCollapsedMargin;
|
||||
width = mMultiUserSwitchWidthCollapsed;
|
||||
}
|
||||
MarginLayoutParams lp = (MarginLayoutParams) mMultiUserSwitch.getLayoutParams();
|
||||
if (marginEnd != lp.getMarginEnd() || lp.width != width) {
|
||||
lp.setMarginEnd(marginEnd);
|
||||
lp.width = width;
|
||||
mMultiUserSwitch.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpansion(float t) {
|
||||
if (!mExpanded) {
|
||||
t = 0f;
|
||||
}
|
||||
mCurrentT = t;
|
||||
float height = mCollapsedHeight + t * (mExpandedHeight - mCollapsedHeight);
|
||||
if (height < mCollapsedHeight) {
|
||||
height = mCollapsedHeight;
|
||||
}
|
||||
if (height > mExpandedHeight) {
|
||||
height = mExpandedHeight;
|
||||
}
|
||||
setClipping(height);
|
||||
updateLayoutValues(t);
|
||||
}
|
||||
|
||||
private void updateLayoutValues(float t) {
|
||||
if (mCaptureValues) {
|
||||
return;
|
||||
}
|
||||
mCurrentValues.interpoloate(mCollapsedValues, mExpandedValues, t);
|
||||
applyLayoutValues(mCurrentValues);
|
||||
}
|
||||
|
||||
private void setClipping(float height) {
|
||||
mClipBounds.set(getPaddingLeft(), 0, getWidth() - getPaddingRight(), (int) height);
|
||||
setClipBounds(mClipBounds);
|
||||
invalidateOutline();
|
||||
}
|
||||
|
||||
public void setUserInfoController(UserInfoController userInfoController) {
|
||||
userInfoController.addListener(new UserInfoController.OnUserInfoChangedListener() {
|
||||
@Override
|
||||
public void onUserInfoChanged(String name, Drawable picture) {
|
||||
mMultiUserAvatar.setImageDrawable(picture);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(Callback qsPanelCallback) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == mSettingsButton) {
|
||||
if (mSettingsButton.isTunerClick()) {
|
||||
if (TunerService.isTunerEnabled(mContext)) {
|
||||
TunerService.showResetRequest(mContext, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Relaunch settings so that the tuner disappears.
|
||||
startSettingsActivity();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(getContext(), R.string.tuner_toast, Toast.LENGTH_LONG).show();
|
||||
TunerService.setTunerEnabled(mContext, true);
|
||||
}
|
||||
}
|
||||
startSettingsActivity();
|
||||
} else if (v == mSystemIconsSuperContainer) {
|
||||
startBatteryActivity();
|
||||
} else if (v == mAlarmStatus && mNextAlarm != null) {
|
||||
PendingIntent showIntent = mNextAlarm.getShowIntent();
|
||||
if (showIntent != null) {
|
||||
mActivityStarter.startPendingIntentDismissingKeyguard(showIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startSettingsActivity() {
|
||||
mActivityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
|
||||
true /* dismissShade */);
|
||||
}
|
||||
|
||||
private void startBatteryActivity() {
|
||||
mActivityStarter.startActivity(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY),
|
||||
true /* dismissShade */);
|
||||
}
|
||||
|
||||
public void setQSPanel(QSPanel qsp) {
|
||||
mQSPanel = qsp;
|
||||
if (mQSPanel != null) {
|
||||
mQSPanel.setCallback(mQsPanelCallback);
|
||||
}
|
||||
mMultiUserSwitch.setQsPanel(qsp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmergencyCallsOnly(boolean show) {
|
||||
boolean changed = show != mShowEmergencyCallsOnly;
|
||||
if (changed) {
|
||||
mShowEmergencyCallsOnly = show;
|
||||
if (mExpanded) {
|
||||
updateEverything();
|
||||
requestCaptureValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchSetPressed(boolean pressed) {
|
||||
// We don't want that everything lights up when we click on the header, so block the request
|
||||
// here.
|
||||
}
|
||||
|
||||
private void captureLayoutValues(LayoutValues target) {
|
||||
target.timeScale = mExpanded ? 1f : mClockCollapsedScaleFactor;
|
||||
target.clockY = mClock.getBottom();
|
||||
target.dateY = mDateGroup.getTop();
|
||||
target.emergencyCallsOnlyAlpha = getAlphaForVisibility(mEmergencyCallsOnly);
|
||||
target.alarmStatusAlpha = getAlphaForVisibility(mAlarmStatus);
|
||||
target.dateCollapsedAlpha = getAlphaForVisibility(mDateCollapsed);
|
||||
target.dateExpandedAlpha = getAlphaForVisibility(mDateExpanded);
|
||||
target.avatarScale = mMultiUserAvatar.getScaleX();
|
||||
target.avatarX = mMultiUserSwitch.getLeft() + mMultiUserAvatar.getLeft();
|
||||
target.avatarY = mMultiUserSwitch.getTop() + mMultiUserAvatar.getTop();
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||
target.batteryX = mSystemIconsSuperContainer.getLeft()
|
||||
+ mSystemIconsContainer.getRight();
|
||||
} else {
|
||||
target.batteryX = mSystemIconsSuperContainer.getLeft()
|
||||
+ mSystemIconsContainer.getLeft();
|
||||
}
|
||||
target.batteryY = mSystemIconsSuperContainer.getTop() + mSystemIconsContainer.getTop();
|
||||
target.batteryLevelAlpha = getAlphaForVisibility(mBatteryLevel);
|
||||
target.settingsAlpha = getAlphaForVisibility(mSettingsContainer);
|
||||
target.settingsTranslation = mExpanded
|
||||
? 0
|
||||
: mMultiUserSwitch.getLeft() - mSettingsContainer.getLeft();
|
||||
target.signalClusterAlpha = mSignalClusterDetached ? 0f : 1f;
|
||||
target.settingsRotation = !mExpanded ? 90f : 0f;
|
||||
}
|
||||
|
||||
private float getAlphaForVisibility(View v) {
|
||||
return v == null || v.getVisibility() == View.VISIBLE ? 1f : 0f;
|
||||
}
|
||||
|
||||
private void applyAlpha(View v, float alpha) {
|
||||
if (v == null || v.getVisibility() == View.GONE) {
|
||||
return;
|
||||
}
|
||||
if (alpha == 0f) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyLayoutValues(LayoutValues values) {
|
||||
mTime.setScaleX(values.timeScale);
|
||||
mTime.setScaleY(values.timeScale);
|
||||
mClock.setY(values.clockY - mClock.getHeight());
|
||||
mDateGroup.setY(values.dateY);
|
||||
mAlarmStatus.setY(values.dateY - mAlarmStatus.getPaddingTop());
|
||||
mMultiUserAvatar.setScaleX(values.avatarScale);
|
||||
mMultiUserAvatar.setScaleY(values.avatarScale);
|
||||
mMultiUserAvatar.setX(values.avatarX - mMultiUserSwitch.getLeft());
|
||||
mMultiUserAvatar.setY(values.avatarY - mMultiUserSwitch.getTop());
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||
mSystemIconsSuperContainer.setX(values.batteryX - mSystemIconsContainer.getRight());
|
||||
} else {
|
||||
mSystemIconsSuperContainer.setX(values.batteryX - mSystemIconsContainer.getLeft());
|
||||
}
|
||||
mSystemIconsSuperContainer.setY(values.batteryY - mSystemIconsContainer.getTop());
|
||||
if (mSignalCluster != null && mExpanded) {
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||
mSignalCluster.setX(mSystemIconsSuperContainer.getX()
|
||||
- mSignalCluster.getWidth());
|
||||
} else {
|
||||
mSignalCluster.setX(mSystemIconsSuperContainer.getX()
|
||||
+ mSystemIconsSuperContainer.getWidth());
|
||||
}
|
||||
mSignalCluster.setY(
|
||||
mSystemIconsSuperContainer.getY() + mSystemIconsSuperContainer.getHeight()/2
|
||||
- mSignalCluster.getHeight()/2);
|
||||
} else if (mSignalCluster != null) {
|
||||
mSignalCluster.setTranslationX(0f);
|
||||
mSignalCluster.setTranslationY(0f);
|
||||
}
|
||||
if (!mSettingsButton.isAnimating()) {
|
||||
mSettingsContainer.setTranslationY(mSystemIconsSuperContainer.getTranslationY());
|
||||
mSettingsContainer.setTranslationX(values.settingsTranslation);
|
||||
mSettingsButton.setRotation(values.settingsRotation);
|
||||
}
|
||||
applyAlpha(mEmergencyCallsOnly, values.emergencyCallsOnlyAlpha);
|
||||
if (!mShowingDetail && !mDetailTransitioning) {
|
||||
// Otherwise it needs to stay invisible
|
||||
applyAlpha(mAlarmStatus, values.alarmStatusAlpha);
|
||||
}
|
||||
applyAlpha(mDateCollapsed, values.dateCollapsedAlpha);
|
||||
applyAlpha(mDateExpanded, values.dateExpandedAlpha);
|
||||
applyAlpha(mBatteryLevel, values.batteryLevelAlpha);
|
||||
applyAlpha(mSettingsContainer, values.settingsAlpha);
|
||||
applyAlpha(mSignalCluster, values.signalClusterAlpha);
|
||||
if (!mExpanded) {
|
||||
mTime.setScaleX(1f);
|
||||
mTime.setScaleY(1f);
|
||||
}
|
||||
updateAmPmTranslation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures all layout values (position, visibility) for a certain state. This is used for
|
||||
* animations.
|
||||
*/
|
||||
private static final class LayoutValues {
|
||||
|
||||
float dateExpandedAlpha;
|
||||
float dateCollapsedAlpha;
|
||||
float emergencyCallsOnlyAlpha;
|
||||
float alarmStatusAlpha;
|
||||
float timeScale = 1f;
|
||||
float clockY;
|
||||
float dateY;
|
||||
float avatarScale;
|
||||
float avatarX;
|
||||
float avatarY;
|
||||
float batteryX;
|
||||
float batteryY;
|
||||
float batteryLevelAlpha;
|
||||
float settingsAlpha;
|
||||
float settingsTranslation;
|
||||
float signalClusterAlpha;
|
||||
float settingsRotation;
|
||||
|
||||
public void interpoloate(LayoutValues v1, LayoutValues v2, float t) {
|
||||
timeScale = v1.timeScale * (1 - t) + v2.timeScale * t;
|
||||
clockY = v1.clockY * (1 - t) + v2.clockY * t;
|
||||
dateY = v1.dateY * (1 - t) + v2.dateY * t;
|
||||
avatarScale = v1.avatarScale * (1 - t) + v2.avatarScale * t;
|
||||
avatarX = v1.avatarX * (1 - t) + v2.avatarX * t;
|
||||
avatarY = v1.avatarY * (1 - t) + v2.avatarY * t;
|
||||
batteryX = v1.batteryX * (1 - t) + v2.batteryX * t;
|
||||
batteryY = v1.batteryY * (1 - t) + v2.batteryY * t;
|
||||
settingsTranslation = v1.settingsTranslation * (1 - t) + v2.settingsTranslation * t;
|
||||
|
||||
float t1 = Math.max(0, t - 0.5f) * 2;
|
||||
settingsRotation = v1.settingsRotation * (1 - t1) + v2.settingsRotation * t1;
|
||||
emergencyCallsOnlyAlpha =
|
||||
v1.emergencyCallsOnlyAlpha * (1 - t1) + v2.emergencyCallsOnlyAlpha * t1;
|
||||
|
||||
float t2 = Math.min(1, 2 * t);
|
||||
signalClusterAlpha = v1.signalClusterAlpha * (1 - t2) + v2.signalClusterAlpha * t2;
|
||||
|
||||
float t3 = Math.max(0, t - 0.7f) / 0.3f;
|
||||
batteryLevelAlpha = v1.batteryLevelAlpha * (1 - t3) + v2.batteryLevelAlpha * t3;
|
||||
settingsAlpha = v1.settingsAlpha * (1 - t3) + v2.settingsAlpha * t3;
|
||||
dateExpandedAlpha = v1.dateExpandedAlpha * (1 - t3) + v2.dateExpandedAlpha * t3;
|
||||
dateCollapsedAlpha = v1.dateCollapsedAlpha * (1 - t3) + v2.dateCollapsedAlpha * t3;
|
||||
alarmStatusAlpha = v1.alarmStatusAlpha * (1 - t3) + v2.alarmStatusAlpha * t3;
|
||||
}
|
||||
}
|
||||
|
||||
private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() {
|
||||
private boolean mScanState;
|
||||
|
||||
@Override
|
||||
public void onToggleStateChanged(final boolean state) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
handleToggleStateChanged(state);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowingDetail(final DetailAdapter detail, int x, int y) {
|
||||
mDetailTransitioning = true;
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
handleShowingDetail(detail);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanStateChanged(final boolean state) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
handleScanStateChanged(state);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleToggleStateChanged(boolean state) {
|
||||
mQsDetailHeaderSwitch.setChecked(state);
|
||||
}
|
||||
|
||||
private void handleScanStateChanged(boolean state) {
|
||||
if (mScanState == state) return;
|
||||
mScanState = state;
|
||||
final Animatable anim = (Animatable) mQsDetailHeaderProgress.getDrawable();
|
||||
if (state) {
|
||||
mQsDetailHeaderProgress.animate().alpha(1f);
|
||||
anim.start();
|
||||
} else {
|
||||
mQsDetailHeaderProgress.animate().alpha(0f);
|
||||
anim.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleShowingDetail(final QSTile.DetailAdapter detail) {
|
||||
final boolean showingDetail = detail != null;
|
||||
transition(mClock, !showingDetail);
|
||||
transition(mDateGroup, !showingDetail);
|
||||
if (mAlarmShowing) {
|
||||
transition(mAlarmStatus, !showingDetail);
|
||||
}
|
||||
transition(mQsDetailHeader, showingDetail);
|
||||
mShowingDetail = showingDetail;
|
||||
if (showingDetail) {
|
||||
mQsDetailHeaderTitle.setText(detail.getTitle());
|
||||
final Boolean toggleState = detail.getToggleState();
|
||||
if (toggleState == null) {
|
||||
mQsDetailHeaderSwitch.setVisibility(INVISIBLE);
|
||||
mQsDetailHeader.setClickable(false);
|
||||
} else {
|
||||
mQsDetailHeaderSwitch.setVisibility(VISIBLE);
|
||||
mQsDetailHeaderSwitch.setChecked(toggleState);
|
||||
mQsDetailHeader.setClickable(true);
|
||||
mQsDetailHeader.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean checked = !mQsDetailHeaderSwitch.isChecked();
|
||||
mQsDetailHeaderSwitch.setChecked(checked);
|
||||
detail.setToggleState(checked);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
mQsDetailHeader.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void transition(final View v, final boolean in) {
|
||||
if (in) {
|
||||
v.bringToFront();
|
||||
v.setVisibility(VISIBLE);
|
||||
}
|
||||
if (v.hasOverlappingRendering()) {
|
||||
v.animate().withLayer();
|
||||
}
|
||||
v.animate()
|
||||
.alpha(in ? 1 : 0)
|
||||
.withEndAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!in) {
|
||||
v.setVisibility(INVISIBLE);
|
||||
}
|
||||
mDetailTransitioning = false;
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -68,6 +68,7 @@ import android.widget.SeekBar;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
@@ -152,7 +153,7 @@ public class VolumeDialog implements TunerService.Tunable {
|
||||
mKeyguard = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
||||
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||
mAccessibilityMgr = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
mActiveSliderTint = loadColorStateList(R.color.system_accent_color);
|
||||
mActiveSliderTint = ColorStateList.valueOf(Utils.getColorAccent(mContext));
|
||||
mInactiveSliderTint = loadColorStateList(R.color.volume_slider_inactive);
|
||||
|
||||
initDialog();
|
||||
|
||||
Reference in New Issue
Block a user