首先是APP的展示
代码:
后台管理:
搭建环境:
APP:Android Studio 2.3
后台管理:Myeclipse10以上
数据库:Mysql
代码
首页:
public class GoodsListActivity extends Activity { private GridView gv_goodsList; private Intent mIntent; private TextView tv_actionBarTitle; private ImageView iv_refresh; private static final int WHAT_GET_ALL_GOODSINFO = 205; private String menu_title[] = { "全部", "最新发布", "热门", "拍卖", "免费送", "急售"}; private static final int WHAT_GET_ALL_GOODSINFO_FAILED = 203; public static final int WHAT_GET_DATA_FINISHED = 200; private RotateAnimation animation; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { animation.cancel();//停止刷新 progressDialogUtils.closeProgressDialog(); switch (msg.what) { case WHAT_GET_ALL_GOODSINFO: goodsList = (List<Goods>) msg.obj; showDate(); break; case WHAT_GET_DATA_FINISHED: ToastUtils.showInfo(GoodsListActivity.this, "加载成功"); goodsList = (List<Goods>) msg.obj; showDate(); break; case WHAT_GET_ALL_GOODSINFO_FAILED: ToastUtils.showInfo(GoodsListActivity.this, "数据加载失败"); break; } } }; private EditText et_search; private Button btn_search; /** * 显示数据到视图上 */ private void showDate() { setAdapter(); } private ProgressDialogUtils progressDialogUtils; private List<Goods> goodsList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SysApplication.getInstance().addActivity(this); progressDialogUtils = new ProgressDialogUtils(this, "加载数据", "拼命加载数据中......"); initView(); updateDate(); } // private String[] titls = {"校园代步", "手机", "电脑", "数码配件", "数码", "电器", "运动健身", "衣物伞帽", "图书教材", "校园网", "生活娱乐", "其他"}; /** * 设置刷新按钮的动画 */ private void setAnimation() { animation = new RotateAnimation(0, 360f, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(1000); animation.setRepeatCount(40); } /** * 更新数据 */ private void updateDate() { progressDialogUtils.showProgressDialog(); mIntent = getIntent(); String type = mIntent.getStringExtra("type"); if ("search".equals(type)) { } else if ("classify".equals(type)) { final int position = mIntent.getIntExtra("position", 0); //开启线程读取数据 new Thread() { @Override public void run() { GoodsInfoQueryHttpUtils.getNewGoodsInfoToList(GoodsListActivity.this, getResources().getString(R.string.url_query_goods) + "?type=all&position=" + position, handler); } }.start(); } else if ("other".equals(type)) { int title = mIntent.getIntExtra("title", 0); // Log.e("mylog", "查询的是哪里的?" + title + "----"); switch (title) { case 0: getAllGoodsInfo(); break; case 1: getNewGoodsInfo(); break; case 2: getHotGoodsInfo(); break; case 3: getPaiGoodsInfo(); break; case 4: getFreeGoodsInfo(); break; case 5: getUrgentGoodsInfo(); break; } } } /** * 获取正在拍卖的商品 */ private void getPaiGoodsInfo() { //开启线程读取数据 new Thread() { @Override public void run() { GoodsInfoQueryHttpUtils.getNewGoodsInfoToList(GoodsListActivity.this, getResources().getString(R.string.url_query_goods) + "?type=pai", handler); } }.start(); } /** * 获取紧急出售的商品 */ private void getUrgentGoodsInfo() { //开启线程读取数据 new Thread() { @Override public void run() { GoodsInfoQueryHttpUtils.getNewGoodsInfoToList(GoodsListActivity.this, getResources().getString(R.string.url_query_goods) + "?type=new&flag=urgent", handler); } }.start(); } /** * 获取免费的商品 */ private void getFreeGoodsInfo() { //开启线程读取数据 new Thread() { @Override public void run() { GoodsInfoQueryHttpUtils.getNewGoodsInfoToList(GoodsListActivity.this, getResources().getString(R.string.url_query_goods) + "?type=new&flag=free", handler); } }.start(); } /** * 获取最热门的 */ private void getHotGoodsInfo() { //开启线程读取数据 new Thread() { @Override public void run() { GoodsInfoQueryHttpUtils.getNewGoodsInfoToList(GoodsListActivity.this, getResources().getString(R.string.url_query_goods) + "?type=new&flag=hot", handler); } }.start(); } /** * 获取最新发布的商品 */ private
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198