Commit faf9f80931ae573ada602f0e71397c51c8bfb747

Authored by wwx
1 parent 55f0d839

no message

app/src/main/java/com/shunzhi/parent/contract/apply/ApplyReplaceCardContract.java
@@ -26,6 +26,6 @@ public interface ApplyReplaceCardContract { @@ -26,6 +26,6 @@ public interface ApplyReplaceCardContract {
26 } 26 }
27 27
28 interface IApplyReplaceCardView extends IBaseView{ 28 interface IApplyReplaceCardView extends IBaseView{
29 - void showTipsDialog(); 29 + void showTipsDialog(String string);
30 } 30 }
31 } 31 }
app/src/main/java/com/shunzhi/parent/contract/report/ReportDetialContract.java
@@ -25,7 +25,7 @@ public interface ReportDetialContract { @@ -25,7 +25,7 @@ public interface ReportDetialContract {
25 interface IReportDetialView extends IBaseView { 25 interface IReportDetialView extends IBaseView {
26 // pointNow,pointPast,sceneName 26 // pointNow,pointPast,sceneName
27 void showDetialList(List<DeyuDetialBean> list, JsonArray pointNow, JsonArray pointPast, JsonArray sceneName); 27 void showDetialList(List<DeyuDetialBean> list, JsonArray pointNow, JsonArray pointPast, JsonArray sceneName);
28 - void showDetialInfo(float rank, String scoree, String bijiao1,String bijiao2,String bijiao3,String bijiao4,String describe); 28 + void showDetialInfo(float rank, String scoree, String bijiao1,String bijiao2,String bijiao3,String bijiao4,String describe);
29 29
30 } 30 }
31 } 31 }
app/src/main/java/com/shunzhi/parent/presenter/apply/ApplyReplaceCardPresenter.java
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint; @@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
4 import android.text.TextUtils; 4 import android.text.TextUtils;
5 import android.util.Log; 5 import android.util.Log;
6 6
  7 +import com.google.gson.JsonArray;
7 import com.google.gson.JsonObject; 8 import com.google.gson.JsonObject;
8 import com.share.mvpsdk.base.BasePresenter; 9 import com.share.mvpsdk.base.BasePresenter;
9 import com.share.mvpsdk.utils.ToastUtils; 10 import com.share.mvpsdk.utils.ToastUtils;
@@ -11,6 +12,8 @@ import com.shunzhi.parent.contract.apply.ApplyReplaceCardContract; @@ -11,6 +12,8 @@ import com.shunzhi.parent.contract.apply.ApplyReplaceCardContract;
11 import com.shunzhi.parent.model.apply.ApplyReplaceCardModel; 12 import com.shunzhi.parent.model.apply.ApplyReplaceCardModel;
12 import com.shunzhi.parent.views.ReplaceCardDialog; 13 import com.shunzhi.parent.views.ReplaceCardDialog;
13 14
  15 +import org.json.JSONObject;
  16 +
14 import io.reactivex.functions.Consumer; 17 import io.reactivex.functions.Consumer;
15 18
16 /** 19 /**
@@ -18,8 +21,6 @@ import io.reactivex.functions.Consumer; @@ -18,8 +21,6 @@ import io.reactivex.functions.Consumer;
18 */ 21 */
19 public class ApplyReplaceCardPresenter extends ApplyReplaceCardContract.ApplyReplaceCardPreenter { 22 public class ApplyReplaceCardPresenter extends ApplyReplaceCardContract.ApplyReplaceCardPreenter {
20 23
21 - private JsonObject json;  
22 - private ReplaceCardDialog replaceCardDialog=null;  
23 24
24 @Override 25 @Override
25 public ApplyReplaceCardContract.IApplyReplaceCardModel getModel() { 26 public ApplyReplaceCardContract.IApplyReplaceCardModel getModel() {
@@ -39,15 +40,9 @@ public class ApplyReplaceCardPresenter extends ApplyReplaceCardContract.ApplyRep @@ -39,15 +40,9 @@ public class ApplyReplaceCardPresenter extends ApplyReplaceCardContract.ApplyRep
39 public void accept(JsonObject jsonObject) throws Exception { 40 public void accept(JsonObject jsonObject) throws Exception {
40 ToastUtils.showToast("data:" + jsonObject.toString()); 41 ToastUtils.showToast("data:" + jsonObject.toString());
41 42
42 - json = jsonObject.getAsJsonObject("data");  
43 - String isShowTipDialog = json.get("data").getAsString();  
44 - if (isShowTipDialog.equals("true")) {  
45 - //mIView.showTipsDialog();  
46 - replaceCardDialog.setTitle("补卡提示");  
47 - replaceCardDialog.setText("您已补卡成功!");  
48 - replaceCardDialog.show();  
49 - }  
50 - 43 + String isShowTipsDialog = jsonObject.get("data").getAsString();
  44 + Log.i("ApplyReplaceCard:", String.valueOf(isShowTipsDialog));
  45 + mIView.showTipsDialog(isShowTipsDialog);
51 } 46 }
52 }, new Consumer<Throwable>() { 47 }, new Consumer<Throwable>() {
53 @Override 48 @Override
app/src/main/java/com/shunzhi/parent/ui/fragment/apply/ApplyReplaceCardFragment.java
@@ -23,12 +23,12 @@ import com.shunzhi.parent.views.ReplaceCardDialog; @@ -23,12 +23,12 @@ import com.shunzhi.parent.views.ReplaceCardDialog;
23 * Created by Administrator on 2018/4/10 0010. 23 * Created by Administrator on 2018/4/10 0010.
24 */ 24 */
25 25
26 -public class ApplyReplaceCardFragment extends BaseMVPCompatFragment<ApplyReplaceCardContract.ApplyReplaceCardPreenter, ApplyReplaceCardContract.IApplyReplaceCardModel> implements View.OnClickListener { 26 +public class ApplyReplaceCardFragment extends BaseMVPCompatFragment<ApplyReplaceCardContract.ApplyReplaceCardPreenter, ApplyReplaceCardContract.IApplyReplaceCardModel> implements View.OnClickListener, ApplyReplaceCardContract.IApplyReplaceCardView {
27 private Button bt_sure; 27 private Button bt_sure;
28 private Button bt_cancel; 28 private Button bt_cancel;
29 ReplaceCardDialog replaceCardDialog = null; 29 ReplaceCardDialog replaceCardDialog = null;
30 private EditText et_cardnum; 30 private EditText et_cardnum;
31 - private String cardnum =""; 31 + private String cardnum = "";
32 32
33 @NonNull 33 @NonNull
34 @Override 34 @Override
@@ -66,16 +66,27 @@ public class ApplyReplaceCardFragment extends BaseMVPCompatFragment&lt;ApplyReplace @@ -66,16 +66,27 @@ public class ApplyReplaceCardFragment extends BaseMVPCompatFragment&lt;ApplyReplace
66 //studentid 从成长界面获取 此处设置为“123” 66 //studentid 从成长界面获取 此处设置为“123”
67 mPresenter.ReplaceCardDetail(12, cardnum); 67 mPresenter.ReplaceCardDetail(12, cardnum);
68 } 68 }
69 -  
70 -// cardnum = et_cardnum.getText().toString().trim();  
71 -// if (TextUtils.isEmpty(cardnum)) {  
72 -// Toast.makeText(getActivity(), "卡号不能为空,请重新输入", Toast.LENGTH_SHORT).show();  
73 -// } else {  
74 -// replaceCardDialog.setTitle("补卡提示");  
75 -// replaceCardDialog.setText("您已补卡成功!");  
76 -// replaceCardDialog.show();  
77 -// } 69 + break;
  70 + default:
78 break; 71 break;
79 } 72 }
80 } 73 }
  74 +
  75 + @Override
  76 + public void showTipsDialog(String msg) {
  77 +
  78 + if (msg.equals("true")) {
  79 + if (replaceCardDialog == null) {
  80 + replaceCardDialog = new ReplaceCardDialog(getActivity());
  81 + } else {
  82 + replaceCardDialog.setTitle("补卡提示");
  83 + replaceCardDialog.setText("您已补卡成功!");
  84 + replaceCardDialog.show();
  85 + }
  86 + } else {
  87 + ToastUtils.showToast("补卡失败!");
  88 + }
  89 +
  90 +
  91 + }
81 } 92 }
app/src/main/res/layout/fragment_apply_replacecard.xml
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 android:orientation="horizontal"> 39 android:orientation="horizontal">
40 40
41 <TextView 41 <TextView
42 - android:layout_weight="1" 42 + android:layout_weight="1.2"
43 android:id="@+id/tv_carduser" 43 android:id="@+id/tv_carduser"
44 android:layout_margin="@dimen/dp_8" 44 android:layout_margin="@dimen/dp_8"
45 android:layout_width="0dp" 45 android:layout_width="0dp"
@@ -50,9 +50,10 @@ @@ -50,9 +50,10 @@
50 50
51 <TextView 51 <TextView
52 android:id="@+id/et_carduser" 52 android:id="@+id/et_carduser"
53 - android:layout_weight="3" 53 + android:layout_weight="2.8"
54 android:layout_width="0dp" 54 android:layout_width="0dp"
55 android:layout_height="wrap_content" 55 android:layout_height="wrap_content"
  56 + android:layout_margin="@dimen/dp_8"
56 android:gravity="center" 57 android:gravity="center"
57 android:text="张三" 58 android:text="张三"
58 android:textColor="@color/hintTextColor" 59 android:textColor="@color/hintTextColor"
@@ -67,7 +68,7 @@ @@ -67,7 +68,7 @@
67 68
68 <TextView 69 <TextView
69 android:id="@+id/tv_cardnum" 70 android:id="@+id/tv_cardnum"
70 - android:layout_weight="1" 71 + android:layout_weight="1.2"
71 android:layout_width="0dp" 72 android:layout_width="0dp"
72 android:layout_height="wrap_content" 73 android:layout_height="wrap_content"
73 android:layout_margin="@dimen/dp_8" 74 android:layout_margin="@dimen/dp_8"
@@ -77,9 +78,10 @@ @@ -77,9 +78,10 @@
77 78
78 <EditText 79 <EditText
79 android:id="@+id/et_cardnum" 80 android:id="@+id/et_cardnum"
80 - android:layout_weight="3" 81 + android:layout_weight="2.8"
81 android:layout_width="0dp" 82 android:layout_width="0dp"
82 android:layout_height="wrap_content" 83 android:layout_height="wrap_content"
  84 + android:layout_margin="@dimen/dp_8"
83 android:gravity="center" 85 android:gravity="center"
84 android:background="@null" 86 android:background="@null"
85 android:inputType="number" 87 android:inputType="number"
@@ -101,18 +103,19 @@ @@ -101,18 +103,19 @@
101 android:layout_width="0dp" 103 android:layout_width="0dp"
102 android:layout_height="wrap_content" 104 android:layout_height="wrap_content"
103 android:layout_margin="@dimen/dp_8" 105 android:layout_margin="@dimen/dp_8"
104 - android:layout_weight="1" 106 + android:layout_weight="1.2"
105 android:text="考勤次数:" 107 android:text="考勤次数:"
106 android:textColor="@color/hintTextColor" 108 android:textColor="@color/hintTextColor"
107 android:textSize="@dimen/textSize16" /> 109 android:textSize="@dimen/textSize16" />
108 110
109 <TextView 111 <TextView
110 android:id="@+id/et_cardnumber" 112 android:id="@+id/et_cardnumber"
111 - android:layout_weight="3" 113 + android:layout_weight="2.8"
112 android:layout_width="0dp" 114 android:layout_width="0dp"
  115 + android:layout_margin="@dimen/dp_8"
113 android:layout_height="wrap_content" 116 android:layout_height="wrap_content"
114 android:gravity="center" 117 android:gravity="center"
115 - android:text="5次" 118 + android:text="0次"
116 android:textColor="@color/hintTextColor" 119 android:textColor="@color/hintTextColor"
117 android:textSize="@dimen/textSize16" /> 120 android:textSize="@dimen/textSize16" />
118 </LinearLayout> 121 </LinearLayout>
@@ -132,7 +135,7 @@ @@ -132,7 +135,7 @@
132 android:id="@+id/bt_sure" 135 android:id="@+id/bt_sure"
133 android:layout_width="80dp" 136 android:layout_width="80dp"
134 android:layout_height="wrap_content" 137 android:layout_height="wrap_content"
135 - android:layout_marginLeft="@dimen/dp_60" 138 + android:layout_marginLeft="@dimen/dp_40"
136 android:layout_alignParentLeft="true" 139 android:layout_alignParentLeft="true"
137 android:text="确定" 140 android:text="确定"
138 android:textColor="@color/white" 141 android:textColor="@color/white"
@@ -143,7 +146,7 @@ @@ -143,7 +146,7 @@
143 android:id="@+id/bt_cancle" 146 android:id="@+id/bt_cancle"
144 android:layout_width="80dp" 147 android:layout_width="80dp"
145 android:layout_height="wrap_content" 148 android:layout_height="wrap_content"
146 - android:layout_marginRight="@dimen/dp_60" 149 + android:layout_marginRight="@dimen/dp_40"
147 android:layout_alignParentRight="true" 150 android:layout_alignParentRight="true"
148 android:text="取消" 151 android:text="取消"
149 android:textColor="@color/white" 152 android:textColor="@color/white"