@@ -907,6 +907,8 @@ public String toString() {
907907 * </pre>
908908 */
909909 public static class Builder {
910+ private static final int MAX_ACTION_BUTTONS = 2 ;
911+
910912 private Context mContext ;
911913
912914 private long mWhen ;
@@ -938,7 +940,7 @@ public static class Builder {
938940 private ArrayList <String > mKindList = new ArrayList <String >(1 );
939941 private Bundle mExtras ;
940942 private int mPriority ;
941- private ArrayList <Action > mActions = new ArrayList <Action >(3 );
943+ private ArrayList <Action > mActions = new ArrayList <Action >(MAX_ACTION_BUTTONS );
942944 private boolean mUseChronometer ;
943945 private Style mStyle ;
944946
@@ -1460,7 +1462,7 @@ private RemoteViews applyStandardTemplateWithActions(int layoutId) {
14601462 if (N > 0 ) {
14611463 // Log.d("Notification", "has actions: " + mContentText);
14621464 big .setViewVisibility (R .id .actions , View .VISIBLE );
1463- if (N >3 ) N =3 ;
1465+ if (N >MAX_ACTION_BUTTONS ) N =MAX_ACTION_BUTTONS ;
14641466 big .removeAllViews (R .id .actions );
14651467 for (int i =0 ; i <N ; i ++) {
14661468 final RemoteViews button = generateActionButton (mActions .get (i ));
@@ -1500,18 +1502,14 @@ private RemoteViews makeBigContentView() {
15001502 }
15011503
15021504 private RemoteViews generateActionButton (Action action ) {
1503- RemoteViews button = new RemoteViews (mContext .getPackageName (), R .layout .notification_action );
1505+ final boolean tombstone = (action .actionIntent == null );
1506+ RemoteViews button = new RemoteViews (mContext .getPackageName (),
1507+ tombstone ? R .layout .notification_action_tombstone
1508+ : R .layout .notification_action );
15041509 button .setTextViewCompoundDrawables (R .id .action0 , action .icon , 0 , 0 , 0 );
15051510 button .setTextViewText (R .id .action0 , action .title );
1506- if (action . actionIntent != null ) {
1511+ if (! tombstone ) {
15071512 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 );
15151513 }
15161514 button .setContentDescription (R .id .action0 , action .title );
15171515 return button ;
0 commit comments