Commit 8c2638401b896de9a7b0f9daa7c4ced4289adc57
1 parent
c169928b
Exists in
yxb_dev
and in
2 other branches
no message
Showing
15 changed files
with
71 additions
and
37 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/adapter/MyConsultAdapter.java
... | ... | @@ -3,6 +3,7 @@ package com.shunzhi.parent.adapter; |
3 | 3 | import android.content.Context; |
4 | 4 | import android.support.v7.widget.LinearLayoutManager; |
5 | 5 | import android.support.v7.widget.RecyclerView; |
6 | +import android.util.Log; | |
6 | 7 | import android.view.LayoutInflater; |
7 | 8 | import android.view.View; |
8 | 9 | import android.view.ViewGroup; |
... | ... | @@ -19,6 +20,7 @@ import com.shunzhi.parent.AppContext; |
19 | 20 | import com.shunzhi.parent.R; |
20 | 21 | import com.shunzhi.parent.bean.channel.ChannelContextBean; |
21 | 22 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
23 | +import com.shunzhi.parent.util.GlideUtils; | |
22 | 24 | |
23 | 25 | /** |
24 | 26 | * Created by ToaHanDong on 2018/3/14. |
... | ... | @@ -70,8 +72,7 @@ public class MyConsultAdapter extends BaseRecyclerViewAdapter<ChannelContextBean |
70 | 72 | if (object.getIsAds() == 1) { |
71 | 73 | frame_ad.setVisibility(View.VISIBLE); |
72 | 74 | normal_content.setVisibility(View.GONE); |
73 | - Glide.with(mContext).load(object.getImage()).placeholder(R.color.xueqing_blue) | |
74 | - .into(iv_consult); | |
75 | + GlideUtils.showImg(mContext,iv_consult,object.getImage()); | |
75 | 76 | frame_ad.setOnClickListener(new View.OnClickListener() { |
76 | 77 | @Override |
77 | 78 | public void onClick(View v) { |
... | ... | @@ -83,8 +84,7 @@ public class MyConsultAdapter extends BaseRecyclerViewAdapter<ChannelContextBean |
83 | 84 | normal_content.setVisibility(View.VISIBLE); |
84 | 85 | tvConsultTitle.setText(object.getTitle()); |
85 | 86 | tvConsultContent.setText(object.getContent()); |
86 | - Glide.with(mContext).load(object.getImage()).placeholder(R.color.xueqing_blue) | |
87 | - .into(iv_consult); | |
87 | + GlideUtils.showImg(mContext,iv_consult,object.getImage()); | |
88 | 88 | normal_content.setOnClickListener(new View.OnClickListener() { |
89 | 89 | @Override |
90 | 90 | public void onClick(View v) { | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
... | ... | @@ -158,7 +158,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
158 | 158 | mRxManager.register(mIModel.getUserInfo(mobile, school_id, captcha).subscribe(new Consumer<UserInfo>() { |
159 | 159 | @Override |
160 | 160 | public void accept(UserInfo userInfo) throws Exception { |
161 | - Log.d("6666", "userInfo=" + userInfo.toString()); | |
161 | +// Log.d("6666", "userInfo=" + userInfo.toString()); | |
162 | 162 | if (userInfo != null) { |
163 | 163 | CurrentBean currentBean = userInfo.getData(); |
164 | 164 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, currentBean.getMobile()); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/PersonInfoActivity.java
... | ... | @@ -18,6 +18,7 @@ import com.shunzhi.parent.AppContext; |
18 | 18 | import com.shunzhi.parent.R; |
19 | 19 | import com.shunzhi.parent.contract.mine.PersonInfoContract; |
20 | 20 | import com.shunzhi.parent.presenter.mine.PersonInfoPrasenter; |
21 | +import com.shunzhi.parent.util.GlideUtils; | |
21 | 22 | |
22 | 23 | /** |
23 | 24 | * Created by Administrator on 2018/3/10 0010. |
... | ... | @@ -56,9 +57,11 @@ public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract |
56 | 57 | private void initInfo() { |
57 | 58 | String url = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_IMAGE); |
58 | 59 | if (!TextUtils.isEmpty(url)) { |
59 | - Glide.with(this).load(url).asBitmap().error(R.drawable.test).centerCrop().into(user_image); | |
60 | + GlideUtils.showImg(this,user_image,url); | |
61 | +// Glide.with(this).load(url).asBitmap().error(R.drawable.test).centerCrop().into(user_image); | |
60 | 62 | } else { |
61 | - Glide.with(this).load(R.drawable.test).centerCrop().into(user_image); | |
63 | +// Glide.with(this).load(R.drawable.test).centerCrop().into(user_image); | |
64 | + GlideUtils.showImg(this,user_image,url); | |
62 | 65 | } |
63 | 66 | user_image.setCornerRadius(20); |
64 | 67 | user_image.setOval(true); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java
... | ... | @@ -56,7 +56,6 @@ public class ConsultOneLevelActivity extends BaseCompatActivity implements View. |
56 | 56 | Bundle bundle = new Bundle(); |
57 | 57 | bundle.putString("channel", channel); |
58 | 58 | consultOneLevelFragment.setArguments(bundle); |
59 | -// ToastUtils.showToast("channel=" + channel); | |
60 | 59 | fragmentTransaction = getSupportFragmentManager().beginTransaction(); |
61 | 60 | fragmentTransaction.add(R.id.frame_consult, consultOneLevelFragment) |
62 | 61 | .show(consultOneLevelFragment).commit(); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
... | ... | @@ -111,7 +111,6 @@ public class WebViewActivity extends BaseCompatActivity { |
111 | 111 | |
112 | 112 | initWebView(); |
113 | 113 | initWebSetting(nesteScrollWebView.getSettings()); |
114 | - ToastUtils.showToast(getIntent().getStringExtra("url")); | |
115 | 114 | nesteScrollWebView.loadUrl(getIntent().getStringExtra("url")); |
116 | 115 | } |
117 | 116 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
... | ... | @@ -24,6 +24,7 @@ import com.shunzhi.parent.contract.ceping.CepingContract; |
24 | 24 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; |
25 | 25 | import com.shunzhi.parent.ui.activity.MyChildActivity; |
26 | 26 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
27 | +import com.shunzhi.parent.util.GlideUtils; | |
27 | 28 | import com.shunzhi.parent.views.TextAndImgShowView; |
28 | 29 | |
29 | 30 | import java.util.List; |
... | ... | @@ -181,17 +182,21 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
181 | 182 | |
182 | 183 | @Override |
183 | 184 | public void showTools(List<ToolBean> toolBeanList) { |
184 | - if (toolBeanList.size() == 1) { | |
185 | + if (toolBeanList.size() > 0) { | |
185 | 186 | tvCourse1.setText(toolBeanList.get(0).toolName); |
186 | - Glide.with(getActivity()).load(toolBeanList.get(0).toolImage).into(ivCourse1); | |
187 | + GlideUtils.showImg(getActivity(),ivCourse1,toolBeanList.get(0).toolImage); | |
187 | 188 | tvCourse1.setTag(toolBeanList.get(0).toolUrl); |
188 | - } else if (toolBeanList.size() == 2) { | |
189 | + } | |
190 | + | |
191 | + if (toolBeanList.size() > 1) { | |
189 | 192 | tvCourse2.setText(toolBeanList.get(1).toolName); |
190 | - Glide.with(getActivity()).load(toolBeanList.get(1).toolImage).into(ivCourse1); | |
193 | + GlideUtils.showImg(getActivity(),ivCourse2,toolBeanList.get(1).toolImage); | |
191 | 194 | tvCourse2.setTag(toolBeanList.get(1).toolUrl); |
192 | - } else if (toolBeanList.size() == 3) { | |
195 | + } | |
196 | + | |
197 | + if (toolBeanList.size() > 2) { | |
193 | 198 | tvCourse3.setText(toolBeanList.get(2).toolName); |
194 | - Glide.with(getActivity()).load(toolBeanList.get(2).toolImage).into(ivCourse1); | |
199 | + GlideUtils.showImg(getActivity(),ivCourse3,toolBeanList.get(2).toolImage); | |
195 | 200 | tvCourse3.setTag(toolBeanList.get(2).toolUrl); |
196 | 201 | } |
197 | 202 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
... | ... | @@ -29,6 +29,7 @@ import com.shunzhi.parent.presenter.consult.ConsultPresenter; |
29 | 29 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
30 | 30 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
31 | 31 | import com.shunzhi.parent.util.AttrsUtils; |
32 | +import com.shunzhi.parent.util.GlideUtils; | |
32 | 33 | import com.shunzhi.parent.views.TextAndImgShowView; |
33 | 34 | import com.stx.xhb.xbanner.XBanner; |
34 | 35 | |
... | ... | @@ -89,7 +90,6 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
89 | 90 | // mPresenter.getTools(layout_control); |
90 | 91 | mPresenter.getBanners("2", AppContext.getInstance().district); |
91 | 92 | |
92 | - | |
93 | 93 | initBroadCast(); |
94 | 94 | |
95 | 95 | initListeners(); |
... | ... | @@ -129,8 +129,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
129 | 129 | xBanner.setmAdapter(new XBanner.XBannerAdapter() { |
130 | 130 | @Override |
131 | 131 | public void loadBanner(XBanner banner, Object model, View view, int position) { |
132 | - Glide.with(getActivity()).load(imgesUrl.get(position)).placeholder(R.drawable.ic_launcher_background) | |
133 | - .into((ImageView) view); | |
132 | + GlideUtils.showImg(getActivity(),(ImageView) view,imgesUrl.get(position)); | |
134 | 133 | } |
135 | 134 | }); |
136 | 135 | |
... | ... | @@ -153,11 +152,6 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
153 | 152 | public void onResume() { |
154 | 153 | super.onResume(); |
155 | 154 | xBanner.startAutoPlay(); |
156 | -// if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
157 | -// tvLocalAddress.setText(AppContext.getInstance().district); | |
158 | -// mPresenter.getBanners("2", AppContext.getInstance().district); | |
159 | -// mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, 1); | |
160 | -// } | |
161 | 155 | } |
162 | 156 | |
163 | 157 | @Override |
... | ... | @@ -230,7 +224,6 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
230 | 224 | TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); |
231 | 225 | textAndImgShowView.setTextColor(R.color.textColor); |
232 | 226 | textAndImgShowView.setText(list.get(i).getChannelName()); |
233 | -// textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(list.get(i).getChannelImage())); | |
234 | 227 | textAndImgShowView.addImgs(list.get(i).getChannelImage()); |
235 | 228 | textAndImgShowView.setSelect(true); |
236 | 229 | textAndImgShowView.setWidth(getActivity(), layout_control); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
... | ... | @@ -13,6 +13,7 @@ import android.widget.TextView; |
13 | 13 | |
14 | 14 | import com.bumptech.glide.Glide; |
15 | 15 | import com.makeramen.roundedimageview.RoundedImageView; |
16 | +import com.netease.nimlib.sdk.NIMClient; | |
16 | 17 | import com.share.mvpsdk.base.BasePresenter; |
17 | 18 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
18 | 19 | import com.share.mvpsdk.utils.CacheUtils; |
... | ... | @@ -28,6 +29,7 @@ import com.shunzhi.parent.ui.activity.MyChildActivity; |
28 | 29 | import com.shunzhi.parent.ui.activity.PersonInfoActivity; |
29 | 30 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
30 | 31 | import com.shunzhi.parent.ui.activity.orderdetail.OrderDetailActivity; |
32 | +import com.shunzhi.parent.util.GlideUtils; | |
31 | 33 | |
32 | 34 | import static java.util.ResourceBundle.clearCache; |
33 | 35 | |
... | ... | @@ -77,9 +79,11 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
77 | 79 | String url = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_IMAGE); |
78 | 80 | ToastUtils.showToast(url); |
79 | 81 | if (!TextUtils.isEmpty(url)) { |
80 | - Glide.with(getActivity()).load(url).asBitmap().error(R.drawable.test).centerCrop().into(user_photo); | |
82 | + GlideUtils.showImg(getContext(),user_photo,url); | |
83 | +// Glide.with(getActivity()).load(url).asBitmap().error(R.drawable.test).centerCrop().into(user_photo); | |
81 | 84 | } else { |
82 | - Glide.with(getActivity()).load(R.drawable.test).centerCrop().into(user_photo); | |
85 | +// Glide.with(getActivity()).load(R.drawable.test).centerCrop().into(user_photo); | |
86 | + GlideUtils.showImg(getContext(),user_photo,url); | |
83 | 87 | user_photo.setCornerRadius(20); |
84 | 88 | } |
85 | 89 | user_photo.setCornerRadius(20); |
... | ... | @@ -87,6 +91,9 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
87 | 91 | user_name.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_NAME)); |
88 | 92 | user_mobile.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); |
89 | 93 | user_mobile.setVisibility(View.VISIBLE); |
94 | + }else { | |
95 | + user_name.setVisibility(View.VISIBLE); | |
96 | + user_mobile.setVisibility(View.GONE); | |
90 | 97 | } |
91 | 98 | } |
92 | 99 | |
... | ... | @@ -156,6 +163,7 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
156 | 163 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, ""); |
157 | 164 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, ""); |
158 | 165 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, ""); |
166 | + AppConfig.ISLOGIN=false; | |
159 | 167 | setPersonInfo(); |
160 | 168 | } |
161 | 169 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
... | ... | @@ -22,6 +22,7 @@ import com.shunzhi.parent.bean.channel.ChannelContextBean; |
22 | 22 | import com.shunzhi.parent.contract.consult.ConsultContract; |
23 | 23 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; |
24 | 24 | import com.shunzhi.parent.ui.MainActivity; |
25 | +import com.shunzhi.parent.util.GlideUtils; | |
25 | 26 | import com.stx.xhb.xbanner.XBanner; |
26 | 27 | |
27 | 28 | import java.util.ArrayList; |
... | ... | @@ -99,12 +100,10 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult |
99 | 100 | xBanner.stopAutoPlay(); |
100 | 101 | xBanner.setmAutoPalyTime(10000); |
101 | 102 | // xBanner.setSlideScrollMode(View.OVER_SCROLL_NEVER); |
102 | - Log.d("66666","imgUrl="+imgUrl.toString()+"describeList="+describeList.toString()); | |
103 | 103 | xBanner.setmAdapter(new XBanner.XBannerAdapter() { |
104 | 104 | @Override |
105 | 105 | public void loadBanner(XBanner banner, Object model, View view, int position) { |
106 | - Glide.with(getActivity()).load(imgUrl.get(position)).placeholder(R.drawable.ic_launcher_background) | |
107 | - .into((ImageView) view); | |
106 | + GlideUtils.showImg(getActivity(),(ImageView) view,imgUrl.get(position)); | |
108 | 107 | } |
109 | 108 | }); |
110 | 109 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
... | ... | @@ -13,14 +13,12 @@ import android.widget.ImageView; |
13 | 13 | import android.widget.LinearLayout; |
14 | 14 | import android.widget.TextView; |
15 | 15 | |
16 | -import com.bumptech.glide.Glide; | |
17 | 16 | import com.jcodecraeer.xrecyclerview.XRecyclerView; |
18 | 17 | import com.share.mvpsdk.base.BasePresenter; |
19 | 18 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
20 | 19 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
21 | 20 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
22 | 21 | import com.share.mvpsdk.utils.DisplayUtils; |
23 | -import com.shunzhi.parent.AppConfig; | |
24 | 22 | import com.shunzhi.parent.AppContext; |
25 | 23 | import com.shunzhi.parent.R; |
26 | 24 | import com.shunzhi.parent.adapter.MyConsultAdapter; |
... | ... | @@ -32,6 +30,7 @@ import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; |
32 | 30 | import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; |
33 | 31 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
34 | 32 | import com.shunzhi.parent.util.AttrsUtils; |
33 | +import com.shunzhi.parent.util.GlideUtils; | |
35 | 34 | import com.shunzhi.parent.views.TextAndImgShowView; |
36 | 35 | |
37 | 36 | import java.util.ArrayList; |
... | ... | @@ -214,16 +213,14 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
214 | 213 | |
215 | 214 | @Override |
216 | 215 | public void onBindViewHolder(final GuangGaoBean object, int position) { |
217 | - Glide.with(getActivity()).load(AppConfig.BASE_URL_FILE + object.fileSrc).error(R.drawable.ic_launcher_foreground).into(iv_grally); | |
218 | - | |
216 | + GlideUtils.showImg(mContext, iv_grally, object.fileSrc); | |
219 | 217 | tv_grally_title.setText(object.describe + ""); |
220 | 218 | iv_grally.setOnClickListener(new View.OnClickListener() { |
221 | 219 | @Override |
222 | 220 | public void onClick(View v) { |
223 | - WebViewActivity.getInstance(mContext,object.url, -1); | |
221 | + WebViewActivity.getInstance(mContext, object.url, -1); | |
224 | 222 | } |
225 | 223 | }); |
226 | - | |
227 | 224 | } |
228 | 225 | } |
229 | 226 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/util/GlideUtils.java
0 → 100644
... | ... | @@ -0,0 +1,29 @@ |
1 | +package com.shunzhi.parent.util; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.text.TextUtils; | |
5 | +import android.widget.ImageView; | |
6 | + | |
7 | +import com.bumptech.glide.Glide; | |
8 | +import com.shunzhi.parent.AppConfig; | |
9 | +import com.shunzhi.parent.R; | |
10 | + | |
11 | +/** | |
12 | + * Created by ToaHanDong on 2018/3/21. | |
13 | + */ | |
14 | + | |
15 | +public class GlideUtils { | |
16 | + | |
17 | + public static void showImg(Context context, ImageView imageView,String url){ | |
18 | + if (!TextUtils.isEmpty(url)){ | |
19 | + if (url.startsWith("http")) | |
20 | + Glide.with(context).load(url).placeholder(R.color.xueqing_blue) | |
21 | + .into(imageView); | |
22 | + else Glide.with(context).load(AppConfig.BASE_URL_FILE+url).placeholder(R.color.xueqing_blue) | |
23 | + .into(imageView); | |
24 | + }else { | |
25 | + Glide.with(context).load(url).placeholder(R.color.xueqing_blue).centerCrop().into(imageView); | |
26 | + } | |
27 | + } | |
28 | + | |
29 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
... | ... | @@ -17,6 +17,7 @@ import com.share.mvpsdk.utils.DisplayUtils; |
17 | 17 | import com.shunzhi.parent.AppConfig; |
18 | 18 | import com.shunzhi.parent.AppContext; |
19 | 19 | import com.shunzhi.parent.R; |
20 | +import com.shunzhi.parent.util.GlideUtils; | |
20 | 21 | |
21 | 22 | |
22 | 23 | /** |
... | ... | @@ -57,6 +58,7 @@ public class TextAndImgShowView extends LinearLayout { |
57 | 58 | } |
58 | 59 | |
59 | 60 | public void addImgs(String imgUrl){ |
61 | +// Log.d("66666","imgUrl="+imgUrl); | |
60 | 62 | if (!imgUrl.startsWith("http"))imgUrl= AppConfig.BASE_URL_FILE+imgUrl; |
61 | 63 | Glide.with(getContext()).load(imgUrl).error(R.drawable.gxzt).into(image); |
62 | 64 | } |
... | ... | @@ -81,7 +83,7 @@ public class TextAndImgShowView extends LinearLayout { |
81 | 83 | } |
82 | 84 | |
83 | 85 | public void setWidth(Activity activity, View layout_control) { |
84 | - Log.d("66666", "layout_control=" + layout_control.getMeasuredWidth()); | |
86 | +// Log.d("66666", "layout_control=" + layout_control.getMeasuredWidth()); | |
85 | 87 | LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
86 | 88 | params.width = (DisplayUtils.getScreenWidthPixels(activity) - |
87 | 89 | DisplayUtils.dp2px(layout_control.getPaddingLeft() + layout_control.getPaddingRight() | ... | ... |
app/src/main/res/drawable-xhdpi/logo.png
app/src/main/res/drwable-xxhdpi/logo.png
app/src/main/res/values/strings.xml