All Products
Search
Document Center

Mobile Platform as a Service:List dialog

Last Updated:Mar 03, 2023

AUListDialog (formerly APListPopDialog) provides a list dialog box containing a title, an option list, a Confirm button, and a Cancel button. Each option is a PopMenuItem with icon, option name, and selected state.

Sample image

Android

Dependency

See Quick start.

API description

public interface OnItemClickListener {
    void onItemClick(int index);
}

/**
 * Create AUListDialog based on the input list, in which the item contains only text but no image.
 *
 * @param context The context object.
 * @param list The string list with only ItemName instead of any image.
 */
public AUListDialog(Context context, ArrayList<String> list)

/**
 * Create AUListDialog based on the input list.
 *
 * @param list The PopMenuItem list.
 * @param context The context object.
 */
public AUListDialog(ArrayList<PopMenuItem> list, Context context) 

/**
 * Create AUListDialog based on the input list.
 *
 * @param title The title.
 * @param list PopMenuItem The object list. Icons are allowed.
 * @param context The context object.
 */
public AUListDialog(String title, ArrayList<PopMenuItem> list, Context context) 

/**
 * Create AUListDialog based on the input list.
 *
 * @param title The title.
 * @param message The message main body.
 * @param list PopMenuItem The object list. Icons are allowed.
 * @param context The context object.
 */
public AUListDialog(String title, String message, ArrayList<PopMenuItem> list, Context context) 

/**
 * Create AUListDialog based on the input list.
 *
 * @param title The title.
 * @param list The PopMenuItem list.
 * @param showSelectionState Whether to display the icon in the selected state.
 * @param positiveString Confirm button text.
 * @param positiveListener The Confirm button listener.
 * @param negativeString Cancel button text.
 * @param negativeListener The Cancel button listener.
 * @param context The context object.
 */
public AUListDialog(String title, ArrayList<PopMenuItem> list, boolean showSelectionState,
        String positiveString, View.OnClickListener positiveListener,
        String negativeString, View.OnClickListener negativeListener, Context context) 

/**
 * Create AUListDialog based on the input list.
 *
 * @param title The title.
 * @param message The message main body.
 * @param list The PopMenuItem list.
 * @param showSelectionState Whether to display the icon in the selected state.
 * @param positiveString Confirm button text.
 * @param positiveListener The Confirm button listener.
 * @param negativeString Cancel button text.
 * @param negativeListener The Cancel button listener.
 * @param context The context object.
 */
public AUListDialog(String title, String message, ArrayList<PopMenuItem> list, boolean showSelectionState,
        String positiveString, View.OnClickListener positiveListener,
        String negativeString, View.OnClickListener negativeListener, Context context)

/**
 * Set the list option tapping event listener.
 */
public void setOnItemClickListener(OnItemClickListener listener) {
    this.listener = listener;
}


/**
 * Dynamic data refreshing API.
 *
 * @param list
 */
public void updateData(ArrayList<PopMenuItem> list)

Sample code

  • List dialog with options only

    option1

     new AUListDialog(this, getData(7)).show();
    
      private ArrayList<String> getData(int size){
          ArrayList<String> data = new ArrayList<String>();
          for (int i= 1 ; i<= size; i++){
              data.add("Option"+ String.valueOf(i));
          }
          return data;
      }
  • List dialog with a title

    Title

      ArrayList<PopMenuItem> items = new ArrayList<PopMenuItem>();
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      new AUListDialog("Title", items, this).show();
  • List dialog with description text

    option2

      ArrayList<PopMenuItem> items = new ArrayList<PopMenuItem>();
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      new AUListDialog("", "The description should not exceed 3 rows, and no ending mark is needed at the end of the last sentence.", items, this).show();
  • List dialog with a title and description text

    Single-line title

      ArrayList<PopMenuItem> items = new ArrayList<PopMenuItem>();
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      new AUListDialog("Single-line Title", "The description should not exceed 3 rows, and no ending mark is needed at the end of the last sentence.", items, this).show();
  • List dialog with checkboxes

    Title2

      ArrayList<PopMenuItem> items = new ArrayList<PopMenuItem>();
      PopMenuItem item = new PopMenuItem("Option", null);
      item.setType(AUCheckIcon.STATE_UNCHECKED);
      items.add(item);
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      items.add(new PopMenuItem("Option", null));
      new AUListDialog("Title", items, true, "OK", null, "Cancel", null, this).show();