./data/
CartData類
說明:購(gòu)物車數(shù)據(jù)的存儲(chǔ)與操作
/*本地存儲(chǔ)標(biāo)記*/
private static final StringCART_DATA_TAG ="CART_DATA";
private static final StringDATA_LIST_TAG ="BOOKS_IN_CART_LIST";
private static final StringDATA_SAVE_TAG ="CART_DATA_SAVE_BOOLEAN";
/*當(dāng)作本地運(yùn)行時(shí)數(shù)據(jù)庫(kù)使用,存儲(chǔ)購(gòu)物車列表數(shù)據(jù)*/
private static ListBOOKS_IN_CART_LIST =new ArrayList<>();
/*應(yīng)用內(nèi)部讀取List數(shù)據(jù)*/
public static ListgetBooksInCartList()
/*應(yīng)用內(nèi)部設(shè)置List數(shù)據(jù)*/
public static void setBooksInCartList(List mBooksInCartList)
/*返回所查找的Book在list數(shù)組中的position,-1表示沒找到*/
public static int searchBookById(String bookId)
/*添加商品到購(gòu)物車*/
public static void addProductCart(BookInCart mBookInCart)
/*修改現(xiàn)有的購(gòu)物車中商品的數(shù)量*/
public static boolean alterNumberData(BookInCart mBookInCart)
/*修改現(xiàn)有的購(gòu)物車中商品的數(shù)量*/
public static boolean alterNumberData(String bookId, int number)
/*刪除選定購(gòu)物車列表的數(shù)據(jù)*/
public static void deleteProductCart(String[] bookIdList)
/*清空數(shù)據(jù)萧恕,(清空購(gòu)物車)*/
public static void deleteAllCart()
/*保存購(gòu)物車內(nèi)數(shù)據(jù)到Android本地*/
public static void saveCartData(Context mContext)
/*從本地加載數(shù)據(jù)*/
public static final void loadCartData(Context mContext)
./gson/
BooksGsonBean類
說明:在用Gson解析從list.html傳入Android原生的數(shù)據(jù)時(shí)使用
./model/
BookInCart類
說明:購(gòu)物車列表項(xiàng)
./util/
JsonUtil類
說明:數(shù)據(jù)解析的相關(guān)轉(zhuǎn)換操作
./
CartWebInterface類
說明:Android原生與webview交互的接口類
MainActivity
說明:應(yīng)用程序入口敢伸,主界面活動(dòng)