Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70334ac2 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge changes If0b865ac,Ie0c61300 into jb-dev

* changes:
  Move BigPicture's header to the top of its large view.
  Action button improvements:
parents 5ddb19e5 0749e8e8
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -907,6 +907,8 @@ public class Notification implements Parcelable
     * </pre>
     */
    public static class Builder {
        private static final int MAX_ACTION_BUTTONS = 2;

        private Context mContext;

        private long mWhen;
@@ -938,7 +940,7 @@ public class Notification implements Parcelable
        private ArrayList<String> mKindList = new ArrayList<String>(1);
        private Bundle mExtras;
        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 Style mStyle;

@@ -1460,7 +1462,7 @@ public class Notification implements Parcelable
            if (N > 0) {
                // Log.d("Notification", "has actions: " + mContentText);
                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);
                for (int i=0; i<N; i++) {
                    final RemoteViews button = generateActionButton(mActions.get(i));
@@ -1500,18 +1502,14 @@ public class Notification implements Parcelable
        }

        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.setTextViewText(R.id.action0, action.title);
            if (action.actionIntent != null) {
            if (!tombstone) {
                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);
            return button;
+2 −1
Original line number Diff line number Diff line
@@ -17,8 +17,9 @@
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/borderlessButtonStyle" 
    android:id="@+id/action0"
    android:layout_width="match_parent"
    android:layout_width="0dp"
    android:layout_height="48dp"
    android:layout_weight="1"
    android:gravity="left|center_vertical"
    android:drawablePadding="8dp"
    android:paddingLeft="8dp"
+28 −0
Original line number Diff line number Diff line
<?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>
+6 −2
Original line number Diff line number Diff line
@@ -15,12 +15,16 @@
-->

<Button xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/borderlessButtonStyle" 
    android:id="@+id/action0"
    android:layout_width="match_parent"
    android:layout_width="0dp"
    android:layout_height="48dp"
    android:layout_weight="1"
    android:gravity="left|center_vertical"
    android:drawablePadding="8dp"
    android:paddingLeft="8dp"
    android:textColor="#666"
    android:textColor="#ccc"
    android:textSize="14dp"
    android:alpha="0.5"
    android:enabled="false"
    />
+3 −6
Original line number Diff line number Diff line
@@ -143,14 +143,11 @@
                style="?android:attr/progressBarStyleHorizontal"
                />
        </LinearLayout>
        <LinearLayout
        <include
            layout="@layout/notification_action_list"
            android:id="@+id/actions"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:visibility="gone"
                >
                <!-- actions will be added here -->
        </LinearLayout>
            />
    </LinearLayout>
</FrameLayout>
Loading