/*** General ActionSheet display API* @param context Context* @param actionSheetInfo ActionSheet information* @return true if using a custom ActionSheet; false if using the SDK's default ActionSheet*/boolean showActionSheet(Activity context, ActionSheetInfo actionSheetInfo);
@Overridepublic boolean showActionSheet(Activity context, ActionSheetInfo actionSheetInfo) {ActionSheet actionSheet = ActionSheet.create(context);// Set the titleif (actionSheetInfo.getTitle() != null) {actionSheet.setMainTitle(actionSheetInfo.getTitle());}// Set whether the configuration can be cancelledactionSheet.setCancelable(actionSheetInfo.isCancelable());// Add itemsif (actionSheetInfo.getItems() != null) {for (ActionSheetItem item : actionSheetInfo.getItems()) {if (item.getTextColor() != null) {actionSheet.addButton(item.getText(), ActionSheet.CUSTOM_TEXT_COLOR_BTN,String.format("#%08X", item.getTextColor()));} else {actionSheet.addButton(item.getText(), ActionSheet.GRAY_STYLE_BTN);}}}// Set the text on the Cancel buttonif (actionSheetInfo.getCancelText() != null) {actionSheet.addCancelButton(actionSheetInfo.getCancelText());}// Set the tap listenerif (actionSheetInfo.getItemClickListener() != null) {actionSheet.setOnButtonClickListener(new ActionSheet.OnButtonClickListener() {@Overridepublic void onClick(View clickedView, int which) {actionSheetInfo.getItemClickListener().onClick(which);actionSheet.dismiss();}});}// Set the cancellation listenerif (actionSheetInfo.getCancelListener() != null) {actionSheet.setOnDismissListener(new ActionSheet.OnDismissListener() {@Overridepublic void onDismiss() {actionSheetInfo.getCancelListener().onCancel(null);}});}if (!context.isFinishing() && !actionSheet.isShowing()) {actionSheet.show();}return true;}
피드백