Search in sources :

Example 1 with Product

use of org.robobinding.gallery.model.Product in project RoboBinding-gallery by RoboBinding.

the class FragmentDemo method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    int productIndex = getArguments().getInt(EXTRA_PRODUCT_INDEX);
    Product product = MemoryProductStore.getInstance().getByIndex(productIndex);
    presentationModel = new FragmentDemoPresentationModel(product);
}
Also used : Product(org.robobinding.gallery.model.Product) FragmentDemoPresentationModel(org.robobinding.gallery.presentationmodel.FragmentDemoPresentationModel)

Example 2 with Product

use of org.robobinding.gallery.model.Product in project RoboBinding-gallery by RoboBinding.

the class DatabaseHelper method onCreate.

@Override
public void onCreate(SQLiteDatabase db) {
    String itemTable = MessageFormat.format("create table {0} ({1} integer primary key autoincrement, {2} text not null, {3} text not null)", ProductTable.TABLE_NAME, ProductTable._ID, ProductTable.NAME, ProductTable.DESCRIPTION);
    db.execSQL(itemTable);
    List<Product> products = TestData.products();
    for (Product product : products) {
        insertProduct(db, product);
    }
}
Also used : Product(org.robobinding.gallery.model.Product)

Example 3 with Product

use of org.robobinding.gallery.model.Product in project RoboBinding-gallery by RoboBinding.

the class ContextMenuPresentationModel method deleteProduct.

public void deleteProduct(MenuItem menuItem) {
    AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) menuItem.getMenuInfo();
    Product deletedProduct = productStore.remove(menuInfo.position);
    productOperationListener.onProductDeleted(deletedProduct);
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) Product(org.robobinding.gallery.model.Product)

Example 4 with Product

use of org.robobinding.gallery.model.Product in project RoboBinding-gallery by RoboBinding.

the class TypedCursorActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GetAllQuery<Product> allProductsQuery = new GetAllQuery<Product>(ProductTable.TABLE_NAME, new ProductRowMapper());
    db = getDatabaseHelper().getReadableDatabase();
    presentationModel = new TypedCursorPresentationModel(db, allProductsQuery);
    initializeContentView(R.layout.activity_typed_cursor, presentationModel);
}
Also used : GetAllQuery(org.robobinding.gallery.model.typedcursor.GetAllQuery) Product(org.robobinding.gallery.model.Product) TypedCursorPresentationModel(org.robobinding.gallery.presentationmodel.TypedCursorPresentationModel) ProductRowMapper(org.robobinding.gallery.model.typedcursor.ProductRowMapper)

Aggregations

Product (org.robobinding.gallery.model.Product)4 AdapterContextMenuInfo (android.widget.AdapterView.AdapterContextMenuInfo)1 GetAllQuery (org.robobinding.gallery.model.typedcursor.GetAllQuery)1 ProductRowMapper (org.robobinding.gallery.model.typedcursor.ProductRowMapper)1 FragmentDemoPresentationModel (org.robobinding.gallery.presentationmodel.FragmentDemoPresentationModel)1 TypedCursorPresentationModel (org.robobinding.gallery.presentationmodel.TypedCursorPresentationModel)1