修改代码中问题
This commit is contained in:
kaka727 2016-09-01 21:30:07 +08:00
parent fb918b7612
commit 7384182b7d
803 changed files with 12274 additions and 12286 deletions

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Shop</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,78 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,63 +0,0 @@
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

@ -1,63 +0,0 @@
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

@ -1,63 +0,0 @@
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

@ -1,53 +0,0 @@
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

@ -1,53 +0,0 @@
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

@ -1,53 +0,0 @@
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

@ -1,61 +0,0 @@
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

@ -1,61 +0,0 @@
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

@ -1,61 +0,0 @@
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

@ -1,82 +0,0 @@
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

@ -1,82 +0,0 @@
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

@ -1,82 +0,0 @@
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

@ -1,106 +0,0 @@
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

@ -1,106 +0,0 @@
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

@ -1,106 +0,0 @@
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

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent" android:id="@+id/tv_hello_world"
android:layout_height="wrap_content" android:text=" " />
<TextView android:layout_width="fill_parent" android:id="@+id/tv_scroll"
android:layout_below="@id/tv_hello_world" android:layout_marginLeft="20dip"
android:layout_height="wrap_content"
android:text=" " />
<Button android:id="@+id/bt_scrollLeft"
android:layout_alignParentBottom="true" android:layout_width="200dip"
android:layout_height="wrap_content" android:text="scrollLeft" />
<Button android:id="@+id/bt_scrollRight" android:layout_width="200dip"
android:layout_toRightOf="@id/bt_scrollLeft"
android:layout_alignParentBottom="true" android:layout_height="wrap_content"
android:text="scrollRight" />
</RelativeLayout>

View File

@ -1,28 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent" android:id="@+id/tv_hello_world"
android:layout_height="wrap_content" android:text=" " />
<com.stone.shop.view.MultiViewGroup
android:id="@+id/mymultiViewGroup" android:layout_below="@id/tv_hello_world"
android:layout_height="wrap_content" android:layout_width="wrap_content">
</com.stone.shop.view.MultiViewGroup>
<Button
android:id="@+id/bt_scrollLeft"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="跳过,直接登录" />
<Button android:id="@+id/bt_scrollRight" android:layout_width="200dip"
android:layout_toRightOf="@id/bt_scrollLeft"
android:layout_alignParentBottom="true" android:layout_height="wrap_content"
android:text="停止滑动" />
</RelativeLayout>

View File

@ -1,11 +0,0 @@
package com.stone.date;
public class MessageDef {
//查询用户订单成功完成
public static final int MINE_FINISH_LOAD_DATA = 401;
//查询用户成功完成
public static final int MINE_INFO_FINISH_FIND_USER = 402;
}

View File

@ -1,29 +0,0 @@
package com.stone.date;
/**
* 类型分类汇总
*
* @date 2014-4-29
* @author Stone
*/
public class TypeDef {
//父分类
public static final String[] typeDadList = { "学习", "点餐", "校园服务", "娱乐" };
//子分类--学习小菜
public static final String[] typeSonList1 = { "教室", "图书馆" , "学校通知"};
//子分类--吃饭小菜
public static final String[] typeSonList2 = { "一食堂", "二食堂" };
//子分类--购物小菜
public static final String[] typeSonList3 = {"博学堂", "打印", "理发", "宾馆", "自行车", "生日蛋糕", "宿舍超市"};
//子分类--疯狂小菜
public static final String[] typeSonList4 = { "兼职", "景点门票", "租车", "旅游",
"聚餐", "宾馆", "KTV" };
public static final String[] chDayOfWeek = {"","","","","","",""};
}

View File

@ -1,169 +0,0 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.Constant;
import com.stone.shop.model.Discuss;
import com.stone.shop.model.User;
import com.stone.shop.view.CommentActivity;
import com.stone.util.ActivityUtil;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobPointer;
import cn.bmob.v3.datatype.BmobRelation;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.UpdateListener;
public class AIContentAdapter extends BaseContentAdapter<Discuss> {
public static final String TAG = "AIContentAdapter";
public static final int SAVE_FAVOURITE = 2;
public AIContentAdapter(Context context, List<Discuss> list) {
super(context, list);
// TODO Auto-generated constructor stub
}
@Override
public View getConvertView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = mInflater.inflate(R.layout.ai_item, null);
viewHolder.userName = (TextView) convertView.findViewById(R.id.user_name);
viewHolder.userLogo = (ImageView) convertView.findViewById(R.id.user_logo);
viewHolder.contentText = (TextView) convertView.findViewById(R.id.content_text);
viewHolder.contentImage = (ImageView) convertView.findViewById(R.id.content_image);
viewHolder.love = (TextView) convertView.findViewById(R.id.item_action_love);
viewHolder.hate = (TextView) convertView.findViewById(R.id.item_action_hate);
viewHolder.share = (TextView) convertView.findViewById(R.id.item_action_share);
viewHolder.comment = (TextView) convertView.findViewById(R.id.item_action_comment);
viewHolder.title_text = (TextView) convertView.findViewById(R.id.title_text);
viewHolder.time_text = (TextView) convertView.findViewById(R.id.time_text);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
final Discuss entity = dataList.get(position);
viewHolder.userName.setText(entity.getAuthor().getUsername());
viewHolder.contentText.setText(entity.getContent());
if (null == entity.getContentfigureurl()) {
viewHolder.contentImage.setVisibility(View.GONE);
} else {
viewHolder.contentImage.setVisibility(View.VISIBLE);
}
viewHolder.love.setText(entity.getLove() + "");
if (entity.getMyLove()) {
viewHolder.love.setTextColor(Color.parseColor("#D95555"));
} else {
viewHolder.love.setTextColor(Color.parseColor("#000000"));
}
viewHolder.title_text.setText(entity.getTitle());
viewHolder.time_text.setText(entity.getCreatedAt());
viewHolder.hate.setText(entity.getHate() + "");
viewHolder.love.setOnClickListener(new OnClickListener() {
boolean oldFav = entity.getMyFav();
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (entity.getMyLove()) {
ActivityUtil.show(mContext, "您已赞过啦");
return;
}
entity.setLove(entity.getLove() + 1);
viewHolder.love.setTextColor(Color.parseColor("#D95555"));
viewHolder.love.setText(entity.getLove() + "");
entity.increment("love", 1);
if (entity.getMyFav()) {
entity.setMyFav(false);
}
entity.setMyLove(true);
entity.update(mContext, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
entity.setMyLove(true);
entity.setMyFav(oldFav);
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
entity.setMyLove(false);
entity.setMyFav(oldFav);
}
});
}
});
viewHolder.hate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
entity.setHate(entity.getHate() + 1);
viewHolder.hate.setText(entity.getHate() + "");
entity.increment("hate", 1);
entity.update(mContext, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
ActivityUtil.show(mContext, "点踩成功~");
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
}
});
}
});
viewHolder.comment.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// 评论
Intent intent = new Intent();
intent.setClass(mContext, CommentActivity.class);
intent.putExtra("data", entity);
mContext.startActivity(intent);
}
});
return convertView;
}
public static class ViewHolder {
public ImageView userLogo;
public TextView userName;
public TextView contentText;
public ImageView contentImage;
private TextView title_text;
private TextView time_text;
public TextView love;
public TextView hate;
public TextView share;
public TextView comment;
}
}

View File

@ -1,70 +0,0 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.BXTNews;
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.TextView;
/**
* 教学类-博学堂-讲座列表适配器
*
* @date 2014-5-10
* @author Stone
*/
public class BXTListAdapter extends BaseAdapter {
private List<BXTNews> mNewsList; // 商品列表信息
private LayoutInflater mInflater = null;
public BXTListAdapter(Context context, List<BXTNews> newsList) {
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

@ -1,61 +0,0 @@
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;
public abstract class BaseContentAdapter<T> extends BaseAdapter{
protected Context mContext;
protected List<T> dataList ;
protected LayoutInflater mInflater;
public List<T> getDataList() {
return dataList;
}
public void setDataList(List<T> dataList) {
this.dataList = dataList;
}
public BaseContentAdapter(Context context,List<T> list){
mContext = context;
dataList = list;
mInflater = LayoutInflater.from(mContext);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return dataList.size();
}
@Override
public T getItem(int position) {
// TODO Auto-generated method stub
return dataList.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
return getConvertView(position,convertView,parent);
}
public abstract View getConvertView(int position, View convertView, ViewGroup parent);
}

View File

@ -1,67 +0,0 @@
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 List<Classroom> mNewsList; // 商品列表信息
private LayoutInflater mInflater = null;
public ClassroomAdapter(Context context, List<Classroom> newsList) {
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

@ -1,55 +0,0 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.Comment;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class CommentAdapter extends BaseContentAdapter<Comment>{
public CommentAdapter(Context context, List<Comment> list) {
super(context, list);
// TODO Auto-generated constructor stub
}
@Override
public View getConvertView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder viewHolder;
if(convertView == null){
viewHolder = new ViewHolder();
convertView = mInflater.inflate(R.layout.comment_item, null);
viewHolder.userName = (TextView)convertView.findViewById(R.id.userName_comment);
viewHolder.commentContent = (TextView)convertView.findViewById(R.id.content_comment);
viewHolder.index = (TextView)convertView.findViewById(R.id.index_comment);
viewHolder.time_comment = (TextView) convertView.findViewById(R.id.time_comment);
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolder)convertView.getTag();
}
final Comment comment = dataList.get(position);
if(comment.getUser()!=null){
viewHolder.userName.setText(comment.getUser().getUsername());
}else{
viewHolder.userName.setText("墙友");
}
viewHolder.index.setText((position+1)+"");
viewHolder.commentContent.setText(comment.getCommentContent());
viewHolder.time_comment.setText(comment.getCreatedAt());
return convertView;
}
public static class ViewHolder{
public TextView userName;
public TextView commentContent;
public TextView index;
private TextView time_comment;
}
}

View File

@ -1,17 +0,0 @@
package com.stone.shop.adapter;
import android.widget.Button;
import android.widget.TextView;
/**
* 商品视图
* @date 2014-4-26
* @author Stone
*/
public class GoodsHolder {
public TextView tvName; //商品名称
public TextView tvPrice; //商品单价
public TextView btnBuyGood; //购买按钮
}

View File

@ -1,68 +0,0 @@
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.TextView;
import com.stone.shop.R;
import com.stone.shop.model.Good;
public class GoodsListAdapter extends BaseAdapter {
private List<Good> mGoodsList; // 商品列表信息
private LayoutInflater mInflater = null;
public GoodsListAdapter(Context context, List<Good> goodsList) {
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

@ -1,111 +0,0 @@
package com.stone.shop.adapter;
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 final String[] mSchoolTexts = TypeDef.typeSonList1;
private int[] mSchoolImages = { R.drawable.ic_81, R.drawable.ic_82, R.drawable.ic_8 };
//吃饭小菜
public static final String[] mFoodTexts = TypeDef.typeSonList2;
private int[] mFoodImages = { R.drawable.ic_41, R.drawable.ic_42};
//购物小菜
public static final 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 final 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);
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

@ -1,77 +0,0 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.Information;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
* 校园通知消息列表适配器第二版
* @author XCP
* @date 2016-8-25
*
*/
public class InfoNewsListAdapter extends BaseAdapter {
private LayoutInflater mInflater = null;
private List<Information> mInfoNewsList = null;
public InfoNewsListAdapter(Context context, List<Information> infonewsList) {
mInfoNewsList = infonewsList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mInfoNewsList.size();
}
@Override
public Object getItem(int position) {
return mInfoNewsList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(List<Information> list) {
mInfoNewsList = 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;
ss = mInfoNewsList.get(position).getCreatedAt().split(" ");
newsHolder.tvNewsType.setText(mInfoNewsList.get(position).getHolder()); //新闻单位
newsHolder.tvNewsTitle.setText(mInfoNewsList.get(position).getTitle()); //新闻标题
newsHolder.tvNewsDate.setText(ss[0]); //新闻发布日期
return convertView;
}
}

View File

@ -1,71 +0,0 @@
package com.stone.shop.adapter;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.model.Information;
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.TextView;
/**
* 学校通知列表适配器
* @author XCP
* @date 2016-8-22
*/
public class InformationListAdapter extends BaseAdapter {
private List<Information> mInfoList; // 商品列表信息
private LayoutInflater mInflater = null;
public InformationListAdapter(Context context, List<Information> infoList) {
mInfoList = infoList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mInfoList.size();
}
@Override
public Object getItem(int position) {
return mInfoList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(List<Information> list) {
Log.i("InformationListAdapter", "Adapter刷新数据");
mInfoList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
BXTNewsHolder newsHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.info_list_item, null);
newsHolder = new BXTNewsHolder();
newsHolder.tvBXTNewsTitle = (TextView) convertView
.findViewById(R.id.tv_info_item_title);
convertView.setTag(newsHolder);
} else {
newsHolder = (BXTNewsHolder) convertView.getTag();
}
newsHolder.tvBXTNewsTitle.setText(mInfoList.get(position).getTitle());
return convertView;
}
}

View File

@ -1,67 +0,0 @@
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 String[] mItemNames; // 项目列表名称
private String[] mItemContents; //项目列表的备注值
private int[] mItemImgIds; // 项目列表Icon
private LayoutInflater mInflater = null;
public MineListAdapter(Context context, String[] names, String[] contents, int[] imgIds) {
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

@ -1,12 +0,0 @@
package com.stone.shop.adapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MineListHolder {
public ImageView imgItem; //项目Icon
public TextView tvItemName; //项目名称
public TextView tvItemContent; //项目值
}

View File

@ -1,62 +0,0 @@
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.TextView;
import com.stone.shop.R;
/**
* MineActivity 项目列表适配器
* @date 2014-5-10
* @author Stone
*/
public class MineSoftAdapter extends BaseAdapter {
private String[] mItemNames; // 项目列表名称
private String[] mItemContents; //项目列表的备注值
private LayoutInflater mInflater = null;
public MineSoftAdapter(Context context, String[] names, String[] contents) {
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

@ -1,10 +0,0 @@
package com.stone.shop.adapter;
import android.widget.TextView;
public class MineSoftHolder {
public TextView tvItemName; //项目名称
public TextView tvItemContent; //项目值
}

View File

@ -1,11 +0,0 @@
package com.stone.shop.adapter;
import android.widget.TextView;
public class NewsHolder {
public TextView tvNewsType; //新闻分类
public TextView tvNewsTitle; //新闻标题
public TextView tvNewsDate; //新闻时间
}

View File

@ -1,78 +0,0 @@
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.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 NewsListAdapter extends BaseAdapter {
private LayoutInflater mInflater = null;
private List<News> mNewsList = null; // 所选分类下的所有店铺列表
public NewsListAdapter(Context context, List<News> newsList) {
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<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;
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

@ -1,12 +0,0 @@
package com.stone.shop.adapter;
import android.widget.TextView;
public class OrderInfoHolder {
public TextView tvOrderInfoGoodName;
public TextView tvOrderInfoShopName;
public TextView tvOrderInfoPrice;
public TextView tvOrderInfoState;
}

View File

@ -1,78 +0,0 @@
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.TextView;
import com.stone.shop.R;
import com.stone.shop.model.Order;
/**
* 适配器--适配订单列表中的数据
*
* @date 2014-5-27
* @author Stone
*/
public class OrderInfoListAdapter extends BaseAdapter {
private LayoutInflater mInflater = null;
private List<Order> mOrderList = null; // 所选分类下的所有店铺列表
public OrderInfoListAdapter(Context context, List<Order> orderList) {
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

@ -1,64 +0,0 @@
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 LayoutInflater mInflater = null;
private List<SComment> mSComList = null; // 所选分类下的所有店铺列表
public SCommentAdapter(Context context, List<SComment> list) {
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

@ -1,123 +0,0 @@
package com.stone.shop.adapter;
import java.util.ArrayList;
import java.util.Iterator;
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 LayoutInflater mInflater = null;
private ArrayList<Shop> mShopList = null; // 所选分类下的所有店铺列表
private String mType; // 商店的分类
public ShopListAdapter(Context context, ArrayList<Shop> shopList,
String type) {
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

@ -1,41 +0,0 @@
package com.stone.shop.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.SparseArray;
import android.view.ViewGroup;
/*
Extension of FragmentStatePagerAdapter which intelligently caches
all active fragments and manages the fragment lifecycles.
Usage involves extending from SmartFragmentStatePagerAdapter as you would any other PagerAdapter.
*/
public abstract class SmartFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
// Sparse array to keep track of registered fragments in memory
private SparseArray<Fragment> registeredFragments = new SparseArray<Fragment>();
public SmartFragmentStatePagerAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
// Register the fragment when the item is instantiated
@Override
public Object instantiateItem(ViewGroup container, int position) {
Fragment fragment = (Fragment) super.instantiateItem(container, position);
registeredFragments.put(position, fragment);
return fragment;
}
// Unregister when the item is inactive
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
registeredFragments.remove(position);
super.destroyItem(container, position, object);
}
// Returns the fragment for the position (if instantiated)
public Fragment getRegisteredFragment(int position) {
return registeredFragments.get(position);
}
}

View File

@ -1,76 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 博学堂讲座实体类
* @date 2014-5-10
* @author Stone
*/
public class BXTNews extends BmobObject{
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

@ -1,78 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,31 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
public class Classroom extends BmobObject {
private String name;
private String type;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "ClassRoom [name= " + name + "tpye= " + type + "]";
}
}

View File

@ -1,27 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
public class Comment extends BmobObject{
public static final String TAG = "Comment";
private User user;
private String commentContent;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getCommentContent() {
return commentContent;
}
public void setCommentContent(String commentContent) {
this.commentContent = commentContent;
}
}

View File

@ -1,127 +0,0 @@
package com.stone.shop.model;
import java.io.Serializable;
import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.datatype.BmobRelation;
public class Discuss extends BmobObject implements Serializable {
private User author;
private String title;
private String content;
private BmobFile Contentfigureurl;
private int love;
private int hate;
private int share;
private int comment;
private boolean isPass;
private boolean myFav;// 收藏
private boolean myLove;//
private BmobRelation relation;
public BmobRelation getRelation() {
return relation;
}
public void setRelation(BmobRelation relation) {
this.relation = relation;
}
public User getAuthor() {
return author;
}
public void setAuthor(User author) {
this.author = author;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public BmobFile getContentfigureurl() {
return Contentfigureurl;
}
public void setContentfigureurl(BmobFile contentfigureurl) {
Contentfigureurl = contentfigureurl;
}
public int getLove() {
return love;
}
public void setLove(int love) {
this.love = love;
}
public int getHate() {
return hate;
}
public void setHate(int hate) {
this.hate = hate;
}
public int getShare() {
return share;
}
public void setShare(int share) {
this.share = share;
}
public int getComment() {
return comment;
}
public void setComment(int comment) {
this.comment = comment;
}
public boolean isPass() {
return isPass;
}
public void setPass(boolean isPass) {
this.isPass = isPass;
}
public boolean getMyFav() {
return myFav;
}
public void setMyFav(boolean myFav) {
this.myFav = myFav;
}
public boolean getMyLove() {
return myLove;
}
public void setMyLove(boolean myLove) {
this.myLove = myLove;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "QiangYu [author=" + author + ", content=" + content + ", Contentfigureurl=" + Contentfigureurl
+ ", love=" + love + ", hate=" + hate + ", share=" + share + ", comment=" + comment + ", isPass="
+ isPass + ", myFav=" + myFav + ", myLove=" + myLove + ", relation=" + relation + "]";
}
}

View File

@ -1,49 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 用户反馈信息
* @date 2014-5-27
* @author Stone
*/
public class FeedBack extends BmobObject {
private String username;
private String phone;
private String email;
private String content;
public String getUsername() {
return username;
}
public String getPhone() {
return phone;
}
public String getEmail() {
return email;
}
public String getContent() {
return content;
}
public void setUsername(String username) {
this.username = username;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setEmail(String email) {
this.email = email;
}
public void setContent(String content) {
this.content = content;
}
}

View File

@ -1,61 +0,0 @@
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 type = ""; // 类型
private String name = ""; // 名称
private String price = ""; // 价格
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

@ -1,63 +0,0 @@
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

@ -1,63 +0,0 @@
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

@ -1,63 +0,0 @@
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

@ -1,51 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 学校通知实体类
* @author XCP
* @date 2016-8-22
*/
public class Information extends BmobObject{
private String title; //标题
private String topic; //主题
private String time; //时间
private String holder; //单位
private String content; //内容
public String getTitle() {
return title;
}
public String getTopic() {
return topic;
}
public String getTime() {
return time;
}
public String getHolder() {
return holder;
}
public String getcontent() {
return content;
}
public void setTitle(String title) {
this.title = title;
}
public void setTopic(String topic) {
this.topic = topic;
}
public void setTime(String time) {
this.time = time;
}
public void setHolder(String holder) {
this.holder = holder;
}
public void setContent(String content){
this.content = content;
}
}

View File

@ -1,30 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
public class Library {
private String name;
private String type;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "Library [name= " + name + "tpye= " + type + "]";
}
}

View File

@ -1,28 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 中奖用户
* @date 2014-5-28
* @author Stone
*/
public class LuckyUser extends BmobObject {
private String username;
private String award;
public String getUsername() {
return username;
}
public String getAward() {
return award;
}
public void setUsername(String username) {
this.username = username;
}
public void setAward(String award) {
this.award = award;
}
}

View File

@ -1,50 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 首页校内新闻实体类
*
* @date 2014-5-3
* @author Stone
*/
public class News extends BmobObject {
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

@ -1,53 +0,0 @@
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

@ -1,53 +0,0 @@
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

@ -1,53 +0,0 @@
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

@ -1,92 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 订单实体类
* @date 2014-4-24
* @author Stone
*/
public class Order extends BmobObject {
private String userName;
private String goodID; // 商品ID
private String goodName;
private String shopID; // 商店ID
private String shopName;
private String count; // 数量
private String price; // 价格
private String time; // 取餐时间
private String phone; // 联系电话
private String state = "未取餐"; // 订单状态(已取, 未取)
private String tips; // 附加信息
public String getGoodID() {
return goodID;
}
public String getGoodName() {
return goodName;
}
public String getUserName() {
return userName;
}
public String getShopID() {
return shopID;
}
public String getShopName() {
return shopName;
}
public String getCount() {
return count;
}
public String getPrice() {
return price;
}
public String getTime() {
return time;
}
public String getPhone() {
return phone;
}
public String getState() {
return state;
}
public String getTips() {
return tips;
}
public void setGoodID(String goodID) {
this.goodID = goodID;
}
public void setGoodName(String goodName) {
this.goodName = goodName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setShopID(String shopID) {
this.shopID = shopID;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public void setCount(String count) {
this.count = count;
}
public void setTime(String time) {
this.time = time;
}
public void setPrice(String price) {
this.price = price;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setState(String state) {
this.state = state;
}
public void setTips(String tips) {
this.tips = tips;
}
}

View File

@ -1,44 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
public class Reservation extends BmobObject {
private String roomId;
private String roomName;
private String userId;
private String dateTime;
public String getRoomId() {
return roomId;
}
public void setRoomId(String roomId) {
this.roomId = roomId;
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
}

View File

@ -1,58 +0,0 @@
package com.stone.shop.model;
import cn.bmob.v3.BmobObject;
/**
* 店铺评论实体类
* @date 2014-5-3
* @author Stone
*/
public class SComment extends BmobObject {
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

@ -1,61 +0,0 @@
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

@ -1,61 +0,0 @@
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

@ -1,61 +0,0 @@
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

@ -1,80 +0,0 @@
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; // 促销信息
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

@ -1,82 +0,0 @@
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

@ -1,82 +0,0 @@
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

@ -1,82 +0,0 @@
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

@ -1,101 +0,0 @@
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 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 = "普通用户"; // 用户类型(普通用户黑名单中奖者)
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

@ -1,106 +0,0 @@
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

@ -1,106 +0,0 @@
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

@ -1,106 +0,0 @@
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

@ -1,111 +0,0 @@
package com.stone.shop.view;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.adapter.AIContentAdapter;
import com.stone.shop.model.Discuss;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.datatype.BmobDate;
import cn.bmob.v3.listener.FindListener;
public class AwardActivity extends Activity {
private ArrayList<Discuss> mListItems;
private AIContentAdapter mAdapter;
private ListView actualListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_award);
initView();
initData();
findViewById(R.id.btn_add).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(AwardActivity.this, EditActivity.class), 1024);
}
});
}
private void initView() {
actualListView = (ListView) findViewById(R.id.pull_refresh_list);
actualListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
intent.setClass(AwardActivity.this, CommentActivity.class);
intent.putExtra("data", mListItems.get(position));
startActivity(intent);
}
});
}
private void initData() {
mListItems = new ArrayList<Discuss>();
mAdapter = new AIContentAdapter(this, mListItems);
actualListView.setAdapter(mAdapter);
fetchData();
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
private void fetchData() {
BmobQuery<Discuss> query = new BmobQuery<Discuss>();
query.order("-createdAt");
query.setLimit(1000);
BmobDate date = new BmobDate(new Date(System.currentTimeMillis()));
query.addWhereLessThan("createdAt", date);
query.include("author");
query.findObjects(this, new FindListener<Discuss>() {
@Override
public void onSuccess(List<Discuss> list) {
if (list != null) {
mListItems.clear();
mListItems.addAll(list);
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onError(int arg0, String arg1) {
toast(arg1);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1024 && resultCode == RESULT_OK) {
fetchData();
}
}
}

View File

@ -1,94 +0,0 @@
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 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.ListView;
import android.widget.Toast;
/**
* 教学类-博学堂界面
* @date 2014-5-10
* @author Stone
*/
public class BXTActivity extends Activity implements OnItemClickListener{
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) {
if(newsList.isEmpty())
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

@ -1,61 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
/**
* 教学类-博学堂-讲座详情界面
* @date 2014-5-10
* @author Stone
*/
public class BXTNewsActivity extends Activity {
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

@ -1,88 +0,0 @@
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.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.TextView;
import android.widget.Toast;
public class ClassroomActivity extends Activity implements OnItemClickListener {
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) {
if (newsList.isEmpty())
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);
}
}

View File

@ -1,374 +0,0 @@
package com.stone.shop.view;
import java.util.ArrayList;
import java.util.List;
import com.stone.shop.R;
import com.stone.shop.adapter.CommentAdapter;
import com.stone.shop.model.Comment;
import com.stone.shop.model.Constant;
import com.stone.shop.model.Discuss;
import com.stone.shop.model.User;
import com.stone.util.ActivityUtil;
import com.stone.util.ToastFactory;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobPointer;
import cn.bmob.v3.datatype.BmobRelation;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
public class CommentActivity extends Activity implements OnClickListener {
private ListView commentList;
private TextView footer;
private EditText commentContent;
private Button commentCommit;
private TextView userName;
private TextView commentItemContent;
private ImageView commentItemImage;
private ImageView userLogo;
private TextView comment;
private TextView share;
private TextView love;
private TextView hate;
private TextView title_text;
private TextView time_text;
private Discuss qiangYu;
private String commentEdit = "";
private CommentAdapter mAdapter;
private List<Comment> comments = new ArrayList<Comment>();
private int pageNum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comment);
findViews();
setupViews();
setListener();
fetchData();
}
private void findViews() {
commentList = (ListView) findViewById(R.id.comment_list);
footer = (TextView) findViewById(R.id.loadmore);
commentContent = (EditText) findViewById(R.id.comment_content);
commentCommit = (Button) findViewById(R.id.comment_commit);
userName = (TextView) findViewById(R.id.user_name);
commentItemContent = (TextView) findViewById(R.id.content_text);
commentItemImage = (ImageView) findViewById(R.id.content_image);
userLogo = (ImageView) findViewById(R.id.user_logo);
comment = (TextView) findViewById(R.id.item_action_comment);
share = (TextView) findViewById(R.id.item_action_share);
love = (TextView) findViewById(R.id.item_action_love);
hate = (TextView) findViewById(R.id.item_action_hate);
title_text = (TextView) findViewById(R.id.title_text);
time_text = (TextView) findViewById(R.id.time_text);
}
private void setupViews() {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
| WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
qiangYu = (Discuss) getIntent().getSerializableExtra("data");
pageNum = 0;
mAdapter = new CommentAdapter(this, comments);
commentList.setAdapter(mAdapter);
setListViewHeightBasedOnChildren(commentList);
commentList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
/*do nothing*/
}
});
commentList.setCacheColorHint(0);
commentList.setScrollingCacheEnabled(false);
commentList.setScrollContainer(false);
commentList.setFastScrollEnabled(true);
commentList.setSmoothScrollbarEnabled(true);
initMoodView(qiangYu);
}
private void initMoodView(Discuss mood2) {
if (mood2 == null) {
return;
}
userName.setText(qiangYu.getAuthor().getUsername());
commentItemContent.setText(qiangYu.getContent());
if (null == qiangYu.getContentfigureurl()) {
commentItemImage.setVisibility(View.GONE);
} else {
commentItemImage.setVisibility(View.VISIBLE);
}
love.setText(qiangYu.getLove() + "");
if (qiangYu.getMyLove()) {
love.setTextColor(Color.parseColor("#D95555"));
} else {
love.setTextColor(Color.parseColor("#000000"));
}
hate.setText(qiangYu.getHate() + "");
time_text.setText(mood2.getCreatedAt());
title_text.setText(mood2.getTitle());
}
private void setListener() {
footer.setOnClickListener(this);
commentCommit.setOnClickListener(this);
userLogo.setOnClickListener(this);
love.setOnClickListener(this);
hate.setOnClickListener(this);
share.setOnClickListener(this);
comment.setOnClickListener(this);
}
private void fetchData() {
fetchComment();
}
private void fetchComment() {
BmobQuery<Comment> query = new BmobQuery<Comment>();
query.addWhereRelatedTo("relation", new BmobPointer(qiangYu));
query.include("user");
query.order("createdAt");
query.setLimit(Constant.NUMBERS_PER_PAGE);
query.setSkip(Constant.NUMBERS_PER_PAGE * (pageNum++));
query.findObjects(this, new FindListener<Comment>() {
public void onSuccess(List<Comment> data) {
if (!data.isEmpty()&& data.get(data.size() - 1) != null) {
if (data.size() < Constant.NUMBERS_PER_PAGE) {
toast("已加载完所有评论~");
footer.setText("暂无更多评论~");}
mAdapter.getDataList().addAll(data);
mAdapter.notifyDataSetChanged();
setListViewHeightBasedOnChildren(commentList);
} else {
toast("暂无更多评论~");
footer.setText("暂无更多评论~");
pageNum--;
}
}
public void onError(int arg0, String arg1) {
toast("获取评论失败。请检查网络~");
pageNum--;
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.user_logo:
break;
case R.id.loadmore:
onClickLoadMore();
break;
case R.id.comment_commit:
onClickCommit();
break;
case R.id.item_action_love:
onClickLove();
break;
case R.id.item_action_hate:
onClickHate();
break;
case R.id.item_action_share:
break;
case R.id.item_action_comment:
onClickComment();
break;
default:
break;
}
}
private void onClickLoadMore() {
fetchData();
}
private void onClickCommit() {
User currentUser = BmobUser.getCurrentUser(this, User.class);
if (currentUser != null) {// 已登录
commentEdit = commentContent.getText().toString().trim();
if (TextUtils.isEmpty(commentEdit)) {
toast("评论内容不能为空。");
return;
}
// comment now
publishComment(currentUser, commentEdit);
} else {// 未登录
toast("发表评论前请先登录。");
}
}
private void publishComment(User user, String content) {
final Comment comment = new Comment();
comment.setUser(user);
comment.setCommentContent(content);
comment.save(this, new SaveListener() {
@Override
public void onSuccess() {
toast("评论成功。");
if (mAdapter.getDataList().size() < Constant.NUMBERS_PER_PAGE) {
mAdapter.getDataList().add(comment);
mAdapter.notifyDataSetChanged();
setListViewHeightBasedOnChildren(commentList);
}
commentContent.setText("");
hideSoftInput();
// 将该评论与强语绑定到一起
BmobRelation relation = new BmobRelation();
relation.add(comment);
qiangYu.setRelation(relation);
qiangYu.update(CommentActivity.this, new UpdateListener() {
@Override
public void onSuccess() {/* fetchData*/}
@Override
public void onFailure(int arg0, String arg1) {/*do nothing*/}
});
}
@Override
public void onFailure(int arg0, String arg1) {
toast("评论失败。请检查网络~");
}
});
}
boolean isFav = false;
private void onClickLove() {
User user = BmobUser.getCurrentUser(this, User.class);
if (user == null) {
// 前往登录注册界面
ActivityUtil.show(this, "请先登录。");
return;
}
if (qiangYu.getMyLove()) {
ActivityUtil.show(CommentActivity.this, "您已经赞过啦");
return;
}
isFav = qiangYu.getMyFav();
if (isFav) {
qiangYu.setMyFav(false);
}
qiangYu.setLove(qiangYu.getLove() + 1);
love.setTextColor(Color.parseColor("#D95555"));
love.setText(qiangYu.getLove() + "");
qiangYu.increment("love", 1);
qiangYu.update(this, new UpdateListener() {
@Override
public void onSuccess() {
qiangYu.setMyLove(true);
qiangYu.setMyFav(isFav);
ActivityUtil.show(CommentActivity.this, "点赞成功~");
}
@Override
public void onFailure(int arg0, String arg1) {/*do nothing*/}
});
}
private void onClickHate() {
qiangYu.setHate(qiangYu.getHate() + 1);
hate.setText(qiangYu.getHate() + "");
qiangYu.increment("hate", 1);
qiangYu.update(this, new UpdateListener() {
@Override
public void onSuccess() {
ActivityUtil.show(CommentActivity.this, "点踩成功~");
}
@Override
public void onFailure(int arg0, String arg1) {
/*do nothing*/
}
});
}
private void onClickComment() {
commentContent.requestFocus();
InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(commentContent, 0);
}
private void hideSoftInput() {
InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(commentContent.getWindowToken(), 0);
}
/***
* 动态设置listview的高度 item 总布局必须是linearLayout
*
* @param listView
*/
public void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)) + 15;
listView.setLayoutParams(params);
}
private void toast(String message) {
Toast toast = ToastFactory.getToast(this, message);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
}

View File

@ -1,99 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import com.stone.shop.model.Discuss;
import com.stone.shop.model.User;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Toast;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.listener.SaveListener;
public class EditActivity extends Activity {
private EditText edit_title;
private EditText edit_content;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
initView();
findViewById(R.id.btn_publish).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String title = edit_title.getText().toString().trim();
String content = edit_content.getText().toString().trim();
if (TextUtils.isEmpty(title)) {
toast("标题不能为空");
return;
}
if (TextUtils.isEmpty(content)) {
toast("内容不能为空");
return;
}
publishWithoutFigure(title ,content, null);
}
});
}
private void initView() {
edit_title = (EditText) findViewById(R.id.edit_title);
edit_content = (EditText) findViewById(R.id.edit_content);
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
private void publishWithoutFigure(final String title, final String commitContent,
final BmobFile figureFile) {
User user = BmobUser.getCurrentUser(this, User.class);
final Discuss qiangYu = new Discuss();
qiangYu.setAuthor(user);
qiangYu.setTitle(title);
qiangYu.setContent(commitContent);
if (figureFile != null) {
qiangYu.setContentfigureurl(figureFile);
}
qiangYu.setLove(0);
qiangYu.setHate(0);
qiangYu.setShare(0);
qiangYu.setComment(0);
qiangYu.setPass(true);
qiangYu.save(this, new SaveListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
toast("发表成功!");
setResult(RESULT_OK);
finish();
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
toast("发表失败!");
}
});
}
}

View File

@ -1,92 +0,0 @@
package com.stone.shop.view;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.SaveListener;
import com.stone.shop.R;
import com.stone.shop.model.FeedBack;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
/**
* 意见反馈界面
*
* @date 2014-5-27
* @author Stone
*/
public class FeedBackActivity extends Activity implements OnClickListener {
private EditText etContent;
private Button btnSubmit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
initView();
}
private void initView() {
etContent = (EditText) findViewById(R.id.et_feedback_content);
btnSubmit = (Button) findViewById(R.id.btn_feedback_submit);
btnSubmit.setOnClickListener(this);
}
/**
* 提交用户的反馈信息
*/
private void submit() {
String content = etContent.getText().toString();
if ("".equals(content)) {
toast("亲,请先写点东西吧");
} else {
BmobUser user = BmobUser.getCurrentUser(this);
FeedBack fb = new FeedBack();
fb.setUsername(user.getUsername());
fb.setEmail(user.getEmail());
fb.setContent(content);
fb.save(this, new SaveListener() {
@Override
public void onSuccess() {
toast("提交成功, 在这里会尽快回复");
back();
}
@Override
public void onFailure(int arg0, String arg1) {
toast("提交失败");
}
});
}
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.btn_feedback_submit) {
submit();
}
}
private void back() {
finish();
}
public void clickFeedBack(View v) {
finish();
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
}

View File

@ -1,180 +0,0 @@
package com.stone.shop.view;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ImageView.ScaleType;
import android.widget.TextView;
import android.widget.Toast;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
import com.stone.date.TypeDef;
import com.stone.shop.R;
import com.stone.shop.adapter.ImagePagerAdapter;
import com.stone.shop.adapter.NewsListAdapter;
import com.stone.shop.model.News;
import com.stone.ui.AutoScrollViewPager;
import com.stone.ui.ListScrollView;
/**
* 主界面
*
* @date 2014-4-24
* @author Stone
*/
public class HomeActivity extends Activity implements OnClickListener,
OnItemClickListener {
private ListScrollView listScrollView;
// 校历
private TextView tvWeek; // 周次和星期
private TextView tvDay; // 年月日
// 图片轮播
private FrameLayout flImageAds;
private AutoScrollViewPager viewPager;
private List<View> mImgViews;
private ImageButton btnHideAds;
private int[] mImgResId = { R.drawable.ic_banner1, R.drawable.ic_banner1,
R.drawable.ic_banner1, R.drawable.ic_banner1 };
// 校园新闻
private ListView lvNewsList;
private List<News> newsList = new ArrayList<News>();
private NewsListAdapter newsListAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
// 解决ScrollView和ListView之间的冲突
listScrollView = (ListScrollView) findViewById(R.id.listScrollView);
lvNewsList = (ListView) findViewById(R.id.lv_news);
listScrollView.setListView(lvNewsList);
flImageAds = (FrameLayout) findViewById(R.id.fl_image_ads);
viewPager = (AutoScrollViewPager) findViewById(R.id.view_pager);
btnHideAds = (ImageButton) findViewById(R.id.btn_hide_ads);
mImgViews = new ArrayList<View>();
for (int i = 0; i < mImgResId.length; i++) {
ImageView imageView = new ImageView(this);
imageView.setImageResource(mImgResId[i]);
imageView.setScaleType(ScaleType.CENTER_CROP);
mImgViews.add(imageView);
}
btnHideAds.setOnClickListener(this);
viewPager.setAdapter(new ImagePagerAdapter(this, mImgViews));
viewPager.setInterval(3000); // 设置自动滚动的间隔时间单位为毫秒
viewPager.setDirection(AutoScrollViewPager.RIGHT); // 设置自动滚动的方向默认向右
viewPager.setCycle(true); // 是否自动循环轮播默认为true
viewPager.setScrollDurationFactor(3); // 设置ViewPager滑动动画间隔时间的倍率达到减慢动画或改变动画速度的效果
viewPager.setStopScrollWhenTouch(true); // 当手指碰到ViewPager时是否停止自动滚动默认为true
viewPager.setBorderAnimation(true); // 设置循环滚动时滑动到从边缘滚动到下一个是否需要动画默认为true
viewPager
.setSlideBorderMode(AutoScrollViewPager.SLIDE_BORDER_MODE_NONE);// 滑动到第一个或最后一个Item的处理方式支持没有任何操作轮播以及传递到父View三种模式
viewPager.startAutoScroll();
// 校历
tvWeek = (TextView) findViewById(R.id.tv_week);
tvDay = (TextView) findViewById(R.id.tv_day);
setTime();
// 新闻
newsListAdapter = new NewsListAdapter(this, newsList);
lvNewsList.setAdapter(newsListAdapter);
lvNewsList.setOnItemClickListener(this);
getNewsData();
}
/**
* 设置校历中日期的时间
*/
public void setTime() {
Calendar calendar = Calendar.getInstance();
String year = Integer.toString(calendar.get(Calendar.YEAR));
String month = Integer.toString(calendar.get(Calendar.MONTH)+1);
String day = Integer.toString(calendar.get(Calendar.DAY_OF_MONTH));
String week = Integer.toString(calendar.get(Calendar.WEEK_OF_YEAR)-9);
String dayOfWeek = Integer.toString(calendar.get(Calendar.DAY_OF_WEEK));
String chDayOfWeek = TypeDef.chDayOfWeek[Integer.parseInt(dayOfWeek)-1];
toast(year+"-"+month+"-"+day+" "+""+week+""+" "+" 星期 "+chDayOfWeek);
tvWeek.setText(""+week+""+" "+" 星期 "+chDayOfWeek);
tvDay.setText(year+""+month+""+day+"");
}
/**
* 初始化新闻列表数据
* @date 2014-5-3
* @author Stone
*/
public void getNewsData() {
BmobQuery<News> query = new BmobQuery<News>();
query.order("-updatedAt");
query.findObjects(this, new FindListener<News>() {
@Override
public void onSuccess(List<News> object) {
newsList = object;
// 通知Adapter数据更新
newsListAdapter.refresh((ArrayList<News>) newsList);
newsListAdapter.notifyDataSetChanged();
}
@Override
public void onError(int arg0, String arg1) {
toast("对不起, 获取数据失败了");
}
});
}
@Override
protected void onResume() {
super.onResume();
// start auto scroll when onResume
viewPager.startAutoScroll();
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.btn_hide_ads) {
flImageAds.setVisibility(View.GONE);
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Intent toNewsDetail = new Intent(HomeActivity.this, NewsActivity.class);
toNewsDetail.putExtra("NewsTitle", newsList.get(position).getTitle());
toNewsDetail.putExtra("NewsAuthor", newsList.get(position).getAuthor());
toNewsDetail.putExtra("NewsTime", newsList.get(position).getCreatedAt());
toNewsDetail.putExtra("NewsContent", newsList.get(position).getContent());
startActivity(toNewsDetail);
}
public void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT);
}
}

View File

@ -1,49 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import com.stone.shop.model.Information;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
/**
* 教学 - 学校通知详情界面
* @author XCP
* @date 2016-8-22
*/
public class InfoContentActivity extends Activity {
private TextView tvInfoTitle;
private TextView tvInfoTopic;
private TextView tvInfoTime;
private TextView tvInfoHolder;
private TextView tvInfoContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_infoitem);
initView();
}
private void initView() {
tvInfoTitle = (TextView) findViewById(R.id.tv_info_item_title);
tvInfoTopic = (TextView) findViewById(R.id.tv_info_item_topic);
tvInfoTime = (TextView) findViewById(R.id.tv_info_item_time);
tvInfoHolder = (TextView) findViewById(R.id.tv_info_item_holder);
tvInfoContent = (TextView) findViewById(R.id.tv_info_item_content);
tvInfoTitle.setText(getIntent().getStringExtra("title"));
tvInfoTopic.setText(getIntent().getStringExtra("topic"));
tvInfoTime.setText(getIntent().getStringExtra("time"));
tvInfoHolder.setText(getIntent().getStringExtra("holder"));
tvInfoContent.setText(getIntent().getStringExtra("content"));
}
}

View File

@ -1,48 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
/**
* 校园新闻内容显示第二版
* @author XCP
* @date 2016-8-30
*
*/
public class InfoNewsContentActivity extends Activity {
private TextView tvInfoTitle;
private TextView tvInfoTopic;
private TextView tvInfoTime;
private TextView tvInfoHolder;
private TextView tvInfoContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_infonews_item);
initView();
}
private void initView() {
tvInfoTitle = (TextView) findViewById(R.id.tv_infonews_title);
tvInfoTopic = (TextView) findViewById(R.id.tv_infonews_topic);
tvInfoTime = (TextView) findViewById(R.id.tv_infonews_time);
tvInfoHolder = (TextView) findViewById(R.id.tv_infonews_holder);
tvInfoContent = (TextView) findViewById(R.id.tv_infonews_content);
tvInfoTitle.setText(getIntent().getStringExtra("title"));
tvInfoTopic.setText("关键词:" + getIntent().getStringExtra("topic"));
tvInfoTime.setText("日期:" + getIntent().getStringExtra("time"));
tvInfoHolder.setText("单位: " + getIntent().getStringExtra("holder"));
tvInfoContent.setText(getIntent().getStringExtra("content"));
}
}

View File

@ -1,91 +0,0 @@
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.InfoNewsListAdapter;
import com.stone.shop.model.Information;
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.ListView;
import android.widget.Toast;
/**
* 教学-学校通知界面
* @author XCP
* @date 2016-8-22
*/
public class InformationActivity extends Activity implements OnItemClickListener{
private ListView mlvInfoContent;
private InfoNewsListAdapter mInfoNewsListAdapter;
private List<Information> mInformationList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_information);
initView();
initData();
}
private void initView() {
mlvInfoContent = (ListView) findViewById(R.id.lv_information);
mInformationList = new ArrayList<Information>();
mInfoNewsListAdapter = new InfoNewsListAdapter(this, mInformationList);
mlvInfoContent.setAdapter(mInfoNewsListAdapter);
mlvInfoContent.setOnItemClickListener(this);
}
private void initData() {
BmobQuery<Information> query = new BmobQuery<Information>();
query.findObjects(this, new FindListener<Information>() {
@Override
public void onSuccess(List<Information> infoList) {
if(infoList.isEmpty())
toast("亲, 暂时还木有通知哦");
else {
mInformationList = infoList;
mInfoNewsListAdapter.refresh(infoList);
mInfoNewsListAdapter.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 toInfoContentActivity = new Intent(InformationActivity.this, InfoNewsContentActivity.class);
toInfoContentActivity.putExtra("title", mInformationList.get(position).getTitle());
toInfoContentActivity.putExtra("topic", mInformationList.get(position).getTopic());
toInfoContentActivity.putExtra("time", mInformationList.get(position).getTime());
toInfoContentActivity.putExtra("holder", mInformationList.get(position).getHolder());
toInfoContentActivity.putExtra("content", mInformationList.get(position).getcontent());
startActivity(toInfoContentActivity);
}
}

View File

@ -1,88 +0,0 @@
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.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.TextView;
import android.widget.Toast;
public class LibraryActivity extends Activity implements OnItemClickListener {
private GridView lvBXTNews;
private ClassroomAdapter mBxtListAdapter;
private List<Classroom> mBXTNewsList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_library);
initView();
initData();
}
private void initView() {
lvBXTNews = (GridView) findViewById(R.id.gv_library);
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) {
if (newsList.isEmpty())
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(LibraryActivity.this, LibraryReservationActivity.class);
Classroom classroom = mBXTNewsList.get(position);
intent.putExtra("roomId", classroom.getObjectId());
intent.putExtra("roomName", classroom.getName());
startActivity(intent);
}
}

View File

@ -1,125 +0,0 @@
package com.stone.shop.view;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.stone.shop.R;
import com.stone.shop.model.Reservation;
import com.stone.shop.model.User;
import com.stone.ui.DateTimePickDialogUtil;
import com.stone.ui.DateTimePickDialogUtil.DateTimeListener;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
public class LibraryReservationActivity extends Activity {
private Button btnLogin;
private SimpleDateFormat dateFormat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_libraryreservation);
TextView tvTitle = (TextView) findViewById(R.id.tv_title);
tvTitle.setText("预定研修室");
final String roomId = getIntent().getStringExtra("roomId");
final String roomName = getIntent().getStringExtra("roomName");
TextView tvRoom = (TextView) findViewById(R.id.textView1);
tvRoom.setText("研修室:" + roomName);
btnLogin = (Button) findViewById(R.id.btn_login);
dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
// 查找Person表里面id为6b6c11c537的数据
BmobQuery<Reservation> bmobQuery = new BmobQuery<Reservation>();
bmobQuery.addWhereEqualTo("userId", User.userId);
bmobQuery.addWhereEqualTo("roomId", roomId);
bmobQuery.findObjects(LibraryReservationActivity.this, new FindListener<Reservation>() {
@Override
public void onSuccess(List<Reservation> newsList) {
if (!newsList.isEmpty()) {
String dateTime = newsList.get(0).getDateTime();
try {
if (dateFormat.parse(dateTime).before(new Date())) {
Reservation gameScore = new Reservation();
gameScore.setObjectId(newsList.get(0).getObjectId());
gameScore.delete(LibraryReservationActivity.this);
} else {
btnLogin.setEnabled(false);
btnLogin.setText("已经预定" + (TextUtils.isEmpty(dateTime) ? "" : (" " + dateTime)));
}
} catch (ParseException e) {
// TODO
Logger logger = Logger.getLogger("lavasoft");
logger.log(Level.SEVERE, "something may be wrong", e);
}
}
}
@Override
public void onError(int arg0, String arg1) {
toast("查询失败");
}
});
btnLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO
DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(LibraryReservationActivity.this,
dateFormat.format(new Date()));
dateTimePicKDialog.dateTimePicKDialog(new DateTimeListener() {
@Override
public void onDateTimeChane(final String dateTime) {
//TODO
Reservation libreservation = new Reservation();
libreservation.setRoomId(roomId);
libreservation.setRoomName(roomName);
libreservation.setUserId(User.userId);
libreservation.setDateTime(dateTime);
libreservation.save(LibraryReservationActivity.this, new SaveListener() {
@Override
public void onSuccess() {
// TODO
toast("预定成功");
btnLogin.setEnabled(false);
btnLogin.setText("已经预定 " + dateTime);
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO
toast("预定失败");
}
});
}
});
}
});
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
}

View File

@ -1,299 +0,0 @@
package com.stone.shop.view;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.Bitmap;
import java.util.logging.Level;
import java.util.logging.Logger;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.listener.SaveListener;
import com.stone.shop.R;
import com.stone.shop.model.User;
import com.stone.util.Util;
import com.tencent.connect.UserInfo;
import com.tencent.connect.common.Constants;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.Tencent;
import com.tencent.tauth.UiError;
/**
* 登陆界面
*
* @date 2014-4-24
* @author Stone
*/
public class LoginActivity extends Activity implements OnClickListener {
private static final String TAG = "LoginActicity";
private Button btnLogin;
private Button btnReg;
private EditText etUsername;
private EditText etPassword;
private String username;
private String password;
private static final String APP_ID = "222222";
private UserInfo mInfo;
private TextView mUserInfo;
private ImageView mUserLogo;
private ImageView mNewLoginButton;
// QQ登陆
private static Tencent mTencent;
public String sthwrong="something may be wrong";
public String lavasoft="lavasoft";
Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.what == 0) {
JSONObject response = (JSONObject) msg.obj;
if (response.has("nickname")) {
try {
mUserInfo.setVisibility(android.view.View.VISIBLE);
mUserInfo.setText(response.getString("nickname"));
} catch (JSONException e) {
Logger logger = Logger.getLogger(lavasoft);
logger.log(Level.SEVERE, sthwrong, e);}
}
} else if (msg.what == 1) {
Bitmap bitmap = (Bitmap) msg.obj;
mUserLogo.setImageBitmap(bitmap);
mUserLogo.setVisibility(android.view.View.VISIBLE);
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 初始化 Bmob SDK
// 使用时请将第二个参数Application ID替换成你在Bmob服务器端创建的Application ID
Bmob.initialize(this, "252a2c58d0dc9a78a5411501c62ce0de");
setContentView(R.layout.activity_login);
// QQ登陆, 获取实例
mTencent = Tencent.createInstance(APP_ID, this.getApplicationContext());
btnLogin = (Button) findViewById(R.id.btn_login);
btnReg = (Button) findViewById(R.id.btn_register);
etUsername = (EditText) findViewById(R.id.et_username);
etPassword = (EditText) findViewById(R.id.et_password);
btnLogin.setOnClickListener(this);
btnReg.setOnClickListener(this);
findViewById(R.id.btn_qq).setOnClickListener(this);
mUserInfo = (TextView) findViewById(R.id.user_nickname);
mUserLogo = (ImageView) findViewById(R.id.user_logo);
mNewLoginButton = (ImageView) findViewById(R.id.new_login_btn);
mNewLoginButton.setOnClickListener(this);
getUserInfo();}
public String getusername()
{
return username;
}
public String getpassword()
{
return password;
}
private void getUserInfo() {
SharedPreferences sp = getSharedPreferences("UserInfo", 0);
etUsername.setText(sp.getString(getusername(), null));
etPassword.setText(sp.getString(getpassword(), null));
}
// 保存用户的登陆记录
private void saveUserInfo(String username, String password) {
SharedPreferences sp = getSharedPreferences("UserInfo", 0);
Editor editor = sp.edit();
editor.putString("username", username);
editor.putString("password", password);
editor.commit();
}
public void onClickLogin() {
if (!mTencent.isSessionValid()) {
mTencent.login(this, "all", loginListener);
Log.d("SDKQQAgentPref", "FirstLaunch_SDK:" + SystemClock.elapsedRealtime());
} else {
mTencent.logout(this);
updateUserInfo();
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
// 登陆
case R.id.btn_login:
username = etUsername.getText().toString();
password = etPassword.getText().toString();
if (!Util.isNetworkConnected(this)) {
toast("木有网络 ( ⊙ o ⊙ ) ");
} else if ("".equals(username) || "".equals(password)) {
toast("请输入账号和密码");
break;
} else {
final User bu2 = new User();
bu2.setUsername(username);
bu2.setPassword(password);
bu2.login(this, new SaveListener() {
@Override
public void onSuccess() {
toast("欢迎进入 在这里 服务系统");
saveUserInfo(username, password); // 保存用户信息
User.userId = bu2.getObjectId(); // 跳转到主页
Intent toHome = new Intent(LoginActivity.this, BaseActivity.class);
startActivity(toHome);
finish();}
@Override
public void onFailure(int arg0, String arg1) {
toast("用户名或密码错误");
}
});
}
break;
case R.id.btn_register:
Intent toReg = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(toReg);
break;
case R.id.btn_qq:
onClickLogin();
break;
default:
break;
}
}
public void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
IUiListener loginListener = new BaseUiListener() {
@Override
protected void doComplete(JSONObject values) {
Log.d("SDKQQAgentPref", "AuthorSwitch_SDK:" + SystemClock.elapsedRealtime());
initOpenidAndToken(values);
updateUserInfo();
}
};
private class BaseUiListener implements IUiListener {
@Override
public void onComplete(Object response) {
if (null == response) {
Util.showResultDialog(LoginActivity.this, "返回为空", "登录失败");
return;
}
JSONObject jsonResponse = (JSONObject) response;
if (jsonResponse.length() == 0) {
Util.showResultDialog(LoginActivity.this, "返回为空", "登录失败");
return;
}
doComplete((JSONObject) response);
try {
User.userId = jsonResponse.getString("openid");
} catch (JSONException e) {
// TODO
Logger logger = Logger.getLogger(lavasoft);
logger.log(Level.SEVERE, sthwrong, e);
}
Intent toHome = new Intent(LoginActivity.this, BaseActivity.class);
startActivity(toHome);
finish();
}
protected void doComplete(JSONObject values) {
//do nothing
}
@Override
public void onError(UiError e) {
Util.toastMessage(LoginActivity.this, "onError: " + e.errorDetail);
Util.dismissDialog();
}
@Override
public void onCancel() {
Util.toastMessage(LoginActivity.this, "onCancel: ");
Util.dismissDialog();
}
}
private void updateUserInfo() {
if (mTencent != null && mTencent.isSessionValid()) {
IUiListener listener = new IUiListener() {
@Override
public void onError(UiError e) { /*do nothing*/ }
@Override
public void onComplete(final Object response) {
Message msg = new Message();
msg.obj = response;
msg.what = 0;
mHandler.sendMessage(msg);
new Thread() {
@Override
public void run() {
JSONObject json = (JSONObject) response;
if (json.has("figureurl")) {
Bitmap bitmap = null;
try {bitmap = Util.getbitmap(json.getString("figureurl_qq_2"));
} catch (JSONException e) {
Logger logger = Logger.getLogger(lavasoft);
logger.log(Level.SEVERE, sthwrong, e);}
Message msg = new Message();
msg.obj = bitmap;
msg.what = 1;
mHandler.sendMessage(msg);}}
}.start();}
@Override
public void onCancel() {/*do nothing*/}
};
mInfo = new UserInfo(this, mTencent.getQQToken());
mInfo.getUserInfo(listener);
} else {
mUserInfo.setText("");
mUserInfo.setVisibility(android.view.View.GONE);
mUserLogo.setVisibility(android.view.View.GONE);
}
}
public static void initOpenidAndToken(JSONObject jsonObject) {
try {
String token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN);
String expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN);
String openId = jsonObject.getString(Constants.PARAM_OPEN_ID);
if (!TextUtils.isEmpty(token) && !TextUtils.isEmpty(expires) && !TextUtils.isEmpty(openId)) {
mTencent.setAccessToken(token, expires);
mTencent.setOpenId(openId);
}
} catch (Exception e) {
Logger logger = Logger.getLogger("lavasoft");
logger.log(Level.SEVERE, "sthwrong", e);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, "-->onActivityResult " + requestCode + " resultCode=" + resultCode);
if (requestCode == Constants.REQUEST_LOGIN || requestCode == Constants.REQUEST_APPBAR) {
Tencent.onActivityResultData(requestCode, resultCode, data, loginListener);
}
super.onActivityResult(requestCode, resultCode, data);
}
}

View File

@ -1,57 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity implements OnClickListener {
private TextView tv;
private Button bt_scrollLeft;
private Button bt_scrollRight;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.tv_scroll);
bt_scrollLeft = (Button) findViewById(R.id.bt_scrollLeft);
bt_scrollRight = (Button) findViewById(R.id.bt_scrollRight);
bt_scrollLeft.setOnClickListener(this);
bt_scrollRight.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.bt_scrollLeft:
tv.scrollBy(20, 0);
int tvscrllX = tv.getScrollX();
int tvscrllY = tv.getScrollY();
System.out.println( " tvscrllX ---> " + tvscrllX + " --- tvscrllY ---> "+tvscrllY);
bt_scrollLeft.scrollBy(20, 0);
break;
case R.id.bt_scrollRight:
tv.scrollTo(-100, 0);
int tvscrllXx = tv.getScrollX();
int tvscrllYx = tv.getScrollY();
System.out.println( " tvscrllX ---> " + tvscrllXx + " --- tvscrllY ---> "+tvscrllYx);
break;
default:
break;
}
}
}

View File

@ -1,189 +0,0 @@
package com.stone.shop.view;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.CountListener;
import com.stone.date.MessageDef;
import com.stone.shop.R;
import com.stone.shop.adapter.MineListAdapter;
import com.stone.shop.model.Order;
/**
* 个人中心主界面
* @date 2014-4-24
* @author Stone
*/
public class MineActivity extends Activity implements OnItemClickListener{
private String[] userItemNames = {"stonekity"} ;
private String[] userItemContents = {""} ;
private String[] orderItemNames = {"当前订单", "历史订单"};
private String[] orderItemContents = {"*", ""};
private String[] aboutItemNames = {"通知中心", "软件相关", "推荐给朋友", "退出账号"};
private String[] aboutItemContents = {"", "", "", ""};
private int[] userImgIds = {R.drawable.ic_menu_myplaces};
private int[] orderImgIds = {R.drawable.ic_menu_find_holo_light, R.drawable.ic_menu_copy_holo_light};
private int[] aboutImgIds = {R.drawable.ic_menu_notifications, R.drawable.ic_menu_info_details, R.drawable.ic_menu_share, R.drawable.ic_star_yes};
private ListView lvMineUser;
private ListView lvMineOrder;
private ListView lvMineAbout;
private MineListAdapter userListAdapter;
private MineListAdapter orderListAdapter;
private MineListAdapter aboutListAdapter;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if(msg.what==MessageDef.MINE_FINISH_LOAD_DATA) {
orderListAdapter.notifyDataSetChanged();
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mine);
initData("已取餐");
initData("未取餐");
initView();
}
private void initView() {
lvMineUser = (ListView) findViewById(R.id.lv_mine_user);
lvMineOrder = (ListView) findViewById(R.id.lv_mine_order);
lvMineAbout = (ListView) findViewById(R.id.lv_mine_about);
userListAdapter = new MineListAdapter(this, userItemNames, userItemContents, userImgIds);
orderListAdapter = new MineListAdapter(this, orderItemNames, orderItemContents, orderImgIds);
aboutListAdapter = new MineListAdapter(this, aboutItemNames, aboutItemContents, aboutImgIds);
lvMineUser.setAdapter(userListAdapter);
lvMineOrder.setAdapter(orderListAdapter);
lvMineAbout.setAdapter(aboutListAdapter);
lvMineUser.setOnItemClickListener(this);
lvMineOrder.setOnItemClickListener(this);
lvMineAbout.setOnItemClickListener(this);
}
//初始化列表菜单中数据
public void initData(final String type) {
//获取用户
BmobUser user = BmobUser.getCurrentUser(this);
userItemNames[0] = user.getUsername();
//获取小菜订单(数量)
BmobQuery<Order> query = new BmobQuery<Order>();
query.order("-updatedAt");
query.addWhereEqualTo("userName", user.getUsername());
query.addWhereEqualTo("state", type);
query.count(this, Order.class, new CountListener() {
@Override
public void onSuccess(int count) {
if("未取餐".equals(type)) {
orderItemContents[0] ="( " +count+ " )";
}
if("已取餐".equals(type)) {
orderItemContents[1] ="( " +count+ " )";
}
Message msg = new Message();
msg.what = MessageDef.MINE_FINISH_LOAD_DATA;
mHandler.sendMessage(msg);
}
@Override
public void onFailure(int arg0, String arg1) {
toast("查询失败");
}
});
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
//个人资料
if(parent.getId() == R.id.lv_mine_user) {
switch (position) {
case 0: //资料卡
Intent toMineInfo = new Intent(MineActivity.this, MineInfoActivity.class);
startActivity(toMineInfo);
break;
default:
break;
}
}
//小菜订单
if(parent.getId() == R.id.lv_mine_order) {
Intent toOrderInfo;
switch (position) {
case 0:
toOrderInfo = new Intent(MineActivity.this, OrderInfoActivity.class);
toOrderInfo.putExtra("type", "now");
startActivity(toOrderInfo);
break;
case 1:
toOrderInfo = new Intent(MineActivity.this, OrderInfoActivity.class);
toOrderInfo.putExtra("type", "old");
startActivity(toOrderInfo);
break;
default:
break;
}
}
//其他
if(parent.getId() == R.id.lv_mine_about) {
switch (position) {
case 1: //软件相关
Intent toMineSoft = new Intent(MineActivity.this, MineSoftActivity.class);
startActivity(toMineSoft);
break;
case 2: //推荐给朋友
Intent toShare = new Intent(Intent.ACTION_SEND);
toShare.setType("text/plain");
toShare.putExtra(Intent.EXTRA_SUBJECT, "分享");
toShare.putExtra(Intent.EXTRA_TEXT, "校园小菜-HBUT版" +"\n" + "针对湖工大的校园小菜测试版上线了,赶紧下载体验吧"+ "http://xiaocai.bmob.cn");
startActivity(Intent.createChooser(toShare, "分享到"));
break;
case 3: //退出当期账号
BmobUser.logOut(this);
Intent toLogin = new Intent(MineActivity.this, LoginActivity.class);
startActivity(toLogin);
finish();
break;
default:
break;
}
}
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
}

View File

@ -1,116 +0,0 @@
package com.stone.shop.view;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.FindListener;
import com.stone.date.MessageDef;
import com.stone.shop.R;
import com.stone.shop.model.User;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
/**
* 个人资料卡
* @date 2014-5-21
* @author Stone
*/
public class MineInfoActivity extends Activity {
private TextView tvUsername;
private TextView tvSchool;
private TextView tvCademy;
private TextView tvDorPart;
private TextView tvDorNum;
private TextView tvPhone;
private TextView tvQQ;
private User curUser = new User();
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MessageDef.MINE_INFO_FINISH_FIND_USER:
initView();
break;
default:
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mine_info);
getCurUser();
}
private void initView() {
tvUsername = (TextView) findViewById(R.id.tv_mineinfo_username);
tvSchool = (TextView) findViewById(R.id.tv_mineinfo_school);
tvCademy = (TextView) findViewById(R.id.tv_mineinfo_cademy);
tvDorPart = (TextView) findViewById(R.id.tv_mineinfo_dorpart);
tvDorNum = (TextView) findViewById(R.id.tv_mineinfo_dornum);
tvPhone = (TextView) findViewById(R.id.tv_mineinfo_phone);
tvQQ = (TextView) findViewById(R.id.tv_mineinfo_qq);
tvUsername.setText(curUser.getUsername());
tvSchool.setText(curUser.getSchool());
tvCademy.setText(curUser.getCademy());
tvDorPart.setText(curUser.getDorPart());
tvDorNum.setText(curUser.getDorNum());
tvPhone.setText(curUser.getPhone());
tvQQ.setText(curUser.getQQ());
}
private void getCurUser() {
BmobUser bmobUser = BmobUser.getCurrentUser(this);
BmobQuery<User> query = new BmobQuery<User>();
query.addWhereEqualTo("objectId", bmobUser.getObjectId());
query.findObjects(this, new FindListener<User>() {
@Override
public void onSuccess(List<User> object) {
curUser = object.get(0);
Message msg = new Message();
msg.what = MessageDef.MINE_INFO_FINISH_FIND_USER;
mHandler.sendMessage(msg);
}
@Override
public void onError(int arg0, String arg1) {
toast("亲, 获取当前用户失败");
}
});
}
public void clickEdit(View v) {
Intent toEditMineInfo = new Intent(MineInfoActivity.this, MineInfoEditActivity.class);
startActivity(toEditMineInfo);
}
public void clickBack(View v) {
finish();
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
}

View File

@ -1,138 +0,0 @@
package com.stone.shop.view;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.UpdateListener;
import com.stone.date.MessageDef;
import com.stone.shop.R;
import com.stone.shop.model.User;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
/**
* 修改个人资料卡
* @date 2014-5-28
* @author Stone
*/
public class MineInfoEditActivity extends Activity {
private EditText etUsername;
private EditText etSchool;
private EditText etCademy;
private EditText etDorPart;
private EditText etDorNum;
private EditText etPhone;
private EditText etQQ;
private User curUser;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if(msg.what==MessageDef.MINE_INFO_FINISH_FIND_USER) {
initView();
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mine_info_edit);
setCurUser();
}
private void initView() {
etUsername = (EditText) findViewById(R.id.et_mineinfo_username);
etSchool = (EditText) findViewById(R.id.et_mineinfo_school);
etCademy = (EditText) findViewById(R.id.et_mineinfo_cademy);
etDorPart = (EditText) findViewById(R.id.et_mineinfo_dorpart);
etDorNum = (EditText) findViewById(R.id.et_mineinfo_dornum);
etPhone = (EditText) findViewById(R.id.et_mineinfo_phone);
etQQ = (EditText) findViewById(R.id.et_mineinfo_qq);
etUsername.setText(curUser.getUsername());
etSchool.setText(curUser.getSchool());
etCademy.setText(curUser.getCademy());
etDorPart.setText(curUser.getDorPart());
etDorNum.setText(curUser.getDorNum());
etPhone.setText(curUser.getPhone());
etQQ.setText(curUser.getQQ());
}
private void setCurUser() {
BmobUser bmobUser = BmobUser.getCurrentUser(this);
BmobQuery<User> query = new BmobQuery<User>();
query.addWhereEqualTo("objectId", bmobUser.getObjectId());
query.findObjects(this, new FindListener<User>() {
@Override
public void onSuccess(List<User> object) {
curUser = object.get(0);
Message msg = new Message();
msg.what = MessageDef.MINE_INFO_FINISH_FIND_USER;
mHandler.sendMessage(msg);
}
@Override
public void onError(int arg0, String arg1) {
toast("获取当前用户失败");
}
});
}
private void saveUserInfo() {
if(curUser == null) {
toast("curUser为空");
} else {
toast("当前用户为 " + curUser.getUsername());
}
Log.i("当前用户的ID: ", curUser.getObjectId());
curUser.setUsername(etUsername.getText().toString());
curUser.setSchool(etSchool.getText().toString());
curUser.setCademy(etCademy.getText().toString());
curUser.setDorPart(etDorPart.getText().toString());
curUser.setDorNum(etDorNum.getText().toString());
curUser.setPhone(etPhone.getText().toString());
curUser.setQQ(etQQ.getText().toString());
curUser.update(this, curUser.getObjectId(), new UpdateListener() {
@Override
public void onSuccess() {
toast("更新成功");
}
@Override
public void onFailure(int arg0, String arg1) {
toast("更新失败");
}
});
}
public void clickSave(View v) {
saveUserInfo();
finish();
}
public void clickCancel(View v) {
finish();
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
}

View File

@ -1,76 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import com.stone.shop.adapter.MineListAdapter;
import com.stone.shop.adapter.MineSoftAdapter;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
/**
* 软件相关
* @date 2014-5-21
* @author Stone
*/
public class MineSoftActivity extends Activity implements OnItemClickListener{
private String[] softItemNames = {"意见反馈", "检查更新", "使用协议", "关于我们"};
private String[] softItemContents = {"", "", "", ""};
private ListView lvMineSoft;
private MineSoftAdapter softListAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_soft);
initView();
}
private void initView() {
lvMineSoft = (ListView) findViewById(R.id.lv_mine_soft);
softListAdapter = new MineSoftAdapter(this, softItemNames, softItemContents);
lvMineSoft.setAdapter(softListAdapter);
lvMineSoft.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
switch (position) {
case 0:
Intent toFeedBack = new Intent(MineSoftActivity.this, FeedBackActivity.class);
startActivity(toFeedBack);
break;
case 1:
toast("已经是最新版本");
break;
case 2:
break;
case 3:
Intent toAboutSoft = new Intent(MineSoftActivity.this, AboutActivity.class);
startActivity(toAboutSoft);
break;
default:
break;
}
}
public void clickSoftBack(View v) {
finish();
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}
}

View File

@ -1,62 +0,0 @@
package com.stone.shop.view;
import java.util.logging.Logger;
import com.stone.shop.R;
import android.content.Intent;
import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
/**
*
* @author http://http://blog.csdn.net/qinjuning
*/
public class MultiScreenActivity extends Activity implements OnClickListener {
private Button bt_scrollLeft;
private Button bt_scrollRight;
private MultiViewGroup mulTiViewGroup ;
public static int screenWidth ;
public static int scrrenHeight ;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DisplayMetrics metric = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metric);
screenWidth = metric.widthPixels ;
scrrenHeight = metric.heightPixels;
//System.out.println("screenWidth * scrrenHeight --->" + screenWidth + " * " +scrrenHeight);
Logger logger = Logger.getLogger("lavasoft");
logger.info("screenWidth * scrrenHeight --->" + screenWidth + " * " +scrrenHeight);
setContentView(R.layout.multiview);
mulTiViewGroup = (MultiViewGroup)findViewById(R.id.mymultiViewGroup);
bt_scrollLeft = (Button) findViewById(R.id.bt_scrollLeft);
bt_scrollRight = (Button) findViewById(R.id.bt_scrollRight);
bt_scrollLeft.setOnClickListener(this);
bt_scrollRight.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent = new Intent(MultiScreenActivity.this,LoginActivity.class);
switch (v.getId()) {
case R.id.bt_scrollLeft:
startActivity(intent);
break;
case R.id.bt_scrollRight:
mulTiViewGroup.stopMove() ;
break;
default:
break;
}
}
}

View File

@ -1,320 +0,0 @@
package com.stone.shop.view;
import com.stone.shop.R;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Scroller;
//自定义ViewGroup 包含了三个LinearLayout控件存放在不同的布局位置通过scrollBy或者scrollTo方法切换
public class MultiViewGroup extends ViewGroup {
private Context mContext;
private static String TAG = "MultiViewGroup";
private int curScreen = 0 ; //当前屏
private Scroller mScroller = null ;
public MultiViewGroup(Context context) {
super(context);
mContext = context;
init();
}
public MultiViewGroup(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
init();
}
//startScroll 滑屏
public void startMove(){
curScreen ++ ;
Log.i(TAG, "----startMove---- curScreen " + curScreen);
Log.i(TAG, "----width " + getWidth());
//采用Scroller类控制滑动过程
mScroller.startScroll((curScreen-1) *getWidth(), 0,
getWidth(), 0,3000);
//暴力点直接到目标出
//其实在点击按钮的时候就回触发View绘制流程这儿我们在强制绘制下View
invalidate();
}
//停止滑屏
public void stopMove(){
Log.v(TAG, "----stopMove ----");
if(mScroller != null){
//如果动画还没结束我们就按下了结束的按钮那我们就结束该动画即马上滑动指定位置
if(!mScroller.isFinished()){
int scrollCurX= mScroller.getCurrX() ;
//判断是否达到下一屏的中间位置如果达到就抵达下一屏否则保持在原屏幕
int descScreen = ( scrollCurX + getWidth() / 2) / getWidth() ;
Log.i(TAG, "----mScroller.is not finished ---- shouldNext" + descScreen);
Log.i(TAG, "----mScroller.is not finished ---- scrollCurX " + scrollCurX);
mScroller.abortAnimation();
//停止了动画我们马上滑倒目标位置
scrollTo(descScreen * getWidth() , 0);
mScroller.forceFinished(true);
curScreen = descScreen ;
}
}
else
Log.i(TAG, "----OK mScroller.is finished ---- ");
}
// 只有当前LAYOUT中的某个CHILD导致SCROLL发生滚动才会致使自己的COMPUTESCROLL被调用
@Override
public void computeScroll() {
Log.e(TAG, "computeScroll");
// 如果返回true表示动画还没有结束
// 因为前面startScroll所以只有在startScroll完成时 才会为false
if (mScroller.computeScrollOffset()) {
Log.e(TAG, mScroller.getCurrX() + "======" + mScroller.getCurrY());
// 产生了动画效果 每次滚动一点
scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
Log.e(TAG, "### getleft is " + getLeft() + " ### getRight is " + getRight());
//刷新View 否则效果可能有误差
postInvalidate();
}
else
Log.i(TAG, "have done the scoller -----");
}
/////以上可以演示Scroller类的使用
//// --------------------------------
/////--------------------------------
private static final int TOUCH_STATE_REST = 0;
private static final int TOUCH_STATE_SCROLLING = 1;
private int mTouchState = TOUCH_STATE_REST;
//--------------------------
//处理触摸事件 ~
public static final int SNAP_VELOCITY = 600 ;
private int mTouchSlop = 0 ;
private float mLastionMotionX = 0 ;
//处理触摸的速率
private VelocityTracker mVelocityTracker = null ;
// 这个感觉没什么作用 不管true还是false 都是会执行onTouchEvent的 因为子view里面onTouchEvent返回false了
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
Log.e(TAG, "onInterceptTouchEvent-slop:" + mTouchSlop);
final int action = ev.getAction();
//表示已经开始滑动了不需要走该Action_MOVE方法了(第一次时可能调用)
if ((action == MotionEvent.ACTION_MOVE) && (mTouchState != TOUCH_STATE_REST)) {
return true;
}
final float x = ev.getX();
switch (action) {
case MotionEvent.ACTION_MOVE:
Log.e(TAG, "onInterceptTouchEvent move");
final int xDiff = (int) Math.abs(mLastionMotionX - x);
if (xDiff > mTouchSlop)
{mTouchState = TOUCH_STATE_SCROLLING;} //超过了最小滑动距离
break;
case MotionEvent.ACTION_DOWN:
Log.e(TAG, "onInterceptTouchEvent down");
mLastionMotionX = x;
Log.e(TAG, mScroller.isFinished() + "");
mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST : TOUCH_STATE_SCROLLING;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
Log.e(TAG, "onInterceptTouchEvent up or cancel");
mTouchState = TOUCH_STATE_REST;
break;
default:
break;
}
Log.e(TAG, mTouchState + "====" + TOUCH_STATE_REST);
return mTouchState != TOUCH_STATE_REST;
}
public boolean onTouchEvent(MotionEvent event){
Log.i(TAG, "--- onTouchEvent--> " );
Log.e(TAG, "onTouchEvent start");
if (mVelocityTracker == null) {
Log.e(TAG, "onTouchEvent start-------** VelocityTracker.obtain");
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(event);
super.onTouchEvent(event);
//手指位置地点
float x = event.getX();
switch(event.getAction()){
case MotionEvent.ACTION_DOWN: //如果屏幕的动画还没结束你就按下了我们就结束该动画
if(mScroller != null&&!mScroller.isFinished()){
mScroller.abortAnimation();
}
mLastionMotionX = x ;
break ;
case MotionEvent.ACTION_MOVE:
int detaX = (int)(mLastionMotionX - x );
scrollBy(detaX, 0);
Log.e(TAG, "--- MotionEvent.ACTION_MOVE--> detaX is " + detaX );
mLastionMotionX = x ;
break ;
case MotionEvent.ACTION_UP:
final VelocityTracker velocityTracker = mVelocityTracker ;
velocityTracker.computeCurrentVelocity(1000);
int velocityX = (int) velocityTracker.getXVelocity() ;
Log.e(TAG , "---velocityX---" + velocityX);
//滑动速率达到了一个标准(快速向右滑屏返回上一个屏幕) 马上进行切屏处理
if (velocityX > SNAP_VELOCITY && curScreen > 0) {
// Fling enough to move left
Log.e(TAG, "snap left");
snapToScreen(curScreen - 1);
}
//快速向左滑屏返回下一个屏幕)
else if(velocityX < -SNAP_VELOCITY && curScreen < (getChildCount()-1)){
Log.e(TAG, "snap right");
snapToScreen(curScreen + 1);
}
//以上为快速移动的 强制切换屏幕
else{
//我们是缓慢移动的因此先判断是保留在本屏幕还是到下一屏幕
snapToDestination();
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
mTouchState = TOUCH_STATE_REST ;
break;
case MotionEvent.ACTION_CANCEL:
mTouchState = TOUCH_STATE_REST ;
break;
default:
break;
}
return true ;
}
////我们是缓慢移动的
private void snapToDestination(){
//当前的偏移位置
int scrollX = getScrollX() ;
Log.e(TAG, "### onTouchEvent snapToDestination ### scrollX is " + scrollX);
//判断是否超过下一屏的中间位置如果达到就抵达下一屏否则保持在原屏幕
//直接使用这个公式判断是哪一个屏幕 前后或者自己
//判断是否超过下一屏的中间位置如果达到就抵达下一屏否则保持在原屏幕
// 这样的一个简单公式意思是假设当前滑屏偏移值即 scrollCurX 加上每个屏幕一半的宽度除以每个屏幕的宽度就是
// 我们目标屏所在位置了 假如每个屏幕宽度为320dip, 我们滑到了500dip处很显然我们应该到达第二屏
int destScreen = (getScrollX() + getWidth() / 2 ) / getWidth() ;
Log.e(TAG, "### onTouchEvent ACTION_UP### dx destScreen " + destScreen);
snapToScreen(destScreen);
}
private void snapToScreen(int whichScreen){
//简单的移到目标屏幕可能是当前屏或者下一屏幕
//直接跳转过去不太友好
//为了友好性我们在增加一个动画效果
//需要再次滑动的距离 屏或者下一屏幕的继续滑动距离
curScreen = whichScreen ;
if(curScreen > getChildCount() - 1)
curScreen = getChildCount() - 1 ;
int dx = curScreen*getWidth() - getScrollX() ;
Log.e(TAG, "### onTouchEvent ACTION_UP### dx is " + dx);
mScroller.startScroll(getScrollX(), 0, dx, 0,Math.abs(dx) * 2);
//此时需要手动刷新View 否则没效果
invalidate();
}
private void init() {
mScroller = new Scroller(mContext);
// 初始化3个 LinearLayout控件
LinearLayout oneLL = new LinearLayout(mContext);
oneLL.setBackground(getResources().getDrawable(R.drawable.w01));
addView(oneLL);
LinearLayout twoLL = new LinearLayout(mContext);
twoLL.setBackground(getResources().getDrawable(R.drawable.w02));
addView(twoLL);
LinearLayout threeLL = new LinearLayout(mContext);
threeLL.setBackground(getResources().getDrawable(R.drawable.w03));
addView(threeLL);
LinearLayout fourLL = new LinearLayout(mContext);
fourLL.setBackground(getResources().getDrawable(R.drawable.w04));
addView(fourLL);
LinearLayout fiveLL = new LinearLayout(mContext);
fiveLL.setBackground(getResources().getDrawable(R.drawable.w05));
addView(fiveLL);
//初始化一个最小滑动距离
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
// measure过程
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Log.i(TAG, "--- start onMeasure --");
// 设置该ViewGroup的大小
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
int childCount = getChildCount();
Log.i(TAG, "--- onMeasure childCount is -->" + childCount);
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
// 设置每个子视图的大小 即全屏
child.measure(getWidth(), MultiScreenActivity.scrrenHeight);
}
}
// layout过程
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
Log.i(TAG, "--- start onLayout --");
int startLeft = 0; // 每个子视图的起始布局坐标
int startTop = 10; // 间距设置为10px 相当于 androidmarginTop= "10px"
int childCount = getChildCount();
Log.i(TAG, "--- onLayout childCount is -->" + childCount );
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
//即使可见的才划到屏幕上
if(child.getVisibility() != View.GONE)
{
child.layout(startLeft, startTop, startLeft + getWidth(), startTop + MultiScreenActivity.scrrenHeight );
startLeft = startLeft + getWidth() ;}//校准每个子View的起始布局位置
//三个子视图的在屏幕中的分布如下 [0 , 320] / [320,640] / [640,960]
}
}
}

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