Commit 2c96431743010723361b92fa7d292084b655dd46
1 parent
d8f68cd8
Exists in
yxb_dev
and in
2 other branches
no message
Showing
9 changed files
with
156 additions
and
73 deletions
Show diff stats
.idea/modules.xml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | <modules> | 4 | <modules> |
5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | 5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> | 6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> |
7 | - <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" /> | ||
8 | <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> | 7 | <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> |
8 | + <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" /> | ||
9 | <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> | 9 | <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> |
10 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> | 10 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> |
11 | </modules> | 11 | </modules> |
app/src/main/java/com/shunzhi/parent/bean/ToolBean.java
@@ -5,17 +5,17 @@ import java.io.Serializable; | @@ -5,17 +5,17 @@ import java.io.Serializable; | ||
5 | /** | 5 | /** |
6 | * Created by ToaHanDong on 2018/3/14. | 6 | * Created by ToaHanDong on 2018/3/14. |
7 | * toolId (integer, optional): 工具ID , | 7 | * toolId (integer, optional): 工具ID , |
8 | - toolName (string, optional): 工具名称 , | ||
9 | - toolImage (string, optional): 工具图片 , | ||
10 | - toolUrl (string, optional): 工具链接 , | ||
11 | - orderById (integer, optional): 工具排序 | 8 | + * toolName (string, optional): 工具名称 , |
9 | + * toolImage (string, optional): 工具图片 , | ||
10 | + * toolUrl (string, optional): 工具链接 , | ||
11 | + * orderById (integer, optional): 工具排序 | ||
12 | */ | 12 | */ |
13 | 13 | ||
14 | public class ToolBean implements Serializable { | 14 | public class ToolBean implements Serializable { |
15 | 15 | ||
16 | - public ToolBean(String toolImg,String toolName){ | ||
17 | - this.toolImage=toolImg; | ||
18 | - this.toolName=toolName; | 16 | + public ToolBean(String toolImg, String toolName) { |
17 | + this.toolImage = toolImg; | ||
18 | + this.toolName = toolName; | ||
19 | } | 19 | } |
20 | 20 | ||
21 | 21 | ||
@@ -25,7 +25,11 @@ public class ToolBean implements Serializable { | @@ -25,7 +25,11 @@ public class ToolBean implements Serializable { | ||
25 | 25 | ||
26 | public String toolUrl; | 26 | public String toolUrl; |
27 | 27 | ||
28 | + public String toolId; | ||
28 | 29 | ||
30 | + public String columnType; | ||
31 | + | ||
32 | + public String orderById; | ||
29 | 33 | ||
30 | @Override | 34 | @Override |
31 | public String toString() { | 35 | public String toString() { |
app/src/main/java/com/shunzhi/parent/contract/ceping/CepingContract.java
@@ -31,7 +31,7 @@ public interface CepingContract { | @@ -31,7 +31,7 @@ public interface CepingContract { | ||
31 | 31 | ||
32 | interface ICePingView extends IBaseFragment{ | 32 | interface ICePingView extends IBaseFragment{ |
33 | 33 | ||
34 | - void showTools(); | 34 | + void showTools(List<ToolBean> toolBeanList); |
35 | 35 | ||
36 | } | 36 | } |
37 | 37 |
app/src/main/java/com/shunzhi/parent/presenter/ceping/CePingPresenter.java
@@ -14,6 +14,9 @@ import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; | @@ -14,6 +14,9 @@ import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; | ||
14 | import com.shunzhi.parent.util.AttrsUtils; | 14 | import com.shunzhi.parent.util.AttrsUtils; |
15 | import com.shunzhi.parent.views.TextAndImgShowView; | 15 | import com.shunzhi.parent.views.TextAndImgShowView; |
16 | 16 | ||
17 | +import java.util.ArrayList; | ||
18 | +import java.util.List; | ||
19 | + | ||
17 | import io.reactivex.functions.Consumer; | 20 | import io.reactivex.functions.Consumer; |
18 | 21 | ||
19 | /** | 22 | /** |
@@ -41,26 +44,32 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | @@ -41,26 +44,32 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | ||
41 | if (jsonObject.get("status").getAsString().equals("1")){ | 44 | if (jsonObject.get("status").getAsString().equals("1")){ |
42 | JsonArray jsonArray=jsonObject.getAsJsonArray("data"); | 45 | JsonArray jsonArray=jsonObject.getAsJsonArray("data"); |
43 | layout_control.removeAllViews(); | 46 | layout_control.removeAllViews(); |
47 | + List<ToolBean> toolBeanList=new ArrayList<>(); | ||
44 | for (int i = 0; i < jsonArray.size(); i++) { | 48 | for (int i = 0; i < jsonArray.size(); i++) { |
45 | ToolBean toolBean=new Gson().fromJson(jsonArray.get(i).getAsJsonObject(),ToolBean.class); | 49 | ToolBean toolBean=new Gson().fromJson(jsonArray.get(i).getAsJsonObject(),ToolBean.class); |
46 | - TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | ||
47 | - textAndImgShowView.setTextColor(R.color.textColor); | ||
48 | - textAndImgShowView.setText(toolBean.toolName); | ||
49 | - textAndImgShowView.addImgs(toolBean.toolImage); | ||
50 | - textAndImgShowView.setSelect(true); | ||
51 | - textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | ||
52 | - textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); | ||
53 | - textAndImgShowView.setTag(toolBean); | ||
54 | - textAndImgShowView.setOnClickListener(new View.OnClickListener() { | ||
55 | - @Override | ||
56 | - public void onClick(View view) { | ||
57 | - ToolBean toolBean1= (ToolBean) view.getTag(); | ||
58 | - WebViewActivity.getInstance(mIView.getBindActivity(),toolBean1.toolUrl,-1); | ||
59 | - } | ||
60 | - }); | ||
61 | - layout_control.addView(textAndImgShowView); | ||
62 | - mIView.showTools(); | 50 | + if (toolBean.columnType.equals("2")){ |
51 | + TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | ||
52 | + textAndImgShowView.setTextColor(R.color.textColor); | ||
53 | + textAndImgShowView.setText(toolBean.toolName); | ||
54 | + textAndImgShowView.addImgs(toolBean.toolImage); | ||
55 | + textAndImgShowView.setSelect(true); | ||
56 | + textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | ||
57 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); | ||
58 | + textAndImgShowView.setTag(toolBean); | ||
59 | + textAndImgShowView.setOnClickListener(new View.OnClickListener() { | ||
60 | + @Override | ||
61 | + public void onClick(View view) { | ||
62 | + ToolBean toolBean1= (ToolBean) view.getTag(); | ||
63 | + WebViewActivity.getInstance(mIView.getBindActivity(),toolBean1.toolUrl,-1); | ||
64 | + } | ||
65 | + }); | ||
66 | + layout_control.addView(textAndImgShowView); | ||
67 | + } else if (toolBean.columnType.equals("1")){ | ||
68 | + //活动 | ||
69 | + toolBeanList.add(toolBean); | ||
70 | + } | ||
63 | } | 71 | } |
72 | + mIView.showTools(toolBeanList); | ||
64 | }else { | 73 | }else { |
65 | 74 | ||
66 | } | 75 | } |
app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
@@ -133,6 +133,7 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -133,6 +133,7 @@ public class WebViewActivity extends BaseCompatActivity { | ||
133 | nesteScrollWebView.setWebViewClient(new WebViewClient() { | 133 | nesteScrollWebView.setWebViewClient(new WebViewClient() { |
134 | @Override | 134 | @Override |
135 | public boolean shouldOverrideUrlLoading(WebView view, String url) { | 135 | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
136 | + Log.d("666666","url="+url); | ||
136 | if (url.startsWith("http"))view.loadUrl(url); | 137 | if (url.startsWith("http"))view.loadUrl(url); |
137 | // if (url.contains("platformapi/startapp")) { | 138 | // if (url.contains("platformapi/startapp")) { |
138 | // startAlipayActivity(url); | 139 | // startAlipayActivity(url); |
@@ -158,6 +159,8 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -158,6 +159,8 @@ public class WebViewActivity extends BaseCompatActivity { | ||
158 | 159 | ||
159 | @Override | 160 | @Override |
160 | public void onPageStarted(WebView view, String url, Bitmap favicon) { | 161 | public void onPageStarted(WebView view, String url, Bitmap favicon) { |
162 | +// Log.d("666666","onPageStartedurl="+url); | ||
163 | + if (url.startsWith("http"))view.loadUrl(url); | ||
161 | view.getSettings().setJavaScriptEnabled(true); | 164 | view.getSettings().setJavaScriptEnabled(true); |
162 | super.onPageStarted(view, url, favicon); | 165 | super.onPageStarted(view, url, favicon); |
163 | } | 166 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
@@ -14,36 +14,39 @@ import android.widget.ImageView; | @@ -14,36 +14,39 @@ import android.widget.ImageView; | ||
14 | import android.widget.LinearLayout; | 14 | import android.widget.LinearLayout; |
15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
16 | 16 | ||
17 | +import com.bumptech.glide.Glide; | ||
17 | import com.share.mvpsdk.base.BasePresenter; | 18 | import com.share.mvpsdk.base.BasePresenter; |
18 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | 19 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
19 | import com.share.mvpsdk.utils.ToastUtils; | 20 | import com.share.mvpsdk.utils.ToastUtils; |
20 | import com.shunzhi.parent.AppContext; | 21 | import com.shunzhi.parent.AppContext; |
21 | import com.shunzhi.parent.R; | 22 | import com.shunzhi.parent.R; |
23 | +import com.shunzhi.parent.bean.ToolBean; | ||
22 | import com.shunzhi.parent.contract.ceping.CepingContract; | 24 | import com.shunzhi.parent.contract.ceping.CepingContract; |
23 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; | 25 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; |
24 | import com.shunzhi.parent.ui.activity.MyChildActivity; | 26 | import com.shunzhi.parent.ui.activity.MyChildActivity; |
27 | +import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; | ||
25 | import com.shunzhi.parent.views.TextAndImgShowView; | 28 | import com.shunzhi.parent.views.TextAndImgShowView; |
26 | 29 | ||
30 | +import java.util.List; | ||
31 | + | ||
27 | import me.leefeng.citypicker.CityPicker; | 32 | import me.leefeng.citypicker.CityPicker; |
28 | import me.leefeng.citypicker.CityPickerListener; | 33 | import me.leefeng.citypicker.CityPickerListener; |
29 | 34 | ||
30 | 35 | ||
31 | -public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingPresenter,CepingContract.ICePingModel> implements CepingContract.ICePingView | ||
32 | - ,View.OnClickListener,CityPickerListener{ | ||
33 | - | ||
34 | - TextView tvLocalAddress; | 36 | +public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingPresenter, CepingContract.ICePingModel> implements CepingContract.ICePingView |
37 | + , View.OnClickListener, CityPickerListener { | ||
35 | 38 | ||
36 | - ImageView ivCamera; | 39 | + TextView tvLocalAddress, tvCourse1, tvCourse2, tvCourse3; |
37 | 40 | ||
38 | - TextAndImgShowView textAndImg_xqjc,textAndImg_zxlx; | 41 | + ImageView ivCamera, ivCourse1, ivCourse2, ivCourse3; |
39 | 42 | ||
40 | - FrameLayout frame_hot1; | 43 | + TextAndImgShowView textAndImg_xqjc, textAndImg_zxlx; |
41 | 44 | ||
42 | FloatingActionButton floatingActionButton; | 45 | FloatingActionButton floatingActionButton; |
43 | 46 | ||
44 | LinearLayout layout_control; | 47 | LinearLayout layout_control; |
45 | 48 | ||
46 | - CityPicker cityPicker=null; | 49 | + CityPicker cityPicker = null; |
47 | 50 | ||
48 | @Override | 51 | @Override |
49 | public int getLayoutId() { | 52 | public int getLayoutId() { |
@@ -53,25 +56,30 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -53,25 +56,30 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
53 | @Override | 56 | @Override |
54 | public void initUI(View view, @Nullable Bundle savedInstanceState) { | 57 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
55 | 58 | ||
56 | - ivCamera=view.findViewById(R.id.ivCamera); | ||
57 | - tvLocalAddress=view.findViewById(R.id.tvLocalAddress); | ||
58 | - textAndImg_xqjc=view.findViewById(R.id.textAndImg_xqjc); | ||
59 | - textAndImg_zxlx=view.findViewById(R.id.textAndImg_zxlx); | ||
60 | - frame_hot1=view.findViewById(R.id.frame_hot1); | ||
61 | - layout_control=view.findViewById(R.id.layout_control); | ||
62 | - floatingActionButton=view.findViewById(R.id.floatingActionButton); | 59 | + ivCamera = view.findViewById(R.id.ivCamera); |
60 | + tvLocalAddress = view.findViewById(R.id.tvLocalAddress); | ||
61 | + textAndImg_xqjc = view.findViewById(R.id.textAndImg_xqjc); | ||
62 | + textAndImg_zxlx = view.findViewById(R.id.textAndImg_zxlx); | ||
63 | + layout_control = view.findViewById(R.id.layout_control); | ||
64 | + floatingActionButton = view.findViewById(R.id.floatingActionButton); | ||
65 | + tvCourse1 = view.findViewById(R.id.tvCourse1); | ||
66 | + tvCourse2 = view.findViewById(R.id.tvCourse2); | ||
67 | + tvCourse3 = view.findViewById(R.id.tvCourse3); | ||
68 | + ivCourse1 = view.findViewById(R.id.ivCourse1); | ||
69 | + ivCourse2 = view.findViewById(R.id.ivCourse2); | ||
70 | + ivCourse3 = view.findViewById(R.id.ivCourse3); | ||
63 | 71 | ||
64 | addTools(); | 72 | addTools(); |
65 | 73 | ||
66 | tvLocalAddress.setText(AppContext.getInstance().cityName); | 74 | tvLocalAddress.setText(AppContext.getInstance().cityName); |
67 | textAndImg_xqjc.setTextColor(R.color.white); | 75 | textAndImg_xqjc.setTextColor(R.color.white); |
68 | textAndImg_xqjc.setText("学情检测"); | 76 | textAndImg_xqjc.setText("学情检测"); |
69 | - textAndImg_xqjc.setImgs(R.drawable.xqjc,R.drawable.xqjc); | 77 | + textAndImg_xqjc.setImgs(R.drawable.xqjc, R.drawable.xqjc); |
70 | textAndImg_xqjc.setSelect(true); | 78 | textAndImg_xqjc.setSelect(true); |
71 | 79 | ||
72 | textAndImg_zxlx.setText("专项训练"); | 80 | textAndImg_zxlx.setText("专项训练"); |
73 | textAndImg_zxlx.setTextColor(R.color.white); | 81 | textAndImg_zxlx.setTextColor(R.color.white); |
74 | - textAndImg_zxlx.setImgs(R.drawable.zxlx,R.drawable.zxlx); | 82 | + textAndImg_zxlx.setImgs(R.drawable.zxlx, R.drawable.zxlx); |
75 | textAndImg_zxlx.setSelect(true); | 83 | textAndImg_zxlx.setSelect(true); |
76 | 84 | ||
77 | initListeners(view); | 85 | initListeners(view); |
@@ -81,17 +89,11 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -81,17 +89,11 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
81 | startActivity(new Intent().setClass(getActivity(), MyChildActivity.class)); | 89 | startActivity(new Intent().setClass(getActivity(), MyChildActivity.class)); |
82 | } | 90 | } |
83 | }); | 91 | }); |
84 | -// floatingActionButton.setOnClickListeners(new DragFloatActionButton.OnClickListeners() { | ||
85 | -// @Override | ||
86 | -// public void onClicks() { | ||
87 | -// ToastUtils.showToast("dfafdaf"); | ||
88 | -// } | ||
89 | -// }); | ||
90 | } | 92 | } |
91 | 93 | ||
92 | private void addTools() { | 94 | private void addTools() { |
93 | - layout_control.measure(0,0); | ||
94 | - mPresenter.getTools(layout_control,AppContext.getInstance().district); | 95 | + layout_control.measure(0, 0); |
96 | + mPresenter.getTools(layout_control, AppContext.getInstance().district); | ||
95 | 97 | ||
96 | } | 98 | } |
97 | 99 | ||
@@ -112,9 +114,9 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -112,9 +114,9 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
112 | 114 | ||
113 | private void initBroadCast() { | 115 | private void initBroadCast() { |
114 | 116 | ||
115 | - IntentFilter intentFilter=new IntentFilter(); | ||
116 | - intentFilter.addAction(AppContext.LOCATION_CITYNAME+""); | ||
117 | - getActivity().registerReceiver(broadcastReceiver,intentFilter); | 117 | + IntentFilter intentFilter = new IntentFilter(); |
118 | + intentFilter.addAction(AppContext.LOCATION_CITYNAME + ""); | ||
119 | + getActivity().registerReceiver(broadcastReceiver, intentFilter); | ||
118 | 120 | ||
119 | } | 121 | } |
120 | 122 | ||
@@ -127,20 +129,23 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -127,20 +129,23 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
127 | 129 | ||
128 | @Override | 130 | @Override |
129 | public void onClick(View view) { | 131 | public void onClick(View view) { |
130 | - switch (view.getId()){ | 132 | + switch (view.getId()) { |
131 | case R.id.frame_hot1://热门课程 | 133 | case R.id.frame_hot1://热门课程 |
132 | - ToastUtils.showToast("remen1"); | 134 | + if (tvCourse1.getTag()!=null) |
135 | + WebViewActivity.getInstance(getActivity(),tvCourse1.getTag().toString(),-1); | ||
133 | break; | 136 | break; |
134 | case R.id.frame_hot2: | 137 | case R.id.frame_hot2: |
135 | - ToastUtils.showToast("remen2"); | 138 | + if (tvCourse2.getTag()!=null) |
139 | + WebViewActivity.getInstance(getActivity(),tvCourse2.getTag().toString(),-1); | ||
136 | break; | 140 | break; |
137 | case R.id.frame_hot3: | 141 | case R.id.frame_hot3: |
138 | - ToastUtils.showToast("remen3"); | 142 | + if (tvCourse3.getTag()!=null) |
143 | + WebViewActivity.getInstance(getActivity(),tvCourse3.getTag().toString(),-1); | ||
139 | break; | 144 | break; |
140 | case R.id.tvLocalAddress: | 145 | case R.id.tvLocalAddress: |
141 | // AppContext.getInstance().startLocation(); | 146 | // AppContext.getInstance().startLocation(); |
142 | - if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this); | ||
143 | - if (cityPicker.isShow())cityPicker.close(); | 147 | + if (null == cityPicker) cityPicker = new CityPicker(getActivity(), this); |
148 | + if (cityPicker.isShow()) cityPicker.close(); | ||
144 | else cityPicker.show(); | 149 | else cityPicker.show(); |
145 | break; | 150 | break; |
146 | case R.id.ivCamera: | 151 | case R.id.ivCamera: |
@@ -149,10 +154,10 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -149,10 +154,10 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
149 | } | 154 | } |
150 | } | 155 | } |
151 | 156 | ||
152 | - private BroadcastReceiver broadcastReceiver=new BroadcastReceiver() { | 157 | + private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { |
153 | @Override | 158 | @Override |
154 | public void onReceive(Context context, Intent intent) { | 159 | public void onReceive(Context context, Intent intent) { |
155 | - if (intent.getAction().equals(AppContext.LOCATION_CITYNAME+"")){ | 160 | + if (intent.getAction().equals(AppContext.LOCATION_CITYNAME + "")) { |
156 | tvLocalAddress.setText(AppContext.getInstance().cityName); | 161 | tvLocalAddress.setText(AppContext.getInstance().cityName); |
157 | } | 162 | } |
158 | } | 163 | } |
@@ -161,19 +166,31 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -161,19 +166,31 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
161 | @Override | 166 | @Override |
162 | public void onDestroy() { | 167 | public void onDestroy() { |
163 | super.onDestroy(); | 168 | super.onDestroy(); |
164 | - if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); | ||
165 | - if (null!=cityPicker)cityPicker.cancle(); | 169 | + if (null != broadcastReceiver) getActivity().unregisterReceiver(broadcastReceiver); |
170 | + if (null != cityPicker) cityPicker.cancle(); | ||
166 | } | 171 | } |
167 | 172 | ||
168 | @Override | 173 | @Override |
169 | public void getCity(String name) { | 174 | public void getCity(String name) { |
170 | tvLocalAddress.setText(name.split(" ")[1]); | 175 | tvLocalAddress.setText(name.split(" ")[1]); |
171 | - mPresenter.getTools(layout_control,name.split(" ")[2]); | 176 | + mPresenter.getTools(layout_control, name.split(" ")[2]); |
172 | ToastUtils.showToast(name.split(" ")[2]); | 177 | ToastUtils.showToast(name.split(" ")[2]); |
173 | } | 178 | } |
174 | 179 | ||
175 | @Override | 180 | @Override |
176 | - public void showTools() { | ||
177 | - | 181 | + public void showTools(List<ToolBean> toolBeanList) { |
182 | + if (toolBeanList.size() == 1) { | ||
183 | + tvCourse1.setText(toolBeanList.get(0).toolName); | ||
184 | + Glide.with(getActivity()).load(toolBeanList.get(0).toolImage).into(ivCourse1); | ||
185 | + tvCourse1.setTag(toolBeanList.get(0).toolUrl); | ||
186 | + } else if (toolBeanList.size() == 2) { | ||
187 | + tvCourse2.setText(toolBeanList.get(1).toolName); | ||
188 | + Glide.with(getActivity()).load(toolBeanList.get(1).toolImage).into(ivCourse1); | ||
189 | + tvCourse2.setTag(toolBeanList.get(1).toolUrl); | ||
190 | + } else if (toolBeanList.size() == 3) { | ||
191 | + tvCourse3.setText(toolBeanList.get(2).toolName); | ||
192 | + Glide.with(getActivity()).load(toolBeanList.get(2).toolImage).into(ivCourse1); | ||
193 | + tvCourse3.setTag(toolBeanList.get(2).toolUrl); | ||
194 | + } | ||
178 | } | 195 | } |
179 | } | 196 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
@@ -30,7 +30,7 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | @@ -30,7 +30,7 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | ||
30 | implements MineContract.IMineView, View.OnClickListener { | 30 | implements MineContract.IMineView, View.OnClickListener { |
31 | LinearLayout childlayout, personinfo, layout_orderDetail, layout_order; | 31 | LinearLayout childlayout, personinfo, layout_orderDetail, layout_order; |
32 | RoundedImageView user_photo; | 32 | RoundedImageView user_photo; |
33 | - TextView user_name, user_mobile; | 33 | + TextView user_name, user_mobile, tvExit; |
34 | 34 | ||
35 | @NonNull | 35 | @NonNull |
36 | @Override | 36 | @Override |
@@ -56,6 +56,8 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | @@ -56,6 +56,8 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | ||
56 | user_photo = view.findViewById(R.id.user_photo); | 56 | user_photo = view.findViewById(R.id.user_photo); |
57 | user_name = view.findViewById(R.id.user_name); | 57 | user_name = view.findViewById(R.id.user_name); |
58 | user_mobile = view.findViewById(R.id.user_mobile); | 58 | user_mobile = view.findViewById(R.id.user_mobile); |
59 | + tvExit = view.findViewById(R.id.tvExit); | ||
60 | + tvExit.setOnClickListener(this); | ||
59 | 61 | ||
60 | } | 62 | } |
61 | 63 | ||
@@ -97,15 +99,25 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | @@ -97,15 +99,25 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | ||
97 | Bundle bundle = new Bundle(); | 99 | Bundle bundle = new Bundle(); |
98 | bundle.putString("url", AppConfig.BASE_URL_ORDER + "ParentOrderCenter.aspx?userid=" + | 100 | bundle.putString("url", AppConfig.BASE_URL_ORDER + "ParentOrderCenter.aspx?userid=" + |
99 | AppConfig.getAppConfig(getContext()).get(AppConfig.USER_ID)); | 101 | AppConfig.getAppConfig(getContext()).get(AppConfig.USER_ID)); |
100 | - bundle.putInt("type",AppConfig.ORDER_CENTER); | 102 | + bundle.putInt("type", AppConfig.ORDER_CENTER); |
101 | startNewActivity(WebViewActivity.class, bundle); | 103 | startNewActivity(WebViewActivity.class, bundle); |
102 | break; | 104 | break; |
105 | + case R.id.tvExit: | ||
106 | + clearUerinfo(); | ||
107 | + break; | ||
103 | default: | 108 | default: |
104 | break; | 109 | break; |
105 | } | 110 | } |
106 | 111 | ||
107 | } | 112 | } |
108 | 113 | ||
114 | + private void clearUerinfo() { | ||
115 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, ""); | ||
116 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, ""); | ||
117 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, ""); | ||
118 | + setPersonInfo(); | ||
119 | + } | ||
120 | + | ||
109 | @Override | 121 | @Override |
110 | public void onResume() { | 122 | public void onResume() { |
111 | super.onResume(); | 123 | super.onResume(); |
app/src/main/res/layout/fragment_ce_ping.xml
@@ -164,8 +164,15 @@ | @@ -164,8 +164,15 @@ | ||
164 | android:layout_height="match_parent" | 164 | android:layout_height="match_parent" |
165 | android:layout_marginRight="@dimen/size_dp_5" | 165 | android:layout_marginRight="@dimen/size_dp_5" |
166 | android:layout_weight="1" | 166 | android:layout_weight="1" |
167 | + android:onClick="onClick" | ||
167 | android:background="@drawable/shape_xueqing_radius8"> | 168 | android:background="@drawable/shape_xueqing_radius8"> |
168 | - | 169 | + <ImageView |
170 | + android:layout_margin="@dimen/size_dp_8" | ||
171 | + android:layout_width="match_parent" | ||
172 | + android:layout_height="match_parent" | ||
173 | + android:scaleType="fitXY" | ||
174 | + android:id="@+id/ivCourse1" | ||
175 | + /> | ||
169 | <LinearLayout | 176 | <LinearLayout |
170 | android:layout_width="wrap_content" | 177 | android:layout_width="wrap_content" |
171 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
@@ -175,6 +182,7 @@ | @@ -175,6 +182,7 @@ | ||
175 | android:orientation="vertical"> | 182 | android:orientation="vertical"> |
176 | 183 | ||
177 | <TextView | 184 | <TextView |
185 | + android:id="@+id/tvCourse1" | ||
178 | android:layout_width="wrap_content" | 186 | android:layout_width="wrap_content" |
179 | android:layout_height="wrap_content" | 187 | android:layout_height="wrap_content" |
180 | android:text="热门课程" | 188 | android:text="热门课程" |
@@ -209,8 +217,15 @@ | @@ -209,8 +217,15 @@ | ||
209 | android:layout_marginBottom="@dimen/size_dp_5" | 217 | android:layout_marginBottom="@dimen/size_dp_5" |
210 | android:layout_marginRight="@dimen/size_dp_5" | 218 | android:layout_marginRight="@dimen/size_dp_5" |
211 | android:layout_weight="1" | 219 | android:layout_weight="1" |
220 | + android:onClick="onClick" | ||
212 | android:background="@drawable/shape_xueqing_radius8"> | 221 | android:background="@drawable/shape_xueqing_radius8"> |
213 | - | 222 | + <ImageView |
223 | + android:layout_margin="@dimen/size_dp_8" | ||
224 | + android:layout_width="match_parent" | ||
225 | + android:layout_height="match_parent" | ||
226 | + android:scaleType="fitXY" | ||
227 | + android:id="@+id/ivCourse2" | ||
228 | + /> | ||
214 | <LinearLayout | 229 | <LinearLayout |
215 | android:layout_width="wrap_content" | 230 | android:layout_width="wrap_content" |
216 | android:layout_height="wrap_content" | 231 | android:layout_height="wrap_content" |
@@ -220,6 +235,7 @@ | @@ -220,6 +235,7 @@ | ||
220 | android:orientation="vertical"> | 235 | android:orientation="vertical"> |
221 | 236 | ||
222 | <TextView | 237 | <TextView |
238 | + android:id="@+id/tvCourse2" | ||
223 | android:layout_width="wrap_content" | 239 | android:layout_width="wrap_content" |
224 | android:layout_height="wrap_content" | 240 | android:layout_height="wrap_content" |
225 | android:text="热门课程" | 241 | android:text="热门课程" |
@@ -247,8 +263,15 @@ | @@ -247,8 +263,15 @@ | ||
247 | android:layout_marginRight="@dimen/size_dp_5" | 263 | android:layout_marginRight="@dimen/size_dp_5" |
248 | android:layout_marginTop="@dimen/size_dp_5" | 264 | android:layout_marginTop="@dimen/size_dp_5" |
249 | android:layout_weight="1" | 265 | android:layout_weight="1" |
266 | + android:onClick="onClick" | ||
250 | android:background="@drawable/shape_xueqing_radius8"> | 267 | android:background="@drawable/shape_xueqing_radius8"> |
251 | - | 268 | + <ImageView |
269 | + android:layout_margin="@dimen/size_dp_8" | ||
270 | + android:layout_width="match_parent" | ||
271 | + android:layout_height="match_parent" | ||
272 | + android:scaleType="fitXY" | ||
273 | + android:id="@+id/ivCourse3" | ||
274 | + /> | ||
252 | <LinearLayout | 275 | <LinearLayout |
253 | android:layout_width="wrap_content" | 276 | android:layout_width="wrap_content" |
254 | android:layout_height="wrap_content" | 277 | android:layout_height="wrap_content" |
@@ -258,6 +281,7 @@ | @@ -258,6 +281,7 @@ | ||
258 | android:orientation="vertical"> | 281 | android:orientation="vertical"> |
259 | 282 | ||
260 | <TextView | 283 | <TextView |
284 | + android:id="@+id/tvCourse3" | ||
261 | android:layout_width="wrap_content" | 285 | android:layout_width="wrap_content" |
262 | android:layout_height="wrap_content" | 286 | android:layout_height="wrap_content" |
263 | android:text="热门课程" | 287 | android:text="热门课程" |
app/src/main/res/layout/fragment_mine.xml
@@ -320,7 +320,21 @@ | @@ -320,7 +320,21 @@ | ||
320 | </LinearLayout> | 320 | </LinearLayout> |
321 | </LinearLayout> | 321 | </LinearLayout> |
322 | 322 | ||
323 | - | 323 | + <TextView |
324 | + android:id="@+id/tvExit" | ||
325 | + android:layout_width="match_parent" | ||
326 | + android:layout_height="wrap_content" | ||
327 | + android:layout_gravity="center_vertical" | ||
328 | + android:gravity="center" | ||
329 | + android:layout_weight="1" | ||
330 | + android:layout_marginTop="@dimen/size_dp_15" | ||
331 | + android:layout_marginBottom="@dimen/size_dp_15" | ||
332 | + android:paddingTop="@dimen/size_dp_5" | ||
333 | + android:paddingBottom="@dimen/size_dp_5" | ||
334 | + android:background="@drawable/shape_xueqing_radius8" | ||
335 | + android:text="退出登录" | ||
336 | + android:textColor="@color/white" | ||
337 | + android:textSize="@dimen/size_dp_16" /> | ||
324 | 338 | ||
325 | </LinearLayout> | 339 | </LinearLayout> |
326 | </ScrollView> | 340 | </ScrollView> |