Skip to content

Commit 512214f

Browse files
committed
# Conflicts: # app/src/main/java/com/zhuolang/main/common/APPConfig.java # app/src/main/res/layout/homepage.xml
2 parents 3a454c3 + 1d66939 commit 512214f

File tree

7 files changed

+49
-16
lines changed

7 files changed

+49
-16
lines changed

app/src/main/java/com/zhuolang/main/common/APPConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
*/
66

77
public class APPConfig {
8-
// private static String base_url="http://192.168.23.1:8080/MicroDoctorServer/";
8+
private static String base_url="http://192.168.23.1:8080/MicroDoctorServer/";
99
// private static String base_url="http://192.168.43.123:8080/MicroDoctorServer/";
10-
// private static String base_url="http://10.11.37.107:8080/MicroDoctorServer/";
1110
// private static String base_url="http://192.168.168.100:8080/MicroDoctorServer/";
12-
private static String base_url = "http://27.45.36.67:80/MicroDoctorServer/";
11+
// private static String base_url = "http:// 27.45.9.166:80/MicroDoctorServer/";
1312
public static String addAppointment = base_url + "add_appointment";
1413
public static String login = base_url + "login_user";
1514
public static String showDoctor = base_url + "findByType_user";
@@ -22,4 +21,5 @@ public class APPConfig {
2221
public static String IS_LOGIN = "is_login";
2322
public static String ACCOUNT = "account";
2423
public static String USERDATA = "userData";//获取当前用户的key
24+
public static String TYPE = "userType";
2525
}

app/src/main/java/com/zhuolang/main/ui/activity/AppointActivity.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private void initMotion() {
7171
final List<OkHttpUtils.Param> list = new ArrayList<OkHttpUtils.Param>();
7272
OkHttpUtils.Param typeParam = new OkHttpUtils.Param("type", "1");
7373
list.add(typeParam);
74-
74+
CustomWaitDialog.show(AppointActivity.this, "连接服务中...");
7575
new Thread(new Runnable() {
7676
@Override
7777
public void run() {
@@ -81,6 +81,7 @@ public void onSuccess(Object response) {
8181
Message message = new Message();
8282
message.what = 0;
8383
message.obj = response;
84+
CustomWaitDialog.miss();
8485
if (handler.sendMessage(message)) {
8586
// Toast.makeText(AppointActivity.this, "发送数据成功!", Toast.LENGTH_SHORT).show();
8687
} else {
@@ -90,7 +91,7 @@ public void onSuccess(Object response) {
9091
@Override
9192
public void onFailure(Exception e) {
9293
Toast.makeText(AppointActivity.this, "网络连接失败,请重试!", Toast.LENGTH_SHORT).show();
93-
// CustomWaitDialog.miss();
94+
CustomWaitDialog.miss();
9495
}
9596
}, list);
9697
}

app/src/main/java/com/zhuolang/main/ui/activity/DoctorListActivity.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.zhuolang.main.common.APPConfig;
1515
import com.zhuolang.main.model.DoctorDto;
1616
import com.zhuolang.main.utils.OkHttpUtils;
17+
import com.zhuolang.main.view.CustomWaitDialog;
1718

1819
import java.util.*;
1920

@@ -73,6 +74,7 @@ public void initMotion() {
7374
final List<OkHttpUtils.Param> list = new ArrayList<OkHttpUtils.Param>();
7475
OkHttpUtils.Param typeParam = new OkHttpUtils.Param("type", "1");//接口要求传类型,类型一为医师
7576
list.add(typeParam);
77+
CustomWaitDialog.show(DoctorListActivity.this, "连接服务中...");
7678
new Thread(new Runnable() {
7779
@Override
7880
public void run() {
@@ -84,6 +86,7 @@ public void onSuccess(Object response) {
8486
message.what = 0;
8587
message.obj = response;
8688
if (handler.sendMessage(message)) {
89+
CustomWaitDialog.miss();
8790
// Toast.makeText(DoctorListActivity.this, "发送数据成功!", Toast.LENGTH_SHORT).show();
8891
}else {
8992
// Toast.makeText(DoctorListActivity.this, "发送数据失败,请重试!", Toast.LENGTH_SHORT).show();
@@ -98,7 +101,7 @@ public void onFailure(Exception e) {
98101
// startActivity(intent);
99102
// finish();
100103
Toast.makeText(DoctorListActivity.this, "网络连接失败,请重试!", Toast.LENGTH_SHORT).show();
101-
104+
CustomWaitDialog.miss();
102105
}
103106
}, list);
104107
}

app/src/main/java/com/zhuolang/main/ui/activity/LoginActivity.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class LoginActivity extends Activity {
3838

3939
private String account;
4040
private String psd;
41+
private int type;
4142

4243
private Handler handler = new Handler(){
4344
@Override
@@ -47,7 +48,7 @@ public void handleMessage(Message msg) {
4748
case 0:
4849
CustomWaitDialog.miss();
4950
String result = (String)msg.obj;
50-
if (result.equals("login_success")){
51+
if (result.equals("login_success0")||result.equals("login_success1")){
5152
//保存登录状态
5253
SharedPrefsUtil.putValue(LoginActivity.this,APPConfig.IS_LOGIN,true);
5354
Intent intentService = new Intent();
@@ -58,6 +59,7 @@ public void handleMessage(Message msg) {
5859
Toast.makeText(LoginActivity.this,"登陆成功!",Toast.LENGTH_SHORT).show();
5960
Intent intent = new Intent();
6061
intent.setClass(LoginActivity.this, MainActivity.class);
62+
// intent.putExtra("type", type + "");
6163
startActivity(intent);
6264
finish();
6365
}
@@ -128,12 +130,16 @@ public void onSuccess(Object response) {
128130
Message message = new Message();
129131
message.what = 0;
130132
message.obj = response;
131-
if (handler.sendMessage(message)) {
132-
// Toast.makeText(LoginActivity.this, "发送数据成功!", Toast.LENGTH_SHORT).show();
133-
}
134-
else {
135-
// Toast.makeText(LoginActivity.this, "发送数据失败,请重试!", Toast.LENGTH_SHORT).show();
133+
if (response.toString().equals("login_success0")) {
134+
type = 0 ;
135+
SharedPrefsUtil.putValue(LoginActivity.this,APPConfig.TYPE,"0");
136+
// Toast.makeText(AppointActivity.this, "发送数据成功!", Toast.LENGTH_SHORT).show();
137+
} else {
138+
type = 1 ;
139+
SharedPrefsUtil.putValue(LoginActivity.this,APPConfig.TYPE,"1");
140+
// Toast.makeText(AppointActivity.this, "发送数据失败,请重试!", Toast.LENGTH_SHORT).show();
136141
}
142+
handler.sendMessage(message);
137143
}
138144

139145
@Override

app/src/main/java/com/zhuolang/main/ui/activity/RegisterActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ public void handleMessage(Message msg) {
209209
RegisterActivity.this.startService(intentService);
210210
//保存登录状态
211211
SharedPrefsUtil.putValue(RegisterActivity.this, APPConfig.IS_LOGIN, true);
212+
SharedPrefsUtil.putValue(RegisterActivity.this,APPConfig.TYPE,type.toString());
212213
Intent intent = new Intent();
213214
intent.setClass(RegisterActivity.this, MainActivity.class);
214215
// Toast.makeText(RegisterActivity.this,"登陆成功!",Toast.LENGTH_SHORT).show();

app/src/main/java/com/zhuolang/main/ui/fragment/HomepageTabFragment.java

+23-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
import android.view.View;
99
import android.view.ViewGroup;
1010
import android.widget.ImageView;
11+
import android.widget.TextView;
12+
import android.widget.Toast;
1113

14+
import com.google.gson.Gson;
1215
import com.zhuolang.main.R;
16+
import com.zhuolang.main.common.APPConfig;
17+
import com.zhuolang.main.model.DoctorDto;
1318
import com.zhuolang.main.ui.activity.*;
19+
import com.zhuolang.main.utils.SharedPrefsUtil;
1420

1521
/**
1622
* Created by wnf on 2016/10/29.
@@ -26,6 +32,10 @@ public class HomepageTabFragment extends Fragment implements View.OnClickListene
2632
private ImageView imageAppoint = null;//预约挂号
2733
private ImageView imageMyAppoint = null;//我的预约
2834
private ImageView imageConsult = null;//我的咨询
35+
private TextView tv_appointMine;
36+
private TextView tv_history;
37+
38+
private String type;
2939

3040
@Override
3141
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
@@ -41,14 +51,24 @@ public View onCreateView(final LayoutInflater inflater, final ViewGroup containe
4151
*初始化数据
4252
*/
4353
private void initView(View view) {
54+
type = SharedPrefsUtil.getValue(getContext(), APPConfig.TYPE, "");
55+
tv_appointMine= (TextView) view.findViewById(R.id.tv_homep_appointmine);
56+
tv_history= (TextView) view.findViewById(R.id.tv_homep_history);
4457
imageConsult = (ImageView) view.findViewById(R.id.image_item_consult);
45-
imageConsult.setOnClickListener(this);
4658
imageDoctor = (ImageView) view.findViewById(R.id.image_item_doctor);
47-
imageDoctor.setOnClickListener(this);
4859
imageAppoint = (ImageView) view.findViewById(R.id.image_item_appointment);
49-
imageAppoint.setOnClickListener(this);
5060
imageMyAppoint = (ImageView) view.findViewById(R.id.image_item_myappointment);
61+
if (type.equals("1")){
62+
tv_appointMine.setText("预约我的");
63+
tv_history.setText("历史记录");
64+
}else {
65+
tv_appointMine.setText("我的预约");
66+
tv_history.setText("我的咨询");
67+
}
68+
imageAppoint.setOnClickListener(this);
5169
imageMyAppoint.setOnClickListener(this);
70+
imageDoctor.setOnClickListener(this);
71+
imageConsult.setOnClickListener(this);
5272
}
5373

5474
@Override

app/src/main/res/layout/homepage.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
android:layout_width="78dp"
9898
android:layout_height="78dp" />
9999
<TextView
100+
android:id="@+id/tv_homep_appointmine"
100101
android:text="我的预约"
101102
android:textSize="11dp"
102103
android:layout_gravity="center"
@@ -116,7 +117,8 @@
116117
android:layout_width="78dp"
117118
android:layout_height="78dp" />
118119
<TextView
119-
android:text="历史记录"
120+
android:id="@+id/tv_homep_history"
121+
android:text="我的咨询"
120122
android:textSize="11dp"
121123
android:layout_gravity="center"
122124
android:layout_width="wrap_content"

0 commit comments

Comments
 (0)