Commit b7d02685e98afd0ad896351cdfb3e24ec4e90350
1 parent
e3782ee9
Exists in
yxb_dev
and in
1 other branch
no message
Showing
12 changed files
with
63 additions
and
25 deletions
Show diff stats
.idea/misc.xml
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | </value> |
25 | 25 | </option> |
26 | 26 | </component> |
27 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
27 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
28 | 28 | <output url="file://$PROJECT_DIR$/build/classes" /> |
29 | 29 | </component> |
30 | 30 | <component name="ProjectType"> | ... | ... |
app/libs/processor.jar
No preview for this file type
app/src/main/java/com/shunzhi/parent/AppContext.java
... | ... | @@ -64,6 +64,8 @@ public class AppContext extends GlobalApplication { |
64 | 64 | super.onCreate(); |
65 | 65 | |
66 | 66 | NIMClient.init(this, loginInfo(), options()); |
67 | + if (null==AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT)) | |
68 | + AppConfig.getAppConfig(getContext()).set(AppConfig.DISTRICT,"越城区"); | |
67 | 69 | |
68 | 70 | if (inMainProcess(this)) { |
69 | 71 | //开启地图地位 |
... | ... | @@ -210,9 +212,9 @@ public class AppContext extends GlobalApplication { |
210 | 212 | @Override |
211 | 213 | public void onLocationChanged(AMapLocation aMapLocation) { |
212 | 214 | if (null != aMapLocation) { |
215 | + Timber.d("88888%s","aMapLocation="+aMapLocation.getErrorCode()); | |
213 | 216 | if (aMapLocation.getErrorCode() == 0) { |
214 | 217 | String currName = AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT); |
215 | - Log.e("11111", currName); | |
216 | 218 | if (currName != null && !"定位失败".equals(currName) &&! "".equals(currName)) { |
217 | 219 | district = AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT); |
218 | 220 | } else { |
... | ... | @@ -221,18 +223,17 @@ public class AppContext extends GlobalApplication { |
221 | 223 | aMapLocation.getCityCode(); |
222 | 224 | } |
223 | 225 | AppConfig.getAppConfig(getContext()).set(AppConfig.DISTRICT, district); |
224 | - Intent intent = new Intent(); | |
225 | - intent.setAction(LOCATION_CITYNAME + ""); | |
226 | - sendBroadcast(intent); | |
227 | - Log.e("11111", "222222"); | |
228 | 226 | stopLocation(); |
229 | 227 | } else { |
230 | 228 | cityName = "定位失败"; |
231 | 229 | district = "定位失败"; |
232 | 230 | if (null != AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT)) |
233 | 231 | district = AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT); |
232 | + else if ("定位失败".equals(district))district="越城区"; | |
234 | 233 | } |
235 | - | |
234 | + Intent intent = new Intent(); | |
235 | + intent.setAction(LOCATION_CITYNAME + ""); | |
236 | + sendBroadcast(intent); | |
236 | 237 | } |
237 | 238 | } |
238 | 239 | }; | ... | ... |
app/src/main/java/com/shunzhi/parent/adapter/MyConsultAdapter.java
... | ... | @@ -20,6 +20,7 @@ import com.shunzhi.parent.R; |
20 | 20 | import com.shunzhi.parent.bean.channel.ChannelContextBean; |
21 | 21 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
22 | 22 | import com.shunzhi.parent.util.GlideUtils; |
23 | +import com.squareup.picasso.Picasso; | |
23 | 24 | |
24 | 25 | /** |
25 | 26 | * Created by ToaHanDong on 2018/3/14. |
... | ... | @@ -75,7 +76,7 @@ public class MyConsultAdapter extends BaseRecyclerViewAdapter<ChannelContextBean |
75 | 76 | if (object.getIsAds() == 1) { |
76 | 77 | frame_ad.setVisibility(View.VISIBLE); |
77 | 78 | normal_content.setVisibility(View.GONE); |
78 | - GlideUtils.showImg(mContext,iv_consult,object.getImage()); | |
79 | + GlideUtils.showImgWithPicass(mContext,iv_consult,object.getImage()); | |
79 | 80 | frame_ad.setOnClickListener(new View.OnClickListener() { |
80 | 81 | @Override |
81 | 82 | public void onClick(View v) { |
... | ... | @@ -89,7 +90,7 @@ public class MyConsultAdapter extends BaseRecyclerViewAdapter<ChannelContextBean |
89 | 90 | tvConsultContent.setText(object.getContent()); |
90 | 91 | tvPingLunNums.setText("浏览量:"+object.getLookNum()+""); |
91 | 92 | tvZhuanFaNums.setText("转发:"+object.getForwardingNum()+""); |
92 | - GlideUtils.showImg(mContext,iv_consult,object.getImage()); | |
93 | + GlideUtils.showImgWithPicass(mContext,iv_consult,object.getImage()); | |
93 | 94 | normal_content.setOnClickListener(new View.OnClickListener() { |
94 | 95 | @Override |
95 | 96 | public void onClick(View v) { | ... | ... |
app/src/main/java/com/shunzhi/parent/db/DBHelper.java
... | ... | @@ -14,7 +14,7 @@ public class DBHelper extends SQLiteOpenHelper { |
14 | 14 | public final int VERSION=1; |
15 | 15 | |
16 | 16 | public DBHelper(Context context, String name) { |
17 | - super(context, name, null, 2); | |
17 | + super(context, name, null, 1); | |
18 | 18 | } |
19 | 19 | |
20 | 20 | public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler) { | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
... | ... | @@ -25,6 +25,7 @@ import java.util.List; |
25 | 25 | |
26 | 26 | import io.reactivex.functions.Consumer; |
27 | 27 | import retrofit2.HttpException; |
28 | +import timber.log.Timber; | |
28 | 29 | |
29 | 30 | /** |
30 | 31 | * Created by ToaHanDong on 2018/3/14. |
... | ... | @@ -78,6 +79,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
78 | 79 | }, new Consumer<Throwable>() { |
79 | 80 | @Override |
80 | 81 | public void accept(Throwable throwable) throws Exception { |
82 | + Timber.d("88888%s","getBanners="+throwable.toString()); | |
81 | 83 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
82 | 84 | } |
83 | 85 | })); |
... | ... | @@ -102,6 +104,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
102 | 104 | @Override |
103 | 105 | public void accept(Throwable throwable) throws Exception { |
104 | 106 | try { |
107 | + Timber.d("88888%s","getContextChannel="+throwable.toString()); | |
105 | 108 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
106 | 109 | }catch (Exception e){ |
107 | 110 | |
... | ... | @@ -132,6 +135,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
132 | 135 | }, new Consumer<Throwable>() { |
133 | 136 | @Override |
134 | 137 | public void accept(Throwable throwable) throws Exception { |
138 | + Timber.d("88888%s","getInformationTopic="+throwable.toString()); | |
135 | 139 | // Log.d("66666","getInformationTopic="+throwable); |
136 | 140 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
137 | 141 | } |
... | ... | @@ -148,6 +152,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
148 | 152 | }, new Consumer<Throwable>() { |
149 | 153 | @Override |
150 | 154 | public void accept(Throwable throwable) throws Exception { |
155 | + Timber.d("88888%s","loginVote="+throwable.toString()); | |
151 | 156 | mIView.showVote(position,""); |
152 | 157 | } |
153 | 158 | })); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/MainActivity.java
1 | 1 | package com.shunzhi.parent.ui; |
2 | 2 | |
3 | +import android.content.Context; | |
3 | 4 | import android.content.Intent; |
4 | 5 | import android.os.Bundle; |
5 | 6 | import android.support.annotation.NonNull; |
... | ... | @@ -40,6 +41,11 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. |
40 | 41 | |
41 | 42 | FragmentTransaction fragmentTransaction = null; |
42 | 43 | |
44 | + public static void newInstance(Context context){ | |
45 | + Intent intent=new Intent(context,MainActivity.class); | |
46 | + context.startActivity(intent); | |
47 | + } | |
48 | + | |
43 | 49 | @Override |
44 | 50 | protected void initView(Bundle savedInstanceState) { |
45 | 51 | |
... | ... | @@ -146,7 +152,9 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. |
146 | 152 | |
147 | 153 | @Override |
148 | 154 | public void onPermissionGranted(int requestCode) { |
149 | - | |
155 | + if (requestCode==PermissionUtils.CODE_ACCESS_COARSE_LOCATION||requestCode==PermissionUtils.CODE_ACCESS_FINE_LOCATION){ | |
156 | + AppContext.getInstance().startLocation(); | |
157 | + } | |
150 | 158 | } |
151 | 159 | |
152 | 160 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
... | ... | @@ -34,6 +34,7 @@ import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
34 | 34 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
35 | 35 | import com.shunzhi.parent.util.AttrsUtils; |
36 | 36 | import com.shunzhi.parent.views.TextAndImgShowView; |
37 | +import com.squareup.picasso.Picasso; | |
37 | 38 | import com.stx.xhb.xbanner.XBanner; |
38 | 39 | |
39 | 40 | import java.util.ArrayList; |
... | ... | @@ -42,6 +43,7 @@ import java.util.List; |
42 | 43 | import cn.jzvd.JZVideoPlayerStandard; |
43 | 44 | import me.leefeng.citypicker.CityPicker; |
44 | 45 | import me.leefeng.citypicker.CityPickerListener; |
46 | +import timber.log.Timber; | |
45 | 47 | |
46 | 48 | public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel> implements View.OnClickListener |
47 | 49 | , ConsultContract.IConsultView, CityPickerListener { |
... | ... | @@ -76,6 +78,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
76 | 78 | |
77 | 79 | NestedScrollView nesteScrollView; |
78 | 80 | |
81 | + private String districtName=""; | |
82 | + | |
79 | 83 | @Override |
80 | 84 | public int getLayoutId() { |
81 | 85 | return R.layout.fragment_zi_xun; |
... | ... | @@ -96,7 +100,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
96 | 100 | videoplayer.batteryLevel.setVisibility(View.GONE); |
97 | 101 | videoplayer.replayTextView.setVisibility(View.GONE); |
98 | 102 | videoplayer.backButton.setVisibility(View.GONE); |
99 | - | |
103 | + districtName=AppConfig.getAppConfig(AppContext.getContext()).get(AppConfig.DISTRICT); | |
100 | 104 | initBroadCast(); |
101 | 105 | initRecycler(); |
102 | 106 | initListeners(); |
... | ... | @@ -109,7 +113,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
109 | 113 | } |
110 | 114 | }); |
111 | 115 | |
112 | - mPresenter.getBanners("2", AppContext.getInstance().district); | |
116 | + mPresenter.getBanners("2", districtName); | |
113 | 117 | |
114 | 118 | } |
115 | 119 | |
... | ... | @@ -121,7 +125,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
121 | 125 | //refresh data here |
122 | 126 | pageIndex = 1; |
123 | 127 | contextList.clear(); |
124 | - mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
128 | + mPresenter.getContextChannel(districtName, 0, 1, pageIndex); | |
125 | 129 | recycler_context.refreshComplete(); |
126 | 130 | } |
127 | 131 | |
... | ... | @@ -129,12 +133,12 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
129 | 133 | public void onLoadMore() { |
130 | 134 | // load more data here |
131 | 135 | pageIndex = pageIndex + 1; |
132 | - mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
136 | + mPresenter.getContextChannel(districtName, 0, 1, pageIndex); | |
133 | 137 | recycler_context.refreshComplete(); |
134 | 138 | } |
135 | 139 | }); |
136 | 140 | pageIndex = 1; |
137 | - mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
141 | + mPresenter.getContextChannel(districtName, 0, 1, pageIndex); | |
138 | 142 | } |
139 | 143 | |
140 | 144 | private void initListeners() { |
... | ... | @@ -145,8 +149,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
145 | 149 | private void initBanners() { |
146 | 150 | xBanner.setData(imgesUrl, describeList); |
147 | 151 | // xBanner.setPointsIsVisible(false); |
152 | + xBanner.setAutoPalyTime(5000); | |
148 | 153 | xBanner.setmAdapter(xBannerAdapter); |
149 | - | |
150 | 154 | xBanner.setOnItemClickListener(new XBanner.OnItemClickListener() { |
151 | 155 | @Override |
152 | 156 | public void onItemClick(XBanner banner, int position) { |
... | ... | @@ -160,7 +164,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
160 | 164 | private XBanner.XBannerAdapter xBannerAdapter = new XBanner.XBannerAdapter() { |
161 | 165 | @Override |
162 | 166 | public void loadBanner(XBanner banner, Object model, View view, int position) { |
163 | - Glide.with(getContext()).load(imgesUrl.get(position)).into((ImageView) view); | |
167 | +// Glide.with(getContext()).load(imgesUrl.get(position)).into((ImageView) view); | |
168 | + Picasso.get().load(imgesUrl.get(position)).into((ImageView) view); | |
164 | 169 | // GlideUtils.showImg(getActivity(),(ImageView) view,imgesUrl.get(position)); |
165 | 170 | } |
166 | 171 | }; |
... | ... | @@ -196,7 +201,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
196 | 201 | case R.id.ivSearch://搜索按钮 |
197 | 202 | if (!TextUtils.isEmpty(et_search.getText().toString())) { |
198 | 203 | contextList.clear(); |
199 | - mPresenter.getInformationTopic(et_search.getText().toString(), AppContext.getInstance().district, "0", "1", 1); | |
204 | + mPresenter.getInformationTopic(et_search.getText().toString(), districtName, "0", "1", 1); | |
200 | 205 | } |
201 | 206 | break; |
202 | 207 | } |
... | ... | @@ -213,7 +218,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
213 | 218 | @Override |
214 | 219 | public void onReceive(Context context, Intent intent) { |
215 | 220 | if (intent.getAction().equals(AppContext.LOCATION_CITYNAME + "")) { |
216 | - tvLocalAddress.setText(AppContext.getInstance().district); | |
221 | + districtName=AppConfig.getAppConfig(AppContext.getContext()).get(AppConfig.DISTRICT); | |
222 | + tvLocalAddress.setText(districtName); | |
217 | 223 | } |
218 | 224 | } |
219 | 225 | }; |
... | ... | @@ -301,7 +307,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
301 | 307 | |
302 | 308 | public void refresh() { |
303 | 309 | first = true; |
304 | - tvLocalAddress.setText(AppContext.getInstance().district); | |
310 | + districtName=AppConfig.getAppConfig(AppContext.getContext()).get(AppConfig.DISTRICT); | |
311 | + tvLocalAddress.setText(districtName); | |
305 | 312 | mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); |
306 | 313 | mPresenter.getBanners("2", AppContext.getInstance().district); |
307 | 314 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
... | ... | @@ -75,7 +75,8 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult |
75 | 75 | tvJump.setOnClickListener(new View.OnClickListener() { |
76 | 76 | @Override |
77 | 77 | public void onClick(View view) { |
78 | - startNewActivity(MainActivity.class); | |
78 | +// startNewActivity(MainActivity.class); | |
79 | + MainActivity.newInstance(getContext()); | |
79 | 80 | getActivity().finish(); |
80 | 81 | } |
81 | 82 | }); |
... | ... | @@ -148,6 +149,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult |
148 | 149 | } else { |
149 | 150 | isQidong = false; |
150 | 151 | startNewActivity(StartActivity.class); |
152 | + getActivity().finish(); | |
151 | 153 | // showVideos(); |
152 | 154 | // showBanners(); |
153 | 155 | } |
... | ... | @@ -169,7 +171,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult |
169 | 171 | private void showBanners() { |
170 | 172 | xBanner.setData(imgUrl, describeList); |
171 | 173 | xBanner.stopAutoPlay(); |
172 | - xBanner.setmAutoPalyTime(10000); | |
174 | + xBanner.setAutoPalyTime(10000); | |
173 | 175 | xBanner.setPointsIsVisible(false); |
174 | 176 | xBanner.setmAdapter(new XBanner.XBannerAdapter() { |
175 | 177 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/util/GlideUtils.java
... | ... | @@ -7,6 +7,7 @@ import android.widget.ImageView; |
7 | 7 | import com.bumptech.glide.Glide; |
8 | 8 | import com.shunzhi.parent.AppConfig; |
9 | 9 | import com.shunzhi.parent.R; |
10 | +import com.squareup.picasso.Picasso; | |
10 | 11 | |
11 | 12 | /** |
12 | 13 | * Created by ToaHanDong on 2018/3/21. |
... | ... | @@ -26,6 +27,15 @@ public class GlideUtils { |
26 | 27 | } |
27 | 28 | } |
28 | 29 | |
30 | + public static void showImgWithPicass(Context context,ImageView imageView,String url){ | |
31 | + if (!TextUtils.isEmpty(url)){ | |
32 | + if (url.startsWith("http")) | |
33 | + Picasso.get().load(url).error(R.color.xueqing_blue).into(imageView); | |
34 | + else Picasso.get().load(AppConfig.BASE_URL_FILE+url).error(R.color.xueqing_blue).into(imageView); | |
35 | + }else { | |
36 | + Picasso.get().load(url).error(R.color.xueqing_blue).into(imageView); | |
37 | + } | |
38 | + } | |
29 | 39 | |
30 | 40 | public static void showImgWithDefaule(Context context,ImageView imageView,String url,int defaultImg){ |
31 | 41 | if (!TextUtils.isEmpty(url)){ | ... | ... |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
... | ... | @@ -17,6 +17,7 @@ import com.share.mvpsdk.utils.DisplayUtils; |
17 | 17 | import com.share.mvpsdk.utils.ToastUtils; |
18 | 18 | import com.shunzhi.parent.AppConfig; |
19 | 19 | import com.shunzhi.parent.R; |
20 | +import com.squareup.picasso.Picasso; | |
20 | 21 | |
21 | 22 | |
22 | 23 | /** |
... | ... | @@ -59,7 +60,8 @@ public class TextAndImgShowView extends LinearLayout { |
59 | 60 | public void addImgs(String imgUrl) { |
60 | 61 | // Log.d("66666","imgUrl="+imgUrl); |
61 | 62 | if (!imgUrl.startsWith("http")) imgUrl = AppConfig.BASE_URL_FILE + imgUrl; |
62 | - Glide.with(getContext()).load(imgUrl).error(R.drawable.gxzt).into(image); | |
63 | + Picasso.get().load(imgUrl).error(R.drawable.gxzt).into(image); | |
64 | +// Glide.with(getContext()).load(imgUrl).error(R.drawable.gxzt).into(image); | |
63 | 65 | } |
64 | 66 | |
65 | 67 | public void setSelect(boolean isSelect) { | ... | ... |
mvpsdk/build.gradle
... | ... | @@ -105,7 +105,7 @@ dependencies { |
105 | 105 | // compile(name: 'jiaozivideoplayer-6.2.3', ext: 'aar') |
106 | 106 | |
107 | 107 | //轮播图XBanner |
108 | - compile 'com.xhb:xbanner:1.3.1' | |
108 | + compile 'com.xhb:xbanner:1.3.8' | |
109 | 109 | |
110 | 110 | //省市区联动 |
111 | 111 | compile 'me.leefeng:citypicker:1.0' |
... | ... | @@ -125,5 +125,7 @@ dependencies { |
125 | 125 | compile 'com.j256.ormlite:ormlite-core:4.48' |
126 | 126 | compile 'com.j256.ormlite:ormlite-android:4.48' |
127 | 127 | |
128 | + compile 'com.squareup.picasso:picasso:2.71828' | |
129 | + | |
128 | 130 | |
129 | 131 | } | ... | ... |