Skip to content

Commit f54bfcf

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Restyling action buttons." into jb-dev
2 parents 4e90bb5 + e551884 commit f54bfcf

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
@@ -1503,7 +1503,16 @@ private RemoteViews generateActionButton(Action action) {
15031503
RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
15041504
button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
15051505
button.setTextViewText(R.id.action0, action.title);
1506-
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
1506+
if (action.actionIntent != null) {
1507+
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
1508+
//button.setBoolean(R.id.action0, "setEnabled", true);
1509+
button.setFloat(R.id.button0, "setAlpha", 1.0f);
1510+
button.setBoolean(R.id.button0, "setClickable", true);
1511+
} else {
1512+
//button.setBoolean(R.id.action0, "setEnabled", false);
1513+
button.setFloat(R.id.button0, "setAlpha", 0.5f);
1514+
button.setBoolean(R.id.button0, "setClickable", false);
1515+
}
15071516
button.setContentDescription(R.id.action0, action.title);
15081517
return button;
15091518
}

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)