Commit 38b93710dcfeb1024d970dcda1a99fc2556d16da
1 parent
ab99c955
Exists in
yxb_dev
and in
2 other branches
no message
Showing
12 changed files
with
79 additions
and
40 deletions
 
Show diff stats
app/src/main/java/com/shunzhi/parent/AppConfig.java
| ... | ... | @@ -24,10 +24,11 @@ public class AppConfig { | 
| 24 | 24 | public static String PARENT_ID = "parent_id"; | 
| 25 | 25 | public static String NIM_CONFIG_VIBRATE = "nim_config_vibrate";//收到通知震动 | 
| 26 | 26 | public static String NIM_CONFIG_SOUND = "nim_config_sound";//收到通知响铃 | 
| 27 | + public static String ISBINDING="isbinding"; | |
| 27 | 28 | |
| 28 | 29 | |
| 29 | 30 | public static boolean ISLOGIN = false; | 
| 30 | - public static boolean ISBINDING = false; | |
| 31 | +// public static boolean ISBINDING = false; | |
| 31 | 32 | |
| 32 | 33 | public static int BINDING_SUCCESS_HEZUO = 1; | 
| 33 | 34 | public static int BINDING_SUCCESS_NOT = 2; | ... | ... | 
app/src/main/java/com/shunzhi/parent/AppContext.java
| ... | ... | @@ -15,6 +15,7 @@ import com.netease.nimlib.sdk.StatusBarNotificationConfig; | 
| 15 | 15 | import com.netease.nimlib.sdk.auth.LoginInfo; | 
| 16 | 16 | import com.share.mvpsdk.global.GlobalApplication; | 
| 17 | 17 | import com.amap.api.location.AMapLocationClientOption.AMapLocationMode; | 
| 18 | +import com.share.mvpsdk.helper.RetrofitCreateHelper; | |
| 18 | 19 | import com.shunzhi.parent.bean.message.DaoMaster; | 
| 19 | 20 | import com.shunzhi.parent.bean.message.DaoMaster.DevOpenHelper; | 
| 20 | 21 | import com.shunzhi.parent.bean.message.DaoSession; | 
| ... | ... | @@ -57,6 +58,7 @@ public class AppContext extends GlobalApplication { | 
| 57 | 58 | initMapLocal(); | 
| 58 | 59 | NIMClient.init(this, loginInfo(), options()); | 
| 59 | 60 | initDB(); | 
| 61 | + RetrofitCreateHelper.getInstance().setAuthorization(AppConfig.getAppConfig(this).get(AppConfig.ACCESS_TOKEN)); | |
| 60 | 62 | } | 
| 61 | 63 | |
| 62 | 64 | private void initDB() { | ... | ... | 
app/src/main/java/com/shunzhi/parent/manager/MessageManager.java
| ... | ... | @@ -79,9 +79,11 @@ public class MessageManager { | 
| 79 | 79 | public void onEvent(StatusCode statusCode) { | 
| 80 | 80 | if (statusCode == StatusCode.KICKOUT) { | 
| 81 | 81 | Context context = AppContext.getInstance(); | 
| 82 | -// Intent i = new Intent(context, LoginAndRegistActivity.class); | |
| 83 | -// i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 84 | -// context.startActivity(i); | |
| 82 | + Intent i = new Intent(context, LoginAndRegistActivity.class); | |
| 83 | + i.putExtra("type", "登录"); | |
| 84 | + i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 85 | + ToastUtils.showToast("请重新登录"); | |
| 86 | + context.startActivity(i); | |
| 85 | 87 | } | 
| 86 | 88 | } | 
| 87 | 89 | }, true); | ... | ... | 
app/src/main/java/com/shunzhi/parent/model/orderdetail/OrderDetailModel.java
| ... | ... | @@ -30,7 +30,7 @@ public class OrderDetailModel extends BaseModel implements OrderDetailContract.I | 
| 30 | 30 | @Override | 
| 31 | 31 | public Observable<JsonObject> getOrderDetails() { | 
| 32 | 32 | String user_id=AppConfig.getAppConfig(AppContext.getContext()).get(AppConfig.USER_ID); | 
| 33 | - Log.d("6666","user_id="+user_id); | |
| 33 | +// Log.d("6666","user_id="+user_id); | |
| 34 | 34 | return RetrofitCreateHelper.getInstance().createApi(OrderDetailApi.class, AppConfig.BASE_URL).getOrderDetail(user_id) | 
| 35 | 35 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 
| 36 | 36 | ... | ... | 
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
| ... | ... | @@ -55,7 +55,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | 
| 55 | 55 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.ACCESS_TOKEN, jsonObject.get("access_token").getAsString()); | 
| 56 | 56 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, loginName); | 
| 57 | 57 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, loginPwd); | 
| 58 | - RetrofitCreateHelper.getInstance().setAuthorization("Bearer " + jsonObject.get("access_token").getAsString()); | |
| 58 | + RetrofitCreateHelper.getInstance().setAuthorization(jsonObject.get("access_token").getAsString()); | |
| 59 | 59 | getUserInfo(loginName, 0, ""); | 
| 60 | 60 | } else { | 
| 61 | 61 | ToastUtils.showToast(jsonObject.get("error").getAsString()); | 
| ... | ... | @@ -167,8 +167,8 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | 
| 167 | 167 | AppConfig.getAppConfig(AppContext.getContext()).set(AppConfig.USER_ID, currentBean.getUserid()); | 
| 168 | 168 | |
| 169 | 169 | if (currentBean.getStudentClass() != null && currentBean.getStudentClass().size() > 0) { | 
| 170 | - Log.e("qqqq--==","qqqqq"); | |
| 171 | - AppConfig.ISBINDING = true; | |
| 170 | +// Log.e("qqqq--==","qqqqq"); | |
| 171 | + AppConfig.getAppConfig(mIView.getBindActivity()).set(AppConfig.ISBINDING,"1"); | |
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | 174 | String account = currentBean.getUserid(); | ... | ... | 
app/src/main/java/com/shunzhi/parent/presenter/mine/MyChildPresenter.java
| ... | ... | @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; | 
| 4 | 4 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; | 
| 5 | 5 | import com.share.mvpsdk.utils.ToastUtils; | 
| 6 | 6 | import com.shunzhi.parent.AppConfig; | 
| 7 | +import com.shunzhi.parent.AppContext; | |
| 7 | 8 | import com.shunzhi.parent.bean.ChildClass; | 
| 8 | 9 | import com.shunzhi.parent.bean.CurrentBean; | 
| 9 | 10 | import com.shunzhi.parent.bean.GradeBean; | 
| ... | ... | @@ -70,7 +71,7 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | 
| 70 | 71 | @Override | 
| 71 | 72 | public void accept(JsonObject jsonObject) throws Exception { | 
| 72 | 73 | ToastUtils.showToast("绑定孩子成功"); | 
| 73 | - AppConfig.ISBINDING=true; | |
| 74 | + AppConfig.getAppConfig(AppContext.getContext()).set(AppConfig.ISBINDING,"1"); | |
| 74 | 75 | if (jsonObject.get("data").toString().equals("null")) { | 
| 75 | 76 | mIView.addChildSuccess("", ""); | 
| 76 | 77 | } else { | ... | ... | 
app/src/main/java/com/shunzhi/parent/presenter/orederdetail/OrderDetailPresenter.java
| ... | ... | @@ -44,7 +44,7 @@ public class OrderDetailPresenter extends OrderDetailContract.OrderDetailPreente | 
| 44 | 44 | OrderDetailBean orderDetailBean=new Gson().fromJson(orderDetailObj,OrderDetailBean.class); | 
| 45 | 45 | orderDetailBeanList.add(orderDetailBean); | 
| 46 | 46 | } | 
| 47 | - Log.d("6666","orderDetailBeanList="+orderDetailBeanList); | |
| 47 | +// Log.d("6666","orderDetailBeanList="+orderDetailBeanList); | |
| 48 | 48 | mIView.showOrderDetais(orderDetailBeanList); | 
| 49 | 49 | }else { | 
| 50 | 50 | ToastUtils.showToast(jsonObject.get("message").getAsString()); | 
| ... | ... | @@ -53,7 +53,7 @@ public class OrderDetailPresenter extends OrderDetailContract.OrderDetailPreente | 
| 53 | 53 | }, new Consumer<Throwable>() { | 
| 54 | 54 | @Override | 
| 55 | 55 | public void accept(Throwable throwable) throws Exception { | 
| 56 | - Log.d("6666","throwable="+throwable.toString()); | |
| 56 | +// Log.d("6666","throwable="+throwable.toString()); | |
| 57 | 57 | } | 
| 58 | 58 | })); | 
| 59 | 59 | ... | ... | 
app/src/main/java/com/shunzhi/parent/ui/activity/orderdetail/OrderDetailActivity.java
| ... | ... | @@ -20,6 +20,7 @@ import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | 
| 20 | 20 | import com.share.mvpsdk.base.adapter.OnItemClickListener; | 
| 21 | 21 | import com.share.mvpsdk.utils.DateUtils; | 
| 22 | 22 | import com.share.mvpsdk.utils.DisplayUtils; | 
| 23 | +import com.share.mvpsdk.utils.ToastUtils; | |
| 23 | 24 | import com.shunzhi.parent.AppConfig; | 
| 24 | 25 | import com.shunzhi.parent.R; | 
| 25 | 26 | import com.shunzhi.parent.bean.orderdetail.OrderDetailBean; | ... | ... | 
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -146,6 +146,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 146 | 146 | xBanner.setmAdapter(new XBanner.XBannerAdapter() { | 
| 147 | 147 | @Override | 
| 148 | 148 | public void loadBanner(XBanner banner, Object model, View view, int position) { | 
| 149 | + if(position<=imgesUrl.size()-1) | |
| 149 | 150 | GlideUtils.showImg(getActivity(),(ImageView) view,imgesUrl.get(position)); | 
| 150 | 151 | } | 
| 151 | 152 | }); | ... | ... | 
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
| ... | ... | @@ -78,7 +78,12 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | 
| 78 | 78 | } | 
| 79 | 79 | |
| 80 | 80 | private void setPersonInfo() { | 
| 81 | - if (AppConfig.ISBINDING) { | |
| 81 | + | |
| 82 | + String useName=AppConfig.getAppConfig(getContext()).get(AppConfig.USER_NAME); | |
| 83 | + if (!TextUtils.isEmpty(useName))AppConfig.ISLOGIN=true; | |
| 84 | + else AppConfig.ISLOGIN=false; | |
| 85 | + | |
| 86 | + if (TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.ISBINDING))) { | |
| 82 | 87 | binding_state.setText(""); | 
| 83 | 88 | } | 
| 84 | 89 | if (AppConfig.ISLOGIN) { | ... | ... | 
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
| ... | ... | @@ -5,6 +5,7 @@ import android.os.CountDownTimer; | 
| 5 | 5 | import android.support.annotation.NonNull; | 
| 6 | 6 | import android.support.annotation.Nullable; | 
| 7 | 7 | import android.text.TextUtils; | 
| 8 | +import android.util.Log; | |
| 8 | 9 | import android.view.View; | 
| 9 | 10 | import android.widget.ImageView; | 
| 10 | 11 | import android.widget.TextView; | 
| ... | ... | @@ -71,18 +72,10 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | 
| 71 | 72 | jiecaoVideo.loadingProgressBar.setVisibility(View.GONE); | 
| 72 | 73 | countDownTimer.start(); | 
| 73 | 74 | isQidong = TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START)); | 
| 74 | - if (isQidong) { | |
| 75 | - jiecaoVideo.setVisibility(View.VISIBLE); | |
| 76 | - xBanner.setVisibility(View.GONE); | |
| 77 | - AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); | |
| 78 | -// mPresenter.getBanners("0", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district); | |
| 79 | - mPresenter.getBanners("0", ""); | |
| 80 | - } else { | |
| 81 | - jiecaoVideo.setVisibility(View.GONE); | |
| 82 | - xBanner.setVisibility(View.VISIBLE); | |
| 83 | - mPresenter.getBanners("1", ""); | |
| 84 | -// mPresenter.getBanners("1", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district); | |
| 85 | - } | |
| 75 | + | |
| 76 | + if (isQidong)mPresenter.getBanners("0", ""); | |
| 77 | + else mPresenter.getBanners("1", ""); | |
| 78 | +// showVideos(); | |
| 86 | 79 | |
| 87 | 80 | tvJump=view.findViewById(R.id.tvJump); | 
| 88 | 81 | |
| ... | ... | @@ -96,6 +89,20 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | 
| 96 | 89 | |
| 97 | 90 | } | 
| 98 | 91 | |
| 92 | + private void showVideos(){ | |
| 93 | + if (isQidong) { | |
| 94 | + jiecaoVideo.setVisibility(View.VISIBLE); | |
| 95 | + xBanner.setVisibility(View.GONE); | |
| 96 | +// mPresenter.getBanners("0", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district); | |
| 97 | + mPresenter.getBanners("0", ""); | |
| 98 | + } else { | |
| 99 | + jiecaoVideo.setVisibility(View.GONE); | |
| 100 | + xBanner.setVisibility(View.VISIBLE); | |
| 101 | + mPresenter.getBanners("1", ""); | |
| 102 | +// mPresenter.getBanners("1", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district); | |
| 103 | + } | |
| 104 | + } | |
| 105 | + | |
| 99 | 106 | @NonNull | 
| 100 | 107 | @Override | 
| 101 | 108 | public BasePresenter initPresenter() { | 
| ... | ... | @@ -121,36 +128,42 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | 
| 121 | 128 | public void showContext(List<ChannelContextBean> list) { | 
| 122 | 129 | |
| 123 | 130 | } | 
| 124 | - | |
| 131 | + List<String> imgUrl = new ArrayList<>(); | |
| 132 | + List<String> describeList = new ArrayList<>(); | |
| 125 | 133 | private void initBannes(List<GuangGaoBean> guangGaoBeanList) { | 
| 126 | 134 | try { | 
| 135 | + imgUrl = new ArrayList<>(); | |
| 136 | + describeList = new ArrayList<>(); | |
| 127 | 137 | if (isQidong) { | 
| 138 | + AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); | |
| 128 | 139 | String fileUrl = "", describe = ""; | 
| 129 | 140 | for (int i = 0; i < guangGaoBeanList.size(); i++) { | 
| 130 | 141 | if (guangGaoBeanList.get(i).fileSrc.contains(".mp4")) { | 
| 131 | 142 | fileUrl = AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc; | 
| 132 | 143 | describe = guangGaoBeanList.get(i).describe; | 
| 144 | + imgUrl.add(fileUrl); | |
| 145 | + describeList.add(describe); | |
| 146 | + }else { | |
| 147 | + imgUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); | |
| 148 | + describeList.add(guangGaoBeanList.get(i).describe); | |
| 133 | 149 | } | 
| 134 | 150 | } | 
| 135 | - jiecaoVideo.setUp(fileUrl, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, describe); | |
| 136 | - jiecaoVideo.startVideo(); | |
| 151 | +// Log.d("66666","fileUrl="+guangGaoBeanList); | |
| 152 | + if (!TextUtils.isEmpty(fileUrl)){ | |
| 153 | + jiecaoVideo.setUp(fileUrl, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, describe); | |
| 154 | + jiecaoVideo.startVideo(); | |
| 155 | + }else { | |
| 156 | + isQidong=false; | |
| 157 | + showVideos(); | |
| 158 | + showBanners(); | |
| 159 | + } | |
| 160 | + | |
| 137 | 161 | } else { | 
| 138 | - final List<String> imgUrl = new ArrayList<>(); | |
| 139 | - List<String> describeList = new ArrayList<>(); | |
| 140 | 162 | for (int i = 0; i < guangGaoBeanList.size(); i++) { | 
| 141 | 163 | imgUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); | 
| 142 | 164 | describeList.add(guangGaoBeanList.get(i).describe); | 
| 143 | 165 | } | 
| 144 | - xBanner.setData(imgUrl, describeList); | |
| 145 | - xBanner.stopAutoPlay(); | |
| 146 | - xBanner.setmAutoPalyTime(10000); | |
| 147 | - xBanner.setPointsIsVisible(false); | |
| 148 | - xBanner.setmAdapter(new XBanner.XBannerAdapter() { | |
| 149 | - @Override | |
| 150 | - public void loadBanner(XBanner banner, Object model, View view, int position) { | |
| 151 | - GlideUtils.showImg(getActivity(), (ImageView) view, imgUrl.get(position)); | |
| 152 | - } | |
| 153 | - }); | |
| 166 | + showBanners(); | |
| 154 | 167 | } | 
| 155 | 168 | |
| 156 | 169 | } catch (Exception e) { | 
| ... | ... | @@ -158,6 +171,19 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | 
| 158 | 171 | } | 
| 159 | 172 | } | 
| 160 | 173 | |
| 174 | + private void showBanners(){ | |
| 175 | + xBanner.setData(imgUrl, describeList); | |
| 176 | + xBanner.stopAutoPlay(); | |
| 177 | + xBanner.setmAutoPalyTime(10000); | |
| 178 | + xBanner.setPointsIsVisible(false); | |
| 179 | + xBanner.setmAdapter(new XBanner.XBannerAdapter() { | |
| 180 | + @Override | |
| 181 | + public void loadBanner(XBanner banner, Object model, View view, int position) { | |
| 182 | + GlideUtils.showImg(getActivity(), (ImageView) view, imgUrl.get(position)); | |
| 183 | + } | |
| 184 | + }); | |
| 185 | + } | |
| 186 | + | |
| 161 | 187 | @Override | 
| 162 | 188 | public void onDestroy() { | 
| 163 | 189 | super.onDestroy(); | ... | ... | 
mvpsdk/src/main/java/com/share/mvpsdk/helper/RetrofitCreateHelper.java
| ... | ... | @@ -111,7 +111,7 @@ public class RetrofitCreateHelper { | 
| 111 | 111 | // return retrofit.create(clazz); | 
| 112 | 112 | // } | 
| 113 | 113 | public void setAuthorization(String Authorization) { | 
| 114 | - this.token = Authorization; | |
| 114 | + this.token ="Bearer " + Authorization; | |
| 115 | 115 | } | 
| 116 | 116 | |
| 117 | 117 | public <T> T login(Class<T> clazz, String url) { | ... | ... |