Compare commits

..

9 Commits

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 MiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 KiB

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

@ -7,11 +7,11 @@
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="D:\AndroidSDK\.android\.android\avd\Pixel_2_API_31.avd" />
<value value="E:\SDK\avd\.android\avd\Pixel_XL_API_30.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-06-14T12:27:15.523840400Z" />
<timeTargetWasSelectedWithDropDown value="2022-07-10T02:39:23.302314100Z" />
</component>
</project>

@ -19,9 +19,9 @@
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_history.xml" value="0.22" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_main2.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_menu.xml" value="0.33" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_menu.xml" value="0.25" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_no_pick.xml" value="0.2" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_sign_up.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_sign_up.xml" value="0.22" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_wait.xml" value="0.18" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/buttom.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/forget.xml" value="0.2630208333333333" />
@ -30,7 +30,7 @@
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/my_fragment1.xml" value="0.1" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/my_fragment2.xml" value="0.18489583333333334" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/my_fragment3.xml" value="0.2" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/pickup.xml" value="0.5" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/pickup.xml" value="0.1" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/tab1.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/top.xml" value="0.3717105263157895" />
<entry key="..\:/无人物流/xcr_se/src/Logistics/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.1" />

@ -16,16 +16,16 @@
android:supportsRtl="true"
android:theme="@style/Theme.Logistics">
<activity
android:name=".ui.HistoryActivity"
android:name=".ui.HistoryUI"
android:exported="false" />
<activity
android:name=".ui.SearchActivity"
android:name=".ui.SearchUI"
android:exported="false" />
<activity
android:name=".ui.MenuActivity"
android:exported="false" />
<activity
android:name=".ui.LoginActivity"
android:name=".ui.LoginUI"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -33,7 +33,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.SignUpActivity" />
<activity android:name=".ui.SignUpUI" />
<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="portrait"

@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<head title="pickup">
<meta charset="utf-8" />
<script type="text/javascript" type="text/javascript">

@ -2,10 +2,11 @@ package com.example.logistics.entity;
public class Good {
private int id;
private String phoneNum;
private int shelfNum;
private int floorNum;
private String time;
private String phoneNum;//货主手机号
private int shelfNum;//货架号
private int floorNum;//货架层号
private String time;//入库时间
public Good(){

@ -4,9 +4,9 @@ import android.provider.ContactsContract;
public class Operation {
private int id;
private String pickUpCode;
private String phoneNum;
private String time;
private String pickUpCode;//取件码
private String phoneNum;//货主手机号
private String time;//取件时间
public Operation(){

@ -2,9 +2,9 @@ package com.example.logistics.entity;
public class User {
private int userId;
private String userName;
private String passWord;
private String phoneNum;
private String userName;//用户名
private String passWord;//密码
private String phoneNum;//手机吗
public User(){

@ -18,31 +18,30 @@ import java.util.Map;
public class goodManager {
private static final String TAG = "goodDao";
private static final String TAG = "goodManager";
public int search(String id, String phonenum, Context context){//搜索快件位置id手机号
Log.d(TAG, "search");
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
Connection connection = DBOpenHelper.getConn();//DBO连接数据库
int msg = 0;
try{
Log.d(TAG, "select goods");
String sql = "select * from goods where id = ?";
String sql = "select * from goods where id = ?";//搜索指定取件码(=id号的快件信息
if(connection != null){
Log.d(TAG, "connection!");
PreparedStatement ps = connection.prepareStatement(sql);
if(ps != null){
Log.e(TAG, "id: " + id);
ps.setInt(1,Integer.parseInt(id));
ResultSet rs = ps.executeQuery();
ps.setInt(1,Integer.parseInt(id));//设置sql语句中id号
ResultSet rs = ps.executeQuery();//执行sql语句并返回结果到rs
int count = rs.getMetaData().getColumnCount();
while(rs.next()){
while(rs.next()){//遍历返回结果加入map中
for(int i = 1; i <= count; i++){
String field = rs.getMetaData().getColumnName(i);
map.put(field, rs.getString(field));
@ -53,14 +52,14 @@ public class goodManager {
if(map.size() != 0){
Log.d(TAG, "map isnot null");
StringBuilder s = new StringBuilder();
for(String key:map.keySet()){
if(key.equals("phonenum")){
for(String key:map.keySet()){//搜索map中的key值
if(key.equals("phonenum")){//搜索phonenum属性
String strphone = String.valueOf(map.get(key));
Log.d(TAG, strphone);
if(phonenum.equals(strphone.substring(7,11))){
if(phonenum.equals(strphone.substring(7,11))){//如果手机尾号后四位相等
msg = 1; //phonenum correct
Log.d(TAG, "phonenum correct");
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);//弹出快件位置信息
builder.setTitle("快件位置");
builder.setMessage("\n第 "+ map.get("shelfnum")+ " 号货架\n第 " + map.get("floornum")+ " 层");
Looper.prepare();
@ -89,11 +88,14 @@ public class goodManager {
e.printStackTrace();
Log.d(TAG, "search bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}
public boolean delete(String pickupcode){
public boolean delete(String pickupcode){//根据取件码删除快递
Connection connection = DBOpenHelper.getConn();
try{
@ -105,9 +107,9 @@ public class goodManager {
PreparedStatement ps = connection.prepareStatement(sql);
if(ps != null){
Log.e(TAG, "pickupcode: " + pickupcode);
ps.setString(1,pickupcode);
ps.setString(1,pickupcode);//设置参数
ps.executeUpdate();
ps.executeUpdate();//删除操作
connection.close();
ps.close();
@ -121,13 +123,16 @@ public class goodManager {
return false;
}
}catch(Exception e){
e.printStackTrace();
Log.d(TAG, "delete bug" + e.getMessage());
}finally {
}
return false;
}
public List<Map<String, Object>> nopick(String phonenum){
public List<Map<String, Object>> nopick(String phonenum){//根据手机号查询未取的件
Connection connection = DBOpenHelper.getConn();
Log.d(TAG, "nopick goods");
@ -162,7 +167,7 @@ public class goodManager {
map.put(field, rs.getString(field));
}
}
datalist.add(map);
datalist.add(map);//加入即将显示的列表中
}
connection.close();
ps.close();
@ -175,11 +180,13 @@ public class goodManager {
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "search bug: " + e.getMessage());
} finally {
}
return datalist;
}
public int pickup(String pickupcode, String phonenum){
public int pickup(String pickupcode, String phonenum){//根据取件码与手机号取件
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
@ -195,7 +202,7 @@ public class goodManager {
if(ps != null){
Log.e(TAG, "pickupcode: " + pickupcode);
ps.setInt(1,Integer.parseInt(pickupcode));
ResultSet rs = ps.executeQuery();
ResultSet rs = ps.executeQuery();//获取要取的件信息
int count = rs.getMetaData().getColumnCount();
while(rs.next()){
@ -206,12 +213,12 @@ public class goodManager {
}
connection.close();
ps.close();
if(map.size() != 0){
if(map.size() != 0){//如果找不到对应快件
Log.d(TAG, "map has value");
StringBuilder s = new StringBuilder();
for(String key:map.keySet()){
if(key.equals("phonenum")){
if(phonenum.equals(map.get(key).toString().substring(7,11))){
if(phonenum.equals(map.get(key).toString().substring(7,11))){//如果手机尾号相等
msg = 1; //password correct
}else{
msg = 2; //password incorrect
@ -235,6 +242,8 @@ public class goodManager {
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}

@ -15,21 +15,19 @@ import java.util.List;
import java.util.Map;
public class operationManager {
private static final String TAG = "operationDao";
private static final String TAG = "operationManager";
public boolean add(String pickupcode, String phonenum){
public boolean add(String pickupcode, String phonenum){//根据取件码与手机号添加操作记录
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
try{
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
Log.d(TAG, "add");
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");//时间格式
Date date = new Date();
String time = format1.format(date);
String time = format1.format(date);//时间格式字符串化
String sql = "insert into operations(pickupcode, phonenum, time) values (?,?,?)";
if(connection != null){
PreparedStatement ps = connection.prepareStatement(sql);
@ -54,16 +52,21 @@ public class operationManager {
e.printStackTrace();
Log.e(TAG, "异常 add operation");
return false;
}finally {
}
}
public List<Map<String, Object>> history(String phonenum){
public List<Map<String, Object>> history(String phonenum){//根据手机号查询历史记录
Connection connection = DBOpenHelper.getConn();
List<Map<String, Object>> datalist;
List<Map<String, Object>> datalist;//查询结果显示列表
datalist = new ArrayList<Map<String, Object>>();
try{
Log.d(TAG, "history");
String sql = "select * from operations where phonenum = ?";
if(connection != null){
@ -98,6 +101,8 @@ public class operationManager {
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "search bug: " + e.getMessage());
}finally {
}
return datalist;
}

@ -14,15 +14,18 @@ import java.sql.Connection;
public class userManager {
private static final String TAG = "userDao";
private static final String TAG = "userManager";
public int login(String username, String password){
public int login(String username, String password){//根据用户名与密码登录
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "login");
String sql = "select * from users where username = ?";
if(connection != null){
@ -41,16 +44,16 @@ public class userManager {
}
connection.close();
ps.close();
password = MD5Utils.md5(password);
password = MD5Utils.md5(password);//密码md5加密
if(map.size() != 0){
StringBuilder s = new StringBuilder();
for(String key:map.keySet()){
if(key.equals("password")){
if(key.equals("password")){//查看password属性
if(password.equals(map.get(key))){
msg = 1; //password correct
msg = 1; //密码正确
}else{
msg = 2; //password incorrect
msg = 2; //密码错误
}
break;
}
@ -68,20 +71,27 @@ public class userManager {
msg = 0;
}
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}
public int loginByPhone(String phonenum, String password){
public int loginByPhone(String phonenum, String password){//通过手机号登录
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "loginByPhone");
String sql = "select * from users where phonenum = ?";
if(connection != null){
@ -100,6 +110,7 @@ public class userManager {
}
connection.close();
ps.close();
password = MD5Utils.md5(password);
if(map.size() != 0){
StringBuilder s = new StringBuilder();
@ -130,15 +141,20 @@ public class userManager {
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}
public User findUser(String username){
public User findUser(String username){//查看是否已有该用户
Connection connection = DBOpenHelper.getConn();
User user = null;
try{
Log.d(TAG, "findUser");
String sql = "select * from users where username = ?";
if(connection != null){
PreparedStatement ps = connection.prepareStatement(sql);
@ -152,21 +168,26 @@ public class userManager {
String passWord = rs.getString(3);
String phoneNum = rs.getString(4);
user = new User(userId, userName, passWord, phoneNum);
user = new User(userId, userName, passWord, phoneNum);//若已有用户,生成用户类并返回
}
}
}
} catch (SQLException throwables) {
throwables.printStackTrace();
} finally {
}
return user;
}
public boolean register(User user){
public boolean register(User user){//注册功能
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
try{
Log.d(TAG, "register");
String sql = "insert into users(username, password, phonenum) values (?,?,?)";
if(connection != null){
@ -193,16 +214,21 @@ public class userManager {
e.printStackTrace();
Log.e(TAG, "异常 register");
return false;
} finally {
}
}
public int change(String phonenum, String password){
public int change(String phonenum, String password){//修改密码
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "change");
String sql = "update users set password = ? where phonenum = ?";
if(connection != null){
@ -230,6 +256,8 @@ public class userManager {
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}

@ -7,9 +7,9 @@ import java.sql.SQLException;
public class DBOpenHelper {
private static String diver = "com.mysql.jdbc.Driver";
//加入utf-8是为了后面往表中输入中文表中不会出现乱码的情况
private static String url = "jdbc:mysql://192.168.43.139:3306/logistics?characterEncoding=utf-8";
private static String url = "jdbc:mysql://192.168.43.203:3306/logistics?characterEncoding=utf-8";
private static String user = "root";//用户名
private static String password = "123...iamfan";//密码
private static String password = "";//密码
/*
*
* */
@ -22,6 +22,8 @@ public class DBOpenHelper {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
}
return conn;
}

@ -32,6 +32,8 @@ public class MD5Utils {
e.printStackTrace();
//发送异常return空字符串
return "";
} finally {
}
}
}

@ -19,26 +19,34 @@ import androidx.fragment.app.Fragment;
import com.example.logistics.R;
import com.example.logistics.manager.goodManager;
//查询快件存放地
public class FindUI extends Fragment implements View.OnClickListener{
private String TAG = "FindUI";
public class FindActivity extends Fragment implements View.OnClickListener{
private Context mContext;
private Button mButton;
private EditText mPickUpCode;
private EditText mPhoneNum;
public FindActivity(){
public FindUI(){
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.my_fragment1,container,false);
Log.d(TAG, "onCreateView");
View view = inflater.inflate(R.layout.frag_find,container,false);
mButton = (Button)view.findViewById(R.id.Sea_Button);
mPickUpCode = (EditText)view.findViewById(R.id.Sea_PickUpCode);
mPhoneNum = (EditText)view.findViewById(R.id.Sea_PhoneNum);
mButton.setOnClickListener(this);
mContext = getActivity();
return view;
}
@ -46,7 +54,10 @@ public class FindActivity extends Fragment implements View.OnClickListener{
public void onClick(View v) {
switch(v.getId()){
case R.id.Sea_Button:
Log.d(TAG, "search");
search(v);
break;
}
}
@ -57,7 +68,7 @@ public class FindActivity extends Fragment implements View.OnClickListener{
@Override
public void run(){
goodManager goodManager = new goodManager();
int msg = goodManager.search(mPickUpCode.getText().toString().trim(), mPhoneNum.getText().toString().trim(), getActivity());
int msg = goodManager.search(mPickUpCode.getText().toString().trim(), mPhoneNum.getText().toString().trim(), getActivity());//查询快件位置并返回结果
Log.e("Main", "msg");
hand1.sendEmptyMessage(msg);
}
@ -68,6 +79,7 @@ public class FindActivity extends Fragment implements View.OnClickListener{
final Handler hand1 = new Handler(){
@Override
public void handleMessage(Message msg){
if(msg.what == 0){
Toast.makeText(mContext, "搜索失败", Toast.LENGTH_SHORT).show();
}else if(msg.what == 2){
@ -75,6 +87,7 @@ public class FindActivity extends Fragment implements View.OnClickListener{
}else if(msg.what == 3){
Toast.makeText(mContext, "取件码不存在", Toast.LENGTH_SHORT).show();
}
}
};
}

@ -25,9 +25,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HistoryActivity extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {
public class HistoryUI extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {
private String TAG = "HistoryActivity";
private String TAG = "HistoryUI";
//绑定界面元素
private ListView lv_history;
private ArrayAdapter<String> arr_adapter;
private SimpleAdapter simp_adapter;
@ -37,6 +38,9 @@ public class HistoryActivity extends Activity implements OnItemClickListener, On
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_history);
sync_his = (ImageButton) findViewById(R.id.sync_his);
@ -52,6 +56,7 @@ public class HistoryActivity extends Activity implements OnItemClickListener, On
Intent intent = getIntent();
phonenum = intent.getStringExtra("user");
Log.d(TAG, "onCreate");
sync();
}
@ -66,12 +71,12 @@ public class HistoryActivity extends Activity implements OnItemClickListener, On
public void onClick(View v){
switch(v.getId()){
case R.id.sync_his:
sync();
sync();//调用同步按钮同步记录
Toast.makeText(this, "同步成功", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState){
public void onScrollStateChanged(AbsListView view, int scrollState){//上下划动屏幕查看操作记录
// TODO Auto-generated method stub
switch(scrollState){
case SCROLL_STATE_FLING:
@ -94,11 +99,14 @@ public class HistoryActivity extends Activity implements OnItemClickListener, On
}
public void sync(){
Log.d(TAG, "sync");
new Thread(){
@Override
public void run(){
operationManager operationManager = new operationManager();
dataList = operationManager.history(phonenum);
dataList = operationManager.history(phonenum);//调用operationManager的查询历史记录
int msg = 1;
hand1.sendEmptyMessage(msg);
@ -111,7 +119,7 @@ public class HistoryActivity extends Activity implements OnItemClickListener, On
@Override
public void handleMessage(Message msg){
if(msg.what == 1){
simp_adapter=new SimpleAdapter(HistoryActivity.this, dataList, R.layout.item, new String[]{"pickupcode","time"}, new int[]{R.id.np_id,R.id.np_time});
simp_adapter=new SimpleAdapter(HistoryUI.this, dataList, R.layout.item, new String[]{"pickupcode","time"}, new int[]{R.id.np_id,R.id.np_time});
lv_history.setAdapter(simp_adapter);
}
}

@ -1,15 +1,12 @@
package com.example.logistics.ui;
import com.example.logistics.R;
import com.example.logistics.manager.goodManager;
import com.example.logistics.manager.operationManager;
import com.example.logistics.manager.userManager;
import com.example.logistics.entity.User;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
@ -20,13 +17,10 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
public class LoginUI extends Activity {
public class LoginActivity extends Activity {
private int islogin = 0;
private Button loginButton;
private Button signUpButton;
private Button forgetButton;
@ -35,26 +29,29 @@ public class LoginActivity extends Activity {
private Button changeButton;
private EditText fphonenum;
private EditText fpassword;
private int islogin = 0;
int flag = 0; //flag = 0 是用户名登录;=1是手机号
// 调用Actvity
private String TAG = "LoginActivity";
private String TAG = "LoginUI";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.activity_login);
loginButton = (Button) this.findViewById(R.id.LoginButton);
signUpButton = (Button) this.findViewById(R.id.SignUpButton);
forgetButton = (Button) this.findViewById(R.id.forget);
phonenumButton = (Button) this.findViewById(R.id.phonenum);
//设置对话框引用Activity对象
AlertDialog.Builder builder = new AlertDialog.Builder(LoginUI.this);
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
//使用别的layout
View view2 = View.inflate(LoginUI.this, R.layout.forget, null);
View view2 = View.inflate(LoginActivity.this, R.layout.forget, null);
builder.setTitle("取件").setView(view2);
builder.setTitle("忘记密码").setView(view2);
alert = builder.create();
@ -76,7 +73,7 @@ public class LoginActivity extends Activity {
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this, SignUpActivity.class);
Intent intent = new Intent(LoginUI.this, SignUpUI.class);
Log.d(TAG, "signup");
startActivity(intent);
}
@ -106,6 +103,7 @@ public class LoginActivity extends Activity {
new View.OnClickListener() {
@Override
public void onClick(View view) {
//输入提示
userName.setHint("请输入手机号");
flag = 1;
}
@ -115,18 +113,22 @@ public class LoginActivity extends Activity {
}
public void change(View view){
//trim() 方法用于删除字符串的头尾空白符,空白符包括:空格、制表符 tab、换行符等其他空白符等。
String phoneunm = fphonenum.getText().toString().trim();
String password = fpassword.getText().toString().trim();
new Thread() {
@Override
public void run() {
//后端用来和数据库交互
userManager userManager = new userManager();
//msg=0代表操作成功
int msg = userManager.change(phoneunm, password);
Log.d(TAG, "change");
if(msg != 1){
Log.d(TAG, "pickup,failed");
//处理异步消息int类型的msg最终会转化为hander的msg类型
hand2.sendEmptyMessage(msg);
return;
}
@ -138,6 +140,8 @@ public class LoginActivity extends Activity {
}
public void login(View view){
Log.d(TAG, "login");
EditText userName = (EditText) this.findViewById(R.id.UserNameEdit);
EditText passWord = (EditText) this.findViewById(R.id.PassWordEdit);
@ -154,10 +158,12 @@ public class LoginActivity extends Activity {
}
Log.e("MAin", "msg");
hand1.sendEmptyMessage(msg);
//msg==1表示登录成功
if(msg == 1){
User owner = userManager.findUser(userName.getText().toString().trim());
Intent intent = new Intent(LoginActivity.this, MenuActivity.class);
Intent intent = new Intent(LoginUI.this, MenuActivity.class);
if(flag == 1){
//不同activity之间传递数据
intent.putExtra("user", userName.getText().toString().trim());
}else{
intent.putExtra("user", owner.getPhoneNum());
@ -190,9 +196,9 @@ public class LoginActivity extends Activity {
@Override
public void handleMessage(Message msg) {
if(msg.what == 0){
Toast.makeText(LoginActivity.this, "修改失败", Toast.LENGTH_SHORT).show();
Toast.makeText(LoginUI.this, "修改失败", Toast.LENGTH_SHORT).show();
}else if(msg.what == 1) {
Toast.makeText(LoginActivity.this, "修改成功", Toast.LENGTH_SHORT).show();
Toast.makeText(LoginUI.this, "修改成功", Toast.LENGTH_SHORT).show();
}
}
};

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

Loading…
Cancel
Save