use of org.robobinding.gallery.model.MemoryProductStore in project RoboBinding-gallery by RoboBinding.
the class ContextMenuDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MemoryProductStore productStore = MemoryProductStore.getInstance();
productStore.reset();
presentationModel = new ContextMenuDemoPresentationModel(productStore);
contextMenuPresentationModel = new ContextMenuPresentationModel(productStore, presentationModel);
initializeContentView(R.layout.activity_context_menu_demo, presentationModel);
ListView productListView = (ListView) findViewById(R.id.productList);
registerForContextMenu(productListView);
}
use of org.robobinding.gallery.model.MemoryProductStore in project RoboBinding-gallery by RoboBinding.
the class ContextualActionModeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MemoryProductStore productStore = MemoryProductStore.getInstance();
productStore.reset();
presentationModel = new ContextualActionModePresentationModel(productStore);
initializeContentView(R.layout.activity_contextual_action_mode, presentationModel);
ListView productListView = (ListView) findViewById(R.id.productList);
productListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
startSupportActionMode(new ActionMode.Callback() {
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
}
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuBinder menuBinder = createMenuBinder(menu, getMenuInflater());
menuBinder.inflateAndBind(R.menu.contextual_action_mode, presentationModel);
return true;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return false;
}
});
return true;
}
});
}
use of org.robobinding.gallery.model.MemoryProductStore in project RoboBinding-gallery by RoboBinding.
the class ViewPagerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewPager viewPager = new ViewPager(this);
viewPager.setId(R.id.viewPager);
setContentView(viewPager);
final MemoryProductStore productStore = MemoryProductStore.getInstance();
FragmentManager fm = getSupportFragmentManager();
viewPager.setAdapter(new FragmentStatePagerAdapter(fm) {
@Override
public int getCount() {
return productStore.size();
}
@Override
public Fragment getItem(int index) {
return FragmentDemo.newInstance(index);
}
});
int selectedProductIndex = getIntent().getIntExtra(FragmentDemo.EXTRA_PRODUCT_INDEX, 0);
viewPager.setCurrentItem(selectedProductIndex);
}
use of org.robobinding.gallery.model.MemoryProductStore in project RoboBinding-gallery by RoboBinding.
the class ListFragmentDemo method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MemoryProductStore productStore = MemoryProductStore.getInstance();
productStore.reset();
presentationModel = new ListFragmentDemoPresentationModel(getActivity(), productStore.getAll());
}
Aggregations