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 26 }
27 27  
28 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 25 interface IReportDetialView extends IBaseView {
26 26 // pointNow,pointPast,sceneName
27 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 4 import android.text.TextUtils;
5 5 import android.util.Log;
6 6  
  7 +import com.google.gson.JsonArray;
7 8 import com.google.gson.JsonObject;
8 9 import com.share.mvpsdk.base.BasePresenter;
9 10 import com.share.mvpsdk.utils.ToastUtils;
... ... @@ -11,6 +12,8 @@ import com.shunzhi.parent.contract.apply.ApplyReplaceCardContract;
11 12 import com.shunzhi.parent.model.apply.ApplyReplaceCardModel;
12 13 import com.shunzhi.parent.views.ReplaceCardDialog;
13 14  
  15 +import org.json.JSONObject;
  16 +
14 17 import io.reactivex.functions.Consumer;
15 18  
16 19 /**
... ... @@ -18,8 +21,6 @@ import io.reactivex.functions.Consumer;
18 21 */
19 22 public class ApplyReplaceCardPresenter extends ApplyReplaceCardContract.ApplyReplaceCardPreenter {
20 23  
21   - private JsonObject json;
22   - private ReplaceCardDialog replaceCardDialog=null;
23 24  
24 25 @Override
25 26 public ApplyReplaceCardContract.IApplyReplaceCardModel getModel() {
... ... @@ -39,15 +40,9 @@ public class ApplyReplaceCardPresenter extends ApplyReplaceCardContract.ApplyRep
39 40 public void accept(JsonObject jsonObject) throws Exception {
40 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 47 }, new Consumer<Throwable>() {
53 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 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 27 private Button bt_sure;
28 28 private Button bt_cancel;
29 29 ReplaceCardDialog replaceCardDialog = null;
30 30 private EditText et_cardnum;
31   - private String cardnum ="";
  31 + private String cardnum = "";
32 32  
33 33 @NonNull
34 34 @Override
... ... @@ -66,16 +66,27 @@ public class ApplyReplaceCardFragment extends BaseMVPCompatFragment&lt;ApplyReplace
66 66 //studentid 从成长界面获取 此处设置为“123”
67 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 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 39 android:orientation="horizontal">
40 40  
41 41 <TextView
42   - android:layout_weight="1"
  42 + android:layout_weight="1.2"
43 43 android:id="@+id/tv_carduser"
44 44 android:layout_margin="@dimen/dp_8"
45 45 android:layout_width="0dp"
... ... @@ -50,9 +50,10 @@
50 50  
51 51 <TextView
52 52 android:id="@+id/et_carduser"
53   - android:layout_weight="3"
  53 + android:layout_weight="2.8"
54 54 android:layout_width="0dp"
55 55 android:layout_height="wrap_content"
  56 + android:layout_margin="@dimen/dp_8"
56 57 android:gravity="center"
57 58 android:text="张三"
58 59 android:textColor="@color/hintTextColor"
... ... @@ -67,7 +68,7 @@
67 68  
68 69 <TextView
69 70 android:id="@+id/tv_cardnum"
70   - android:layout_weight="1"
  71 + android:layout_weight="1.2"
71 72 android:layout_width="0dp"
72 73 android:layout_height="wrap_content"
73 74 android:layout_margin="@dimen/dp_8"
... ... @@ -77,9 +78,10 @@
77 78  
78 79 <EditText
79 80 android:id="@+id/et_cardnum"
80   - android:layout_weight="3"
  81 + android:layout_weight="2.8"
81 82 android:layout_width="0dp"
82 83 android:layout_height="wrap_content"
  84 + android:layout_margin="@dimen/dp_8"
83 85 android:gravity="center"
84 86 android:background="@null"
85 87 android:inputType="number"
... ... @@ -101,18 +103,19 @@
101 103 android:layout_width="0dp"
102 104 android:layout_height="wrap_content"
103 105 android:layout_margin="@dimen/dp_8"
104   - android:layout_weight="1"
  106 + android:layout_weight="1.2"
105 107 android:text="考勤次数:"
106 108 android:textColor="@color/hintTextColor"
107 109 android:textSize="@dimen/textSize16" />
108 110  
109 111 <TextView
110 112 android:id="@+id/et_cardnumber"
111   - android:layout_weight="3"
  113 + android:layout_weight="2.8"
112 114 android:layout_width="0dp"
  115 + android:layout_margin="@dimen/dp_8"
113 116 android:layout_height="wrap_content"
114 117 android:gravity="center"
115   - android:text="5次"
  118 + android:text="0次"
116 119 android:textColor="@color/hintTextColor"
117 120 android:textSize="@dimen/textSize16" />
118 121 </LinearLayout>
... ... @@ -132,7 +135,7 @@
132 135 android:id="@+id/bt_sure"
133 136 android:layout_width="80dp"
134 137 android:layout_height="wrap_content"
135   - android:layout_marginLeft="@dimen/dp_60"
  138 + android:layout_marginLeft="@dimen/dp_40"
136 139 android:layout_alignParentLeft="true"
137 140 android:text="确定"
138 141 android:textColor="@color/white"
... ... @@ -143,7 +146,7 @@
143 146 android:id="@+id/bt_cancle"
144 147 android:layout_width="80dp"
145 148 android:layout_height="wrap_content"
146   - android:layout_marginRight="@dimen/dp_60"
  149 + android:layout_marginRight="@dimen/dp_40"
147 150 android:layout_alignParentRight="true"
148 151 android:text="取消"
149 152 android:textColor="@color/white"
... ...