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