Skip to content

Commit

Permalink
change argument order for icon and tint for Composite Action Items
Browse files Browse the repository at this point in the history
  • Loading branch information
roman.donchenko committed Jan 12, 2017
1 parent ae20008 commit 285ac62
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repositories {
jcenter()
}
dependencies {
compile 'com.drextended.actionhandler:actionhandler:0.1.26'
compile 'com.drextended.actionhandler:actionhandler:0.1.27'
}
```

Expand Down Expand Up @@ -46,7 +46,7 @@ dependencies {
}
},
new ActionItem(ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.string.menu_item_1),
new ActionItem(R.drawable.icon, R.color.tint, ActionType.FIRE_ACTION, new ShowToastAction(), R.string.menu_item_2),
new ActionItem(ActionType.FIRE_ACTION, new ShowToastAction(), R.drawable.icon, R.color.tint, R.string.menu_item_2),
))
.addActionInterceptor(this)
.addActionFiredListener(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,17 +382,17 @@ public static class ActionItem<M> {
* @param menuItemTitleResId The resource id for the title associated with this item.
*/
public ActionItem(String actionType, Action action, @StringRes int menuItemTitleResId) {
this(0, 0, actionType, action, new SimpleTitleProvider<M>(menuItemTitleResId));
this(actionType, action, 0, 0, new SimpleTitleProvider<M>(menuItemTitleResId));
}

/**
* @param iconResId The icon res id associated with this item.
* @param actionType The action type associated with this item.
* @param action The action associated with this item.
* @param iconResId The icon res id associated with this item.
* @param menuItemTitleResId The resource id for the title associated with this item.
*/
public ActionItem(@DrawableRes int iconResId, @ColorRes int iconTintColorResId, String actionType, Action action, @StringRes int menuItemTitleResId) {
this(iconResId, iconTintColorResId, actionType, action, new SimpleTitleProvider<M>(menuItemTitleResId));
public ActionItem(String actionType, Action action, @DrawableRes int iconResId, @ColorRes int iconTintColorResId, @StringRes int menuItemTitleResId) {
this(actionType, action, iconResId, iconTintColorResId, new SimpleTitleProvider<M>(menuItemTitleResId));
}

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

/**
* @param iconResId The icon res id associated with this item.
* @param iconTintColorResId The icon tint color res id for the icon.
* @param actionType The action type associated with this item.
* @param action The action associated with this item.
* @param iconResId The icon res id associated with this item.
* @param iconTintColorResId The icon tint color res id for the icon.
* @param titleProvider provider for corresponding menu item's title
*/
public ActionItem(@DrawableRes int iconResId, @ColorRes int iconTintColorResId, String actionType, Action action, TitleProvider<M> titleProvider) {
public ActionItem(String actionType, Action action, @DrawableRes int iconResId, @ColorRes int iconTintColorResId, TitleProvider<M> titleProvider) {
this.iconResId = iconResId;
this.iconTintColorResId = iconTintColorResId;
this.actionType = actionType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ public String getTitle(Context context, String model) {
return "Title (" + model + ")";
}
},
new ActionItem<>(R.drawable.ic_touch_app_black_24dp, 0,
ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), new CompositeAction.TitleProvider<String>() {
new ActionItem<>(ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.drawable.ic_touch_app_black_24dp, 0,
new CompositeAction.TitleProvider<String>() {
@Override
public String getTitle(Context context, String model) {
// There you can return any title for menu item using some fields from model
return context.getString(R.string.fire_intent_action);
}
}),
new ActionItem(R.drawable.ic_announcement_black_24dp, R.color.greenLight, ActionType.FIRE_ACTION, new ShowToastAction(), R.string.fire_simple_action),
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),
new ActionItem(R.drawable.ic_cloud_upload_black_24dp, R.color.red, ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.string.fire_request_action),
new ActionItem(0, 0, ActionType.FIRE_RX_REQUEST_ACTION, new SampleRxRequestAction(), R.string.fire_rx_request_action)
new ActionItem(ActionType.FIRE_ACTION, new ShowToastAction(), R.drawable.ic_announcement_black_24dp, R.color.greenLight, R.string.fire_simple_action),
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),
new ActionItem(ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.drawable.ic_cloud_upload_black_24dp, R.color.red, R.string.fire_request_action),
new ActionItem(ActionType.FIRE_RX_REQUEST_ACTION, new SampleRxRequestAction(), 0, 0, R.string.fire_rx_request_action)
))
.addActionInterceptor(this)
.addActionFiredListener(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public String getTitle(Context context, String model) {
return "Title (" + model + ")";
}
},
new ActionItem(R.drawable.ic_touch_app_black_24dp, 0, ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.string.fire_intent_action),
new ActionItem(R.drawable.ic_announcement_black_24dp, R.color.greenLight, ActionType.FIRE_ACTION, new ShowToastAction(), R.string.fire_simple_action),
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),
new ActionItem(R.drawable.ic_cloud_upload_black_24dp, R.color.red, ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.string.fire_request_action)
new ActionItem(ActionType.OPEN_NEW_SCREEN, new OpenSecondActivity(), R.drawable.ic_touch_app_black_24dp, 0, R.string.fire_intent_action),
new ActionItem(ActionType.FIRE_ACTION, new ShowToastAction(), R.drawable.ic_announcement_black_24dp, R.color.greenLight, R.string.fire_simple_action),
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),
new ActionItem(ActionType.FIRE_REQUEST_ACTION, new SampleRequestAction(), R.drawable.ic_cloud_upload_black_24dp, R.color.red, R.string.fire_request_action)
))
.addActionInterceptor(this)
.addActionFiredListener(this)
Expand Down

0 comments on commit 285ac62

Please sign in to comment.