Compare commits

..

No commits in common. 'b208d0aea3bdf6854cf2aa5bfb1082b2d963b66e' and '2627a361b6e38f56015489d8362f7d16f827e229' have entirely different histories.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 155 KiB

@ -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_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_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_main2.xml" value="0.10235507246376811" />
<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_menu.xml" value="0.33" />
<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_no_pick.xml" value="0.2" />
<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_sign_up.xml" value="0.10235507246376811" />
<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/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/buttom.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/forget.xml" value="0.2630208333333333" /> <entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/forget.xml" value="0.2630208333333333" />

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

@ -1,90 +0,0 @@
package com.example.logistics.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.Nullable;
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";
private Context mContext;
private Button mButton;
private EditText mPickUpCode;
private EditText mPhoneNum;
public FindUI(){
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
View view = inflater.inflate(R.layout.my_fragment1,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;
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.Sea_Button:
Log.d(TAG, "search");
search(v);
break;
}
}
public void search(View view){
new Thread(){
@Override
public void run(){
goodManager goodManager = new goodManager();
int msg = goodManager.search(mPickUpCode.getText().toString().trim(), mPhoneNum.getText().toString().trim(), getActivity());
Log.e("Main", "msg");
hand1.sendEmptyMessage(msg);
}
}.start();
}
@SuppressLint("HandlerLeak")
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){
Toast.makeText(mContext, "手机尾号错误", Toast.LENGTH_SHORT).show();
}else if(msg.what == 3){
Toast.makeText(mContext, "取件码不存在", Toast.LENGTH_SHORT).show();
}
}
};
}

@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class HistoryUI extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener { public class HistoryActivity extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {
private String TAG = "HistoryActivity"; private String TAG = "HistoryActivity";
private ListView lv_history; private ListView lv_history;
@ -111,7 +111,7 @@ public class HistoryUI extends Activity implements OnItemClickListener, OnScroll
@Override @Override
public void handleMessage(Message msg){ public void handleMessage(Message msg){
if(msg.what == 1){ if(msg.what == 1){
simp_adapter=new SimpleAdapter(HistoryUI.this, dataList, R.layout.item, new String[]{"pickupcode","time"}, new int[]{R.id.np_id,R.id.np_time}); simp_adapter=new SimpleAdapter(HistoryActivity.this, dataList, R.layout.item, new String[]{"pickupcode","time"}, new int[]{R.id.np_id,R.id.np_time});
lv_history.setAdapter(simp_adapter); lv_history.setAdapter(simp_adapter);
} }
} }

@ -1,12 +1,15 @@
package com.example.logistics.ui; package com.example.logistics.ui;
import com.example.logistics.R; 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.manager.userManager;
import com.example.logistics.entity.User; import com.example.logistics.entity.User;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -17,8 +20,11 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; 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 int islogin = 0;
private Button loginButton; private Button loginButton;
@ -44,9 +50,9 @@ public class LoginUI extends Activity {
phonenumButton = (Button) this.findViewById(R.id.phonenum); phonenumButton = (Button) this.findViewById(R.id.phonenum);
AlertDialog.Builder builder = new AlertDialog.Builder(LoginUI.this); AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
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);
@ -70,7 +76,7 @@ public class LoginUI extends Activity {
new View.OnClickListener() { new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(LoginUI.this, SignUpUI.class); Intent intent = new Intent(LoginActivity.this, SignUpActivity.class);
Log.d(TAG, "signup"); Log.d(TAG, "signup");
startActivity(intent); startActivity(intent);
} }
@ -150,7 +156,7 @@ public class LoginUI extends Activity {
hand1.sendEmptyMessage(msg); hand1.sendEmptyMessage(msg);
if(msg == 1){ if(msg == 1){
User owner = userManager.findUser(userName.getText().toString().trim()); User owner = userManager.findUser(userName.getText().toString().trim());
Intent intent = new Intent(LoginUI.this, MenuActivity.class); Intent intent = new Intent(LoginActivity.this, MenuActivity.class);
if(flag == 1){ if(flag == 1){
intent.putExtra("user", userName.getText().toString().trim()); intent.putExtra("user", userName.getText().toString().trim());
}else{ }else{
@ -184,9 +190,9 @@ public class LoginUI extends Activity {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
if(msg.what == 0){ if(msg.what == 0){
Toast.makeText(LoginUI.this, "修改失败", Toast.LENGTH_SHORT).show(); Toast.makeText(LoginActivity.this, "修改失败", Toast.LENGTH_SHORT).show();
}else if(msg.what == 1) { }else if(msg.what == 1) {
Toast.makeText(LoginUI.this, "修改成功", Toast.LENGTH_SHORT).show(); Toast.makeText(LoginActivity.this, "修改成功", Toast.LENGTH_SHORT).show();
} }
} }
}; };

@ -15,14 +15,14 @@ import androidx.annotation.Nullable;
import com.example.logistics.R; import com.example.logistics.R;
public class SetUI extends Fragment implements View.OnClickListener{ public class MeUI extends Fragment implements View.OnClickListener{
private LinearLayout ll_waiting; private LinearLayout ll_waiting;
private LinearLayout ll_history; private LinearLayout ll_history;
private LinearLayout ll_exit; private LinearLayout ll_exit;
private Context mContext; private Context mContext;
private String user; private String user;
public SetUI(){ public MeUI(){
} }
@Nullable @Nullable
@ -52,19 +52,19 @@ public class SetUI extends Fragment implements View.OnClickListener{
Intent intent; Intent intent;
switch(view.getId()){ switch(view.getId()){
case R.id.waiting: case R.id.waiting:
intent = new Intent(mContext, SearchUI.class); intent = new Intent(mContext, NoPickActivity.class);
intent.putExtra("user", user); intent.putExtra("user", user);
startActivity(intent); startActivity(intent);
break; break;
case R.id.history: case R.id.history:
intent = new Intent(mContext, HistoryUI.class); intent = new Intent(mContext, HistoryActivity.class);
intent.putExtra("user", user); intent.putExtra("user", user);
startActivity(intent); startActivity(intent);
break; break;
case R.id.exit: case R.id.exit:
Toast.makeText(mContext, "exit", Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, "exit", Toast.LENGTH_SHORT).show();
intent = new Intent(mContext, LoginUI.class); intent = new Intent(mContext, LoginActivity.class);
startActivity(intent); startActivity(intent);
getActivity().finish(); getActivity().finish();
break; break;

@ -17,7 +17,6 @@ import androidx.fragment.app.FragmentManager;
import com.example.logistics.R; import com.example.logistics.R;
public class MenuActivity extends AppCompatActivity implements View.OnClickListener{ public class MenuActivity extends AppCompatActivity implements View.OnClickListener{
private LinearLayout ly_one,ly_two,ly_three; private LinearLayout ly_one,ly_two,ly_three;
private TextView mTextView1,mTextView2,mTextView3; private TextView mTextView1,mTextView2,mTextView3;
private TextView mTextNum1,mTextNum2,mTextNum3; private TextView mTextNum1,mTextNum2,mTextNum3;
@ -30,7 +29,6 @@ public class MenuActivity extends AppCompatActivity implements View.OnClickListe
private String owner; private String owner;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu); setContentView(R.layout.activity_menu);
@ -95,7 +93,7 @@ public class MenuActivity extends AppCompatActivity implements View.OnClickListe
mTextView1.setSelected(true); mTextView1.setSelected(true);
mTextNum1.setVisibility(View.INVISIBLE); mTextNum1.setVisibility(View.INVISIBLE);
if (mFrag1 == null) { if (mFrag1 == null) {
mFrag1 = new FindUI(); mFrag1 = new SearchUI();
transaction.add(R.id.fragment_container, mFrag1); transaction.add(R.id.fragment_container, mFrag1);
@ -122,7 +120,7 @@ public class MenuActivity extends AppCompatActivity implements View.OnClickListe
mTextView3.setSelected(true); mTextView3.setSelected(true);
mTextNum3.setVisibility(View.INVISIBLE); mTextNum3.setVisibility(View.INVISIBLE);
if (mFrag3 == null) { if (mFrag3 == null) {
mFrag3 = new SetUI(); mFrag3 = new MeUI();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("user", owner); bundle.putString("user", owner);
mFrag3.setArguments(bundle); mFrag3.setArguments(bundle);

@ -0,0 +1,123 @@
package com.example.logistics.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import com.example.logistics.R;
import com.example.logistics.manager.goodManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class NoPickActivity extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {
private String TAG = "NoPickActivity";
private ListView lv_nopick;
private ArrayAdapter<String> arr_adapter;
private SimpleAdapter simp_adapter;
private String phonenum;
private List<Map<String, Object>> dataList;
private ImageButton sync_np;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_no_pick);
dataList=new ArrayList<Map<String,Object>>();
lv_nopick = (ListView) findViewById(R.id.lv_nopick);
sync_np = (ImageButton) findViewById(R.id.sync_np);
simp_adapter=new SimpleAdapter(this, dataList, R.layout.item, new String[]{"id","time"}, new int[]{R.id.np_id,R.id.np_time});
lv_nopick.setAdapter(simp_adapter);
lv_nopick.setOnItemClickListener(this);
lv_nopick.setOnScrollListener(this);
sync_np.setOnClickListener(this);
Intent intent = getIntent();
phonenum = intent.getStringExtra("user");
sync();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
String text=lv_nopick.getItemAtPosition(position)+"";
Toast.makeText(this, "position="+position+" text="+text, Toast.LENGTH_SHORT).show();
}
@Override
public void onClick(View v){
switch(v.getId()){
case R.id.sync_np:
sync();
Toast.makeText(this, "同步成功", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState){
// TODO Auto-generated method stub
switch(scrollState){
case SCROLL_STATE_FLING:
Log.i(TAG, "用户在手指离开屏幕之前,由于用力划了一下,试图仍依靠惯性继续滑动");
break;
case SCROLL_STATE_IDLE:
Log.i(TAG, "视图已经停止滑动");
break;
case SCROLL_STATE_TOUCH_SCROLL:
Log.i(TAG, "手指没有离开屏幕,视图正在滑动");
break;
default:
break;
}
}
@Override
public void onScroll(AbsListView view, int arg1, int arg2, int arg3){
// TODO Auto-generated method stub
}
public void sync(){
new Thread(){
@Override
public void run(){
goodManager goodManager = new goodManager();
dataList = goodManager.nopick(phonenum);
int msg = 1;
hand1.sendEmptyMessage(msg);
}
}.start();
}
@SuppressLint("HandlerLeak")
final Handler hand1 = new Handler(){
@Override
public void handleMessage(Message msg){
if(msg.what == 1){
simp_adapter=new SimpleAdapter(NoPickActivity.this, dataList, R.layout.item, new String[]{"id","time"}, new int[]{R.id.np_id,R.id.np_time});
lv_nopick.setAdapter(simp_adapter);
}
}
};
}

@ -246,12 +246,9 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
boolean flag1 = operationManager.add(pickupcode, user); boolean flag1 = operationManager.add(pickupcode, user);
boolean flag2 = goodManager.delete(pickupcode); boolean flag2 = goodManager.delete(pickupcode);
boolean flag = flag1 & flag2;
if (!flag1) { if (flag) {
msg = 2; msg = 1;
}
if(!flag2){
msg = 3;
} }
hand1.sendEmptyMessage(msg); hand1.sendEmptyMessage(msg);
@ -271,9 +268,9 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
Toast.makeText(mContext, "加入队列成功", Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, "加入队列成功", Toast.LENGTH_SHORT).show();
joinQueue(); joinQueue();
}else if(msg.what == 2){ }else if(msg.what == 2){
Toast.makeText(mContext, "出库失败", Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, "手机号错误", Toast.LENGTH_SHORT).show();
}else if(msg.what == 3){ }else if(msg.what == 3){
Toast.makeText(mContext, "保存记录失败", Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, "取件码不存在", Toast.LENGTH_SHORT).show();
} }
} }
}; };

@ -1,110 +1,66 @@
package com.example.logistics.ui; package com.example.logistics.ui;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.content.Context;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.AbsListView; import android.view.ViewGroup;
import android.widget.AbsListView.OnScrollListener; import android.widget.Button;
import android.widget.AdapterView.OnItemClickListener; import android.widget.EditText;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.example.logistics.R; import com.example.logistics.R;
import com.example.logistics.manager.goodManager; import com.example.logistics.manager.goodManager;
import java.util.ArrayList; public class SearchUI extends Fragment implements View.OnClickListener{
import java.util.List; private Context mContext;
import java.util.Map; private Button mButton;
private EditText mPickUpCode;
public class SearchUI extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener { private EditText mPhoneNum;
private String TAG = "NoPickActivity";
private ListView lv_nopick;
private ArrayAdapter<String> arr_adapter;
private SimpleAdapter simp_adapter;
private String phonenum;
private List<Map<String, Object>> dataList;
private ImageButton sync_np;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_no_pick);
dataList=new ArrayList<Map<String,Object>>(); public SearchUI(){
lv_nopick = (ListView) findViewById(R.id.lv_nopick);
sync_np = (ImageButton) findViewById(R.id.sync_np);
simp_adapter=new SimpleAdapter(this, dataList, R.layout.item, new String[]{"id","time"}, new int[]{R.id.np_id,R.id.np_time});
lv_nopick.setAdapter(simp_adapter);
lv_nopick.setOnItemClickListener(this);
lv_nopick.setOnScrollListener(this);
sync_np.setOnClickListener(this);
Intent intent = getIntent();
phonenum = intent.getStringExtra("user");
sync();
} }
@Nullable
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO Auto-generated method stub View view = inflater.inflate(R.layout.my_fragment1,container,false);
String text=lv_nopick.getItemAtPosition(position)+""; mButton = (Button)view.findViewById(R.id.Sea_Button);
Toast.makeText(this, "position="+position+" text="+text, Toast.LENGTH_SHORT).show(); mPickUpCode = (EditText)view.findViewById(R.id.Sea_PickUpCode);
mPhoneNum = (EditText)view.findViewById(R.id.Sea_PhoneNum);
mButton.setOnClickListener(this);
mContext = getActivity();
return view;
} }
@Override @Override
public void onClick(View v){ public void onClick(View v) {
switch(v.getId()){ switch(v.getId()){
case R.id.sync_np: case R.id.Sea_Button:
sync(); search(v);
Toast.makeText(this, "同步成功", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState){
// TODO Auto-generated method stub
switch(scrollState){
case SCROLL_STATE_FLING:
Log.i(TAG, "用户在手指离开屏幕之前,由于用力划了一下,试图仍依靠惯性继续滑动");
break;
case SCROLL_STATE_IDLE:
Log.i(TAG, "视图已经停止滑动");
break;
case SCROLL_STATE_TOUCH_SCROLL:
Log.i(TAG, "手指没有离开屏幕,视图正在滑动");
break;
default:
break; break;
} }
} }
@Override public void search(View view){
public void onScroll(AbsListView view, int arg1, int arg2, int arg3){
// TODO Auto-generated method stub
}
public void sync(){
new Thread(){ new Thread(){
@Override @Override
public void run(){ public void run(){
goodManager goodManager = new goodManager(); goodManager goodManager = new goodManager();
dataList = goodManager.nopick(phonenum); int msg = goodManager.search(mPickUpCode.getText().toString().trim(), mPhoneNum.getText().toString().trim(), getActivity());
Log.e("Main", "msg");
int msg = 1;
hand1.sendEmptyMessage(msg); hand1.sendEmptyMessage(msg);
} }
}.start(); }.start();
} }
@ -112,12 +68,13 @@ public class SearchUI extends Activity implements OnItemClickListener, OnScrollL
final Handler hand1 = new Handler(){ final Handler hand1 = new Handler(){
@Override @Override
public void handleMessage(Message msg){ public void handleMessage(Message msg){
if(msg.what == 1){ if(msg.what == 0){
simp_adapter=new SimpleAdapter(SearchUI.this, dataList, R.layout.item, new String[]{"id","time"}, new int[]{R.id.np_id,R.id.np_time}); Toast.makeText(mContext, "搜索失败", Toast.LENGTH_SHORT).show();
lv_nopick.setAdapter(simp_adapter); }else if(msg.what == 2){
Toast.makeText(mContext, "手机尾号错误", Toast.LENGTH_SHORT).show();
}else if(msg.what == 3){
Toast.makeText(mContext, "取件码不存在", Toast.LENGTH_SHORT).show();
} }
} }
}; };
}
}

@ -6,7 +6,6 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
@ -16,13 +15,9 @@ import com.example.logistics.R;
import com.example.logistics.manager.userManager; import com.example.logistics.manager.userManager;
import com.example.logistics.entity.User; import com.example.logistics.entity.User;
public class SignUpUI extends Activity { public class SignUpActivity extends Activity {
private String TAG = "SignUpUI";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up); setContentView(R.layout.activity_sign_up);
@ -33,21 +28,17 @@ public class SignUpUI extends Activity {
new View.OnClickListener() { new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.d(TAG, "SignUp:onClick");
register(v); register(v);
} }
} }
); );
// 返回登录按钮监听器 // 返回登录按钮监听器
backLoginButton.setOnClickListener( backLoginButton.setOnClickListener(
new View.OnClickListener() { new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// 跳转到登录界面 // 跳转到登录界面
Log.d(TAG, "BackLogin:onClick"); Intent intent = new Intent(SignUpActivity.this, LoginActivity.class);
Intent intent = new Intent(SignUpUI.this, LoginUI.class);
startActivity(intent); startActivity(intent);
} }
} }
@ -56,9 +47,6 @@ public class SignUpUI extends Activity {
} }
public void register(View view){ public void register(View view){
Log.d(TAG, "register");
EditText userName = (EditText) this.findViewById(R.id.UserNameEdit); EditText userName = (EditText) this.findViewById(R.id.UserNameEdit);
EditText passWord = (EditText) this.findViewById(R.id.PassWordEdit); EditText passWord = (EditText) this.findViewById(R.id.PassWordEdit);
EditText passWordAgain = (EditText) this.findViewById(R.id.PassWordAgainEdit); EditText passWordAgain = (EditText) this.findViewById(R.id.PassWordAgainEdit);
@ -70,34 +58,17 @@ public class SignUpUI extends Activity {
String strPhoneNumber = phone.getText().toString().trim(); String strPhoneNumber = phone.getText().toString().trim();
if (strUserName.length() > 10) { if (strUserName.length() > 10) {
Toast.makeText(SignUpActivity.this, "用户名长度必须小于10", Toast.LENGTH_SHORT).show();
Log.d(TAG, "username out of length");
Toast.makeText(SignUpUI.this, "用户名长度必须小于10", Toast.LENGTH_SHORT).show();
} else if (strUserName.length() == 0) { } else if (strUserName.length() == 0) {
Toast.makeText(SignUpActivity.this, "用户名不能为空!", Toast.LENGTH_SHORT).show();
Log.d(TAG, "username is none");
Toast.makeText(SignUpUI.this, "用户名不能为空!", Toast.LENGTH_SHORT).show();
} else if (strPassWord.length() > 16) { } else if (strPassWord.length() > 16) {
Toast.makeText(SignUpActivity.this, "密码长度必须小于16", Toast.LENGTH_SHORT).show();
Log.d(TAG, "password out of length");
Toast.makeText(SignUpUI.this, "密码长度必须小于16", Toast.LENGTH_SHORT).show();
} else if (strPassWord.length() == 0) { } else if (strPassWord.length() == 0) {
Toast.makeText(SignUpActivity.this, "密码不能为空!", Toast.LENGTH_SHORT).show();
Log.d(TAG, "password is none");
Toast.makeText(SignUpUI.this, "密码不能为空!", Toast.LENGTH_SHORT).show();
} else if (!strPassWord.equals(strPassWordAgain)) { } else if (!strPassWord.equals(strPassWordAgain)) {
Toast.makeText(SignUpActivity.this, "两次密码输入不一致!", Toast.LENGTH_SHORT).show();
Log.d(TAG, "password is not same");
Toast.makeText(SignUpUI.this, "两次密码输入不一致!", Toast.LENGTH_SHORT).show();
} else { } else {
Toast.makeText(SignUpActivity.this, "注册成功!", Toast.LENGTH_SHORT).show();
Log.d(TAG, "register success");
Toast.makeText(SignUpUI.this, "注册成功!", Toast.LENGTH_SHORT).show();
User user = new User(); User user = new User();
user.setUserName(strUserName); user.setUserName(strUserName);
@ -107,27 +78,17 @@ public class SignUpUI extends Activity {
new Thread(){ new Thread(){
@Override @Override
public void run(){ public void run(){
Log.d(TAG, "register thread");
int msg = 0; int msg = 0;
userManager userManager = new userManager(); userManager userManager = new userManager();
User uu = userManager.findUser(user.getUserName()); User uu = userManager.findUser(user.getUserName());
if(uu != null){ if(uu != null){
Log.d(TAG, "have this account");
msg = 1; //have this account msg = 1; //have this account
}else{ }else{
Log.d(TAG, "have no this account");
boolean flag = userManager.register(user); boolean flag = userManager.register(user);
if(flag){ if(flag){
Log.d(TAG, "register success");
msg = 2; msg = 2;
} }
} }
hand.sendEmptyMessage(msg); hand.sendEmptyMessage(msg);
@ -139,24 +100,14 @@ public class SignUpUI extends Activity {
@SuppressLint("HandlerLeak") @SuppressLint("HandlerLeak")
final Handler hand = new Handler(){ final Handler hand = new Handler(){
public void handleMessage(Message msg){ public void handleMessage(Message msg){
Log.d(TAG, "msg is:" + msg.toString());
if(msg.what == 0){ if(msg.what == 0){
Toast.makeText(getApplicationContext(), "注册失败", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "注册失败", Toast.LENGTH_SHORT).show();
}else if(msg.what == 1){ }else if(msg.what == 1){
Toast.makeText(getApplicationContext(), "该账号已存在,请换一个注册", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "该账号已存在,请换一个注册", Toast.LENGTH_SHORT).show();
}else if(msg.what == 2){ }else if(msg.what == 2){
Toast.makeText(getApplicationContext(), "注册成功", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "注册成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(SignUpActivity.this, LoginActivity.class);
Intent intent = new Intent(SignUpUI.this, LoginUI.class);
startActivity(intent); startActivity(intent);
} }
} }
}; };

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="com.example.logistics.ui.LoginUI"> tools:context="com.example.logistics.ui.LoginActivity">
<!--使用线性布局--> <!--使用线性布局-->
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="com.example.logistics.ui.SignUpUI"> tools:context="com.example.logistics.ui.SignUpActivity">
<!--使用线性布局--> <!--使用线性布局-->
<LinearLayout <LinearLayout

Loading…
Cancel
Save