am 7cd46429: Merge "apply Jellybean styling to tablet system bar and panel" into jb-dev
* commit '7cd464292bc1012a46479898b0ee69c5e38dfe35': apply Jellybean styling to tablet system bar and panel
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB |
@@ -78,22 +78,16 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
>
|
>
|
||||||
<com.android.systemui.statusbar.tablet.HoloClock
|
<com.android.systemui.statusbar.policy.Clock
|
||||||
android:id="@+id/clock"
|
android:id="@+id/clock"
|
||||||
|
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="3dip"
|
android:singleLine="true"
|
||||||
android:layout_marginLeft="8dip"
|
android:paddingLeft="6dip"
|
||||||
android:layout_marginRight="4dip"
|
android:layout_marginRight="8dip"
|
||||||
>
|
android:gravity="center_vertical|left"
|
||||||
<TextView android:id="@+id/time_solid"
|
/>
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textSize="40sp"
|
|
||||||
/>
|
|
||||||
</com.android.systemui.statusbar.tablet.HoloClock>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/network_text"
|
android:id="@+id/network_text"
|
||||||
|
|||||||
@@ -18,69 +18,57 @@
|
|||||||
<com.android.systemui.statusbar.tablet.NotificationPanel
|
<com.android.systemui.statusbar.tablet.NotificationPanel
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||||
android:id="@+id/panel_root"
|
android:id="@+id/content_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
>
|
>
|
||||||
|
|
||||||
<ImageView android:id="@+id/clear_all_button"
|
<!-- lift the panel up off the status bar while leaving a touchable are -->
|
||||||
android:layout_width="wrap_content"
|
<Space
|
||||||
android:layout_height="@*android:dimen/system_bar_height"
|
android:id="@+id/system_bar_notification_panel_bottom_space"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_width="478dp"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:paddingLeft="15dp"
|
|
||||||
android:paddingRight="15dp"
|
|
||||||
android:src="@drawable/ic_notify_clear"
|
|
||||||
android:visibility="invisible"
|
|
||||||
android:contentDescription="@string/accessibility_clear_all"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:id="@+id/content_parent"
|
android:id="@+id/content_frame"
|
||||||
|
android:background="@drawable/notification_panel_bg"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="478dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:orientation="vertical"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_above="@id/system_bar_notification_panel_bottom_space"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
>
|
>
|
||||||
|
|
||||||
<include layout="@layout/system_bar_notification_panel_title"
|
<include layout="@layout/system_bar_notification_panel_title"
|
||||||
android:layout_width="478dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="224dp"
|
android:layout_height="130dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_above="@id/content_frame"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_weight="0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:id="@+id/content_frame"
|
|
||||||
android:background="@drawable/notify_panel_notify_bg"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="478dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_marginTop="178dp"
|
|
||||||
>
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/notification_scroller"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
>
|
|
||||||
<com.android.systemui.statusbar.policy.NotificationRowLayout
|
|
||||||
android:id="@+id/content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal|bottom"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:descendantFocusability="afterDescendants"
|
|
||||||
systemui:rowHeight="@dimen/notification_row_min_height"
|
|
||||||
/>
|
|
||||||
</ScrollView>
|
|
||||||
</LinearLayout>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
android:id="@+id/notification_scroller"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
>
|
||||||
|
<com.android.systemui.statusbar.policy.NotificationRowLayout
|
||||||
|
android:id="@+id/content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal|bottom"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:descendantFocusability="afterDescendants"
|
||||||
|
systemui:rowHeight="@dimen/notification_row_min_height"
|
||||||
|
/>
|
||||||
|
</ScrollView>
|
||||||
|
</LinearLayout>
|
||||||
</com.android.systemui.statusbar.tablet.NotificationPanel>
|
</com.android.systemui.statusbar.tablet.NotificationPanel>
|
||||||
|
|||||||
@@ -18,11 +18,14 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||||
android:id="@+id/title_area"
|
android:id="@+id/title_area"
|
||||||
|
android:background="@color/notification_panel_solid_background"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/notify_panel_clock_bg"
|
android:paddingLeft="26dp"
|
||||||
|
android:paddingTop="14dp"
|
||||||
|
android:paddingRight="26dp"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TableLayout
|
<TableLayout
|
||||||
@@ -31,7 +34,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:shrinkColumns="2,4"
|
android:shrinkColumns="2,4"
|
||||||
@@ -167,7 +169,6 @@
|
|||||||
android:id="@+id/settings_button"
|
android:id="@+id/settings_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:src="@drawable/ic_sysbar_quicksettings"
|
android:src="@drawable/ic_sysbar_quicksettings"
|
||||||
android:contentDescription="@string/accessibility_settings_button"
|
android:contentDescription="@string/accessibility_settings_button"
|
||||||
/>
|
/>
|
||||||
@@ -176,7 +177,6 @@
|
|||||||
android:id="@+id/notification_button"
|
android:id="@+id/notification_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:src="@drawable/ic_notification_open"
|
android:src="@drawable/ic_notification_open"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
android:contentDescription="@string/accessibility_notifications_button"
|
android:contentDescription="@string/accessibility_notifications_button"
|
||||||
@@ -186,40 +186,46 @@
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
<com.android.systemui.statusbar.tablet.HoloClock
|
<LinearLayout
|
||||||
android:id="@+id/clock"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:paddingTop="@dimen/notification_panel_header_padding_top"
|
||||||
android:layout_alignParentRight="true"
|
android:orientation="horizontal"
|
||||||
android:layout_marginRight="16dip"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginTop="16dip"
|
android:baselineAligned="false"
|
||||||
>
|
>
|
||||||
<TextView android:id="@+id/time_bg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="right"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textSize="92sp"
|
|
||||||
android:textColor="#ffffff" />
|
|
||||||
<TextView android:id="@+id/time_fg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="right"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textSize="92sp"
|
|
||||||
android:textColor="#ffffff" />
|
|
||||||
</com.android.systemui.statusbar.tablet.HoloClock>
|
|
||||||
|
|
||||||
<com.android.systemui.statusbar.policy.DateView
|
<com.android.systemui.statusbar.policy.Clock
|
||||||
android:id="@+id/date"
|
android:id="@+id/clock"
|
||||||
style="@style/StatusBarNotificationText"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:singleLine="true"
|
||||||
android:layout_alignBottom="@id/clock"
|
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock"
|
||||||
android:layout_alignParentLeft="true"
|
/>
|
||||||
android:gravity="left"
|
|
||||||
android:layout_marginLeft="16dp"
|
<com.android.systemui.statusbar.policy.DateView
|
||||||
android:textColor="#ffffff"
|
android:id="@+id/date"
|
||||||
/>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/clear_all_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_notify_clear"
|
||||||
|
android:contentDescription="@string/accessibility_clear_all"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
</com.android.systemui.statusbar.tablet.NotificationPanelTitle>
|
</com.android.systemui.statusbar.tablet.NotificationPanelTitle>
|
||||||
|
|||||||
@@ -51,4 +51,24 @@
|
|||||||
<item name="android:background">@android:drawable/divider_horizontal_dark</item>
|
<item name="android:background">@android:drawable/divider_horizontal_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.StatusBar.Clock" parent="@*android:style/TextAppearance.StatusBar.Icon">
|
||||||
|
<item name="android:textSize">30dp</item>
|
||||||
|
<item name="android:textStyle">normal</item>
|
||||||
|
<item name="android:textColor">@android:color/holo_blue_light</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.StatusBar.Expanded.Clock">
|
||||||
|
<item name="android:textSize">48dp</item>
|
||||||
|
<item name="android:fontFamily">sans-serif-light</item>
|
||||||
|
<item name="android:textStyle">normal</item>
|
||||||
|
<item name="android:textColor">#ffffff</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.StatusBar.Expanded.Date">
|
||||||
|
<item name="android:textSize">14dp</item>
|
||||||
|
<item name="android:textStyle">normal</item>
|
||||||
|
<item name="android:textColor">#666666</item>
|
||||||
|
<item name="android:textAllCaps">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,178 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 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.tablet;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.res.AssetManager;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.SpannableStringBuilder;
|
|
||||||
import android.text.format.DateFormat;
|
|
||||||
import android.text.style.CharacterStyle;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.text.style.RelativeSizeSpan;
|
|
||||||
import android.text.style.RelativeSizeSpan;
|
|
||||||
import android.text.style.StyleSpan;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
import com.android.systemui.R;
|
|
||||||
|
|
||||||
public class HoloClock extends FrameLayout {
|
|
||||||
private boolean mAttached;
|
|
||||||
private Calendar mCalendar;
|
|
||||||
private String mClockFormatString;
|
|
||||||
private SimpleDateFormat mClockFormat;
|
|
||||||
|
|
||||||
private static final String FONT_DIR = "/system/fonts/";
|
|
||||||
private static final String CLOCK_FONT = FONT_DIR + "AndroidClock_Solid.ttf";
|
|
||||||
private static final String CLOCK_FG_FONT = FONT_DIR + "AndroidClock.ttf";
|
|
||||||
private static final String CLOCK_BG_FONT = FONT_DIR + "AndroidClock_Highlight.ttf";
|
|
||||||
|
|
||||||
private static Typeface sBackgroundType, sForegroundType, sSolidType;
|
|
||||||
private TextView mSolidText, mBgText, mFgText;
|
|
||||||
|
|
||||||
public HoloClock(Context context) {
|
|
||||||
this(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HoloClock(Context context, AttributeSet attrs) {
|
|
||||||
this(context, attrs, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HoloClock(Context context, AttributeSet attrs, int defStyle) {
|
|
||||||
super(context, attrs, defStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onFinishInflate() {
|
|
||||||
super.onFinishInflate();
|
|
||||||
|
|
||||||
if (sSolidType == null) {
|
|
||||||
sSolidType = Typeface.createFromFile(CLOCK_FONT);
|
|
||||||
sBackgroundType = Typeface.createFromFile(CLOCK_BG_FONT);
|
|
||||||
sForegroundType = Typeface.createFromFile(CLOCK_FG_FONT);
|
|
||||||
}
|
|
||||||
mBgText = (TextView) findViewById(R.id.time_bg);
|
|
||||||
if (mBgText != null) {
|
|
||||||
mBgText.setTypeface(sBackgroundType);
|
|
||||||
mBgText.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
mFgText = (TextView) findViewById(R.id.time_fg);
|
|
||||||
if (mFgText != null) {
|
|
||||||
mFgText.setTypeface(sForegroundType);
|
|
||||||
}
|
|
||||||
mSolidText = (TextView) findViewById(R.id.time_solid);
|
|
||||||
if (mSolidText != null) {
|
|
||||||
mSolidText.setTypeface(sSolidType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow();
|
|
||||||
|
|
||||||
if (!mAttached) {
|
|
||||||
mAttached = true;
|
|
||||||
IntentFilter filter = new IntentFilter();
|
|
||||||
|
|
||||||
filter.addAction(Intent.ACTION_TIME_TICK);
|
|
||||||
filter.addAction(Intent.ACTION_TIME_CHANGED);
|
|
||||||
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
|
||||||
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
|
||||||
|
|
||||||
getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: It's safe to do these after registering the receiver since the receiver always runs
|
|
||||||
// in the main thread, therefore the receiver can't run before this method returns.
|
|
||||||
|
|
||||||
// The time zone may have changed while the receiver wasn't registered, so update the Time
|
|
||||||
mCalendar = Calendar.getInstance(TimeZone.getDefault());
|
|
||||||
|
|
||||||
// Make sure we update to the current time
|
|
||||||
updateClock();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow();
|
|
||||||
if (mAttached) {
|
|
||||||
getContext().unregisterReceiver(mIntentReceiver);
|
|
||||||
mAttached = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)) {
|
|
||||||
String tz = intent.getStringExtra("time-zone");
|
|
||||||
mCalendar = Calendar.getInstance(TimeZone.getTimeZone(tz));
|
|
||||||
if (mClockFormat != null) {
|
|
||||||
mClockFormat.setTimeZone(mCalendar.getTimeZone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateClock();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
final void updateClock() {
|
|
||||||
mCalendar.setTimeInMillis(System.currentTimeMillis());
|
|
||||||
CharSequence txt = getTimeText();
|
|
||||||
if (mBgText != null) mBgText.setText(txt);
|
|
||||||
if (mFgText != null) mFgText.setText(txt);
|
|
||||||
if (mSolidText != null) mSolidText.setText(txt);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final CharSequence getTimeText() {
|
|
||||||
Context context = getContext();
|
|
||||||
int res = DateFormat.is24HourFormat(context)
|
|
||||||
? com.android.internal.R.string.twenty_four_hour_time_format
|
|
||||||
: com.android.internal.R.string.twelve_hour_time_format;
|
|
||||||
|
|
||||||
SimpleDateFormat sdf;
|
|
||||||
String format = context.getString(res);
|
|
||||||
if (!format.equals(mClockFormatString)) {
|
|
||||||
// we don't want AM/PM showing up in our statusbar, even in 12h mode
|
|
||||||
format = format.replaceAll("a", "").trim();
|
|
||||||
mClockFormat = sdf = new SimpleDateFormat(format);
|
|
||||||
mClockFormatString = format;
|
|
||||||
} else {
|
|
||||||
sdf = mClockFormat;
|
|
||||||
}
|
|
||||||
String result = sdf.format(mCalendar.getTime());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -34,10 +34,15 @@ import android.view.animation.DecelerateInterpolator;
|
|||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import com.android.systemui.ExpandHelper;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
import com.android.systemui.statusbar.policy.NotificationRowLayout;
|
||||||
|
|
||||||
public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
||||||
View.OnClickListener {
|
View.OnClickListener {
|
||||||
|
private ExpandHelper mExpandHelper;
|
||||||
|
private NotificationRowLayout latestItems;
|
||||||
|
|
||||||
static final String TAG = "Tablet/NotificationPanel";
|
static final String TAG = "Tablet/NotificationPanel";
|
||||||
static final boolean DEBUG = false;
|
static final boolean DEBUG = false;
|
||||||
|
|
||||||
@@ -103,6 +108,16 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
|||||||
setContentFrameVisible(mNotificationCount > 0, false);
|
setContentFrameVisible(mNotificationCount > 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow () {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
latestItems = (NotificationRowLayout) findViewById(R.id.content);
|
||||||
|
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
|
||||||
|
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
|
||||||
|
mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight);
|
||||||
|
mExpandHelper.setEventSource(this);
|
||||||
|
}
|
||||||
|
|
||||||
private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
|
private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mBar.clearAll();
|
mBar.clearAll();
|
||||||
@@ -321,14 +336,11 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInContentArea(int x, int y) {
|
public boolean isInContentArea(int x, int y) {
|
||||||
mContentArea.left = mTitleArea.getLeft() + mTitleArea.getPaddingLeft();
|
mContentArea.left = mContentFrame.getLeft() + mContentFrame.getPaddingLeft();
|
||||||
mContentArea.top = mTitleArea.getTop() + mTitleArea.getPaddingTop()
|
mContentArea.top = mContentFrame.getTop() + mContentFrame.getPaddingTop()
|
||||||
+ (int)mContentParent.getTranslationY(); // account for any adjustment
|
+ (int)mContentParent.getTranslationY(); // account for any adjustment
|
||||||
mContentArea.right = mTitleArea.getRight() - mTitleArea.getPaddingRight();
|
mContentArea.right = mContentFrame.getRight() - mContentFrame.getPaddingRight();
|
||||||
|
mContentArea.bottom = mContentFrame.getBottom() - mContentFrame.getPaddingBottom();
|
||||||
View theBottom = (mContentFrame.getVisibility() == View.VISIBLE)
|
|
||||||
? mContentFrame : mTitleArea;
|
|
||||||
mContentArea.bottom = theBottom.getBottom() - theBottom.getPaddingBottom();
|
|
||||||
|
|
||||||
offsetDescendantRectToMyCoords(mContentParent, mContentArea);
|
offsetDescendantRectToMyCoords(mContentParent, mContentArea);
|
||||||
return mContentArea.contains(x, y);
|
return mContentArea.contains(x, y);
|
||||||
@@ -440,5 +452,25 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
|||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
|
MotionEvent cancellation = MotionEvent.obtain(ev);
|
||||||
|
cancellation.setAction(MotionEvent.ACTION_CANCEL);
|
||||||
|
|
||||||
|
boolean intercept = mExpandHelper.onInterceptTouchEvent(ev) ||
|
||||||
|
super.onInterceptTouchEvent(ev);
|
||||||
|
if (intercept) {
|
||||||
|
latestItems.onInterceptTouchEvent(cancellation);
|
||||||
|
}
|
||||||
|
return intercept;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent ev) {
|
||||||
|
boolean handled = mExpandHelper.onTouchEvent(ev) ||
|
||||||
|
super.onTouchEvent(ev);
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.tablet;
|
package com.android.systemui.statusbar.tablet;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -24,11 +26,17 @@ import android.view.View;
|
|||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import com.android.systemui.R;
|
||||||
|
|
||||||
|
|
||||||
public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener {
|
public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener {
|
||||||
private NotificationPanel mPanel;
|
private NotificationPanel mPanel;
|
||||||
|
private ArrayList<View> buttons;
|
||||||
|
private View mNotificationsButton;
|
||||||
|
|
||||||
public NotificationPanelTitle(Context context, AttributeSet attrs) {
|
public NotificationPanelTitle(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
buttons = new ArrayList<View>();
|
||||||
setOnClickListener(this);
|
setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +44,23 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli
|
|||||||
mPanel = p;
|
mPanel = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinishInflate() {
|
||||||
|
super.onFinishInflate();
|
||||||
|
buttons.add(findViewById(R.id.settings_button));
|
||||||
|
buttons.add(findViewById(R.id.notification_button));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPressed(boolean pressed) {
|
||||||
|
super.setPressed(pressed);
|
||||||
|
for (View button : buttons) {
|
||||||
|
if (button != null) {
|
||||||
|
button.setPressed(pressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent e) {
|
public boolean onTouchEvent(MotionEvent e) {
|
||||||
switch (e.getAction()) {
|
switch (e.getAction()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user