Commit b5c2110354696a66fafcfae32ecc1bf5b12f3e0d
Exists in
yxb_dev
and in
2 other branches
Merge branch 'developer' of http://git.shunzhi.net/taohd/parentwork into developer
# Conflicts: # app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
Showing
15 changed files
with
61 additions
and
27 deletions
Show diff stats
app/src/main/AndroidManifest.xml
@@ -144,6 +144,7 @@ | @@ -144,6 +144,7 @@ | ||
144 | 144 | ||
145 | <activity | 145 | <activity |
146 | android:name=".ui.MainActivity" | 146 | android:name=".ui.MainActivity" |
147 | + android:windowSoftInputMode="adjustPan|stateAlwaysHidden" | ||
147 | android:launchMode="singleInstance" | 148 | android:launchMode="singleInstance" |
148 | android:screenOrientation="portrait"/> | 149 | android:screenOrientation="portrait"/> |
149 | 150 |
app/src/main/java/com/shunzhi/parent/AppConfig.java
@@ -45,7 +45,7 @@ public class AppConfig { | @@ -45,7 +45,7 @@ public class AppConfig { | ||
45 | //正式 | 45 | //正式 |
46 | public static String BASE_URL="http://campus.myjxt.com/"; | 46 | public static String BASE_URL="http://campus.myjxt.com/"; |
47 | public static String BASE_URL_ORDER="http://parent.myjxt.com/"; | 47 | public static String BASE_URL_ORDER="http://parent.myjxt.com/"; |
48 | - public static String BASE_URL_FILE="http://manage.myjxt.com "; | 48 | + public static String BASE_URL_FILE="http://manage.myjxt.com"; |
49 | 49 | ||
50 | 50 | ||
51 | //默认日志保存的路径 | 51 | //默认日志保存的路径 |
app/src/main/java/com/shunzhi/parent/adapter/SchoolListAdapter.java
@@ -2,6 +2,7 @@ package com.shunzhi.parent.adapter; | @@ -2,6 +2,7 @@ package com.shunzhi.parent.adapter; | ||
2 | 2 | ||
3 | 3 | ||
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | +import android.util.Log; | ||
5 | import android.view.LayoutInflater; | 6 | import android.view.LayoutInflater; |
6 | import android.view.View; | 7 | import android.view.View; |
7 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
@@ -31,6 +32,7 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | @@ -31,6 +32,7 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | ||
31 | public SchoolListAdapter(Context context, List<SortBean> list) { | 32 | public SchoolListAdapter(Context context, List<SortBean> list) { |
32 | this.context = context; | 33 | this.context = context; |
33 | this.list = list; | 34 | this.list = list; |
35 | + Log.e("sss-===",list.size()+""); | ||
34 | ischeck = new boolean[list.size()]; | 36 | ischeck = new boolean[list.size()]; |
35 | for (int i=0;i<ischeck.length;i++){ | 37 | for (int i=0;i<ischeck.length;i++){ |
36 | ischeck[i]=false; | 38 | ischeck[i]=false; |
@@ -38,6 +40,15 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | @@ -38,6 +40,15 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | ||
38 | 40 | ||
39 | } | 41 | } |
40 | 42 | ||
43 | + @Override | ||
44 | + public void addAll(List<SortBean> data) { | ||
45 | + super.addAll(data); | ||
46 | + this.list = data; | ||
47 | + ischeck = new boolean[data.size()]; | ||
48 | + for (int i=0;i<ischeck.length;i++){ | ||
49 | + ischeck[i]=false; | ||
50 | + } | ||
51 | + } | ||
41 | 52 | ||
42 | @Override | 53 | @Override |
43 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 54 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
@@ -62,6 +73,7 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | @@ -62,6 +73,7 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | ||
62 | @Override | 73 | @Override |
63 | public void onBindViewHolder(final SortBean object, final int position) { | 74 | public void onBindViewHolder(final SortBean object, final int position) { |
64 | select_school.setVisibility(View.INVISIBLE); | 75 | select_school.setVisibility(View.INVISIBLE); |
76 | + Log.e("1111-===",position+""); | ||
65 | if (ischeck[position] ==true) { | 77 | if (ischeck[position] ==true) { |
66 | select_school.setVisibility(View.VISIBLE); | 78 | select_school.setVisibility(View.VISIBLE); |
67 | } | 79 | } |
@@ -122,4 +134,6 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | @@ -122,4 +134,6 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | ||
122 | public static SortBean getCurrentSortBean() { | 134 | public static SortBean getCurrentSortBean() { |
123 | return currentSortBean; | 135 | return currentSortBean; |
124 | } | 136 | } |
137 | + | ||
138 | + | ||
125 | } | 139 | } |
app/src/main/java/com/shunzhi/parent/presenter/ceping/CePingPresenter.java
1 | package com.shunzhi.parent.presenter.ceping; | 1 | package com.shunzhi.parent.presenter.ceping; |
2 | 2 | ||
3 | -import android.util.Log; | ||
4 | import android.view.View; | 3 | import android.view.View; |
5 | import android.widget.LinearLayout; | 4 | import android.widget.LinearLayout; |
6 | 5 | ||
@@ -19,7 +18,6 @@ import java.util.ArrayList; | @@ -19,7 +18,6 @@ import java.util.ArrayList; | ||
19 | import java.util.List; | 18 | import java.util.List; |
20 | 19 | ||
21 | import io.reactivex.functions.Consumer; | 20 | import io.reactivex.functions.Consumer; |
22 | -import timber.log.Timber; | ||
23 | 21 | ||
24 | /** | 22 | /** |
25 | * Created by ToaHanDong on 2018/3/14. | 23 | * Created by ToaHanDong on 2018/3/14. |
@@ -43,7 +41,6 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | @@ -43,7 +41,6 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | ||
43 | mRxManager.register(mIModel.getTools(areaName).subscribe(new Consumer<JsonObject>() { | 41 | mRxManager.register(mIModel.getTools(areaName).subscribe(new Consumer<JsonObject>() { |
44 | @Override | 42 | @Override |
45 | public void accept(JsonObject jsonObject) throws Exception { | 43 | public void accept(JsonObject jsonObject) throws Exception { |
46 | - | ||
47 | if (jsonObject.get("status").getAsString().equals("1")){ | 44 | if (jsonObject.get("status").getAsString().equals("1")){ |
48 | JsonArray jsonArray=jsonObject.getAsJsonArray("data"); | 45 | JsonArray jsonArray=jsonObject.getAsJsonArray("data"); |
49 | layout_control.removeAllViews(); | 46 | layout_control.removeAllViews(); |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
@@ -50,6 +50,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -50,6 +50,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
50 | @Override | 50 | @Override |
51 | public void accept(JsonObject jsonObject) throws Exception { | 51 | public void accept(JsonObject jsonObject) throws Exception { |
52 | try { | 52 | try { |
53 | +// Log.d("66666","jsonObject="+jsonObject); | ||
53 | if (jsonObject != null && !TextUtils.isEmpty(jsonObject.get("access_token").getAsString())) { | 54 | if (jsonObject != null && !TextUtils.isEmpty(jsonObject.get("access_token").getAsString())) { |
54 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.ACCESS_TOKEN, jsonObject.get("access_token").getAsString()); | 55 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.ACCESS_TOKEN, jsonObject.get("access_token").getAsString()); |
55 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, loginName); | 56 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, loginName); |
@@ -67,7 +68,21 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -67,7 +68,21 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
67 | }, new Consumer<Throwable>() { | 68 | }, new Consumer<Throwable>() { |
68 | @Override | 69 | @Override |
69 | public void accept(Throwable throwable) throws Exception { | 70 | public void accept(Throwable throwable) throws Exception { |
70 | - OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | 71 | + Response response = ((HttpException) throwable).response(); |
72 | + if (response == null) return; | ||
73 | + ResponseBody responseBody = response.errorBody(); | ||
74 | + if (responseBody == null) return; | ||
75 | + try { | ||
76 | + JSONObject json = new JSONObject(responseBody.string()); | ||
77 | + ToastUtils.showToast(json.optString("message")+"json="+json); | ||
78 | + if (TextUtils.isEmpty(json.optString("error"))) { | ||
79 | + mIView.showerror(json.optString("message")); | ||
80 | + return; | ||
81 | + } | ||
82 | + mIView.showerror(json.optString("error")); | ||
83 | + } catch (Exception e1) { | ||
84 | + e1.printStackTrace(); | ||
85 | + } | ||
71 | } | 86 | } |
72 | })); | 87 | })); |
73 | 88 |
app/src/main/java/com/shunzhi/parent/presenter/mine/MyChildPresenter.java
1 | package com.shunzhi.parent.presenter.mine; | 1 | package com.shunzhi.parent.presenter.mine; |
2 | 2 | ||
3 | -import android.util.Log; | ||
4 | - | ||
5 | import com.google.gson.JsonObject; | 3 | import com.google.gson.JsonObject; |
6 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; | 4 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; |
7 | import com.share.mvpsdk.utils.ToastUtils; | 5 | import com.share.mvpsdk.utils.ToastUtils; |
6 | +import com.shunzhi.parent.AppConfig; | ||
8 | import com.shunzhi.parent.bean.ChildClass; | 7 | import com.shunzhi.parent.bean.ChildClass; |
9 | import com.shunzhi.parent.bean.CurrentBean; | 8 | import com.shunzhi.parent.bean.CurrentBean; |
10 | import com.shunzhi.parent.bean.GradeBean; | 9 | import com.shunzhi.parent.bean.GradeBean; |
@@ -71,6 +70,7 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | @@ -71,6 +70,7 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | ||
71 | @Override | 70 | @Override |
72 | public void accept(JsonObject jsonObject) throws Exception { | 71 | public void accept(JsonObject jsonObject) throws Exception { |
73 | ToastUtils.showToast("绑定孩子成功"); | 72 | ToastUtils.showToast("绑定孩子成功"); |
73 | + AppConfig.ISBINDING=true; | ||
74 | if (jsonObject.get("data").toString().equals("null")) { | 74 | if (jsonObject.get("data").toString().equals("null")) { |
75 | mIView.addChildSuccess("", ""); | 75 | mIView.addChildSuccess("", ""); |
76 | } else { | 76 | } else { |
app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
@@ -119,7 +119,6 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -119,7 +119,6 @@ public class WebViewActivity extends BaseCompatActivity { | ||
119 | initWebView(); | 119 | initWebView(); |
120 | initWebSetting(nesteScrollWebView.getSettings()); | 120 | initWebSetting(nesteScrollWebView.getSettings()); |
121 | nesteScrollWebView.loadUrl(getIntent().getStringExtra("url")); | 121 | nesteScrollWebView.loadUrl(getIntent().getStringExtra("url")); |
122 | -// Log.d("66666","getIntent().getStringExtra(\"url\")="+getIntent().getStringExtra("url")); | ||
123 | } | 122 | } |
124 | 123 | ||
125 | @Override | 124 | @Override |
@@ -183,7 +182,6 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -183,7 +182,6 @@ public class WebViewActivity extends BaseCompatActivity { | ||
183 | 182 | ||
184 | @Override | 183 | @Override |
185 | public boolean shouldOverrideUrlLoading(WebView view, String url) { | 184 | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
186 | -// Log.d("66666","shouldOverrideUrlLoading="+url); | ||
187 | if (url.startsWith("http")) view.loadUrl(url); | 185 | if (url.startsWith("http")) view.loadUrl(url); |
188 | // if (url.contains("platformapi/startapp")) { | 186 | // if (url.contains("platformapi/startapp")) { |
189 | // startAlipayActivity(url); | 187 | // startAlipayActivity(url); |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
@@ -11,6 +11,7 @@ import android.view.Gravity; | @@ -11,6 +11,7 @@ import android.view.Gravity; | ||
11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
12 | import android.view.View; | 12 | import android.view.View; |
13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
14 | +import android.view.WindowManager; | ||
14 | import android.widget.EditText; | 15 | import android.widget.EditText; |
15 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
16 | import android.widget.LinearLayout; | 17 | import android.widget.LinearLayout; |
@@ -143,6 +144,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | @@ -143,6 +144,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | ||
143 | PopupWindow popupWindow = new PopupWindow(); | 144 | PopupWindow popupWindow = new PopupWindow(); |
144 | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | 145 | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); |
145 | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | 146 | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); |
147 | + backgroundAlpha(0.5f); | ||
146 | View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view, null); | 148 | View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view, null); |
147 | TextView dialogInfo = view.findViewById(R.id.dialog_info); | 149 | TextView dialogInfo = view.findViewById(R.id.dialog_info); |
148 | dialogInfo.setText("注册成功"); | 150 | dialogInfo.setText("注册成功"); |
@@ -178,8 +180,9 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | @@ -178,8 +180,9 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | ||
178 | 180 | ||
179 | @Override | 181 | @Override |
180 | public void showerror(String error) { | 182 | public void showerror(String error) { |
183 | + backgroundAlpha(1f); | ||
181 | progressDialog.dismiss(); | 184 | progressDialog.dismiss(); |
182 | -// ToastUtils.showToast(error); | 185 | + ToastUtils.showToast(error); |
183 | } | 186 | } |
184 | 187 | ||
185 | @Override | 188 | @Override |
@@ -287,4 +290,11 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | @@ -287,4 +290,11 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | ||
287 | } | 290 | } |
288 | }; | 291 | }; |
289 | 292 | ||
293 | + | ||
294 | + public void backgroundAlpha(float bgAlpha) { | ||
295 | + WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes(); | ||
296 | + lp.alpha = bgAlpha; //0.0-1.0 | ||
297 | + getActivity().getWindow().setAttributes(lp); | ||
298 | + } | ||
299 | + | ||
290 | } | 300 | } |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
@@ -5,6 +5,7 @@ import android.content.Context; | @@ -5,6 +5,7 @@ import android.content.Context; | ||
5 | import android.support.annotation.DrawableRes; | 5 | import android.support.annotation.DrawableRes; |
6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
7 | import android.util.AttributeSet; | 7 | import android.util.AttributeSet; |
8 | +import android.util.Log; | ||
8 | import android.view.View; | 9 | import android.view.View; |
9 | import android.widget.FrameLayout; | 10 | import android.widget.FrameLayout; |
10 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
468 Bytes
app/src/main/res/layout/activity_personinfo.xml
@@ -27,14 +27,14 @@ | @@ -27,14 +27,14 @@ | ||
27 | android:layout_height="180dp" | 27 | android:layout_height="180dp" |
28 | android:background="@drawable/backgroud_top" | 28 | android:background="@drawable/backgroud_top" |
29 | android:orientation="vertical" | 29 | android:orientation="vertical" |
30 | - android:paddingTop="20dp"> | ||
31 | - | 30 | + > |
32 | <TextView | 31 | <TextView |
33 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
34 | - android:layout_height="wrap_content" | 33 | + android:layout_height="?android:actionBarSize" |
35 | android:layout_gravity="center" | 34 | android:layout_gravity="center" |
36 | android:gravity="center" | 35 | android:gravity="center" |
37 | android:text="个人资料" | 36 | android:text="个人资料" |
37 | + android:background="@color/back_top" | ||
38 | android:textColor="@color/white" | 38 | android:textColor="@color/white" |
39 | android:textSize="@dimen/txtsize_headline" /> | 39 | android:textSize="@dimen/txtsize_headline" /> |
40 | 40 | ||
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | android:layout_width="100dp" | 52 | android:layout_width="100dp" |
53 | android:layout_height="100dp" | 53 | android:layout_height="100dp" |
54 | android:src="@color/white" | 54 | android:src="@color/white" |
55 | - app:riv_corner_radius="20dp" | 55 | + app:riv_corner_radius="50dp" |
56 | app:riv_oval="false" | 56 | app:riv_oval="false" |
57 | /> | 57 | /> |
58 | </FrameLayout> | 58 | </FrameLayout> |
app/src/main/res/layout/activity_select_school.xml
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | android:layout_width="wrap_content" | 19 | android:layout_width="wrap_content" |
20 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
21 | android:drawablePadding="@dimen/size_dp_5" | 21 | android:drawablePadding="@dimen/size_dp_5" |
22 | - android:drawableRight="@drawable/pull" | 22 | + android:drawableRight="@drawable/pull_black" |
23 | android:gravity="center" | 23 | android:gravity="center" |
24 | android:paddingLeft="@dimen/size_dp_15" | 24 | android:paddingLeft="@dimen/size_dp_15" |
25 | android:text="杭州" | 25 | android:text="杭州" |
app/src/main/res/layout/fragment_ce_ping.xml
@@ -174,6 +174,7 @@ | @@ -174,6 +174,7 @@ | ||
174 | android:layout_width="match_parent" | 174 | android:layout_width="match_parent" |
175 | android:layout_height="match_parent" | 175 | android:layout_height="match_parent" |
176 | android:scaleType="fitXY" | 176 | android:scaleType="fitXY" |
177 | + android:src="@drawable/activite1" | ||
177 | android:id="@+id/ivCourse1" | 178 | android:id="@+id/ivCourse1" |
178 | /> | 179 | /> |
179 | <LinearLayout | 180 | <LinearLayout |
@@ -228,6 +229,7 @@ | @@ -228,6 +229,7 @@ | ||
228 | android:layout_height="match_parent" | 229 | android:layout_height="match_parent" |
229 | android:scaleType="fitXY" | 230 | android:scaleType="fitXY" |
230 | android:background="@drawable/shape_xueqing_radius8" | 231 | android:background="@drawable/shape_xueqing_radius8" |
232 | + android:src="@drawable/activite2" | ||
231 | android:id="@+id/ivCourse2" | 233 | android:id="@+id/ivCourse2" |
232 | /> | 234 | /> |
233 | <LinearLayout | 235 | <LinearLayout |
@@ -275,6 +277,7 @@ | @@ -275,6 +277,7 @@ | ||
275 | android:layout_height="match_parent" | 277 | android:layout_height="match_parent" |
276 | android:scaleType="fitXY" | 278 | android:scaleType="fitXY" |
277 | android:background="@drawable/shape_xueqing_radius8" | 279 | android:background="@drawable/shape_xueqing_radius8" |
280 | + android:src="@drawable/activite3" | ||
278 | android:id="@+id/ivCourse3" | 281 | android:id="@+id/ivCourse3" |
279 | /> | 282 | /> |
280 | <LinearLayout | 283 | <LinearLayout |
app/src/main/res/layout/fragment_mine.xml
@@ -14,15 +14,15 @@ | @@ -14,15 +14,15 @@ | ||
14 | 14 | ||
15 | <LinearLayout | 15 | <LinearLayout |
16 | android:id="@+id/top_layout" | 16 | android:id="@+id/top_layout" |
17 | - android:paddingTop="20dp" | ||
18 | android:layout_width="match_parent" | 17 | android:layout_width="match_parent" |
19 | android:layout_height="180dp" | 18 | android:layout_height="180dp" |
20 | android:background="@color/back_top" | 19 | android:background="@color/back_top" |
21 | android:orientation="vertical"> | 20 | android:orientation="vertical"> |
22 | 21 | ||
22 | + | ||
23 | <TextView | 23 | <TextView |
24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
25 | - android:layout_height="wrap_content" | 25 | + android:layout_height="?android:actionBarSize" |
26 | android:layout_gravity="center" | 26 | android:layout_gravity="center" |
27 | android:gravity="center" | 27 | android:gravity="center" |
28 | android:text="个人中心" | 28 | android:text="个人中心" |
@@ -37,11 +37,11 @@ | @@ -37,11 +37,11 @@ | ||
37 | 37 | ||
38 | <com.makeramen.roundedimageview.RoundedImageView | 38 | <com.makeramen.roundedimageview.RoundedImageView |
39 | android:id="@+id/user_photo" | 39 | android:id="@+id/user_photo" |
40 | - android:layout_width="60dp" | ||
41 | - android:layout_height="60dp" | 40 | + android:layout_width="80dp" |
41 | + android:layout_height="80dp" | ||
42 | android:layout_margin="20dp" | 42 | android:layout_margin="20dp" |
43 | android:src="@drawable/user_imge_defult" | 43 | android:src="@drawable/user_imge_defult" |
44 | - app:riv_corner_radius="10dp" /> | 44 | + app:riv_corner_radius="40dp" /> |
45 | 45 | ||
46 | <LinearLayout | 46 | <LinearLayout |
47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
mvpsdk/src/main/java/com/share/mvpsdk/helper/okhttp/CacheInterceptor.java
@@ -24,9 +24,9 @@ public class CacheInterceptor implements Interceptor { | @@ -24,9 +24,9 @@ public class CacheInterceptor implements Interceptor { | ||
24 | 24 | ||
25 | @Override | 25 | @Override |
26 | public Response intercept(Chain chain) throws IOException { | 26 | public Response intercept(Chain chain) throws IOException { |
27 | - try { | ||
28 | 27 | ||
29 | Request request = chain.request(); | 28 | Request request = chain.request(); |
29 | + Response response = chain.proceed(request); | ||
30 | if (NetworkConnectionUtils.isNetworkConnected(AppUtils.getContext())) { | 30 | if (NetworkConnectionUtils.isNetworkConnected(AppUtils.getContext())) { |
31 | // 有网络时, 缓存1小时 | 31 | // 有网络时, 缓存1小时 |
32 | int maxAge = 60 * 60; | 32 | int maxAge = 60 * 60; |
@@ -35,7 +35,7 @@ public class CacheInterceptor implements Interceptor { | @@ -35,7 +35,7 @@ public class CacheInterceptor implements Interceptor { | ||
35 | .header("User-Agent", getUserAgent()) | 35 | .header("User-Agent", getUserAgent()) |
36 | .build(); | 36 | .build(); |
37 | 37 | ||
38 | - Response response = chain.proceed(request); | 38 | +// Response response = chain.proceed(request); |
39 | return response.newBuilder() | 39 | return response.newBuilder() |
40 | .removeHeader("Pragma") | 40 | .removeHeader("Pragma") |
41 | .removeHeader("Cache-Control") | 41 | .removeHeader("Cache-Control") |
@@ -50,17 +50,12 @@ public class CacheInterceptor implements Interceptor { | @@ -50,17 +50,12 @@ public class CacheInterceptor implements Interceptor { | ||
50 | .header("User-Agent", getUserAgent()) | 50 | .header("User-Agent", getUserAgent()) |
51 | .build(); | 51 | .build(); |
52 | 52 | ||
53 | - Response response = chain.proceed(request); | ||
54 | return response.newBuilder() | 53 | return response.newBuilder() |
55 | .removeHeader("Pragma") | 54 | .removeHeader("Pragma") |
56 | .removeHeader("Cache-Control") | 55 | .removeHeader("Cache-Control") |
57 | .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) | 56 | .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) |
58 | .build(); | 57 | .build(); |
59 | } | 58 | } |
60 | - }catch (Exception e){ | ||
61 | - e.printStackTrace(); | ||
62 | - return null; | ||
63 | - } | ||
64 | // Request request = chain.request(); | 59 | // Request request = chain.request(); |
65 | // if (!NetworkConnectionUtils.isConnected(AppUtils.getContext())) { | 60 | // if (!NetworkConnectionUtils.isConnected(AppUtils.getContext())) { |
66 | // request = request.newBuilder() | 61 | // request = request.newBuilder() |