修改代码。

This commit is contained in:
qinjiaming_branch 2016-08-30 08:01:30 +08:00
parent dd0e5ca252
commit 6112020442
206 changed files with 5737 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,75 @@
package com.stone.shop.adapter;
import java.util.Iterator;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.BXTNews;
import com.stone.shop.model.Good;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
/**
* 教学类-博学堂-讲座列表适配器
*
* @date 2014-5-10
* @author Stone
*/
public class BXTListAdapter extends BaseAdapter {
private Context mContext;
private List<BXTNews> mNewsList; // 商品列表信息
private LayoutInflater mInflater = null;
public BXTListAdapter(Context context, List<BXTNews> newsList) {
mContext = context;
mNewsList = newsList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mNewsList.size();
}
@Override
public Object getItem(int position) {
return mNewsList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(List<BXTNews> list) {
Log.i("BXTNewsAdapter", "Adapter刷新数据");
mNewsList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
BXTNewsHolder newsHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.bxt_list_item, null);
newsHolder = new BXTNewsHolder();
newsHolder.tvBXTNewsTitle = (TextView) convertView
.findViewById(R.id.tv_bxt_news_item_title);
convertView.setTag(newsHolder);
} else {
newsHolder = (BXTNewsHolder) convertView.getTag();
}
newsHolder.tvBXTNewsTitle.setText(mNewsList.get(position).getTitle());
return convertView;
}
}

View File

@ -0,0 +1,69 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.Classroom;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class ClassroomAdapter extends BaseAdapter {
private Context mContext;
private List<Classroom> mNewsList; // 商品列表信息
private LayoutInflater mInflater = null;
public ClassroomAdapter(Context context, List<Classroom> newsList) {
mContext = context;
mNewsList = newsList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mNewsList.size();
}
@Override
public Object getItem(int position) {
return mNewsList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(List<Classroom> list) {
mNewsList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.gv_item_classroom, null);
viewHolder = new ViewHolder();
viewHolder.tv_chooseText = (TextView) convertView.findViewById(R.id.tv_chooseText);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.tv_chooseText.setText(mNewsList.get(position).getName());
return convertView;
}
class ViewHolder {
public TextView tv_chooseText; // 博学堂讲座标题
}
}

View File

@ -0,0 +1,70 @@
package com.stone.shop.adapter;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
import com.stone.shop.R;
import com.stone.shop.model.Good;
public class GoodsListAdapter extends BaseAdapter {
private Context mContext;
private List<Good> mGoodsList; // 商品列表信息
private LayoutInflater mInflater = null;
public GoodsListAdapter(Context context, List<Good> goodsList) {
mContext = context;
mGoodsList = goodsList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mGoodsList.size();
}
@Override
public Object getItem(int position) {
return mGoodsList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(List<Good> list) {
mGoodsList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
GoodsHolder goodHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.goods_list_item, null);
goodHolder = new GoodsHolder();
goodHolder.tvName = (TextView) convertView
.findViewById(R.id.tv_good_name);
goodHolder.tvPrice = (TextView) convertView
.findViewById(R.id.tv_good_price);
goodHolder.btnBuyGood = (TextView) convertView
.findViewById(R.id.btn_buy_good);
convertView.setTag(goodHolder);
} else {
goodHolder = (GoodsHolder) convertView.getTag();
}
goodHolder.tvName.setText(mGoodsList.get(position).getName());
goodHolder.tvPrice.setText("¥"+mGoodsList.get(position).getPrice());
return convertView;
}
}

View File

@ -0,0 +1,114 @@
package com.stone.shop.adapter;
import android.R.integer;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.stone.date.TypeDef;
import com.stone.shop.R;
/**
* 生活-- 网格布局(ImageView+TextView)适配器
*
* @date 2014-4-24
* @author Stone
*/
public class GridAdapter extends BaseAdapter {
private Context mContext;
private int mIndex = 0; // 代表当前需要适配页面中第几个GridView
//学习小菜
public static String[] mSchoolTexts = TypeDef.typeSonList1;
private int[] mSchoolImages = { R.drawable.ic_81, R.drawable.ic_82, R.drawable.ic_8 };
//吃饭小菜
public static String[] mFoodTexts = TypeDef.typeSonList2;
private int[] mFoodImages = { R.drawable.ic_41, R.drawable.ic_42};
//购物小菜
public static String[] mGiftTexts = TypeDef.typeSonList3;
private int[] mGiftImages = { R.drawable.ic_71, R.drawable.ic_72,
R.drawable.ic_73, R.drawable.ic_74, R.drawable.ic_75,
R.drawable.ic_76, R.drawable.ic_77};
//疯狂小菜
public static String[] mOutTexts = TypeDef.typeSonList4;
private int[] mOutImages = { R.drawable.ic_3, R.drawable.ic_3,
R.drawable.ic_3, R.drawable.ic_3, R.drawable.ic_3,
R.drawable.ic_3, R.drawable.ic_3 };
public GridAdapter(Context context, int index) {
mContext = context;
mIndex = index;
}
@Override
public int getCount() {
int count = 0;
switch (mIndex) {
case 0:
count = mFoodImages.length;
break;
case 1:
count = mGiftImages.length;
break;
case 2:
count = mOutImages.length;
break;
case 3:
count = mSchoolImages.length;
break;
default:
break;
}
return count;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = View.inflate(mContext, R.layout.shop_grid_item, null);
// RelativeLayout rl = (RelativeLayout)
// view.findViewById(R.id.relaGrid);
ImageView image = (ImageView) view.findViewById(R.id.img_chooseImage);
TextView text = (TextView) view.findViewById(R.id.tv_chooseText);
switch (mIndex) {
case 0:
image.setImageResource(mFoodImages[position]);
text.setText(mFoodTexts[position]);
break;
case 1:
image.setImageResource(mGiftImages[position]);
text.setText(mGiftTexts[position]);
break;
case 2:
image.setImageResource(mOutImages[position]);
text.setText(mOutTexts[position]);
break;
case 3:
image.setImageResource(mSchoolImages[position]);
text.setText(mSchoolTexts[position]);
break;
default:
break;
}
return view;
}
}

View File

@ -0,0 +1,67 @@
package com.stone.shop.adapter;
import java.util.List;
import android.content.Context;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
/**
* 首页--图片轮播AutoScrollViewPager适配器
* @author Stone
*/
public class ImagePagerAdapter extends PagerAdapter {
private List<View> mImgViews;
public ImagePagerAdapter(Context context, List<View> imgViews) {
this.mImgViews = imgViews;
}
@Override
public int getCount() {
if(mImgViews != null){
return mImgViews.size();
}
return 0;
}
@Override
public Object instantiateItem(View arg0, int arg1) {
((ViewPager) arg0).addView(mImgViews.get(arg1));
return mImgViews.get(arg1);
}
@Override
public void destroyItem(View arg0, int arg1, Object arg2) {
((ViewPager) arg0).removeView(mImgViews.get(arg1));
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0 == arg1;
}
@Override
public void restoreState(Parcelable arg0, ClassLoader arg1) {
}
@Override
public Parcelable saveState() {
return null;
}
@Override
public void startUpdate(View arg0) {
}
@Override
public void finishUpdate(View arg0) {
}
}

View File

@ -0,0 +1,69 @@
package com.stone.shop.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.stone.shop.R;
/**
* MineActivity 项目列表适配器
* @date 2014-5-10
* @author Stone
*/
public class MineListAdapter extends BaseAdapter {
private Context mContext;
private String[] mItemNames; // 项目列表名称
private String[] mItemContents; //项目列表的备注值
private int[] mItemImgIds; // 项目列表Icon
private LayoutInflater mInflater = null;
public MineListAdapter(Context context, String[] names, String[] contents, int[] imgIds) {
mContext = context;
mItemNames = names;
mItemContents = contents;
mItemImgIds = imgIds;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mItemNames.length;
}
@Override
public Object getItem(int position) {
return mItemNames[position];
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MineListHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.mine_list_item, null);
holder = new MineListHolder();
holder.imgItem = (ImageView) convertView.findViewById(R.id.img_item);
holder.tvItemName = (TextView) convertView
.findViewById(R.id.tv_item_name);
holder.tvItemContent = (TextView) convertView.findViewById(R.id.tv_item_content);
convertView.setTag(holder);
} else {
holder = (MineListHolder) convertView.getTag();
}
holder.imgItem.setBackgroundResource(mItemImgIds[position]);
holder.tvItemName.setText(mItemNames[position]);
holder.tvItemContent.setText(mItemContents[position]);
return convertView;
}
}

View File

@ -0,0 +1,65 @@
package com.stone.shop.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.stone.shop.R;
/**
* MineActivity 项目列表适配器
* @date 2014-5-10
* @author Stone
*/
public class MineSoftAdapter extends BaseAdapter {
private Context mContext;
private String[] mItemNames; // 项目列表名称
private String[] mItemContents; //项目列表的备注值
private LayoutInflater mInflater = null;
public MineSoftAdapter(Context context, String[] names, String[] contents) {
mContext = context;
mItemNames = names;
mItemContents = contents;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mItemNames.length;
}
@Override
public Object getItem(int position) {
return mItemNames[position];
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MineListHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.mine_soft_list_item, null);
holder = new MineListHolder();
holder.tvItemName = (TextView) convertView
.findViewById(R.id.tv_item_name);
holder.tvItemContent = (TextView) convertView.findViewById(R.id.tv_item_content);
convertView.setTag(holder);
} else {
holder = (MineListHolder) convertView.getTag();
}
holder.tvItemName.setText(mItemNames[position]);
holder.tvItemContent.setText(mItemContents[position]);
return convertView;
}
}

View File

@ -0,0 +1,82 @@
package com.stone.shop.adapter;
import java.util.ArrayList;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.News;
import android.R.integer;
import android.content.Context;
import android.graphics.pdf.PdfDocument.Page;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
* 新闻列表适配器
*
* @date 2014-5-3
* @author Stone
*/
public class NewsListAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater mInflater = null;
private List<News> mNewsList = null; // 所选分类下的所有店铺列表
public NewsListAdapter(Context context, List<News> newsList) {
mContext = context;
mNewsList = newsList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mNewsList.size();
}
@Override
public Object getItem(int position) {
return mNewsList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(ArrayList<News> list) {
mNewsList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
NewsHolder newsHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.news_list_item, null);
newsHolder = new NewsHolder();
newsHolder.tvNewsType = (TextView) convertView
.findViewById(R.id.tv_news_type);
newsHolder.tvNewsTitle = (TextView) convertView
.findViewById(R.id.tv_news_title);
newsHolder.tvNewsDate = (TextView) convertView
.findViewById(R.id.tv_news_date);
convertView.setTag(newsHolder);
} else {
newsHolder = (NewsHolder) convertView.getTag();
}
//拆分字符串,只取年月日
String[] ss = new String[2];
ss = mNewsList.get(position).getCreatedAt().split(" ");
newsHolder.tvNewsType.setText(mNewsList.get(position).getType()); //新闻类型
newsHolder.tvNewsTitle.setText(mNewsList.get(position).getTitle()); //新闻标题
newsHolder.tvNewsDate.setText(ss[0]); //新闻发布日期
return convertView;
}
}

View File

@ -0,0 +1,88 @@
package com.stone.shop.adapter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.GetListener;
import com.stone.date.TypeDef;
import com.stone.shop.R;
import com.stone.shop.model.Good;
import com.stone.shop.model.Order;
import com.stone.shop.model.Shop;
import com.stone.shop.view.OrderInfoActivity;
/**
* 适配器--适配订单列表中的数据
*
* @date 2014-5-27
* @author Stone
*/
public class OrderInfoListAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater mInflater = null;
private List<Order> mOrderList = null; // 所选分类下的所有店铺列表
private String mType; // 商店的分类
public OrderInfoListAdapter(Context context, List<Order> orderList) {
mContext = context;
mOrderList = orderList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mOrderList.size();
}
@Override
public Object getItem(int position) {
return mOrderList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
public void refresh(List<Order> list) {
mOrderList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
OrderInfoHolder orderInfoHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.order_info_list_item, null);
orderInfoHolder = new OrderInfoHolder();
orderInfoHolder.tvOrderInfoGoodName = (TextView) convertView
.findViewById(R.id.tv_order_info_good_name);
orderInfoHolder.tvOrderInfoShopName = (TextView) convertView
.findViewById(R.id.tv_order_info_shop_name);
orderInfoHolder.tvOrderInfoPrice = (TextView) convertView
.findViewById(R.id.tv_order_info_price);
orderInfoHolder.tvOrderInfoState = (TextView) convertView
.findViewById(R.id.tv_order_info_state);
convertView.setTag(orderInfoHolder);
} else {
orderInfoHolder = (OrderInfoHolder) convertView.getTag();
}
orderInfoHolder.tvOrderInfoGoodName.setText(mOrderList.get(position).getGoodName());
orderInfoHolder.tvOrderInfoShopName.setText(mOrderList.get(position).getShopName());
orderInfoHolder.tvOrderInfoPrice.setText("¥" + mOrderList.get(position).getPrice());
orderInfoHolder.tvOrderInfoState.setText(mOrderList.get(position).getState());
return convertView;
}
}

View File

@ -0,0 +1,66 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.SComment;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
* 店铺评论列表适配器
* @date 2014-5-3
* @author Stone
*/
public class SCommentAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater mInflater = null;
private List<SComment> mSComList = null; // 所选分类下的所有店铺列表
public SCommentAdapter(Context context, List<SComment> list) {
mContext = context;
mSComList = list;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mSComList.size();
}
@Override
public Object getItem(int position) {
return mSComList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SComHolder scomHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.scom_list_item, null);
scomHolder = new SComHolder();
scomHolder.tvComUser = (TextView) convertView
.findViewById(R.id.tv_commit_user);
scomHolder.tvComContent = (TextView) convertView
.findViewById(R.id.tv_commit_content);
convertView.setTag(scomHolder);
} else {
scomHolder = (SComHolder) convertView.getTag();
}
scomHolder.tvComUser.setText(mSComList.get(position).getUserName());
scomHolder.tvComContent.setText(mSComList.get(position).getContent());
return convertView;
}
}

View File

@ -0,0 +1,126 @@
package com.stone.shop.adapter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.stone.date.TypeDef;
import com.stone.shop.R;
import com.stone.shop.model.Shop;
/**
* 适配器--适配某一分类下的店铺列表数据
*
* @date 2014-4-29
* @author Stone
*/
public class ShopListAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater mInflater = null;
private ArrayList<Shop> mShopList = null; // 所选分类下的所有店铺列表
private String mType; // 商店的分类
public ShopListAdapter(Context context, ArrayList<Shop> shopList,
String type) {
mContext = context;
mShopList = shopList;
mType = type;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mShopList.size();
}
@Override
public Object getItem(int position) {
return mShopList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(ArrayList<Shop> list) {
mShopList = list;
//将数字的类型编号转换为文字
exchangeType(mType);
notifyDataSetChanged();
}
/**
* 根据当前的type类型, 转换成相应的文字
* @date 2014-4-29
* @param typeString
*/
private void exchangeType(String typeString) {
int type = Integer.parseInt(typeString);
int fatherType = type / 10; //父类型编号
int sonType = type % 10; //子类型编号
Iterator<Shop> iterator = mShopList.iterator();
while (iterator.hasNext()) {
switch (fatherType) {
case 1:
iterator.next().setType(
TypeDef.typeDadList[fatherType-1] + "/"
+ TypeDef.typeSonList1[sonType-1]);
break;
case 2:
iterator.next().setType(
TypeDef.typeDadList[fatherType-1] + "/"
+ TypeDef.typeSonList2[sonType-1]);
break;
case 3:
iterator.next().setType(
TypeDef.typeDadList[fatherType-1] + "/"
+ TypeDef.typeSonList3[sonType-1]);
break;
case 4:
iterator.next().setType(
TypeDef.typeDadList[fatherType-1] + "/"
+ TypeDef.typeSonList4[sonType-1]);
break;
default:
break;
}
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ShopHolder shopHodler;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.shop_all_list_item, null);
shopHodler = new ShopHolder();
shopHodler.tvShopName = (TextView) convertView
.findViewById(R.id.tv_shop_name);
shopHodler.tvShopType = (TextView) convertView
.findViewById(R.id.tv_shop_type);
shopHodler.tvShopLoc = (TextView) convertView
.findViewById(R.id.tv_shop_loc);
convertView.setTag(shopHodler);
} else {
shopHodler = (ShopHolder) convertView.getTag();
}
shopHodler.tvShopName.setText(mShopList.get(position).getName());
// 商店的类型需要单独处理
shopHodler.tvShopType.setText(mShopList.get(position).getType());
shopHodler.tvShopLoc.setText("二食堂");
return convertView;
}
}

View File

@ -0,0 +1,78 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 博学堂讲座实体类
* @date 2014-5-10
* @author Stone
*/
public class BXTNews extends BmobObject{
//private String id;
private String title; //标题
private String topic; //讲座主题
private String speaker; //主 讲 人
private String time; //讲座时间
private String location; //讲座地点
private String holder1; //主办单位
private String holder2; //承办单位
private String points; //主讲内容提要
private String speakerinfo; //主讲人简介
public String getTitle() {
return title;
}
public String getTopic() {
return topic;
}
public String getSpeaker() {
return speaker;
}
public String getTime() {
return time;
}
public String getLocation() {
return location;
}
public String getHolder1() {
return holder1;
}
public String getHolder2() {
return holder2;
}
public String getPoints() {
return points;
}
public String getSpeakerinfo() {
return speakerinfo;
}
public void setTitle(String title) {
this.title = title;
}
public void setTopic(String topic) {
this.topic = topic;
}
public void setSpeaker(String speaker) {
this.speaker = speaker;
}
public void setTime(String time) {
this.time = time;
}
public void setLocation(String location) {
this.location = location;
}
public void setHolder1(String holder1) {
this.holder1 = holder1;
}
public void setHolder2(String holder2) {
this.holder2 = holder2;
}
public void setPoints(String points) {
this.points = points;
}
public void setSpeakerinfo(String speakerinfo) {
this.speakerinfo = speakerinfo;
}
}

View File

@ -0,0 +1,63 @@
package com.stone.shop.model;
import java.io.Serializable;
import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobFile;
/**
* 商品实体类
* @date 2014-4-24
* @author Stone
*/
public class Good extends BmobObject implements Serializable{
private static final long serialVersionUID = -3248168273019127389L;
//private String id; 商品ID, 默认
private String shopID = ""; // 商店ID
private String shopName = ""; //商店名称
private String type = ""; // 类型
private String name = ""; // 名称
private String price = ""; // 价格
private BmobFile picGood = null; // 商品主图
public Good(String name, String price) {
this.name = name;
this.price = price;
}
public String getShopID() {
return shopID;
}
public void setShopID(String shopID) {
this.shopID = shopID;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}

View File

@ -0,0 +1,53 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 首页校内新闻实体类
*
* @date 2014-5-3
* @author Stone
*/
public class News extends BmobObject {
// private String id;
// private String time;
private String type; // 新闻类型
private String title; // 新闻标题
private String author; // 新闻作者
private String content; // 新闻内容
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

View File

@ -0,0 +1,61 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 店铺评论实体类
* @date 2014-5-3
* @author Stone
*/
public class SComment extends BmobObject {
// private String id;
// private String time;
private String shopID;
private String shopName;
private String userID;
private String userName;
private String content;
public String getShopID() {
return shopID;
}
public void setShopID(String shopID) {
this.shopID = shopID;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

View File

@ -0,0 +1,82 @@
package com.stone.shop.model;
import java.io.Serializable;
import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobFile;
/**
* 店铺实体类, 实现序列化, Activity之间实现传递
* @date 2014-4-24
* @author Stone
*/
public class Shop extends BmobObject implements Serializable{
private static final long serialVersionUID = -8796635595320697255L;
private String userID; // 主人
private String type; // 类型(11代表第一个GridView中的第一个)
private String name; // 店名
private String location; // 地理位置
private String phone; // 联系电话
private String info; // 简介
private String sale; // 促销信息
private BmobFile picShop; // 商店主图
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getSale() {
return sale;
}
public void setSale(String sale) {
this.sale = sale;
}
}

View File

@ -0,0 +1,106 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.datatype.BmobRelation;
/**
* 用户实体类
* @date 2014-4-24
* @author Stone
*/
public class User extends BmobUser {
public static String userId;
// 父类中已经存在的属性
// private String id;
// private String username;
// private String password;
// private String email;
// private String regTime;
private String sex; // 性别
private String phone; // 电话
private String qq; // QQ
private String school = "湖北工业大学"; // 学校
private String cademy; // 学院
private String dorPart; // 校区
private String dorNum; // 寝室号
private String state = "未登陆"; // 登录状态
private String type = "普通用户"; // 用户类型(普通用户、黑名单、中奖者)
//private BmobFile picUser; // 头像
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getQQ() {
return qq;
}
public void setQQ(String qq) {
this.qq = qq;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getCademy() {
return cademy;
}
public void setCademy(String cademy) {
this.cademy = cademy;
}
public String getDorPart() {
return dorPart;
}
public void setDorPart(String dorPart) {
this.dorPart = dorPart;
}
public String getDorNum() {
return dorNum;
}
public void setDorNum(String dorNum) {
this.dorNum = dorNum;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}

View File

@ -0,0 +1,100 @@
package com.stone.shop.view;
import java.util.ArrayList;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
import com.stone.shop.R;
import com.stone.shop.adapter.BXTListAdapter;
import com.stone.shop.model.BXTNews;
import com.stone.shop.model.Classroom;
import com.stone.shop.model.BXTNews;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.renderscript.Element;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
/**
* 教学类-博学堂界面
* @date 2014-5-10
* @author Stone
*/
public class BXTActivity extends Activity implements OnItemClickListener{
private static final String TAG = "BXTActivity";
private ListView lvBXTNews;
private BXTListAdapter mBxtListAdapter;
private List<BXTNews> mBXTNewsList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bxt);
initView();
initData();
}
private void initView() {
lvBXTNews = (ListView) findViewById(R.id.lv_bxt_news);
mBXTNewsList = new ArrayList<BXTNews>();
mBxtListAdapter = new BXTListAdapter(this, mBXTNewsList);
lvBXTNews.setAdapter(mBxtListAdapter);
lvBXTNews.setOnItemClickListener(this);
}
private void initData() {
BmobQuery<BXTNews> query = new BmobQuery<BXTNews>();
query.findObjects(this, new FindListener<BXTNews>() {
@Override
public void onSuccess(List<BXTNews> newsList) {
//toast("查询商品成功, 共" + newsList.size());
if(newsList.size()==0)
toast("亲, 暂时还木有讲座哦");
else {
mBXTNewsList = newsList;
mBxtListAdapter.refresh(newsList);
mBxtListAdapter.notifyDataSetChanged();
}
}
@Override
public void onError(int arg0, String arg1) {
toast("查询失败");
}
});
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Intent toBXTNewsActivity = new Intent(BXTActivity.this, BXTNewsActivity.class);
toBXTNewsActivity.putExtra("title", mBXTNewsList.get(position).getTitle());
toBXTNewsActivity.putExtra("topic", mBXTNewsList.get(position).getTopic());
toBXTNewsActivity.putExtra("speaker", mBXTNewsList.get(position).getSpeaker());
toBXTNewsActivity.putExtra("time", mBXTNewsList.get(position).getTime());
toBXTNewsActivity.putExtra("location", mBXTNewsList.get(position).getLocation());
toBXTNewsActivity.putExtra("holder1", mBXTNewsList.get(position).getHolder1());
toBXTNewsActivity.putExtra("holder2", mBXTNewsList.get(position).getHolder2());
toBXTNewsActivity.putExtra("points", mBXTNewsList.get(position).getPoints());
toBXTNewsActivity.putExtra("speakerinfo", mBXTNewsList.get(position).getSpeakerinfo());
startActivity(toBXTNewsActivity);
}
}

View File

@ -0,0 +1,65 @@
package com.stone.shop.view;
import com.stone.shop.R;
import com.stone.shop.model.BXTNews;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
/**
* 教学类-博学堂-讲座详情界面
* @date 2014-5-10
* @author Stone
*/
public class BXTNewsActivity extends Activity {
private static final String TAG = "BXTNewsActivity";
private BXTNews news;
private TextView tvBXTNewsTitle;
private TextView tvBXTNewsTopic;
private TextView tvBXTNewsSpeaker;
private TextView tvBXTNewsTime;
private TextView tvBXTNewsLoc;
private TextView tvBXTNewsHolder1;
private TextView tvBXTNewsHolder2;
private TextView tvBXTNewsPoints;
private TextView tvBXTNewsSpeakerInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bxt_news);
initView();
}
private void initView() {
tvBXTNewsTitle = (TextView) findViewById(R.id.tv_bxt_news_title);
tvBXTNewsTopic = (TextView) findViewById(R.id.tv_bxt_news_topic);
tvBXTNewsSpeaker = (TextView) findViewById(R.id.tv_bxt_news_speaker);
tvBXTNewsTime = (TextView) findViewById(R.id.tv_bxt_news_time);
tvBXTNewsLoc = (TextView) findViewById(R.id.tv_bxt_news_loc);
tvBXTNewsHolder1 = (TextView) findViewById(R.id.tv_bxt_news_holder1);
tvBXTNewsHolder2 = (TextView) findViewById(R.id.tv_bxt_news_holder2);
tvBXTNewsPoints = (TextView) findViewById(R.id.tv_bxt_news_point);
tvBXTNewsSpeakerInfo = (TextView) findViewById(R.id.tv_bxt_news_speaker_info);
tvBXTNewsTitle.setText(getIntent().getStringExtra("title"));
tvBXTNewsTopic.setText(getIntent().getStringExtra("topic"));
tvBXTNewsSpeaker.setText(getIntent().getStringExtra("speaker"));
tvBXTNewsTime.setText(getIntent().getStringExtra("time"));
tvBXTNewsLoc.setText(getIntent().getStringExtra("location"));
tvBXTNewsHolder1.setText(getIntent().getStringExtra("holder1"));
tvBXTNewsHolder2.setText(getIntent().getStringExtra("holder2"));
tvBXTNewsPoints.setText(getIntent().getStringExtra("points"));
tvBXTNewsSpeakerInfo.setText(getIntent().getStringExtra("speakerinfo"));
}
}

View File

@ -0,0 +1,104 @@
package com.stone.shop.view;
import cn.bmob.v3.Bmob;
import com.stone.shop.R;
import com.stone.shop.view.old.OldMineActivity;
import android.os.Bundle;
import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.Space;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
/**
* 应用主界面
* @date 2014-4-24
* @author Stone
*/
@SuppressWarnings("deprecation")
public class BaseActivity extends TabActivity {
private static final String TAG = "BaseActivity";
private TabHost tabHost;
private LayoutInflater layoutInflater;
String[] mTitle = new String[] { "周边", "讨论区", "我的"};
int[] mIcon = new int[] { R.drawable.ic_shop2, R.drawable.ic_sale2,
R.drawable.ic_car2, R.drawable.ic_mine };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base);
initTabView();
}
public View getTabItemView(int i) {
// TODO Auto-generated method stub
View view = layoutInflater.inflate(R.layout.tab_widget_item, null);
ImageView imageView = (ImageView) view.findViewById(R.id.imageview);
imageView.setImageResource(mIcon[i]);
TextView textView = (TextView) view.findViewById(R.id.textview);
textView.setText(mTitle[i]);
return view;
}
public void initTabView() {
/**
* tabHost.newTabSpec("artist")创建一个标签项其中artist为它的标签标识符相当于jsp页面标签的name属性
* setIndicator("艺术标签",resources.getDrawable(R.drawable.ic_tab))设置标签显示文本以及标签上的图标该图标并不是一个图片而是一个xml文件哦
* setContent(intent)为当前标签指定一个意图
* tabHost.addTab(spec); 将标签项添加到标签中
*/
tabHost = getTabHost();
layoutInflater = LayoutInflater.from(this);
TabHost.TabSpec spec;
Intent intent1 = new Intent(this, ShopActivity.class);
spec = tabHost.newTabSpec(mTitle[0]).setIndicator( getTabItemView(0) ).setContent(intent1);
tabHost.addTab(spec);
Intent intent2 = new Intent(this, AwardActivity.class);
spec = tabHost.newTabSpec(mTitle[1]).setIndicator( getTabItemView(1) ).setContent(intent2);
tabHost.addTab(spec);
Intent intent3 = new Intent(this, MineActivity.class);
spec = tabHost.newTabSpec(mTitle[2]).setIndicator( getTabItemView(2) ).setContent(intent3);
tabHost.addTab(spec);
/*
Intent intent3 = new Intent(this, WsqActivity.class);
spec = tabHost.newTabSpec(mTitle[2]).setIndicator( getTabItemView(2) ).setContent(intent3);
tabHost.addTab(spec);
Intent intent4 = new Intent(this, OldMineActivity.class);
spec = tabHost.newTabSpec(mTitle[3]).setIndicator( getTabItemView(3) ).setContent(intent4);
tabHost.addTab(spec); */
tabHost.setCurrentTab(0);
}
@Override
public void onBackPressed() {
Toast.makeText(this, "确定要退出在这里么?", Toast.LENGTH_LONG).show();
//super.onBackPressed();
}
}

View File

@ -0,0 +1,94 @@
package com.stone.shop.view;
import java.util.ArrayList;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
import com.stone.shop.R;
import com.stone.shop.adapter.BXTListAdapter;
import com.stone.shop.adapter.ClassroomAdapter;
import com.stone.shop.model.Classroom;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class ClassroomActivity extends Activity implements OnItemClickListener {
private static final String TAG = "BXTActivity";
private GridView lvBXTNews;
private ClassroomAdapter mBxtListAdapter;
private List<Classroom> mBXTNewsList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_classroom);
initView();
initData();
}
private void initView() {
lvBXTNews = (GridView) findViewById(R.id.gv_classroom);
mBXTNewsList = new ArrayList<Classroom>();
mBxtListAdapter = new ClassroomAdapter(this, mBXTNewsList);
lvBXTNews.setAdapter(mBxtListAdapter);
lvBXTNews.setOnItemClickListener(this);
TextView tv_title = (TextView) findViewById(R.id.tv_title);
tv_title.setText("教室");
}
private void initData() {
BmobQuery<Classroom> query = new BmobQuery<Classroom>();
query.addWhereEqualTo("type", "教室");
query.findObjects(this, new FindListener<Classroom>() {
@Override
public void onSuccess(List<Classroom> newsList) {
// toast("查询商品成功, 共" + newsList.size());
if (newsList.size() == 0)
toast("亲, 暂时还木有教室哦");
else {
mBXTNewsList = newsList;
mBxtListAdapter.refresh(newsList);
mBxtListAdapter.notifyDataSetChanged();
}
}
@Override
public void onError(int arg0, String arg1) {
toast("查询失败");
}
});
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(ClassroomActivity.this, ReservationActivity.class);
Classroom classroom = mBXTNewsList.get(position);
intent.putExtra("roomId", classroom.getObjectId());
intent.putExtra("roomName", classroom.getName());
startActivity(intent);
}
}

Some files were not shown because too many files have changed in this diff Show More