文档和模型中的子系统顺序图

This commit is contained in:
kaka727 2016-08-29 11:00:05 +08:00
parent 1e89a44038
commit 5714e0383b
11 changed files with 429 additions and 1 deletions

View File

@ -5,5 +5,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

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

View File

@ -0,0 +1,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<News> mNewsList = null; // 所选分类下的所有店铺列表
public NewsListAdapter(Context context, List<News> newsList) {
mContext = context;
mNewsList = newsList;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mNewsList.size();
}
@Override
public Object getItem(int position) {
return mNewsList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 刷新列表中的数据
public void refresh(ArrayList<News> list) {
mNewsList = list;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
NewsHolder newsHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.news_list_item, null);
newsHolder = new NewsHolder();
newsHolder.tvNewsType = (TextView) convertView
.findViewById(R.id.tv_news_type);
newsHolder.tvNewsTitle = (TextView) convertView
.findViewById(R.id.tv_news_title);
newsHolder.tvNewsDate = (TextView) convertView
.findViewById(R.id.tv_news_date);
convertView.setTag(newsHolder);
} else {
newsHolder = (NewsHolder) convertView.getTag();
}
//拆分字符串,只取年月日
String[] ss = new String[2];
ss = mNewsList.get(position).getCreatedAt().split(" ");
newsHolder.tvNewsType.setText(mNewsList.get(position).getType()); //新闻类型
newsHolder.tvNewsTitle.setText(mNewsList.get(position).getTitle()); //新闻标题
newsHolder.tvNewsDate.setText(ss[0]); //新闻发布日期
return convertView;
}
}

View File

@ -0,0 +1,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<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);
// 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();
}
}

View File

@ -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<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

@ -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

View File

@ -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);
}
}

Binary file not shown.