Commit ae079afc548e0d852fc6f8c1535e410e4ee4084d
Exists in
yxb_dev
and in
2 other branches
Merge branch 'developer' into yxb_dev
# Conflicts: # app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java # app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java # app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultTwoLevelFragment.java # app/src/main/res/layout/activity_consult_two_level.xml # app/src/main/res/layout/fragment_zi_xun.xml
Showing
17 changed files
with
155 additions
and
82 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/ConsultOneLevelActivity.java
| ... | ... | @@ -3,39 +3,37 @@ package com.shunzhi.parent.ui.activity.consult; |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.content.Intent; |
| 5 | 5 | import android.support.v4.app.FragmentTransaction; |
| 6 | -import android.support.v7.app.AppCompatActivity; | |
| 7 | 6 | import android.os.Bundle; |
| 8 | 7 | import android.view.View; |
| 9 | 8 | import android.widget.EditText; |
| 10 | 9 | import android.widget.FrameLayout; |
| 11 | 10 | import android.widget.ImageView; |
| 12 | -import android.widget.TextView; | |
| 13 | 11 | |
| 14 | 12 | import com.share.mvpsdk.base.activity.BaseCompatActivity; |
| 15 | 13 | import com.share.mvpsdk.utils.ToastUtils; |
| 16 | 14 | import com.shunzhi.parent.R; |
| 17 | 15 | import com.shunzhi.parent.ui.fragment.consult.ConsultOneLevelFragment; |
| 18 | 16 | |
| 19 | -public class ConsultOneLevelActivity extends BaseCompatActivity implements View.OnClickListener{ | |
| 17 | +public class ConsultOneLevelActivity extends BaseCompatActivity implements View.OnClickListener { | |
| 20 | 18 | |
| 21 | - | |
| 22 | - public static void getInstance(Context context,String channel){ | |
| 23 | - Intent intent=new Intent(context,ConsultOneLevelActivity.class); | |
| 24 | - intent.putExtra("channel",channel); | |
| 19 | + public static void getInstance(Context context, String channel) { | |
| 20 | + Intent intent = new Intent(context, ConsultOneLevelActivity.class); | |
| 21 | + intent.putExtra("channel", channel); | |
| 25 | 22 | context.startActivity(intent); |
| 26 | 23 | } |
| 27 | 24 | |
| 28 | 25 | EditText et_search; |
| 29 | 26 | |
| 30 | - ImageView ivSearch,ivBack; | |
| 27 | + ImageView ivSearch, ivBack; | |
| 31 | 28 | |
| 32 | - String channel=""; | |
| 29 | + String channel = ""; | |
| 33 | 30 | |
| 34 | 31 | FrameLayout frame_consult; |
| 35 | 32 | |
| 36 | - FragmentTransaction fragmentTransaction=null; | |
| 33 | + FragmentTransaction fragmentTransaction = null; | |
| 34 | + | |
| 35 | + ConsultOneLevelFragment consultOneLevelFragment = null; | |
| 37 | 36 | |
| 38 | - ConsultOneLevelFragment consultOneLevelFragment=null; | |
| 39 | 37 | @Override |
| 40 | 38 | protected void initView(Bundle savedInstanceState) { |
| 41 | 39 | |
| ... | ... | @@ -45,22 +43,22 @@ public class ConsultOneLevelActivity extends BaseCompatActivity implements View. |
| 45 | 43 | |
| 46 | 44 | private void initViews() { |
| 47 | 45 | |
| 48 | - channel=getIntent().getStringExtra("channel"); | |
| 49 | - consultOneLevelFragment=new ConsultOneLevelFragment(); | |
| 50 | - et_search=findViewById(R.id.et_search); | |
| 51 | - ivSearch=findViewById(R.id.ivSearch); | |
| 52 | - ivBack=findViewById(R.id.ivBack); | |
| 53 | - frame_consult=findViewById(R.id.frame_consult); | |
| 46 | + channel = getIntent().getStringExtra("channel"); | |
| 47 | + consultOneLevelFragment = new ConsultOneLevelFragment(); | |
| 48 | + et_search = findViewById(R.id.et_search); | |
| 49 | + ivSearch = findViewById(R.id.ivSearch); | |
| 50 | + ivBack = findViewById(R.id.ivBack); | |
| 51 | + frame_consult = findViewById(R.id.frame_consult); | |
| 54 | 52 | |
| 55 | 53 | ivSearch.setOnClickListener(this); |
| 56 | 54 | ivBack.setOnClickListener(this); |
| 57 | 55 | |
| 58 | - Bundle bundle=new Bundle(); | |
| 59 | - bundle.putString("channel",channel); | |
| 56 | + Bundle bundle = new Bundle(); | |
| 57 | + bundle.putString("channel", channel); | |
| 60 | 58 | consultOneLevelFragment.setArguments(bundle); |
| 61 | - ToastUtils.showToast("channel="+channel); | |
| 62 | - fragmentTransaction=getSupportFragmentManager().beginTransaction(); | |
| 63 | - fragmentTransaction.add(R.id.frame_consult,consultOneLevelFragment) | |
| 59 | +// ToastUtils.showToast("channel=" + channel); | |
| 60 | + fragmentTransaction = getSupportFragmentManager().beginTransaction(); | |
| 61 | + fragmentTransaction.add(R.id.frame_consult, consultOneLevelFragment) | |
| 64 | 62 | .show(consultOneLevelFragment).commit(); |
| 65 | 63 | } |
| 66 | 64 | |
| ... | ... | @@ -71,9 +69,9 @@ public class ConsultOneLevelActivity extends BaseCompatActivity implements View. |
| 71 | 69 | |
| 72 | 70 | @Override |
| 73 | 71 | public void onClick(View view) { |
| 74 | - switch (view.getId()){ | |
| 72 | + switch (view.getId()) { | |
| 75 | 73 | case R.id.ivSearch: |
| 76 | - | |
| 74 | + consultOneLevelFragment.showSearchContent(et_search.getText().toString()); | |
| 77 | 75 | break; |
| 78 | 76 | case R.id.ivBack: |
| 79 | 77 | finish(); | ... | ... |
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
| ... | ... | @@ -70,7 +70,6 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
| 70 | 70 | |
| 71 | 71 | addTools(); |
| 72 | 72 | |
| 73 | - tvLocalAddress.setText(AppContext.getInstance().cityName); | |
| 74 | 73 | textAndImg_xqjc.setTextColor(R.color.white); |
| 75 | 74 | textAndImg_xqjc.setText("学情检测"); |
| 76 | 75 | textAndImg_xqjc.setImgs(R.drawable.xqjc, R.drawable.xqjc); |
| ... | ... | @@ -99,6 +98,10 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
| 99 | 98 | @Override |
| 100 | 99 | public void onResume() { |
| 101 | 100 | super.onResume(); |
| 101 | +// if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
| 102 | + tvLocalAddress.setText(AppContext.getInstance().cityName); | |
| 103 | + addTools(); | |
| 104 | +// } | |
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | private void initListeners(View view) { |
| ... | ... | @@ -125,7 +128,6 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
| 125 | 128 | return new CePingPresenter(); |
| 126 | 129 | } |
| 127 | 130 | |
| 128 | - | |
| 129 | 131 | @Override |
| 130 | 132 | public void onClick(View view) { |
| 131 | 133 | switch (view.getId()) { |
| ... | ... | @@ -175,7 +177,6 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
| 175 | 177 | mPresenter.getTools(layout_control, name.split(" ")[2]); |
| 176 | 178 | AppContext.getInstance().cityName=name.split(" ")[1]; |
| 177 | 179 | AppContext.getInstance().district=name.split(" ")[2]; |
| 178 | -// ToastUtils.showToast(name.split(" ")[2]); | |
| 179 | 180 | } |
| 180 | 181 | |
| 181 | 182 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -158,6 +158,11 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 158 | 158 | public void onResume() { |
| 159 | 159 | super.onResume(); |
| 160 | 160 | xBanner.startAutoPlay(); |
| 161 | +// if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){ | |
| 162 | + tvLocalAddress.setText(AppContext.getInstance().cityName); | |
| 163 | + mPresenter.getBanners("2", AppContext.getInstance().district); | |
| 164 | + mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, 1); | |
| 165 | +// } | |
| 161 | 166 | } |
| 162 | 167 | |
| 163 | 168 | @Override |
| ... | ... | @@ -214,7 +219,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 214 | 219 | @Override |
| 215 | 220 | public void showBanners(List<GuangGaoBean> guangGaoBeanList) { |
| 216 | 221 | for (int i = 0; i < guangGaoBeanList.size(); i++) { |
| 217 | - imgesUrl.add(AppConfig.BASE_URL_IMG + guangGaoBeanList.get(i).fileSrc); | |
| 222 | + imgesUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); | |
| 218 | 223 | describeList.add(guangGaoBeanList.get(i).describe); |
| 219 | 224 | } |
| 220 | 225 | initBanners(); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
| 1 | 1 | package com.shunzhi.parent.ui.fragment; |
| 2 | 2 | |
| 3 | +import android.app.AlertDialog; | |
| 4 | +import android.content.DialogInterface; | |
| 3 | 5 | import android.content.Intent; |
| 4 | 6 | import android.os.Bundle; |
| 5 | 7 | import android.support.annotation.NonNull; |
| ... | ... | @@ -13,6 +15,7 @@ import com.bumptech.glide.Glide; |
| 13 | 15 | import com.makeramen.roundedimageview.RoundedImageView; |
| 14 | 16 | import com.share.mvpsdk.base.BasePresenter; |
| 15 | 17 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 18 | +import com.share.mvpsdk.utils.CacheUtils; | |
| 16 | 19 | import com.share.mvpsdk.utils.ToastUtils; |
| 17 | 20 | import com.shunzhi.parent.AppConfig; |
| 18 | 21 | import com.shunzhi.parent.AppContext; |
| ... | ... | @@ -26,9 +29,11 @@ import com.shunzhi.parent.ui.activity.PersonInfoActivity; |
| 26 | 29 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
| 27 | 30 | import com.shunzhi.parent.ui.activity.orderdetail.OrderDetailActivity; |
| 28 | 31 | |
| 32 | +import static java.util.ResourceBundle.clearCache; | |
| 33 | + | |
| 29 | 34 | public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract.LoginPresenter, LoginAndRegisterContract.ILoginModel> |
| 30 | 35 | implements MineContract.IMineView, View.OnClickListener { |
| 31 | - LinearLayout childlayout, personinfo, layout_orderDetail, layout_order; | |
| 36 | + LinearLayout childlayout, personinfo, layout_orderDetail, layout_order,layout_cache; | |
| 32 | 37 | RoundedImageView user_photo; |
| 33 | 38 | TextView user_name, user_mobile, tvExit,binding_state; |
| 34 | 39 | |
| ... | ... | @@ -49,6 +54,8 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
| 49 | 54 | personinfo = view.findViewById(R.id.personinfo); |
| 50 | 55 | layout_order = view.findViewById(R.id.layout_order); |
| 51 | 56 | layout_orderDetail = view.findViewById(R.id.layout_orderDetail); |
| 57 | + layout_cache=view.findViewById(R.id.layout_cache); | |
| 58 | + layout_cache.setOnClickListener(this); | |
| 52 | 59 | childlayout.setOnClickListener(this); |
| 53 | 60 | personinfo.setOnClickListener(this); |
| 54 | 61 | layout_order.setOnClickListener(this); |
| ... | ... | @@ -109,11 +116,42 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
| 109 | 116 | case R.id.tvExit: |
| 110 | 117 | clearUerinfo(); |
| 111 | 118 | break; |
| 119 | + case R.id.layout_cache: | |
| 120 | + clearMyCache(); | |
| 121 | + break; | |
| 112 | 122 | default: |
| 113 | 123 | break; |
| 114 | 124 | } |
| 115 | 125 | } |
| 116 | 126 | |
| 127 | + private void clearMyCache() { | |
| 128 | + | |
| 129 | + AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()); | |
| 130 | + try { | |
| 131 | + builder.setMessage("清理缓存"+CacheUtils.getCacheSize(getActivity())+"") | |
| 132 | + .setPositiveButton("取消", new DialogInterface.OnClickListener() { | |
| 133 | + @Override | |
| 134 | + public void onClick(DialogInterface dialogInterface, int i) { | |
| 135 | + dialogInterface.dismiss(); | |
| 136 | + } | |
| 137 | + }) | |
| 138 | + .setNegativeButton("确定", new DialogInterface.OnClickListener() { | |
| 139 | + @Override | |
| 140 | + public void onClick(DialogInterface dialogInterface, int i) { | |
| 141 | + try { | |
| 142 | + CacheUtils.clearCache(getActivity()); | |
| 143 | + } catch (Exception e) { | |
| 144 | + e.printStackTrace(); | |
| 145 | + } | |
| 146 | + dialogInterface.dismiss(); | |
| 147 | + } | |
| 148 | + }); | |
| 149 | + } catch (Exception e) { | |
| 150 | + e.printStackTrace(); | |
| 151 | + } | |
| 152 | + builder.create().show(); | |
| 153 | + } | |
| 154 | + | |
| 117 | 155 | private void clearUerinfo() { |
| 118 | 156 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, ""); |
| 119 | 157 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, ""); | ... | ... |
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
| ... | ... | @@ -37,6 +37,8 @@ import com.shunzhi.parent.views.TextAndImgShowView; |
| 37 | 37 | import java.util.ArrayList; |
| 38 | 38 | import java.util.List; |
| 39 | 39 | |
| 40 | +import retrofit2.http.HEAD; | |
| 41 | + | |
| 40 | 42 | public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter, |
| 41 | 43 | ConsultOneContract.IConsultOneModel> implements View.OnClickListener, ConsultOneContract.IConsultOneView { |
| 42 | 44 | |
| ... | ... | @@ -49,12 +51,14 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 49 | 51 | |
| 50 | 52 | LinearLayout layout_control; |
| 51 | 53 | |
| 54 | + | |
| 52 | 55 | List<ChannelContextBean> myConsultBeanList = new ArrayList<>(); |
| 53 | 56 | boolean first=true; |
| 54 | 57 | |
| 55 | 58 | String channel = ""; |
| 56 | 59 | int pageIndex; |
| 57 | 60 | |
| 61 | + | |
| 58 | 62 | @Override |
| 59 | 63 | public int getLayoutId() { |
| 60 | 64 | return R.layout.fragment_consult_one_level; |
| ... | ... | @@ -89,7 +93,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 89 | 93 | ToastUtils.showToast(channel); |
| 90 | 94 | layout_control = view.findViewById(R.id.layout_control); |
| 91 | 95 | layout_control.measure(0, 0); |
| 92 | -// mPresenter.getTools(layout_control); | |
| 93 | 96 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); |
| 94 | 97 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); |
| 95 | 98 | recyclerViewConsultOne.setLayoutManager(new LinearLayoutManager(getActivity())); |
| ... | ... | @@ -116,25 +119,11 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 116 | 119 | |
| 117 | 120 | mPresenter.getBanners("3", AppContext.getInstance().district); |
| 118 | 121 | |
| 119 | -// initRecyclerViewConsult(); | |
| 120 | 122 | } |
| 121 | 123 | |
| 122 | -// private void initRecyclerViewConsult() { | |
| 123 | -// if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); | |
| 124 | -// if (null == myConsultBeanList) myConsultBeanList = new ArrayList<>(); | |
| 125 | -// else myConsultBeanList.clear(); | |
| 126 | -// for (int i = 0; i < 12; i++) { | |
| 127 | -// MyConsultBean myConsultBean = new MyConsultBean(); | |
| 128 | -// myConsultBean.consultCounts = i + ""; | |
| 129 | -// myConsultBean.consultContent = "咨询内容" + i; | |
| 130 | -// myConsultBean.consultTitle = "咨询标题" + i; | |
| 131 | -// myConsultBean.consultZhuanfaCounts = "转发:" + i; | |
| 132 | -// myConsultBeanList.add(myConsultBean); | |
| 133 | -// } | |
| 134 | -// myConsultAdapter.addAll(myConsultBeanList); | |
| 135 | -// recyclerViewConsultOne.setAdapter(myConsultAdapter); | |
| 136 | -// | |
| 137 | -// } | |
| 124 | + public void showSearchContent(String keyword) { | |
| 125 | + mPresenter.getInformationTopic(keyword, AppContext.getInstance().district, channel, "0", 1); | |
| 126 | + } | |
| 138 | 127 | |
| 139 | 128 | @NonNull |
| 140 | 129 | @Override |
| ... | ... | @@ -176,6 +165,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 176 | 165 | |
| 177 | 166 | @Override |
| 178 | 167 | public void showChannel(List<ChannelBean> list) { |
| 168 | + | |
| 179 | 169 | if(first) { |
| 180 | 170 | for (int i = 0; i < list.size(); i++) { |
| 181 | 171 | TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); | ... | ... |
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/fragment_mine.xml
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 | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/utils/CacheUtils.java
| ... | ... | @@ -96,6 +96,11 @@ public class CacheUtils { |
| 96 | 96 | cleanCustomCache(filepath); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | + public static void clearCache(Context context)throws Exception{ | |
| 100 | + File file=new File("/data/data/"+ context.getPackageName()); | |
| 101 | + cleanCustomCache(file.toString()); | |
| 102 | + } | |
| 103 | + | |
| 99 | 104 | public static String getCacheSize(Context context) throws Exception { |
| 100 | 105 | File file=new File("/data/data/"+ context.getPackageName()); |
| 101 | 106 | return getFormatSize(getFolderSize(file)); | ... | ... |