org.solovyev.android.list.MenuOnClick Maven / Gradle / Ivy
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 extends LabeledMenuItem>> menuItems;
protected MenuOnClick(@NotNull List extends LabeledMenuItem>> menuItems) {
this.menuItems = menuItems;
}
@Override
public void onClick(@NotNull Context context, @NotNull ListAdapter extends ListItem> 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