am 70334ac2: Merge changes If0b865ac,Ie0c61300 into jb-dev
* commit '70334ac231c7b4bbb57d430377acec4d4c3b2561': Move BigPicture's header to the top of its large view. Action button improvements:
This commit is contained in:
@@ -907,6 +907,8 @@ public class Notification implements Parcelable
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
private static final int MAX_ACTION_BUTTONS = 2;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private long mWhen;
|
private long mWhen;
|
||||||
@@ -938,7 +940,7 @@ public class Notification implements Parcelable
|
|||||||
private ArrayList<String> mKindList = new ArrayList<String>(1);
|
private ArrayList<String> mKindList = new ArrayList<String>(1);
|
||||||
private Bundle mExtras;
|
private Bundle mExtras;
|
||||||
private int mPriority;
|
private int mPriority;
|
||||||
private ArrayList<Action> mActions = new ArrayList<Action>(3);
|
private ArrayList<Action> mActions = new ArrayList<Action>(MAX_ACTION_BUTTONS);
|
||||||
private boolean mUseChronometer;
|
private boolean mUseChronometer;
|
||||||
private Style mStyle;
|
private Style mStyle;
|
||||||
|
|
||||||
@@ -1460,7 +1462,7 @@ public class Notification implements Parcelable
|
|||||||
if (N > 0) {
|
if (N > 0) {
|
||||||
// Log.d("Notification", "has actions: " + mContentText);
|
// Log.d("Notification", "has actions: " + mContentText);
|
||||||
big.setViewVisibility(R.id.actions, View.VISIBLE);
|
big.setViewVisibility(R.id.actions, View.VISIBLE);
|
||||||
if (N>3) N=3;
|
if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS;
|
||||||
big.removeAllViews(R.id.actions);
|
big.removeAllViews(R.id.actions);
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
final RemoteViews button = generateActionButton(mActions.get(i));
|
final RemoteViews button = generateActionButton(mActions.get(i));
|
||||||
@@ -1500,18 +1502,14 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private RemoteViews generateActionButton(Action action) {
|
private RemoteViews generateActionButton(Action action) {
|
||||||
RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
|
final boolean tombstone = (action.actionIntent == null);
|
||||||
|
RemoteViews button = new RemoteViews(mContext.getPackageName(),
|
||||||
|
tombstone ? R.layout.notification_action_tombstone
|
||||||
|
: R.layout.notification_action);
|
||||||
button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
|
button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
|
||||||
button.setTextViewText(R.id.action0, action.title);
|
button.setTextViewText(R.id.action0, action.title);
|
||||||
if (action.actionIntent != null) {
|
if (!tombstone) {
|
||||||
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
|
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
|
||||||
//button.setBoolean(R.id.action0, "setEnabled", true);
|
|
||||||
button.setFloat(R.id.button0, "setAlpha", 1.0f);
|
|
||||||
button.setBoolean(R.id.button0, "setClickable", true);
|
|
||||||
} else {
|
|
||||||
//button.setBoolean(R.id.action0, "setEnabled", false);
|
|
||||||
button.setFloat(R.id.button0, "setAlpha", 0.5f);
|
|
||||||
button.setBoolean(R.id.button0, "setClickable", false);
|
|
||||||
}
|
}
|
||||||
button.setContentDescription(R.id.action0, action.title);
|
button.setContentDescription(R.id.action0, action.title);
|
||||||
return button;
|
return button;
|
||||||
|
|||||||
@@ -17,8 +17,9 @@
|
|||||||
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
android:id="@+id/action0"
|
android:id="@+id/action0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:gravity="left|center_vertical"
|
android:gravity="left|center_vertical"
|
||||||
android:drawablePadding="8dp"
|
android:drawablePadding="8dp"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
|
|||||||
28
core/res/res/layout/notification_action_list.xml
Normal file
28
core/res/res/layout/notification_action_list.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/actions"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:showDividers="middle"
|
||||||
|
android:divider="?android:attr/listDivider"
|
||||||
|
>
|
||||||
|
<!-- actions will be added here -->
|
||||||
|
</LinearLayout>
|
||||||
@@ -15,12 +15,16 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
style="?android:attr/borderlessButtonStyle"
|
||||||
android:id="@+id/action0"
|
android:id="@+id/action0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:gravity="left|center_vertical"
|
android:gravity="left|center_vertical"
|
||||||
android:drawablePadding="8dp"
|
android:drawablePadding="8dp"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:textColor="#666"
|
android:textColor="#ccc"
|
||||||
android:textSize="14dp"
|
android:textSize="14dp"
|
||||||
|
android:alpha="0.5"
|
||||||
|
android:enabled="false"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -143,14 +143,11 @@
|
|||||||
style="?android:attr/progressBarStyleHorizontal"
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<include
|
||||||
|
layout="@layout/notification_action_list"
|
||||||
android:id="@+id/actions"
|
android:id="@+id/actions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
/>
|
||||||
android:visibility="gone"
|
|
||||||
>
|
|
||||||
<!-- actions will be added here -->
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -27,11 +27,12 @@
|
|||||||
android:id="@+id/big_picture"
|
android:id="@+id/big_picture"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="192dp"
|
android:layout_height="192dp"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
/>
|
/>
|
||||||
<include layout="@layout/notification_template_base"
|
<include layout="@layout/notification_template_base"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="192dp"
|
|
||||||
/>
|
/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -105,16 +105,13 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<include
|
||||||
android:id="@+id/actions"
|
layout="@layout/notification_action_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
>
|
/>
|
||||||
<!-- actions will be added here -->
|
|
||||||
</LinearLayout>
|
|
||||||
<TextView android:id="@+id/overflow_title"
|
<TextView android:id="@+id/overflow_title"
|
||||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
|
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -142,16 +142,13 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
/>
|
/>
|
||||||
<LinearLayout
|
<include
|
||||||
|
layout="@layout/notification_action_list"
|
||||||
android:id="@+id/actions"
|
android:id="@+id/actions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:visibility="gone"
|
/>
|
||||||
>
|
|
||||||
<!-- actions will be added here -->
|
|
||||||
</LinearLayout>
|
|
||||||
<TextView android:id="@+id/overflow_title"
|
<TextView android:id="@+id/overflow_title"
|
||||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
|
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -531,30 +531,27 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
exception = e;
|
|
||||||
}
|
|
||||||
if (expandedOneU == null && expandedLarge == null) {
|
|
||||||
final String ident = sbn.pkg + "/0x" + Integer.toHexString(sbn.id);
|
final String ident = sbn.pkg + "/0x" + Integer.toHexString(sbn.id);
|
||||||
Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
|
Slog.e(TAG, "couldn't inflate view for notification " + ident, e);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
if (expandedOneU != null) {
|
|
||||||
SizeAdaptiveLayout.LayoutParams params =
|
|
||||||
new SizeAdaptiveLayout.LayoutParams(expandedOneU.getLayoutParams());
|
|
||||||
params.minHeight = minHeight;
|
|
||||||
params.maxHeight = minHeight;
|
|
||||||
adaptive.addView(expandedOneU, params);
|
|
||||||
}
|
|
||||||
if (expandedLarge != null) {
|
|
||||||
SizeAdaptiveLayout.LayoutParams params =
|
|
||||||
new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
|
|
||||||
params.minHeight = minHeight+1;
|
|
||||||
params.maxHeight = maxHeight;
|
|
||||||
adaptive.addView(expandedLarge, params);
|
|
||||||
}
|
|
||||||
row.setDrawingCacheEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (expandedOneU != null) {
|
||||||
|
SizeAdaptiveLayout.LayoutParams params =
|
||||||
|
new SizeAdaptiveLayout.LayoutParams(expandedOneU.getLayoutParams());
|
||||||
|
params.minHeight = minHeight;
|
||||||
|
params.maxHeight = minHeight;
|
||||||
|
adaptive.addView(expandedOneU, params);
|
||||||
|
}
|
||||||
|
if (expandedLarge != null) {
|
||||||
|
SizeAdaptiveLayout.LayoutParams params =
|
||||||
|
new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
|
||||||
|
params.minHeight = minHeight+1;
|
||||||
|
params.maxHeight = maxHeight;
|
||||||
|
adaptive.addView(expandedLarge, params);
|
||||||
|
}
|
||||||
|
row.setDrawingCacheEnabled(true);
|
||||||
|
|
||||||
applyLegacyRowBackground(sbn, content);
|
applyLegacyRowBackground(sbn, content);
|
||||||
|
|
||||||
row.setTag(R.id.expandable_tag, Boolean.valueOf(large != null));
|
row.setTag(R.id.expandable_tag, Boolean.valueOf(large != null));
|
||||||
|
|||||||
Reference in New Issue
Block a user