Skip to content

Commit e551884

Browse files
committed
Restyling action buttons.
Bug: 6418617 Change-Id: I843352fbd167aeb6cc7beb0172b7416aabd5856a
1 parent 1a0c914 commit e551884

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

core/java/android/app/Notification.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,16 @@ private RemoteViews generateActionButton(Action action) {
14901490
RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
14911491
button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
14921492
button.setTextViewText(R.id.action0, action.title);
1493-
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
1493+
if (action.actionIntent != null) {
1494+
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
1495+
//button.setBoolean(R.id.action0, "setEnabled", true);
1496+
button.setFloat(R.id.button0, "setAlpha", 1.0f);
1497+
button.setBoolean(R.id.button0, "setClickable", true);
1498+
} else {
1499+
//button.setBoolean(R.id.action0, "setEnabled", false);
1500+
button.setFloat(R.id.button0, "setAlpha", 0.5f);
1501+
button.setBoolean(R.id.button0, "setClickable", false);
1502+
}
14941503
button.setContentDescription(R.id.action0, action.title);
14951504
return button;
14961505
}

core/res/res/layout/notification_action.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
-->
1616

1717
<Button xmlns:android="http://schemas.android.com/apk/res/android"
18+
style="?android:attr/borderlessButtonStyle"
1819
android:id="@+id/action0"
1920
android:layout_width="match_parent"
2021
android:layout_height="48dp"

0 commit comments

Comments
 (0)