All Products
Search
Document Center

Mobile Platform as a Service:Card menu

Last Updated:Mar 16, 2022

AUCardMenu is used to display a selection menu when the user taps the card on the homepage of the mPaaS client. It’s essentially a dialog, and similar to a pop up window.

Sample image

test

Dependency

See Quick start.

API description

/**
* show dialog with default width
* @param view
* @param popItems
*/
public void showDrop(View view, ArrayList<MessagePopItem> popItems)

/**
* show dialog with given width
* @param view
* @param popItems
* @param width
*/
public void showDrop(View view, ArrayList<MessagePopItem> popItems, int width) {
int defaultMarginRight = mContext.getResources().getDimensionPixelSize(R.dimen.AU_SPACE5)/2;
showDrop(view, popItems, width, defaultMarginRight);
}

/**
* show dialog with given width & marginRight
* @param view
* @param popItems
* @param width
*/
public void showDrop(View view, ArrayList<MessagePopItem> popItems, int width, int marginRight)

/**
* show dialog with given ViewLoc
* @param location
* @param popItems
*/
public void showDropWithLocation(ViewLoc location, ArrayList<MessagePopItem> popItems)

If an image is in the hyperlink form, you need to download it.
public void setOnLoadImageListener(OnLoadImageListener onLoadImageListener)

public interface OnLoadImageListener {

/**
* show dialog with given width & marginRight
* @param url URL of the image.
* @param imageView Target view of the image.
* @param defaultDrawable The default image.
*/
public void loadImage(String url, AUImageView imageView ,Drawable defaultDrawable);
}

Custom properties

No customized property is available. The XML layout is not supported.

Sample code

    ArrayList<MessagePopItem> menuList = new ArrayList<MessagePopItem>();

        MessagePopItem item1 = new MessagePopItem();
        IconInfo info = new IconInfo();
        info.type = IconInfo.TYPE_DRAWABLE;
        info.drawable = getResources().getDrawable(R.drawable.menu_del_reject);
        item1.icon = info;
        item1.title = "Test content";
        menuList.add(item1);


        MessagePopItem item2 = new MessagePopItem();
        IconInfo info2 = new IconInfo();
        info2.type = IconInfo.TYPE_DRAWABLE;
        info2.drawable = getResources().getDrawable(R.drawable.menu_delete);
        item2.icon = info2;
        item2.title = "Test content";
        menuList.add(item2);

        MessagePopItem item3 = new MessagePopItem();
        IconInfo info3 = new IconInfo();
        info3.type = IconInfo.TYPE_DRAWABLE;
        info3.drawable = getResources().getDrawable(R.drawable.menu_ignore);
        item3.icon = info3;
        item3.title = "Test content";
        menuList.add(item3);

        MessagePopItem item4 = new MessagePopItem();
        IconInfo info4 = new IconInfo();
        info4.type = IconInfo.TYPE_DRAWABLE;
        info4.drawable = getResources().getDrawable(R.drawable.menu_reject);
        item4.icon = info4;
        item4.title = "Test content";
        menuList.add(item4);

        MessagePopItem item5 = new MessagePopItem();
        IconInfo info5 = new IconInfo();
        info5.type = IconInfo.TYPE_DRAWABLE;
        info5.drawable = getResources().getDrawable(R.drawable.menu_report);
        item5.icon = info5;
        item5.title = "Test content";
        menuList.add(item5);

        final AUCardMenu popMenu = new AUCardMenu(CardMenuActivity.this);
        int id = v.getId();
        if(id == R.id.showCardMenu1) {
            popMenu.showDrop(textView1,menuList);
        }else if(id == R.id.showCardMenu2) {
            popMenu.showDrop(textView2,menuList);
        }