Commit 0118d64149b3e2c1da3b7087a9d19af158f8816d
1 parent
6a922153
Exists in
yxb_dev
and in
2 other branches
no message
Showing
17 changed files
with
116 additions
and
71 deletions
Show diff stats
app/src/main/AndroidManifest.xml
| ... | ... | @@ -113,6 +113,7 @@ |
| 113 | 113 | android:value="1d130afb822d8a1019e6592cbaf10bcc"/> |
| 114 | 114 | |
| 115 | 115 | <activity android:name=".ui.activity.StartActivity" |
| 116 | + android:launchMode="singleInstance" | |
| 116 | 117 | android:windowSoftInputMode="adjustPan|stateAlwaysHidden"> |
| 117 | 118 | <intent-filter> |
| 118 | 119 | <action android:name="android.intent.action.MAIN"/> |
| ... | ... | @@ -126,44 +127,61 @@ |
| 126 | 127 | <!--android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />--> |
| 127 | 128 | <activity |
| 128 | 129 | android:name=".ui.activity.MyChildActivity" |
| 130 | + android:launchMode="singleInstance" | |
| 129 | 131 | android:screenOrientation="portrait"/> |
| 130 | 132 | <activity android:name=".ui.activity.consult.ConsultOneLevelActivity"/> |
| 131 | 133 | <!-- <activity android:name=".ui.activity.LoginAndRegistActivity" /> --> |
| 132 | 134 | <activity |
| 133 | 135 | android:name=".ui.MainActivity" |
| 136 | + android:launchMode="singleInstance" | |
| 137 | + android:windowSoftInputMode="adjustPan|stateAlwaysHidden" | |
| 134 | 138 | android:screenOrientation="portrait"/> |
| 135 | 139 | <activity |
| 136 | 140 | android:name=".ui.activity.ChildDetialActivity" |
| 141 | + android:launchMode="singleInstance" | |
| 137 | 142 | android:screenOrientation="portrait" /> |
| 138 | 143 | <activity |
| 139 | 144 | android:name=".ui.activity.binding.CreateChildInfoActivity" |
| 145 | + android:launchMode="singleInstance" | |
| 140 | 146 | android:screenOrientation="portrait" |
| 141 | 147 | android:windowSoftInputMode="adjustPan|stateHidden"/> |
| 142 | 148 | <activity |
| 143 | 149 | android:name=".ui.activity.binding.SelectSchoolActivity" |
| 150 | + android:launchMode="singleInstance" | |
| 144 | 151 | android:screenOrientation="portrait" |
| 145 | 152 | android:windowSoftInputMode="adjustPan|stateHidden"/> |
| 146 | 153 | |
| 147 | 154 | <activity android:name=".ui.activity.LoginAndRegistActivity" |
| 155 | + android:launchMode="singleInstance" | |
| 148 | 156 | android:screenOrientation="portrait" |
| 149 | 157 | /> |
| 150 | 158 | <activity |
| 151 | 159 | android:name=".ui.activity.PersonInfoActivity" |
| 160 | + android:launchMode="singleInstance" | |
| 152 | 161 | android:screenOrientation="portrait" |
| 153 | 162 | android:windowSoftInputMode="adjustPan|stateHidden"/> |
| 163 | + | |
| 154 | 164 | <activity |
| 155 | 165 | android:name=".ui.activity.binding.CheckInfoActivity" |
| 166 | + android:launchMode="singleInstance" | |
| 156 | 167 | android:screenOrientation="portrait" |
| 157 | 168 | android:windowSoftInputMode="adjustPan|stateHidden"/> |
| 169 | + | |
| 158 | 170 | <activity |
| 159 | 171 | android:name=".ui.activity.binding.InviteCodeActivity" |
| 160 | - | |
| 172 | + android:launchMode="singleInstance" | |
| 161 | 173 | android:screenOrientation="portrait" /> |
| 174 | + | |
| 162 | 175 | <activity |
| 163 | 176 | android:name=".ui.activity.mywebview.WebViewActivity" |
| 177 | + android:launchMode="singleInstance" | |
| 164 | 178 | android:screenOrientation="portrait" /> |
| 165 | - <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity" /> | |
| 166 | - <activity android:name=".ui.activity.orderdetail.OrderDetailActivity" /> | |
| 179 | + | |
| 180 | + <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity" | |
| 181 | + android:launchMode="singleInstance"/> | |
| 182 | + | |
| 183 | + <activity android:name=".ui.activity.orderdetail.OrderDetailActivity" | |
| 184 | + android:launchMode="singleInstance"/> | |
| 167 | 185 | </application> |
| 168 | 186 | |
| 169 | 187 | </manifest> |
| 170 | 188 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/parent/AppConfig.java
| ... | ... | @@ -38,6 +38,7 @@ public class AppConfig { |
| 38 | 38 | public static String BASE_URL="http://60.190.202.57:1000/"; |
| 39 | 39 | public static String BASE_URL_IMG="http://60.190.202.57:1000"; |
| 40 | 40 | public static String BASE_URL_ORDER="http://60.190.202.57:8101/"; |
| 41 | + public static String BASE_URL_FILE="http://60.190.202.57:8196"; | |
| 41 | 42 | |
| 42 | 43 | |
| 43 | 44 | //默认日志保存的路径 | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/ToolBean.java
| ... | ... | @@ -34,8 +34,12 @@ public class ToolBean implements Serializable { |
| 34 | 34 | @Override |
| 35 | 35 | public String toString() { |
| 36 | 36 | return "ToolBean{" + |
| 37 | - "toolImg='" + toolImage + '' + | |
| 37 | + "toolImage='" + toolImage + '' + | |
| 38 | 38 | ", toolName='" + toolName + '\'' + |
| 39 | + ", toolUrl='" + toolUrl + '\'' + | |
| 40 | + ", toolId='" + toolId + '\'' + | |
| 41 | + ", columnType='" + columnType + '\'' + | |
| 42 | + ", orderById='" + orderById + '\'' + | |
| 39 | 43 | '}'; |
| 40 | 44 | } |
| 41 | 45 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/ceping/CePingPresenter.java
| 1 | 1 | package com.shunzhi.parent.presenter.ceping; |
| 2 | 2 | |
| 3 | +import android.util.Log; | |
| 3 | 4 | import android.view.View; |
| 4 | 5 | import android.widget.LinearLayout; |
| 5 | 6 | |
| ... | ... | @@ -18,6 +19,7 @@ import java.util.ArrayList; |
| 18 | 19 | import java.util.List; |
| 19 | 20 | |
| 20 | 21 | import io.reactivex.functions.Consumer; |
| 22 | +import timber.log.Timber; | |
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | 25 | * Created by ToaHanDong on 2018/3/14. | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
| ... | ... | @@ -68,7 +68,6 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
| 68 | 68 | mRxManager.register(mIModel.getBanners(position, areaName).subscribe(new Consumer<JsonObject>() { |
| 69 | 69 | @Override |
| 70 | 70 | public void accept(JsonObject jsonObject) throws Exception { |
| 71 | - Log.d("666666","getBanners="+jsonObject.toString()); | |
| 72 | 71 | if (jsonObject.get("status").getAsString().equals("1")) { |
| 73 | 72 | JsonArray jsonArray = jsonObject.getAsJsonArray("data"); |
| 74 | 73 | List<GuangGaoBean> guangGaoBeanList = new ArrayList<>(); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
| ... | ... | @@ -7,6 +7,7 @@ import android.os.Bundle; |
| 7 | 7 | import android.support.v7.widget.RecyclerView; |
| 8 | 8 | import android.view.View; |
| 9 | 9 | import android.widget.EditText; |
| 10 | +import android.widget.FrameLayout; | |
| 10 | 11 | import android.widget.ImageView; |
| 11 | 12 | import android.widget.TextView; |
| 12 | 13 | |
| ... | ... | @@ -15,6 +16,7 @@ import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
| 15 | 16 | import com.shunzhi.parent.R; |
| 16 | 17 | import com.shunzhi.parent.adapter.MyConsultAdapter; |
| 17 | 18 | import com.shunzhi.parent.bean.MyConsultBean; |
| 19 | +import com.shunzhi.parent.ui.fragment.consult.ConsultTwoLevelFragment; | |
| 18 | 20 | |
| 19 | 21 | import java.util.ArrayList; |
| 20 | 22 | import java.util.List; |
| ... | ... | @@ -32,6 +34,10 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi |
| 32 | 34 | EditText et_search; |
| 33 | 35 | |
| 34 | 36 | String channel; |
| 37 | + | |
| 38 | + FrameLayout frame_consult_two; | |
| 39 | + | |
| 40 | + ConsultTwoLevelFragment consultTwoLevelFragment=null; | |
| 35 | 41 | @Override |
| 36 | 42 | protected void initView(Bundle savedInstanceState) { |
| 37 | 43 | initViews(); |
| ... | ... | @@ -47,12 +53,20 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi |
| 47 | 53 | channel=getIntent().getStringExtra("channel"); |
| 48 | 54 | ivBack = findViewById(R.id.ivBack); |
| 49 | 55 | ivBack.setOnClickListener(this); |
| 56 | + frame_consult_two=findViewById(R.id.frame_consult_two); | |
| 50 | 57 | |
| 51 | 58 | et_search = findViewById(R.id.et_search); |
| 52 | 59 | |
| 53 | 60 | ivSearch = findViewById(R.id.ivSearch); |
| 54 | 61 | ivSearch.setOnClickListener(this); |
| 55 | 62 | |
| 63 | + consultTwoLevelFragment=new ConsultTwoLevelFragment(); | |
| 64 | + Bundle bundle=new Bundle(); | |
| 65 | + bundle.putString("channel",channel); | |
| 66 | + consultTwoLevelFragment.setArguments(bundle); | |
| 67 | + getSupportFragmentManager().beginTransaction().add(R.id.frame_consult_two,consultTwoLevelFragment) | |
| 68 | + .show(consultTwoLevelFragment).commit(); | |
| 69 | + | |
| 56 | 70 | } |
| 57 | 71 | |
| 58 | 72 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
| ... | ... | @@ -19,6 +19,7 @@ import android.widget.TextView; |
| 19 | 19 | import com.share.mvpsdk.base.activity.BaseCompatActivity; |
| 20 | 20 | import com.share.mvpsdk.utils.AppUtils; |
| 21 | 21 | import com.share.mvpsdk.utils.NetworkConnectionUtils; |
| 22 | +import com.share.mvpsdk.utils.ToastUtils; | |
| 22 | 23 | import com.share.mvpsdk.widgets.NestedScrollWebView; |
| 23 | 24 | import com.shunzhi.parent.AppConfig; |
| 24 | 25 | import com.shunzhi.parent.R; |
| ... | ... | @@ -110,6 +111,7 @@ public class WebViewActivity extends BaseCompatActivity { |
| 110 | 111 | |
| 111 | 112 | initWebView(); |
| 112 | 113 | initWebSetting(nesteScrollWebView.getSettings()); |
| 114 | + ToastUtils.showToast(getIntent().getStringExtra("url")); | |
| 113 | 115 | nesteScrollWebView.loadUrl(getIntent().getStringExtra("url")); |
| 114 | 116 | } |
| 115 | 117 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/orderdetail/OrderDetailActivity.java
| ... | ... | @@ -127,7 +127,7 @@ public class OrderDetailActivity extends BaseMVPCompatActivity<OrderDetailContra |
| 127 | 127 | public void onItemClickListener(Object object, int position) { |
| 128 | 128 | OrderDetailBeanList orderDetailBeanList= (OrderDetailBeanList) object; |
| 129 | 129 | WebViewActivity.getInstance(OrderDetailActivity.this, |
| 130 | - AppConfig.BASE_URL_ORDER+"OrderDetail.aspx?orderid="+orderDetailBeanList.orderId,-1); | |
| 130 | + AppConfig.BASE_URL_ORDER+"OrderDetail.aspx?orderid="+orderDetailBeanList.id,-1); | |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | 133 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
| ... | ... | @@ -98,10 +98,10 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
| 98 | 98 | @Override |
| 99 | 99 | public void onResume() { |
| 100 | 100 | super.onResume(); |
| 101 | - if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
| 101 | +// if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
| 102 | 102 | tvLocalAddress.setText(AppContext.getInstance().cityName); |
| 103 | 103 | addTools(); |
| 104 | - } | |
| 104 | +// } | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | private void initListeners(View view) { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -133,11 +133,11 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 133 | 133 | public void onResume() { |
| 134 | 134 | super.onResume(); |
| 135 | 135 | xBanner.startAutoPlay(); |
| 136 | - if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
| 136 | +// if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
| 137 | 137 | tvLocalAddress.setText(AppContext.getInstance().cityName); |
| 138 | 138 | mPresenter.getBanners("2", AppContext.getInstance().district); |
| 139 | 139 | mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, 1); |
| 140 | - } | |
| 140 | +// } | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | @Override |
| ... | ... | @@ -194,7 +194,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 194 | 194 | @Override |
| 195 | 195 | public void showBanners(List<GuangGaoBean> guangGaoBeanList) { |
| 196 | 196 | for (int i = 0; i < guangGaoBeanList.size(); i++) { |
| 197 | - imgesUrl.add(AppConfig.BASE_URL_IMG + guangGaoBeanList.get(i).fileSrc); | |
| 197 | + imgesUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); | |
| 198 | 198 | describeList.add(guangGaoBeanList.get(i).describe); |
| 199 | 199 | } |
| 200 | 200 | initBanners(); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
| ... | ... | @@ -100,7 +100,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult |
| 100 | 100 | xBanner.setmAdapter(new XBanner.XBannerAdapter() { |
| 101 | 101 | @Override |
| 102 | 102 | public void loadBanner(XBanner banner, Object model, View view, int position) { |
| 103 | - Glide.with(getActivity()).load(imgUrl.get(position)).placeholder(R.drawable.ic_launcher_background) | |
| 103 | + Glide.with(getActivity()).load(AppConfig.BASE_URL_FILE+imgUrl.get(position)).placeholder(R.drawable.ic_launcher_background) | |
| 104 | 104 | .into((ImageView) view); |
| 105 | 105 | } |
| 106 | 106 | }); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
| ... | ... | @@ -181,7 +181,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 181 | 181 | |
| 182 | 182 | @Override |
| 183 | 183 | public void onBindViewHolder(GuangGaoBean object, int position) { |
| 184 | - Glide.with(getActivity()).load(AppConfig.BASE_URL_IMG + object.fileSrc).error(R.drawable.ic_launcher_foreground).into(iv_grally); | |
| 184 | + Glide.with(getActivity()).load(AppConfig.BASE_URL_FILE + object.fileSrc).error(R.drawable.ic_launcher_foreground).into(iv_grally); | |
| 185 | 185 | tv_grally_title.setText(object.describe + ""); |
| 186 | 186 | } |
| 187 | 187 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultTwoLevelFragment.java
| ... | ... | @@ -9,6 +9,8 @@ import android.widget.TextView; |
| 9 | 9 | |
| 10 | 10 | import com.share.mvpsdk.base.BasePresenter; |
| 11 | 11 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 12 | +import com.shunzhi.parent.AppConfig; | |
| 13 | +import com.shunzhi.parent.AppContext; | |
| 12 | 14 | import com.shunzhi.parent.R; |
| 13 | 15 | import com.shunzhi.parent.adapter.MyConsultAdapter; |
| 14 | 16 | import com.shunzhi.parent.bean.GuangGaoBean; |
| ... | ... | @@ -33,8 +35,8 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 33 | 35 | |
| 34 | 36 | MyConsultAdapter myConsultAdapter = null; |
| 35 | 37 | |
| 36 | - List<MyConsultBean> myConsultBeanList = new ArrayList<>(); | |
| 37 | 38 | |
| 39 | + String channel=""; | |
| 38 | 40 | @Override |
| 39 | 41 | public int getLayoutId() { |
| 40 | 42 | return R.layout.fragment_consult_two_level; |
| ... | ... | @@ -46,25 +48,11 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 46 | 48 | tvContentName.setText(""); |
| 47 | 49 | |
| 48 | 50 | recyclerView = view.findViewById(R.id.recyclerView); |
| 51 | + channel=getArguments().getString("channel"); | |
| 49 | 52 | |
| 50 | -// initRecyclerView(); | |
| 53 | + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel),0,1); | |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | -// private void initRecyclerView() { | |
| 54 | -// | |
| 55 | -// if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); | |
| 56 | -// for (int i = 0; i < 12; i++) { | |
| 57 | -// MyConsultBean myConsultBean = new MyConsultBean(); | |
| 58 | -// myConsultBean.consultCounts = i + ""; | |
| 59 | -// myConsultBean.consultContent = "咨询内容" + i; | |
| 60 | -// myConsultBean.consultTitle = "咨询标题" + i; | |
| 61 | -// myConsultBean.consultZhuanfaCounts = "转发:" + i; | |
| 62 | -// myConsultBeanList.add(myConsultBean); | |
| 63 | -// } | |
| 64 | -// myConsultAdapter.addAll(myConsultBeanList); | |
| 65 | -// recyclerView.setAdapter(myConsultAdapter); | |
| 66 | -// } | |
| 67 | - | |
| 68 | 56 | @NonNull |
| 69 | 57 | @Override |
| 70 | 58 | public BasePresenter initPresenter() { |
| ... | ... | @@ -83,7 +71,9 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 83 | 71 | |
| 84 | 72 | @Override |
| 85 | 73 | public void showConsultContent(List<ChannelContextBean> list) { |
| 86 | - | |
| 74 | + if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); | |
| 75 | + myConsultAdapter.addAll(list); | |
| 76 | + recyclerView.setAdapter(myConsultAdapter); | |
| 87 | 77 | } |
| 88 | 78 | |
| 89 | 79 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
| ... | ... | @@ -14,6 +14,8 @@ import android.widget.TextView; |
| 14 | 14 | |
| 15 | 15 | import com.bumptech.glide.Glide; |
| 16 | 16 | import com.share.mvpsdk.utils.DisplayUtils; |
| 17 | +import com.shunzhi.parent.AppConfig; | |
| 18 | +import com.shunzhi.parent.AppContext; | |
| 17 | 19 | import com.shunzhi.parent.R; |
| 18 | 20 | |
| 19 | 21 | |
| ... | ... | @@ -55,6 +57,7 @@ public class TextAndImgShowView extends LinearLayout { |
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | public void addImgs(String imgUrl){ |
| 60 | + if (!imgUrl.startsWith("http"))imgUrl= AppConfig.BASE_URL_FILE+imgUrl; | |
| 58 | 61 | Glide.with(getContext()).load(imgUrl).error(R.drawable.gxzt).into(image); |
| 59 | 62 | } |
| 60 | 63 | ... | ... |
app/src/main/res/layout/activity_consult_two_level.xml
app/src/main/res/layout/fragment_zi_xun.xml
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | android:orientation="vertical" |
| 7 | 7 | tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment"> |
| 8 | 8 | |
| 9 | - <include layout="@layout/layout_search"/> | |
| 9 | + <include layout="@layout/layout_search" /> | |
| 10 | 10 | |
| 11 | 11 | <com.stx.xhb.xbanner.XBanner |
| 12 | 12 | android:id="@+id/xBanner" |
| ... | ... | @@ -17,21 +17,20 @@ |
| 17 | 17 | <LinearLayout |
| 18 | 18 | android:layout_width="match_parent" |
| 19 | 19 | android:layout_height="wrap_content" |
| 20 | - android:paddingTop="@dimen/size_dp_10" | |
| 21 | 20 | android:layout_marginLeft="@dimen/size_dp_10" |
| 22 | 21 | android:layout_marginRight="@dimen/size_dp_10" |
| 23 | - > | |
| 22 | + android:paddingTop="@dimen/size_dp_10"> | |
| 24 | 23 | |
| 25 | -<include layout="@layout/layout_textandimgshow" | |
| 26 | - /> | |
| 24 | + <include layout="@layout/layout_textandimgshow" /> | |
| 27 | 25 | |
| 28 | 26 | </LinearLayout> |
| 27 | + | |
| 29 | 28 | <LinearLayout |
| 30 | 29 | android:layout_width="match_parent" |
| 31 | 30 | android:layout_height="wrap_content" |
| 31 | + android:orientation="vertical" | |
| 32 | 32 | android:paddingLeft="@dimen/size_dp_10" |
| 33 | - android:paddingRight="@dimen/size_dp_10" | |
| 34 | - android:orientation="vertical"> | |
| 33 | + android:paddingRight="@dimen/size_dp_10"> | |
| 35 | 34 | |
| 36 | 35 | <TextView |
| 37 | 36 | android:layout_width="match_parent" |
| ... | ... | @@ -44,12 +43,13 @@ |
| 44 | 43 | <LinearLayout |
| 45 | 44 | android:layout_width="match_parent" |
| 46 | 45 | android:layout_height="wrap_content"> |
| 47 | - <android.support.v7.widget.RecyclerView | |
| 48 | - android:id="@+id/recycler_content" | |
| 49 | - android:layout_width="match_parent" | |
| 50 | - android:layout_height="match_parent"> | |
| 51 | 46 | |
| 52 | - </android.support.v7.widget.RecyclerView> | |
| 47 | + <android.support.v7.widget.RecyclerView | |
| 48 | + android:id="@+id/recycler_content" | |
| 49 | + android:layout_width="match_parent" | |
| 50 | + android:layout_height="match_parent"> | |
| 51 | + | |
| 52 | + </android.support.v7.widget.RecyclerView> | |
| 53 | 53 | </LinearLayout> |
| 54 | 54 | </LinearLayout> |
| 55 | 55 | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/helper/RetrofitCreateHelper.java
| ... | ... | @@ -24,12 +24,13 @@ import retrofit2.converter.gson.GsonConverterFactory; |
| 24 | 24 | public class RetrofitCreateHelper { |
| 25 | 25 | private static final int TIMEOUT_READ = 20; |
| 26 | 26 | private static final int TIMEOUT_CONNECTION = 10; |
| 27 | - private static String Authorization="",token=""; | |
| 28 | - private static RetrofitCreateHelper retrofitCreateHelper=null; | |
| 27 | + private static String Authorization = "", token = ""; | |
| 28 | + private static RetrofitCreateHelper retrofitCreateHelper = null; | |
| 29 | 29 | private static final HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor() |
| 30 | 30 | .setLevel(HttpLoggingInterceptor.Level.BODY); |
| 31 | 31 | private static CacheInterceptor cacheInterceptor = new CacheInterceptor(); |
| 32 | - private static OkHttpClient.Builder okhttpClientBuilder=null; | |
| 32 | + private static OkHttpClient.Builder okhttpClientBuilder = null; | |
| 33 | + | |
| 33 | 34 | /*private static OkHttpClient okHttpClient = new OkHttpClient.Builder() |
| 34 | 35 | //SSL证书 |
| 35 | 36 | .sslSocketFactory(TrustManager.getUnsafeOkHttpClient()) |
| ... | ... | @@ -47,33 +48,39 @@ public class RetrofitCreateHelper { |
| 47 | 48 | //失败重连 |
| 48 | 49 | .retryOnConnectionFailure(true) |
| 49 | 50 | .build();*/ |
| 50 | - public static RetrofitCreateHelper getInstance(){ | |
| 51 | - if (null==retrofitCreateHelper){ | |
| 52 | - synchronized (RetrofitCreateHelper.class){ | |
| 53 | - if (null==retrofitCreateHelper)retrofitCreateHelper=new RetrofitCreateHelper(); | |
| 51 | + public static RetrofitCreateHelper getInstance() { | |
| 52 | + if (null == retrofitCreateHelper) { | |
| 53 | + synchronized (RetrofitCreateHelper.class) { | |
| 54 | + if (null == retrofitCreateHelper) retrofitCreateHelper = new RetrofitCreateHelper(); | |
| 54 | 55 | } |
| 55 | 56 | } |
| 56 | 57 | return retrofitCreateHelper; |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | - public RetrofitCreateHelper(){ | |
| 60 | - if (null==okhttpClientBuilder)okhttpClientBuilder=new OkHttpClient.Builder(); | |
| 61 | - okhttpClientBuilder.connectTimeout(10000,TimeUnit.SECONDS); | |
| 62 | - okhttpClientBuilder.addInterceptor(new Interceptor() { | |
| 63 | - @Override | |
| 64 | - public Response intercept(Chain chain) throws IOException { | |
| 65 | - Request original = chain.request(); | |
| 66 | - Request.Builder requestBuilder = original.newBuilder().header("Authorization", Authorization); | |
| 67 | - Request request = requestBuilder.build(); | |
| 68 | - return chain.proceed(request); | |
| 60 | + public RetrofitCreateHelper() { | |
| 61 | + try { | |
| 62 | + if (null == okhttpClientBuilder) { | |
| 63 | + okhttpClientBuilder = new OkHttpClient.Builder(); | |
| 64 | + okhttpClientBuilder.connectTimeout(10000, TimeUnit.SECONDS); | |
| 65 | + okhttpClientBuilder.addInterceptor(new Interceptor() { | |
| 66 | + @Override | |
| 67 | + public Response intercept(Chain chain) throws IOException { | |
| 68 | + Request original = chain.request(); | |
| 69 | + Request.Builder requestBuilder = original.newBuilder().header("Authorization", Authorization); | |
| 70 | + Request request = requestBuilder.build(); | |
| 71 | + return chain.proceed(request); | |
| 72 | + } | |
| 73 | + }); | |
| 74 | + okhttpClientBuilder.addNetworkInterceptor(cacheInterceptor); | |
| 75 | + okhttpClientBuilder.addInterceptor(interceptor); | |
| 69 | 76 | } |
| 70 | - }); | |
| 71 | - okhttpClientBuilder.addNetworkInterceptor(cacheInterceptor); | |
| 72 | - okhttpClientBuilder.addInterceptor(interceptor); | |
| 77 | + } catch (Exception e) { | |
| 78 | + e.printStackTrace(); | |
| 79 | + } | |
| 73 | 80 | } |
| 74 | 81 | |
| 75 | 82 | public <T> T createApi(Class<T> clazz, String url) { |
| 76 | - Authorization=token; | |
| 83 | + Authorization = token; | |
| 77 | 84 | Retrofit retrofit = new Retrofit.Builder() |
| 78 | 85 | .baseUrl(url) |
| 79 | 86 | .client(okhttpClientBuilder.build()) |
| ... | ... | @@ -83,7 +90,7 @@ public class RetrofitCreateHelper { |
| 83 | 90 | return retrofit.create(clazz); |
| 84 | 91 | } |
| 85 | 92 | |
| 86 | -// public static <T> T loginApi(Class<T> clazz, String url) { | |
| 93 | + // public static <T> T loginApi(Class<T> clazz, String url) { | |
| 87 | 94 | // Authorization= StringUtils.getSign(); |
| 88 | 95 | // okHttpClient.newBuilder().addInterceptor(new Interceptor() { |
| 89 | 96 | // @Override |
| ... | ... | @@ -103,13 +110,13 @@ public class RetrofitCreateHelper { |
| 103 | 110 | // .build(); |
| 104 | 111 | // return retrofit.create(clazz); |
| 105 | 112 | // } |
| 106 | - public void setAuthorization(String Authorization){ | |
| 107 | - this.token=Authorization; | |
| 113 | + public void setAuthorization(String Authorization) { | |
| 114 | + this.token = Authorization; | |
| 108 | 115 | } |
| 109 | 116 | |
| 110 | - public <T> T login(Class<T> clazz,String url){ | |
| 111 | - Authorization= StringUtils.getSign(); | |
| 112 | - Retrofit retrofit=new Retrofit.Builder() | |
| 117 | + public <T> T login(Class<T> clazz, String url) { | |
| 118 | + Authorization = StringUtils.getSign(); | |
| 119 | + Retrofit retrofit = new Retrofit.Builder() | |
| 113 | 120 | .client(okhttpClientBuilder.build()) |
| 114 | 121 | .baseUrl(url) |
| 115 | 122 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) |
| ... | ... | @@ -119,6 +126,5 @@ public class RetrofitCreateHelper { |
| 119 | 126 | } |
| 120 | 127 | |
| 121 | 128 | |
| 122 | - | |
| 123 | 129 | } |
| 124 | 130 | ... | ... |