diff --git a/代码/在这里3.0/.classpath b/代码/在这里3.0/.classpath index 0461652..feef834 100644 --- a/代码/在这里3.0/.classpath +++ b/代码/在这里3.0/.classpath @@ -5,5 +5,6 @@ + diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/adapter/NewsListAdapter.java~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/adapter/NewsListAdapter.java~HEAD new file mode 100644 index 0000000..92264ca --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/adapter/NewsListAdapter.java~HEAD @@ -0,0 +1,82 @@ +package com.stone.shop.adapter; + +import java.util.ArrayList; +import java.util.List; + +import com.stone.shop.R; +import com.stone.shop.model.News; + +import android.R.integer; +import android.content.Context; +import android.graphics.pdf.PdfDocument.Page; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +/** + * 新闻列表适配器 + * + * @date 2014-5-3 + * @author Stone + */ +public class NewsListAdapter extends BaseAdapter { + + private Context mContext; + private LayoutInflater mInflater = null; + private List mNewsList = null; // 所选分类下的所有店铺列表 + + public NewsListAdapter(Context context, List newsList) { + mContext = context; + mNewsList = newsList; + mInflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return mNewsList.size(); + } + + @Override + public Object getItem(int position) { + return mNewsList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + // 刷新列表中的数据 + public void refresh(ArrayList list) { + mNewsList = list; + notifyDataSetChanged(); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + NewsHolder newsHolder; + if (convertView == null) { + convertView = mInflater.inflate(R.layout.news_list_item, null); + newsHolder = new NewsHolder(); + newsHolder.tvNewsType = (TextView) convertView + .findViewById(R.id.tv_news_type); + newsHolder.tvNewsTitle = (TextView) convertView + .findViewById(R.id.tv_news_title); + newsHolder.tvNewsDate = (TextView) convertView + .findViewById(R.id.tv_news_date); + convertView.setTag(newsHolder); + } else { + newsHolder = (NewsHolder) convertView.getTag(); + } + //拆分字符串,只取年月日 + String[] ss = new String[2]; + ss = mNewsList.get(position).getCreatedAt().split(" "); + newsHolder.tvNewsType.setText(mNewsList.get(position).getType()); //新闻类型 + newsHolder.tvNewsTitle.setText(mNewsList.get(position).getTitle()); //新闻标题 + newsHolder.tvNewsDate.setText(ss[0]); //新闻发布日期 + return convertView; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/adapter/NewsListAdapter.java~qinjiaming_branch b/代码/在这里3.0/bin/classes/com/stone/shop/adapter/NewsListAdapter.java~qinjiaming_branch new file mode 100644 index 0000000..98c82f2 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/adapter/NewsListAdapter.java~qinjiaming_branch @@ -0,0 +1,81 @@ +package com.stone.shop.adapter; + +import java.util.ArrayList; +import java.util.List; + +import com.stone.shop.R; +import com.stone.shop.model.News; + +import android.R.integer; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +/** + * 新闻列表适配器 + * + * @date 2014-5-3 + * @author Stone + */ +public class NewsListAdapter extends BaseAdapter { + + private Context mContext; + private LayoutInflater mInflater = null; + private List mNewsList = null; // 所选分类下的所有店铺列表 + + public NewsListAdapter(Context context, List newsList) { + mContext = context; + mNewsList = newsList; + mInflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return mNewsList.size(); + } + + @Override + public Object getItem(int position) { + return mNewsList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + // 刷新列表中的数据 + public void refresh(ArrayList list) { + mNewsList = list; + notifyDataSetChanged(); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + NewsHolder newsHolder; + if (convertView == null) { + convertView = mInflater.inflate(R.layout.news_list_item, null); + newsHolder = new NewsHolder(); + newsHolder.tvNewsType = (TextView) convertView + .findViewById(R.id.tv_news_type); + newsHolder.tvNewsTitle = (TextView) convertView + .findViewById(R.id.tv_news_title); + newsHolder.tvNewsDate = (TextView) convertView + .findViewById(R.id.tv_news_date); + convertView.setTag(newsHolder); + } else { + newsHolder = (NewsHolder) convertView.getTag(); + } + //拆分字符串,只取年月日 + String[] ss = new String[2]; + ss = mNewsList.get(position).getCreatedAt().split(" "); + newsHolder.tvNewsType.setText(mNewsList.get(position).getType()); //新闻类型 + newsHolder.tvNewsTitle.setText(mNewsList.get(position).getTitle()); //新闻标题 + newsHolder.tvNewsDate.setText(ss[0]); //新闻发布日期 + return convertView; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoActivity.java~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoActivity.java~HEAD new file mode 100644 index 0000000..d5ce189 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoActivity.java~HEAD @@ -0,0 +1,124 @@ +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 query = new BmobQuery(); + query.addWhereEqualTo("objectId", bmobUser.getObjectId()); + query.findObjects(this, new FindListener() { + + @Override + public void onSuccess(List 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); +// Bundle bundle = new Bundle(); +// bundle.putString("username", curUser.getUsername()); +// bundle.putString("school", curUser.getSchool()); +// bundle.putString("cademy", curUser.getCademy()); +// bundle.putString("dorpart", curUser.getDorPart()); +// bundle.putString("dornum", curUser.getDorNum()); +// bundle.putString("phone", curUser.getPhone()); +// bundle.putString("qq", curUser.getQQ()); +// toEditMineInfo.putExtras(bundle); + startActivity(toEditMineInfo); + } + + public void clickBack(View v) { + finish(); + } + + private void toast(String toast) { + Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); + } + + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoActivity.java~qinjiaming_branch b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoActivity.java~qinjiaming_branch new file mode 100644 index 0000000..fd57ca9 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoActivity.java~qinjiaming_branch @@ -0,0 +1,116 @@ +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 query = new BmobQuery(); + query.addWhereEqualTo("objectId", bmobUser.getObjectId()); + query.findObjects(this, new FindListener() { + + @Override + public void onSuccess(List 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(); + } + + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/util/UtilTest.class b/代码/在这里3.0/bin/classes/com/stone/util/UtilTest.class new file mode 100644 index 0000000..21c4792 Binary files /dev/null and b/代码/在这里3.0/bin/classes/com/stone/util/UtilTest.class differ diff --git a/代码/在这里3.0/project.properties b/代码/在这里3.0/project.properties index 17bdc51..5c5f4c7 100644 --- a/代码/在这里3.0/project.properties +++ b/代码/在这里3.0/project.properties @@ -11,5 +11,5 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-18 +target=android-20 proguard.config=proguard.cfg diff --git a/代码/在这里3.0/src/com/stone/util/UtilTest.java b/代码/在这里3.0/src/com/stone/util/UtilTest.java new file mode 100644 index 0000000..bfe34cc --- /dev/null +++ b/代码/在这里3.0/src/com/stone/util/UtilTest.java @@ -0,0 +1,24 @@ +package com.stone.util; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class UtilTest { + + private static Util util = new Util(); + + @Before + public void setUp() throws Exception { + } + + @Test + public void testIsPhoneNumberValid() { + + String testPhone = "12345678900"; + assertEquals(false,testPhone); + + } + +} diff --git a/在这里:软件需求规格说明书.doc b/在这里:软件需求规格说明书.doc deleted file mode 100644 index fdef825..0000000 Binary files a/在这里:软件需求规格说明书.doc and /dev/null differ diff --git a/文档/软件需求规格说明书.doc b/文档/软件需求规格说明书.doc index 89748dd..0b7fec2 100644 Binary files a/文档/软件需求规格说明书.doc and b/文档/软件需求规格说明书.doc differ diff --git a/模型/讨论区功能顺序图.vsd b/模型/讨论区功能顺序图.vsd index 2d6e9b2..08b16ad 100644 Binary files a/模型/讨论区功能顺序图.vsd and b/模型/讨论区功能顺序图.vsd differ