Commit 8b4376c1c39a117ee28e1ea8129a507ad724ecd3
1 parent
5282249e
Exists in
yxb_dev
and in
2 other branches
no message
Showing
1 changed file
with
92 additions
and
9 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/ui/activity/ChildDetialActivity.java
| 1 | package com.shunzhi.parent.ui.activity; | 1 | package com.shunzhi.parent.ui.activity; |
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | +import android.support.annotation.NonNull; | ||
| 4 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
| 6 | +import android.view.Gravity; | ||
| 7 | +import android.view.LayoutInflater; | ||
| 5 | import android.view.View; | 8 | import android.view.View; |
| 9 | +import android.view.ViewGroup; | ||
| 10 | +import android.view.WindowManager; | ||
| 6 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 12 | +import android.widget.PopupWindow; | ||
| 7 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 8 | 14 | ||
| 9 | import com.google.gson.Gson; | 15 | import com.google.gson.Gson; |
| 10 | -import com.share.mvpsdk.base.activity.BaseCompatActivity; | 16 | +import com.share.mvpsdk.base.BasePresenter; |
| 17 | +import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | ||
| 11 | import com.shunzhi.parent.R; | 18 | import com.shunzhi.parent.R; |
| 12 | import com.shunzhi.parent.bean.ChildBean; | 19 | import com.shunzhi.parent.bean.ChildBean; |
| 20 | +import com.shunzhi.parent.bean.ChildClass; | ||
| 21 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 22 | +import com.shunzhi.parent.contract.mine.MyChildContract; | ||
| 23 | + | ||
| 24 | +import java.util.List; | ||
| 13 | 25 | ||
| 14 | /** | 26 | /** |
| 15 | * Created by Administrator on 2018/3/16 0016. | 27 | * Created by Administrator on 2018/3/16 0016. |
| 16 | */ | 28 | */ |
| 17 | 29 | ||
| 18 | -public class ChildDetialActivity extends BaseCompatActivity { | ||
| 19 | - TextView child_name, child_school, child_class, school_area, student_code,center_title; | 30 | +public class ChildDetialActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> |
| 31 | + implements MyChildContract.IMyChildView, View.OnClickListener { | ||
| 32 | + TextView child_name, child_school, child_class, school_area, student_code, center_title; | ||
| 20 | ImageView back; | 33 | ImageView back; |
| 21 | 34 | ||
| 22 | @Override | 35 | @Override |
| 23 | protected void initView(Bundle savedInstanceState) { | 36 | protected void initView(Bundle savedInstanceState) { |
| 24 | - String childJson=getIntent().getStringExtra("childJson"); | 37 | + String childJson = getIntent().getStringExtra("childJson"); |
| 25 | child_name = findViewById(R.id.child_name); | 38 | child_name = findViewById(R.id.child_name); |
| 26 | child_school = findViewById(R.id.child_school); | 39 | child_school = findViewById(R.id.child_school); |
| 27 | child_class = findViewById(R.id.child_class); | 40 | child_class = findViewById(R.id.child_class); |
| @@ -36,17 +49,17 @@ public class ChildDetialActivity extends BaseCompatActivity { | @@ -36,17 +49,17 @@ public class ChildDetialActivity extends BaseCompatActivity { | ||
| 36 | finish(); | 49 | finish(); |
| 37 | } | 50 | } |
| 38 | }); | 51 | }); |
| 39 | - if(!TextUtils.isEmpty(childJson)) | ||
| 40 | - initChild(childJson); | 52 | + if (!TextUtils.isEmpty(childJson)) |
| 53 | + initChild(childJson); | ||
| 41 | } | 54 | } |
| 42 | 55 | ||
| 43 | private void initChild(String childJson) { | 56 | private void initChild(String childJson) { |
| 44 | - Gson g=new Gson(); | ||
| 45 | - ChildBean childBean=g.fromJson(childJson, ChildBean.class); | 57 | + Gson g = new Gson(); |
| 58 | + ChildBean childBean = g.fromJson(childJson, ChildBean.class); | ||
| 46 | child_name.setText(childBean.getStudentName()); | 59 | child_name.setText(childBean.getStudentName()); |
| 47 | child_school.setText(childBean.getSchoolName()); | 60 | child_school.setText(childBean.getSchoolName()); |
| 48 | child_class.setText(childBean.getClassName()); | 61 | child_class.setText(childBean.getClassName()); |
| 49 | - school_area.setText(childBean.getCityName()+childBean.getAreaName()); | 62 | + school_area.setText(childBean.getCityName() + childBean.getAreaName()); |
| 50 | student_code.setText(childBean.getStudentCode()); | 63 | student_code.setText(childBean.getStudentCode()); |
| 51 | 64 | ||
| 52 | } | 65 | } |
| @@ -55,4 +68,74 @@ public class ChildDetialActivity extends BaseCompatActivity { | @@ -55,4 +68,74 @@ public class ChildDetialActivity extends BaseCompatActivity { | ||
| 55 | protected int getLayoutId() { | 68 | protected int getLayoutId() { |
| 56 | return R.layout.activity_child_detail; | 69 | return R.layout.activity_child_detail; |
| 57 | } | 70 | } |
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public void onClick(View v) { | ||
| 74 | + | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @NonNull | ||
| 78 | + @Override | ||
| 79 | + public BasePresenter initPresenter() { | ||
| 80 | + return null; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public void updateChildList(CurrentBean currentBean) { | ||
| 85 | + | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @Override | ||
| 89 | + public void addChildSuccess(String account, String password) { | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @Override | ||
| 94 | + public void showClass(List<ChildClass> list) { | ||
| 95 | + | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + @Override | ||
| 99 | + public void showError(String error) { | ||
| 100 | + | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void delectChild() { | ||
| 104 | + | ||
| 105 | + final PopupWindow popupWindow = new PopupWindow(); | ||
| 106 | + popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 107 | + popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 108 | + backgroundAlpha(0.5f); | ||
| 109 | + View view = LayoutInflater.from(ChildDetialActivity.this).inflate(R.layout.dialog_view, null); | ||
| 110 | + TextView tv = view.findViewById(R.id.dialog_info); | ||
| 111 | + tv.setText("是否解除绑定?"); | ||
| 112 | + TextView btn_cancel = view.findViewById(R.id.cancel_btn); | ||
| 113 | + btn_cancel.setOnClickListener(new View.OnClickListener() { | ||
| 114 | + @Override | ||
| 115 | + public void onClick(View v) { | ||
| 116 | + popupWindow.dismiss(); | ||
| 117 | + backgroundAlpha(1f); | ||
| 118 | + } | ||
| 119 | + }); | ||
| 120 | + TextView btn_right = view.findViewById(R.id.right_btn); | ||
| 121 | + btn_right.setOnClickListener(new View.OnClickListener() { | ||
| 122 | + @Override | ||
| 123 | + public void onClick(View v) { | ||
| 124 | + popupWindow.dismiss(); | ||
| 125 | + backgroundAlpha(1f); | ||
| 126 | + | ||
| 127 | + } | ||
| 128 | + }); | ||
| 129 | + popupWindow.setContentView(view); | ||
| 130 | + popupWindow.showAtLocation(child_name, Gravity.CENTER, 0, 0); | ||
| 131 | + | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + public void backgroundAlpha(float bgAlpha) { | ||
| 136 | + WindowManager.LayoutParams lp = getWindow().getAttributes(); | ||
| 137 | + lp.alpha = bgAlpha; //0.0-1.0 | ||
| 138 | + getWindow().setAttributes(lp); | ||
| 139 | + } | ||
| 140 | + | ||
| 58 | } | 141 | } |