修改了代码的绝大部分错误,同时完成了一半的顺序图。

This commit is contained in:
qinjiaming_branch 2016-08-23 10:05:23 +08:00
parent 4c019c61c0
commit 6000e93f28
36 changed files with 77 additions and 40 deletions

View File

@ -1,6 +1,6 @@
package com.stone.shop.adapter; package com.stone.shop.adapter;
import android.R.integer; //import android.R.integer;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -83,7 +83,6 @@ public class GridAdapter extends BaseAdapter {
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View view = View.inflate(mContext, R.layout.shop_grid_item, null); View view = View.inflate(mContext, R.layout.shop_grid_item, null);
// RelativeLayout rl = (RelativeLayout) // RelativeLayout rl = (RelativeLayout)
// view.findViewById(R.id.relaGrid);
ImageView image = (ImageView) view.findViewById(R.id.img_chooseImage); ImageView image = (ImageView) view.findViewById(R.id.img_chooseImage);
TextView text = (TextView) view.findViewById(R.id.tv_chooseText); TextView text = (TextView) view.findViewById(R.id.tv_chooseText);

View File

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

@ -72,7 +72,7 @@ public class LibraryReservationActivity extends Activity {
btnLogin.setText("已经预定" + (TextUtils.isEmpty(dateTime) ? "" : (" " + dateTime))); btnLogin.setText("已经预定" + (TextUtils.isEmpty(dateTime) ? "" : (" " + dateTime)));
} }
} catch (ParseException e) { } catch (ParseException e) {
// TODO Auto-generated catch block // TODO
//e.printStackTrace(); //e.printStackTrace();
logger.log(Level.SEVERE, "something may be wrong", e); logger.log(Level.SEVERE, "something may be wrong", e);
} }
@ -86,12 +86,13 @@ public class LibraryReservationActivity extends Activity {
btnLogin.setOnClickListener(new OnClickListener() { btnLogin.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// TODO Auto-generated method stub // TODO
DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(LibraryReservationActivity.this, DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(LibraryReservationActivity.this,
dateFormat.format(new Date())); dateFormat.format(new Date()));
dateTimePicKDialog.dateTimePicKDialog(new DateTimeListener() { dateTimePicKDialog.dateTimePicKDialog(new DateTimeListener() {
@Override @Override
public void onDateTimeChane(final String dateTime) { public void onDateTimeChane(final String dateTime) {
//TODO
Reservation libreservation = new Reservation(); Reservation libreservation = new Reservation();
libreservation.setRoomId(roomId); libreservation.setRoomId(roomId);
libreservation.setRoomName(roomName); libreservation.setRoomName(roomName);
@ -100,14 +101,14 @@ public class LibraryReservationActivity extends Activity {
libreservation.save(LibraryReservationActivity.this, new SaveListener() { libreservation.save(LibraryReservationActivity.this, new SaveListener() {
@Override @Override
public void onSuccess() { public void onSuccess() {
// TODO Auto-generated method stub // TODO
toast("预定成功"); toast("预定成功");
btnLogin.setEnabled(false); btnLogin.setEnabled(false);
btnLogin.setText("已经预定 " + dateTime); btnLogin.setText("已经预定 " + dateTime);
} }
@Override @Override
public void onFailure(int arg0, String arg1) { public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub // TODO
toast("预定失败"); toast("预定失败");
} }
}); });

View File

@ -1,9 +1,8 @@
package com.stone.shop.view; package com.stone.shop.view;
import java.io.IOException;
import java.io.InputStream; import java.util.logging.Level;
import java.net.HttpURLConnection; import java.util.logging.Logger;
import java.net.URL;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -13,8 +12,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
@ -68,7 +66,7 @@ public class LoginActivity extends Activity implements OnClickListener {
// QQ登陆 // QQ登陆
private static Tencent mTencent; private static Tencent mTencent;
// private QQAuth mQQAuth;
Handler mHandler = new Handler() { Handler mHandler = new Handler() {
@ -76,12 +74,15 @@ public class LoginActivity extends Activity implements OnClickListener {
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
if (msg.what == 0) { if (msg.what == 0) {
JSONObject response = (JSONObject) msg.obj; JSONObject response = (JSONObject) msg.obj;
if (response.has("nickname")) { if (response.has("nickname"))
{
Logger logger = Logger.getLogger("lavasoft");
try { try {
mUserInfo.setVisibility(android.view.View.VISIBLE); mUserInfo.setVisibility(android.view.View.VISIBLE);
mUserInfo.setText(response.getString("nickname")); mUserInfo.setText(response.getString("nickname"));
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); //e.printStackTrace();
logger.log(Level.SEVERE, "something may be wrong", e);
} }
} }
@ -226,22 +227,28 @@ public class LoginActivity extends Activity implements OnClickListener {
@Override @Override
public void onComplete(Object response) { public void onComplete(Object response) {
if (null == response) { if (response == null) {
Util.showResultDialog(LoginActivity.this, "返回为空", "登录失败"); Util.showResultDialog(LoginActivity.this, "返回为空", "登录失败");
return; return;
} }
JSONObject jsonResponse = (JSONObject) response; JSONObject jsonResponse = (JSONObject) response;
if (null != jsonResponse && jsonResponse.length() == 0) { if (jsonResponse!=null && jsonResponse.length() == 0)
{
Util.showResultDialog(LoginActivity.this, "返回为空", "登录失败"); Util.showResultDialog(LoginActivity.this, "返回为空", "登录失败");
return; return;
} }
// Util.showResultDialog(LoginActivity.this, response.toString(), "登录成功"); // Util.showResultDialog(LoginActivity.this, response.toString(), "登录成功");
doComplete((JSONObject) response); doComplete((JSONObject) response);
try { Logger logger = Logger.getLogger("lavasoft");
try
{
User.userId = jsonResponse.getString("openid"); User.userId = jsonResponse.getString("openid");
} catch (JSONException e) { }
// TODO Auto-generated catch block catch (JSONException e)
e.printStackTrace(); {
// TODO
//e.printStackTrace();
logger.log(Level.SEVERE, "something may be wrong", e);
} }
Intent toHome = new Intent(LoginActivity.this, BaseActivity.class); Intent toHome = new Intent(LoginActivity.this, BaseActivity.class);
@ -288,10 +295,12 @@ public class LoginActivity extends Activity implements OnClickListener {
JSONObject json = (JSONObject) response; JSONObject json = (JSONObject) response;
if (json.has("figureurl")) { if (json.has("figureurl")) {
Bitmap bitmap = null; Bitmap bitmap = null;
Logger logger = Logger.getLogger("lavasoft");
try { try {
bitmap = Util.getbitmap(json.getString("figureurl_qq_2")); bitmap = Util.getbitmap(json.getString("figureurl_qq_2"));
} catch (JSONException e) { } catch (JSONException e)
{
logger.log(Level.SEVERE, "something may be wrong", e);
} }
Message msg = new Message(); Message msg = new Message();
msg.obj = bitmap; msg.obj = bitmap;
@ -318,7 +327,9 @@ public class LoginActivity extends Activity implements OnClickListener {
} }
} }
public static void initOpenidAndToken(JSONObject jsonObject) { public static void initOpenidAndToken(JSONObject jsonObject)
{
Logger logger = Logger.getLogger("lavasoft");
try { try {
String token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN); String token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN);
String expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN); String expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN);
@ -327,7 +338,11 @@ public class LoginActivity extends Activity implements OnClickListener {
mTencent.setAccessToken(token, expires); mTencent.setAccessToken(token, expires);
mTencent.setOpenId(openId); mTencent.setOpenId(openId);
} }
} catch (Exception e) { }
catch (Exception e)
{
logger.log(Level.SEVERE, "something may be wrong", e);
} }
} }

View File

@ -43,10 +43,9 @@ public class OrderActivity extends Activity implements OnClickListener{
private Button btnOrderCountLess; // 减少数量 private Button btnOrderCountLess; // 减少数量
private Button btnOrderSetTime; // 设置时间 private Button btnOrderSetTime; // 设置时间
private Button btnDlgOk; // 设置时间完成 // private Button btnDlgOk; // 设置时间完成
private Button btnOrderSubmit; // 提交订单 private Button btnOrderSubmit; // 提交订单
// private DialogOrder dlgSetOrderTime;
// private View dlgOrderView; // private View dlgOrderView;
private int mHour; private int mHour;
private int mMinute; private int mMinute;
@ -77,7 +76,6 @@ public class OrderActivity extends Activity implements OnClickListener{
shopID = getIntent().getStringExtra("shopID"); shopID = getIntent().getStringExtra("shopID");
initView(); initView();
//initDlgView();
} }
private void initView() { private void initView() {
@ -104,14 +102,7 @@ public class OrderActivity extends Activity implements OnClickListener{
} }
// private void initDlgView() {
// LayoutInflater inflater = LayoutInflater.from(this);
// dlgOrderView = inflater.inflate(R.layout.dlg_order_settime, null);
// tpOrderTime = (TimePicker) dlgOrderView.findViewById(R.id.tp_dlg_time);
// tpOrderTime.setIs24HourView(true);
// btnDlgOk = (Button) dlgOrderView.findViewById(R.id.btn_dlg_ok);
// btnDlgOk.setOnClickListener(this);
// }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -146,10 +137,8 @@ public class OrderActivity extends Activity implements OnClickListener{
time = tpOrderTime.getCurrentHour()+ " : " + tpOrderTime.getCurrentMinute(); time = tpOrderTime.getCurrentHour()+ " : " + tpOrderTime.getCurrentMinute();
dlgSetOrderTime.dismiss(); dlgSetOrderTime.dismiss();
case R.id.btn_order_submit: case R.id.btn_order_submit:
//toast("小菜订单提交成功");
postOrder(); postOrder();
finish(); finish();
//back();
break; break;
default: default:
break; break;

View File

@ -73,7 +73,7 @@ public class ReservationActivity extends Activity {
btnLogin.setText("已经预定" + (TextUtils.isEmpty(dateTime) ? "" : (" " + dateTime))); btnLogin.setText("已经预定" + (TextUtils.isEmpty(dateTime) ? "" : (" " + dateTime)));
} }
} catch (ParseException e) { } catch (ParseException e) {
// TODO Auto-generated catch block // TODO
//e.printStackTrace(); //e.printStackTrace();
logger.log(Level.SEVERE, "something may be wrong", e); logger.log(Level.SEVERE, "something may be wrong", e);
@ -90,13 +90,14 @@ public class ReservationActivity extends Activity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// TODO
DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(ReservationActivity.this, DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(ReservationActivity.this,
dateFormat.format(new Date())); dateFormat.format(new Date()));
dateTimePicKDialog.dateTimePicKDialog(new DateTimeListener() { dateTimePicKDialog.dateTimePicKDialog(new DateTimeListener() {
@Override @Override
public void onDateTimeChane(final String dateTime) { public void onDateTimeChane(final String dateTime) {
// TODO Auto-generated method stub // TODO
Reservation reservation = new Reservation(); Reservation reservation = new Reservation();
reservation.setRoomId(roomId); reservation.setRoomId(roomId);
reservation.setRoomName(roomName); reservation.setRoomName(roomName);
@ -106,6 +107,7 @@ public class ReservationActivity extends Activity {
reservation.save(ReservationActivity.this, new SaveListener() { reservation.save(ReservationActivity.this, new SaveListener() {
@Override @Override
public void onSuccess() { public void onSuccess() {
// TODO
toast("预定成功"); toast("预定成功");
btnLogin.setEnabled(false); btnLogin.setEnabled(false);
btnLogin.setText("已经预定 " + dateTime); btnLogin.setText("已经预定 " + dateTime);
@ -113,6 +115,7 @@ public class ReservationActivity extends Activity {
@Override @Override
public void onFailure(int arg0, String arg1) { public void onFailure(int arg0, String arg1) {
// TODO
toast("预定失败"); toast("预定失败");
} }
}); });

BIN
顺序图.vsdx Normal file

Binary file not shown.