All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.solovyev.android.list.MenuOnClick Maven / Gradle / Ivy

There is a newer version: 1.1.18
Show newest version
package org.solovyev.android.list;

import android.content.Context;
import android.widget.ListView;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.menu.AMenuBuilder;
import org.solovyev.android.menu.LabeledMenuItem;
import org.solovyev.android.menu.MenuImpl;

import java.util.List;

/**
 * User: serso
 * Date: 5/5/12
 * Time: 7:52 PM
 */
public abstract class MenuOnClick implements ListItem.OnClickAction {

    @NotNull
    private final List>> menuItems;

    protected MenuOnClick(@NotNull List>> menuItems) {
        this.menuItems = menuItems;
    }

    @Override
    public void onClick(@NotNull Context context, @NotNull ListAdapter adapter, @NotNull ListView listView) {
        if (!menuItems.isEmpty()) {
            AMenuBuilder.newInstance(context, MenuImpl.newInstance(menuItems)).create(new ListItemOnClickDataImpl(getData(), adapter, listView)).show();
        }
    }

    @NotNull
    protected abstract T getData();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy