Skip to content

Commit 285ac62

Browse files
author
roman.donchenko
committed
change argument order for icon and tint for Composite Action Items
1 parent ae20008 commit 285ac62

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repositories {
1515
jcenter()
1616
}
1717
dependencies {
18-
compile 'com.drextended.actionhandler:actionhandler:0.1.26'
18+
compile 'com.drextended.actionhandler:actionhandler:0.1.27'
1919
}
2020
```
2121

@@ -46,7 +46,7 @@ dependencies {
4646
}
4747
},
4848
new ActionItem(ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.string.menu_item_1),
49-
new ActionItem(R.drawable.icon, R.color.tint, ActionType.FIRE_ACTION, new ShowToastAction(), R.string.menu_item_2),
49+
new ActionItem(ActionType.FIRE_ACTION, new ShowToastAction(), R.drawable.icon, R.color.tint, R.string.menu_item_2),
5050
))
5151
.addActionInterceptor(this)
5252
.addActionFiredListener(this)

actionhandler/src/main/java/com/drextended/actionhandler/action/CompositeAction.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,17 +382,17 @@ public static class ActionItem<M> {
382382
* @param menuItemTitleResId The resource id for the title associated with this item.
383383
*/
384384
public ActionItem(String actionType, Action action, @StringRes int menuItemTitleResId) {
385-
this(0, 0, actionType, action, new SimpleTitleProvider<M>(menuItemTitleResId));
385+
this(actionType, action, 0, 0, new SimpleTitleProvider<M>(menuItemTitleResId));
386386
}
387387

388388
/**
389-
* @param iconResId The icon res id associated with this item.
390389
* @param actionType The action type associated with this item.
391390
* @param action The action associated with this item.
391+
* @param iconResId The icon res id associated with this item.
392392
* @param menuItemTitleResId The resource id for the title associated with this item.
393393
*/
394-
public ActionItem(@DrawableRes int iconResId, @ColorRes int iconTintColorResId, String actionType, Action action, @StringRes int menuItemTitleResId) {
395-
this(iconResId, iconTintColorResId, actionType, action, new SimpleTitleProvider<M>(menuItemTitleResId));
394+
public ActionItem(String actionType, Action action, @DrawableRes int iconResId, @ColorRes int iconTintColorResId, @StringRes int menuItemTitleResId) {
395+
this(actionType, action, iconResId, iconTintColorResId, new SimpleTitleProvider<M>(menuItemTitleResId));
396396
}
397397

398398
/**
@@ -401,17 +401,17 @@ public ActionItem(@DrawableRes int iconResId, @ColorRes int iconTintColorResId,
401401
* @param titleProvider provider for corresponding menu item's title
402402
*/
403403
public ActionItem(String actionType, Action action, TitleProvider<M> titleProvider) {
404-
this(0, 0, actionType, action, titleProvider);
404+
this(actionType, action, 0, 0, titleProvider);
405405
}
406406

407407
/**
408-
* @param iconResId The icon res id associated with this item.
409-
* @param iconTintColorResId The icon tint color res id for the icon.
410408
* @param actionType The action type associated with this item.
411409
* @param action The action associated with this item.
410+
* @param iconResId The icon res id associated with this item.
411+
* @param iconTintColorResId The icon tint color res id for the icon.
412412
* @param titleProvider provider for corresponding menu item's title
413413
*/
414-
public ActionItem(@DrawableRes int iconResId, @ColorRes int iconTintColorResId, String actionType, Action action, TitleProvider<M> titleProvider) {
414+
public ActionItem(String actionType, Action action, @DrawableRes int iconResId, @ColorRes int iconTintColorResId, TitleProvider<M> titleProvider) {
415415
this.iconResId = iconResId;
416416
this.iconTintColorResId = iconTintColorResId;
417417
this.actionType = actionType;

samples/databinding/src/main/java/com/drextended/databinding/viewmodel/MainActivityViewModel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,18 @@ public String getTitle(Context context, String model) {
7979
return "Title (" + model + ")";
8080
}
8181
},
82-
new ActionItem<>(R.drawable.ic_touch_app_black_24dp, 0,
83-
ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), new CompositeAction.TitleProvider<String>() {
82+
new ActionItem<>(ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.drawable.ic_touch_app_black_24dp, 0,
83+
new CompositeAction.TitleProvider<String>() {
8484
@Override
8585
public String getTitle(Context context, String model) {
8686
// There you can return any title for menu item using some fields from model
8787
return context.getString(R.string.fire_intent_action);
8888
}
8989
}),
90-
new ActionItem(R.drawable.ic_announcement_black_24dp, R.color.greenLight, ActionType.FIRE_ACTION, new ShowToastAction(), R.string.fire_simple_action),
91-
new ActionItem(R.drawable.ic_announcement_black_24dp, R.color.amber, ActionType.FIRE_DIALOG_ACTION, DialogAction.wrap(getString(R.string.action_dialog_message), new ShowToastAction()), R.string.fire_dialog_action),
92-
new ActionItem(R.drawable.ic_cloud_upload_black_24dp, R.color.red, ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.string.fire_request_action),
93-
new ActionItem(0, 0, ActionType.FIRE_RX_REQUEST_ACTION, new SampleRxRequestAction(), R.string.fire_rx_request_action)
90+
new ActionItem(ActionType.FIRE_ACTION, new ShowToastAction(), R.drawable.ic_announcement_black_24dp, R.color.greenLight, R.string.fire_simple_action),
91+
new ActionItem(ActionType.FIRE_DIALOG_ACTION, DialogAction.wrap(getString(R.string.action_dialog_message), new ShowToastAction()), R.drawable.ic_announcement_black_24dp, R.color.amber, R.string.fire_dialog_action),
92+
new ActionItem(ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.drawable.ic_cloud_upload_black_24dp, R.color.red, R.string.fire_request_action),
93+
new ActionItem(ActionType.FIRE_RX_REQUEST_ACTION, new SampleRxRequestAction(), 0, 0, R.string.fire_rx_request_action)
9494
))
9595
.addActionInterceptor(this)
9696
.addActionFiredListener(this)

samples/simple-handling/src/main/java/com/drextended/actionhandlersample/activity/MainActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public String getTitle(Context context, String model) {
6767
return "Title (" + model + ")";
6868
}
6969
},
70-
new ActionItem(R.drawable.ic_touch_app_black_24dp, 0, ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.string.fire_intent_action),
71-
new ActionItem(R.drawable.ic_announcement_black_24dp, R.color.greenLight, ActionType.FIRE_ACTION, new ShowToastAction(), R.string.fire_simple_action),
72-
new ActionItem(R.drawable.ic_announcement_black_24dp, R.color.amber, ActionType.FIRE_DIALOG_ACTION, DialogAction.wrap(getString(R.string.action_dialog_message), new ShowToastAction()), R.string.fire_dialog_action),
73-
new ActionItem(R.drawable.ic_cloud_upload_black_24dp, R.color.red, ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.string.fire_request_action)
70+
new ActionItem(ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.drawable.ic_touch_app_black_24dp, 0, R.string.fire_intent_action),
71+
new ActionItem(ActionType.FIRE_ACTION, new ShowToastAction(), R.drawable.ic_announcement_black_24dp, R.color.greenLight, R.string.fire_simple_action),
72+
new ActionItem(ActionType.FIRE_DIALOG_ACTION, DialogAction.wrap(getString(R.string.action_dialog_message), new ShowToastAction()), R.drawable.ic_announcement_black_24dp, R.color.amber, R.string.fire_dialog_action),
73+
new ActionItem(ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.drawable.ic_cloud_upload_black_24dp, R.color.red, R.string.fire_request_action)
7474
))
7575
.addActionInterceptor(this)
7676
.addActionFiredListener(this)

0 commit comments

Comments
 (0)