网络拦截器添加areacode参数、商城取消订单选项bug修复

This commit is contained in:
itgaojian 2023-02-20 18:09:33 +08:00
parent 8dab7a7868
commit 33c4777168
9 changed files with 417 additions and 135 deletions

View File

@ -52,7 +52,9 @@ android {
sangzhuzi { sangzhuzi {
applicationId "com.tenlion.cultural.sangzhuzi" applicationId "com.tenlion.cultural.sangzhuzi"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "sangzhuzi" resValue ("string", "APP_CHANNEL", "sangzhuzi")
resValue ("string", "CITY_CODE", "540202000000")
resValue ("string", "CITY_ID", "640676")
manifestPlaceholders = [CHANNEL_VALUE: "sangzhuzi", manifestPlaceholders = [CHANNEL_VALUE: "sangzhuzi",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "640676", CITY_ID : "640676",
@ -64,6 +66,8 @@ android {
applicationId "com.tenlion.cultural.nanmulin" applicationId "com.tenlion.cultural.nanmulin"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "nanmulin" resValue "string", "APP_CHANNEL", "nanmulin"
resValue ("string", "CITY_CODE", "540221000000")
resValue ("string", "CITY_ID", "640865")
manifestPlaceholders = [CHANNEL_VALUE: "nanmulin", manifestPlaceholders = [CHANNEL_VALUE: "nanmulin",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "640865", CITY_ID : "640865",
@ -75,6 +79,8 @@ android {
applicationId "com.tenlion.cultural.jiangzi" applicationId "com.tenlion.cultural.jiangzi"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "jiangzi" resValue "string", "APP_CHANNEL", "jiangzi"
resValue ("string", "CITY_CODE", "540222000000")
resValue ("string", "CITY_ID", "641029")
manifestPlaceholders = [CHANNEL_VALUE: "jiangzi", manifestPlaceholders = [CHANNEL_VALUE: "jiangzi",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641029", CITY_ID : "641029",
@ -86,6 +92,8 @@ android {
applicationId "com.tenlion.cultural.dingri" applicationId "com.tenlion.cultural.dingri"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "dingri" resValue "string", "APP_CHANNEL", "dingri"
resValue ("string", "CITY_CODE", "540223000000")
resValue ("string", "CITY_ID", "641204")
manifestPlaceholders = [CHANNEL_VALUE: "dingri", manifestPlaceholders = [CHANNEL_VALUE: "dingri",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641204", CITY_ID : "641204",
@ -97,6 +105,8 @@ android {
applicationId "com.tenlion.cultural.sajia" applicationId "com.tenlion.cultural.sajia"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "sajia" resValue "string", "APP_CHANNEL", "sajia"
resValue ("string", "CITY_CODE", "540224000000")
resValue ("string", "CITY_ID", "641393")
manifestPlaceholders = [CHANNEL_VALUE: "sajia", manifestPlaceholders = [CHANNEL_VALUE: "sajia",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641393", CITY_ID : "641393",
@ -108,6 +118,8 @@ android {
applicationId "com.tenlion.cultural.lazi" applicationId "com.tenlion.cultural.lazi"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "lazi" resValue "string", "APP_CHANNEL", "lazi"
resValue ("string", "CITY_CODE", "540225000000")
resValue ("string", "CITY_ID", "641512")
manifestPlaceholders = [CHANNEL_VALUE: "lazi", manifestPlaceholders = [CHANNEL_VALUE: "lazi",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641512", CITY_ID : "641512",
@ -119,6 +131,8 @@ android {
applicationId "com.tenlion.cultural.angren" applicationId "com.tenlion.cultural.angren"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "angren" resValue "string", "APP_CHANNEL", "angren"
resValue ("string", "CITY_CODE", "540226000000")
resValue ("string", "CITY_ID", "641622")
manifestPlaceholders = [CHANNEL_VALUE: "angren", manifestPlaceholders = [CHANNEL_VALUE: "angren",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641622", CITY_ID : "641622",
@ -130,6 +144,8 @@ android {
applicationId "com.tenlion.cultural.xietongmen" applicationId "com.tenlion.cultural.xietongmen"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "xietongmen" resValue "string", "APP_CHANNEL", "xietongmen"
resValue ("string", "CITY_CODE", "540227000000")
resValue ("string", "CITY_ID", "641825")
manifestPlaceholders = [CHANNEL_VALUE: "xietongmen", manifestPlaceholders = [CHANNEL_VALUE: "xietongmen",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641825", CITY_ID : "641825",
@ -141,6 +157,8 @@ android {
applicationId "com.tenlion.cultural.bailang" applicationId "com.tenlion.cultural.bailang"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "bailang" resValue "string", "APP_CHANNEL", "bailang"
resValue ("string", "CITY_CODE", "540228000000")
resValue ("string", "CITY_ID", "641940")
manifestPlaceholders = [CHANNEL_VALUE: "bailang", manifestPlaceholders = [CHANNEL_VALUE: "bailang",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "641940", CITY_ID : "641940",
@ -152,6 +170,8 @@ android {
applicationId "com.tenlion.cultural.renbu" applicationId "com.tenlion.cultural.renbu"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "renbu" resValue "string", "APP_CHANNEL", "renbu"
resValue ("string", "CITY_CODE", "540229000000")
resValue ("string", "CITY_ID", "642063")
manifestPlaceholders = [CHANNEL_VALUE: "renbu", manifestPlaceholders = [CHANNEL_VALUE: "renbu",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642063", CITY_ID : "642063",
@ -163,6 +183,8 @@ android {
applicationId "com.tenlion.cultural.kangma" applicationId "com.tenlion.cultural.kangma"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "kangma" resValue "string", "APP_CHANNEL", "kangma"
resValue ("string", "CITY_CODE", "540230000000")
resValue ("string", "CITY_ID", "642146")
manifestPlaceholders = [CHANNEL_VALUE: "kangma", manifestPlaceholders = [CHANNEL_VALUE: "kangma",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642146", CITY_ID : "642146",
@ -174,6 +196,8 @@ android {
applicationId "com.tenlion.cultural.dingjie" applicationId "com.tenlion.cultural.dingjie"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "dingjie" resValue "string", "APP_CHANNEL", "dingjie"
resValue ("string", "CITY_CODE", "540231000000")
resValue ("string", "CITY_ID", "642203")
manifestPlaceholders = [CHANNEL_VALUE: "dingjie", manifestPlaceholders = [CHANNEL_VALUE: "dingjie",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642203", CITY_ID : "642203",
@ -185,6 +209,8 @@ android {
applicationId "com.tenlion.cultural.zhongba" applicationId "com.tenlion.cultural.zhongba"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "zhongba" resValue "string", "APP_CHANNEL", "zhongba"
resValue ("string", "CITY_CODE", "540232000000")
resValue ("string", "CITY_ID", "642284")
manifestPlaceholders = [CHANNEL_VALUE: "zhongba", manifestPlaceholders = [CHANNEL_VALUE: "zhongba",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642284", CITY_ID : "642284",
@ -196,6 +222,8 @@ android {
applicationId "com.tenlion.cultural.yadong" applicationId "com.tenlion.cultural.yadong"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "yadong" resValue "string", "APP_CHANNEL", "yadong"
resValue ("string", "CITY_CODE", "540233000000")
resValue ("string", "CITY_ID", "642356")
manifestPlaceholders = [CHANNEL_VALUE: "yadong", manifestPlaceholders = [CHANNEL_VALUE: "yadong",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642356", CITY_ID : "642356",
@ -207,6 +235,8 @@ android {
applicationId "com.tenlion.cultural.jilong" applicationId "com.tenlion.cultural.jilong"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "jilong" resValue "string", "APP_CHANNEL", "jilong"
resValue ("string", "CITY_CODE", "540234000000")
resValue ("string", "CITY_ID", "642389")
manifestPlaceholders = [CHANNEL_VALUE: "jilong", manifestPlaceholders = [CHANNEL_VALUE: "jilong",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642389", CITY_ID : "642389",
@ -218,6 +248,8 @@ android {
applicationId "com.tenlion.cultural.nielamu" applicationId "com.tenlion.cultural.nielamu"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "nielamu" resValue "string", "APP_CHANNEL", "nielamu"
resValue ("string", "CITY_CODE", "540235000000")
resValue ("string", "CITY_ID", "642437")
manifestPlaceholders = [CHANNEL_VALUE: "nielamu", manifestPlaceholders = [CHANNEL_VALUE: "nielamu",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642437", CITY_ID : "642437",
@ -229,6 +261,8 @@ android {
applicationId "com.tenlion.cultural.saga" applicationId "com.tenlion.cultural.saga"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "saga" resValue "string", "APP_CHANNEL", "saga"
resValue ("string", "CITY_CODE", "540236000000")
resValue ("string", "CITY_ID", "642489")
manifestPlaceholders = [CHANNEL_VALUE: "saga", manifestPlaceholders = [CHANNEL_VALUE: "saga",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642489", CITY_ID : "642489",
@ -240,6 +274,8 @@ android {
applicationId "com.tenlion.cultural.gangba" applicationId "com.tenlion.cultural.gangba"
dimension 'market' dimension 'market'
resValue "string", "APP_CHANNEL", "gangba" resValue "string", "APP_CHANNEL", "gangba"
resValue ("string", "CITY_CODE", "540237000000")
resValue ("string", "CITY_ID", "642536")
manifestPlaceholders = [CHANNEL_VALUE: "gangba", manifestPlaceholders = [CHANNEL_VALUE: "gangba",
APP_LOGO : "@drawable/app_logo", APP_LOGO : "@drawable/app_logo",
CITY_ID : "642536", CITY_ID : "642536",

View File

@ -12,7 +12,9 @@ import com.baidu.mapapi.SDKInitializer;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter; import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.sucstepsoft.cm_utils.core.widget.refresh.CustomRefreshHeader; import com.sucstepsoft.cm_utils.core.widget.refresh.CustomRefreshHeader;
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
import com.sucstepsoft.cm_utils.utils.toast.ToastUtils; import com.sucstepsoft.cm_utils.utils.toast.ToastUtils;
import com.tengshisoft.cultural.R;
import cn.jiguang.share.android.api.JShareInterface; import cn.jiguang.share.android.api.JShareInterface;
import cn.leo.magic.screen.MagicScreenAdapter; import cn.leo.magic.screen.MagicScreenAdapter;
@ -46,6 +48,12 @@ public class BaseMyApplication extends Application {
ToastUtils.init(this); ToastUtils.init(this);
ToastUtils.setGravity(Gravity.TOP, 0, 80); ToastUtils.setGravity(Gravity.TOP, 0, 80);
getConfigCityCode();
}
private void getConfigCityCode() {
UserLgUtils.setCityCode(this.getResources().getString(R.string.CITY_CODE));
UserLgUtils.setCityId(this.getResources().getString(R.string.CITY_ID));
} }
private void initShare() { private void initShare() {

View File

@ -37,12 +37,16 @@ public class AreaInterceptor implements Interceptor {
// String cityId = UserLgUtils.getCityId(); // String cityId = UserLgUtils.getCityId();
//判断是否需要添加 //判断是否需要添加
List<String> baseUrlName = originalRequest.headers("is_need_area"); List<String> baseUrlName = originalRequest.headers("is_need_area");
if (baseUrlName.size() <= 0) { if (baseUrlName.size() > 0) {
//需要添加 if(Boolean.parseBoolean(baseUrlName.get(0))){
HttpUrl modifiedUrl = originalRequest.url().newBuilder() //需要添加
.addPathSegment(areaCode) HttpUrl modifiedUrl = originalRequest.url().newBuilder()
.build(); .addPathSegment(areaCode)
request = originalRequest.newBuilder().url(modifiedUrl).build(); .build();
request = originalRequest.newBuilder().url(modifiedUrl).build();
}else{
request = originalRequest;
}
} else { } else {
request = originalRequest; request = originalRequest;
} }

View File

@ -56,7 +56,8 @@ public class BottomCancelOrderDialog extends Dialog {
private View view; private View view;
private List<BaseDictionaryBean> list; private List<BaseDictionaryBean> list;
private BottomCancelOrderDialog(Context context, boolean isCancelable, boolean isBackCancelable, int gravity, List<BaseDictionaryBean> list) { private BottomCancelOrderDialog(Context context, boolean isCancelable, boolean isBackCancelable, int gravity,
List<BaseDictionaryBean> list) {
super(context, R.style.dialog_full_screen); super(context, R.style.dialog_full_screen);
this.context = context; this.context = context;
this.gravity = gravity; this.gravity = gravity;
@ -74,10 +75,19 @@ public class BottomCancelOrderDialog extends Dialog {
EditText etRemark = view.findViewById(R.id.et_remark); EditText etRemark = view.findViewById(R.id.et_remark);
RecyclerView rlvReason = view.findViewById(R.id.rlv_reason); RecyclerView rlvReason = view.findViewById(R.id.rlv_reason);
rlvReason.setLayoutManager(new LinearLayoutManager(context)); rlvReason.setLayoutManager(new LinearLayoutManager(context));
if (list != null && list.size() > 0) {
list.get(0).setCheck(true);
}
DicSelAdapter adapter = new DicSelAdapter(context, list); DicSelAdapter adapter = new DicSelAdapter(context, list);
rlvReason.setAdapter(adapter); rlvReason.setAdapter(adapter);
adapter.addOnItemClickListener(baseDictionaryBean -> { adapter.addOnItemClickListener(baseDictionaryBean -> {
baseDictionaryBean.setCheck(!baseDictionaryBean.isCheck()); for (BaseDictionaryBean b : list) {
if (b.getDataId().equals(baseDictionaryBean.getDataId())) {
b.setCheck(true);
} else {
b.setCheck(false);
}
}
adapter.setData(list); adapter.setData(list);
}); });
tvCancel.setOnClickListener(v -> this.dismiss()); tvCancel.setOnClickListener(v -> this.dismiss());
@ -141,7 +151,8 @@ public class BottomCancelOrderDialog extends Dialog {
//请求获得焦点 //请求获得焦点
editText.requestFocus(); editText.requestFocus();
//调用系统输入法 //调用系统输入法
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager inputManager =
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(editText, 0); inputManager.showSoftInput(editText, 0);
} }
} }
@ -232,7 +243,8 @@ public class BottomCancelOrderDialog extends Dialog {
} }
public BottomCancelOrderDialog build() { public BottomCancelOrderDialog build() {
return new BottomCancelOrderDialog(this.mContext, this.isCancelable, this.mIsBackable, this.mGravity, this.list); return new BottomCancelOrderDialog(this.mContext, this.isCancelable, this.mIsBackable, this.mGravity,
this.list);
} }
} }

View File

@ -1,40 +1,74 @@
package com.tengshisoft.moduleactivity.activity; package com.tengshisoft.moduleactivity.activity;
import android.content.Intent; import android.graphics.Color;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.bumptech.glide.Glide; import com.alibaba.android.arouter.launcher.ARouter;
import com.google.android.material.tabs.TabLayout;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.sucstepsoft.cm_utils.constant.PathConfig; import com.sucstepsoft.cm_utils.constant.PathConfig;
import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean;
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity; import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
import com.sucstepsoft.cm_utils.utils.ExceptionHandler;
import com.tengshisoft.moduleactivity.R; import com.tengshisoft.moduleactivity.R;
import com.tengshisoft.moduleactivity.R2; import com.tengshisoft.moduleactivity.R2;
import com.tengshisoft.moduleijkplayer.controller.CompleteView; import com.tengshisoft.moduleactivity.adapter.ActivityAdapter;
import com.tengshisoft.moduleijkplayer.controller.ErrorView; import com.tengshisoft.moduleactivity.beans.ActivityListBeans;
import com.tengshisoft.moduleijkplayer.controller.GestureView; import com.tengshisoft.moduleactivity.net.ApiActivity;
import com.tengshisoft.moduleijkplayer.controller.LiveControlView;
import com.tengshisoft.moduleijkplayer.controller.PrepareView; import java.util.ArrayList;
import com.tengshisoft.moduleijkplayer.controller.StandardVideoController; import java.util.List;
import com.tengshisoft.moduleijkplayer.controller.TitleView;
import com.tengshisoft.moduleijkplayer.controller.VodControlView;
import com.tengshisoft.moduleijkplayer.player.VideoView;
import com.tengshisoft.moduleijkplayer.util.L;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.Unbinder; import butterknife.Unbinder;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/** /**
* 活动主页 * 活动主页
*/ */
@Route(path = PathConfig.PATH_MODULEACTIVITY_ACTIVITY_MAIN) @Route(path = PathConfig.PATH_MODULEACTIVITY_ACTIVITY_MAIN)
public class ActivityMainActivity extends BaseActivity { public class ActivityMainActivity extends BaseActivity {
public static final int STATE_LOAD = 1234;//加载中
public static final int STATE_ERROR = 1235;//加载失败
public static final int STATE_SUCCESS = 1236;//加载成功
public static final int STATE_EMPTY = 1237;//无数据
@BindView(R2.id.rlv_content)
RecyclerView mRlvContent;
@BindView(R2.id.xtl_type)
TabLayout mTlType;
@BindView(R2.id.pb_loading)
ProgressBar mPbLoading;
@BindView(R2.id.iv_empty)
ImageView mIvEmpty;
@BindView(R2.id.tv_hint)
TypeFaceTextView mTvHint;
@BindView(R2.id.srl_content) @BindView(R2.id.srl_content)
SmartRefreshLayout mLayout; SmartRefreshLayout mSrlContent;
@BindView(R2.id.vv_player)
VideoView mVvPlayer;
private Unbinder mBind; private Unbinder mBind;
private String mStatus;
private int mCurrentPageNo = 1;
private Disposable mD;
private List<ActivityListBeans.RowsBean> mDatas;
private ActivityAdapter mAdapter;
private int mTotalSize = 0;
private String mCurrentType;
private Typeface mTypeface;
@Override @Override
protected int setLayoutId() { protected int setLayoutId() {
@ -45,103 +79,228 @@ public class ActivityMainActivity extends BaseActivity {
public void initData() { public void initData() {
mBind = ButterKnife.bind(this); mBind = ButterKnife.bind(this);
mTvBaseTitle.setText("活动主页"); mTvBaseTitle.setText("活动主页");
refreshView(STATE_LOAD_SUCCESS); refreshView(STATE_LOAD_LOADING);
mLayout.setEnableRefresh(false); mTypeface = Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF");
mLayout.setEnableLoadMore(false); mDatas = new ArrayList<>();
StandardVideoController controller = new StandardVideoController(mActivity); getTypeList();
controller.setEnableOrientation(true); mAdapter = new ActivityAdapter(mActivity, mDatas);
PrepareView prepareView = new PrepareView(this);//准备播放界面 mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false));
ImageView thumb = prepareView.findViewById(R.id.thumb);//封面图 mRlvContent.setAdapter(mAdapter);
Glide.with(this).load(R.drawable.ic_img_default).into(thumb); mAdapter.addOnItemClickListener(this::showDetail);
controller.addControlComponent(prepareView); mSrlContent.setOnLoadMoreListener(refreshLayout -> {
prepareView.setClickStart(); if (mTotalSize > mDatas.size()) {
CompleteView completeView = new CompleteView(this); ++mCurrentPageNo;
controller.addControlComponent(completeView);//自动完成播放界面 mSrlContent.setNoMoreData(false);
ErrorView errorView = new ErrorView(this); getActivityListDataByType(mCurrentPageNo);
controller.addControlComponent(errorView);//错误界面 } else {
mSrlContent.finishLoadMore();
TitleView titleView = new TitleView(this);//标题栏 mSrlContent.setNoMoreData(true);
controller.addControlComponent(titleView);
//根据是否为直播设置不同的底部控制条
boolean isLive = false;
if (isLive) {
controller.addControlComponent(new LiveControlView(this));//直播控制条
} else {
VodControlView vodControlView = new VodControlView(this);//点播控制条
controller.addControlComponent(vodControlView);
}
GestureView gestureControlView = new GestureView(this);//滑动控制视图
controller.addControlComponent(gestureControlView);
controller.setCanChangePosition(!isLive);
//设置标题
titleView.setTitle("测试");
mVvPlayer.setVideoController(controller);
mVvPlayer.setUrl("rtmp://192.168.0.104:1935/live/device0001");
mVvPlayer.addOnStateChangeListener(mOnStateChangeListener);
mVvPlayer.start();
}
private VideoView.OnStateChangeListener mOnStateChangeListener = new VideoView.SimpleOnStateChangeListener() {
@Override
public void onPlayerStateChanged(int playerState) {
switch (playerState) {
case VideoView.PLAYER_NORMAL://小屏
break;
case VideoView.PLAYER_FULL_SCREEN://全屏
break;
} }
} });
mSrlContent.setOnRefreshListener(refreshLayout -> {
@Override if (!TextUtils.isEmpty(mCurrentType)) {
public void onPlayStateChanged(int playState) { mCurrentPageNo = 1;
switch (playState) { mTotalSize = 0;
case VideoView.STATE_IDLE: mDatas.clear();
break; getActivityListDataByType(mCurrentPageNo);
case VideoView.STATE_PREPARING: } else {
//在STATE_PREPARING时设置setMute(true)可实现静音播放 mSrlContent.finishRefresh();
// mVideoView.setMute(true);
break;
case VideoView.STATE_PREPARED:
break;
case VideoView.STATE_PLAYING:
//需在此时获取视频宽高
int[] videoSize = mVvPlayer.getVideoSize();
L.d("视频宽:" + videoSize[0]);
L.d("视频高:" + videoSize[1]);
break;
case VideoView.STATE_PAUSED:
break;
case VideoView.STATE_BUFFERING:
break;
case VideoView.STATE_BUFFERED:
break;
case VideoView.STATE_PLAYBACK_COMPLETED:
break;
case VideoView.STATE_ERROR:
break;
} }
});
}
private void getTypeList() {
RetrofitManager.getInstance()
.create(ApiActivity.class)
.getActivityTypeList("e36ad682-c6b4-44fe-a05c-889a5ff7c284")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<List<BaseDictionaryBean>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(List<BaseDictionaryBean> baseDictionaryBeans) {
if (baseDictionaryBeans != null && baseDictionaryBeans.size() > 0) {
for (int i = 0; i < baseDictionaryBeans.size(); i++) {
BaseDictionaryBean bean = baseDictionaryBeans.get(i);
View view = View.inflate(mActivity, R.layout.item_tab_custom_view, null);
TypeFaceTextView textView = view.findViewById(R.id.tv_tab_title);
textView.setText(bean.getDataName());
TabLayout.Tab tab = mTlType.newTab();
tab.setTag(bean);
tab.setCustomView(view);
mTlType.addTab(tab);
}
mCurrentType = baseDictionaryBeans.get(0).getDataId();
mTlType.setTabIndicatorFullWidth(false);
mTlType.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
setState(STATE_LOAD);
View tabView = tab.getCustomView();
tabView.findViewById(R.id.iv_right).setVisibility(View.VISIBLE);
tabView.findViewById(R.id.iv_Left).setVisibility(View.VISIBLE);
TextView tvTab = tabView.findViewById(R.id.tv_tab_title);
tvTab.setTextColor(Color.RED);
BaseDictionaryBean bean = (BaseDictionaryBean) tab.getTag();
mCurrentType = bean.getDataId();
mCurrentPageNo = 1;
mTotalSize = 0;
getActivityListDataByType(mCurrentPageNo);
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
View tabView = tab.getCustomView();
tabView.findViewById(R.id.iv_right).setVisibility(View.INVISIBLE);
tabView.findViewById(R.id.iv_Left).setVisibility(View.INVISIBLE);
TextView tvTab = tabView.findViewById(R.id.tv_tab_title);
tvTab.setTextColor(Color.GRAY);
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
View customView = mTlType.getTabAt(0).getCustomView();
customView.findViewById(R.id.iv_right).setVisibility(View.VISIBLE);
customView.findViewById(R.id.iv_Left).setVisibility(View.VISIBLE);
TextView tvTab = customView.findViewById(R.id.tv_tab_title);
tvTab.setTextColor(Color.RED);
refreshView(STATE_LOAD_SUCCESS);
setState(STATE_LOAD);
getActivityListDataByType(mCurrentPageNo);
} else {
refreshView(STATE_LOAD_EMPTY);
}
}
@Override
public void onError(Throwable e) {
refreshView(STATE_LOAD_ERROR);
}
@Override
public void onComplete() {
}
});
}
private void getActivityListDataByType(int page) {
RetrofitManager.getInstance()
.create(ApiActivity.class)
.getActivityListByType(mCurrentType, page + "")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ActivityListBeans>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(ActivityListBeans activityListBeans) {
if (page == 1) {
//第一次
if (activityListBeans.getRows() != null && activityListBeans.getRows().size() > 0) {
mDatas = activityListBeans.getRows();
mAdapter.setData(mDatas);
mTotalSize = activityListBeans.getTotal();
mSrlContent.finishRefresh();
mSrlContent.setNoMoreData(false);
setState(STATE_SUCCESS);
} else {
mSrlContent.finishRefresh();
mSrlContent.setNoMoreData(true);
setState(STATE_EMPTY);
}
} else {
//多次
if (activityListBeans.getRows() != null && activityListBeans.getRows().size() > 0) {
mDatas.addAll(activityListBeans.getRows());
mAdapter.setData(mDatas);
mSrlContent.finishLoadMore();
} else {
mSrlContent.setNoMoreData(true);
}
}
}
@Override
public void onError(Throwable e) {
setState(STATE_ERROR);
ExceptionHandler.handleException(e);
mSrlContent.finishRefresh();
mSrlContent.setNoMoreData(true);
}
@Override
public void onComplete() {
}
});
}
public void showDetail(ActivityListBeans.RowsBean rowsBean) {
ARouter.getInstance()
.build(PathConfig.PATH_MODULEACTIVITY_ACTIVITY_DETAIL)
.withString("id", rowsBean.getActivityLibraryId())
.navigation();
}
// @Override
// protected void refreshView() {
// getTypeList();
// }
//
// @Override
// protected void loadMoreData() {
// mSrlView.finishLoadMore();
// }
private void setState(int state) {
switch (state) {
case STATE_LOAD:
mRlvContent.setVisibility(View.GONE);
mTvHint.setVisibility(View.VISIBLE);
mTvHint.setText("加载中...");
mIvEmpty.setVisibility(View.GONE);
mPbLoading.setVisibility(View.VISIBLE);
break;
case STATE_EMPTY:
mRlvContent.setVisibility(View.GONE);
mTvHint.setVisibility(View.VISIBLE);
mTvHint.setText("暂无数据");
mIvEmpty.setVisibility(View.VISIBLE);
mPbLoading.setVisibility(View.GONE);
break;
case STATE_SUCCESS:
mRlvContent.setVisibility(View.VISIBLE);
mTvHint.setVisibility(View.GONE);
mIvEmpty.setVisibility(View.GONE);
mPbLoading.setVisibility(View.GONE);
break;
case STATE_ERROR:
mRlvContent.setVisibility(View.GONE);
mTvHint.setVisibility(View.VISIBLE);
mTvHint.setText("数据加载失败,请稍后重试");
mIvEmpty.setVisibility(View.VISIBLE);
mPbLoading.setVisibility(View.GONE);
break;
} }
};
@Override
protected void onPause() {
super.onPause();
mVvPlayer.pause();
} }
@Override
protected void onResume() {
super.onResume();
mVvPlayer.pause();
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
mOnStateChangeListener = null;
if (mVvPlayer != null) {
mVvPlayer.release();
}
if (mBind != null) { if (mBind != null) {
mBind.unbind(); mBind.unbind();
} }

View File

@ -2,8 +2,6 @@ package com.tengshisoft.moduleactivity.net;
import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean; import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean;
import com.sucstepsoft.cm_utils.core.beans.BaseSuccessBean; import com.sucstepsoft.cm_utils.core.beans.BaseSuccessBean;
import com.sucstepsoft.cm_utils.core.beans.UserLoginBean;
import com.sucstepsoft.cm_utils.core.retrofit_net.bean.UserBean;
import com.tengshisoft.moduleactivity.beans.ActivityDetail; import com.tengshisoft.moduleactivity.beans.ActivityDetail;
import com.tengshisoft.moduleactivity.beans.ActivityListBeans; import com.tengshisoft.moduleactivity.beans.ActivityListBeans;
import com.tengshisoft.moduleactivity.beans.MineActivityListBean; import com.tengshisoft.moduleactivity.beans.MineActivityListBean;
@ -43,8 +41,10 @@ public interface ApiActivity {
* @param page * @param page
* @return * @return
*/ */
@Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json"}) @Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json", "is_need_area" +
@GET("app/activitylibrary/listpageactivitylibraryrelease") ":true"})
// @GET("app/activitylibrary/listpageactivitylibraryrelease") 原接口
@GET("app/activitylibrary/listpageactivitylibraryfornetrelease")
Observable<ActivityListBeans> getActivityListByType(@Query("activityType") String type, @Query("page") String page); Observable<ActivityListBeans> getActivityListByType(@Query("activityType") String type, @Query("page") String page);
/** /**
@ -62,7 +62,8 @@ public interface ApiActivity {
* @param id * @param id
* @return * @return
*/ */
@Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json","is_need_area:false"}) @Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json", "is_need_area" +
":false"})
@GET("app/dictionaryself/listdictionarybyparentidrelease/{dictionaryParentId}") @GET("app/dictionaryself/listdictionarybyparentidrelease/{dictionaryParentId}")
Observable<List<BaseDictionaryBean>> getActivityTypeList(@Path("dictionaryParentId") String id); Observable<List<BaseDictionaryBean>> getActivityTypeList(@Path("dictionaryParentId") String id);
@ -78,7 +79,8 @@ public interface ApiActivity {
//GET /app/activitylibrary/getactivitylibrarybyid/{activityLibraryId} //GET /app/activitylibrary/getactivitylibrarybyid/{activityLibraryId}
@Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json"}) @Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json"})
@GET("app/activitylibrary/getactivitylibrarybyid/{activityLibraryId}") @GET("app/activitylibrary/getactivitylibrarybyid/{activityLibraryId}")
Observable<ActivityDetail> getActivityByIdToken(@Path("activityLibraryId") String id, @Header("token") String token); Observable<ActivityDetail> getActivityByIdToken(@Path("activityLibraryId") String id,
@Header("token") String token);
/** /**
* 报名 * 报名
@ -96,7 +98,8 @@ public interface ApiActivity {
*/ */
@Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json"}) @Headers({"base_url_name:activity", "Content-Type:application/json", "Accept:application/json"})
@GET("app/activityuserapply/cancelapply/{activityid}/{activityApplyUserId}") @GET("app/activityuserapply/cancelapply/{activityid}/{activityApplyUserId}")
Observable<BaseSuccessBean> doCancelSignUp(@Path("activityid") String id, @Path("activityApplyUserId") String aId, @Header("token") String token); Observable<BaseSuccessBean> doCancelSignUp(@Path("activityid") String id, @Path("activityApplyUserId") String aId
, @Header("token") String token);
/** /**
* 获取验证码 * 获取验证码

View File

@ -1,18 +1,75 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/srl_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
tools:context=".activity.ActivityMainActivity"> android:orientation="vertical"
android:theme="@style/Theme.AppCompat">
<com.tengshisoft.moduleijkplayer.player.VideoView <LinearLayout
android:id="@+id/vv_player"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="220dp" android:layout_height="wrap_content"
app:layout_constraintDimensionRatio="16:10" android:background="@drawable/shape_tab_bg">
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" <com.google.android.material.tabs.TabLayout
app:layout_constraintTop_toTopOf="parent" /> android:id="@+id/xtl_type"
</com.scwang.smartrefresh.layout.SmartRefreshLayout> android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabIndicatorColor="@color/white"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/app_title"
app:tabTextAppearance="@style/TabLayoutTextStyle"
app:tabTextColor="@color/gray_text" />
</LinearLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="100dp"
android:layout_height="100dp"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading_pic" />
<ImageView
android:id="@+id/iv_empty"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/ic_empty_data" />
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:id="@+id/tv_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/iv_empty"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textColor="@color/text_detail_24"
android:textSize="16sp"
tools:text="暂无数据" />
</LinearLayout>
</RelativeLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>

View File

@ -39,7 +39,7 @@ public class SplashActivity extends BaseActivity {
refreshView(STATE_LOAD_SUCCESS); refreshView(STATE_LOAD_SUCCESS);
ImmersionBar.with(this).init(); ImmersionBar.with(this).init();
mRlTitleBar1.setVisibility(View.GONE); mRlTitleBar1.setVisibility(View.GONE);
getCityCode(); // getCityCode();
PermissionUtils.permission(PermissionConstants.STORAGE, PermissionConstants.LOCATION, PermissionConstants.PHONE) PermissionUtils.permission(PermissionConstants.STORAGE, PermissionConstants.LOCATION, PermissionConstants.PHONE)
.callback(new PermissionUtils.SimpleCallback() { .callback(new PermissionUtils.SimpleCallback() {
@Override @Override

View File

@ -783,6 +783,9 @@ public class HomeFragment extends BaseFragment {
*/ */
private void chooseFuncPage(MainFuncBean mainFuncBean) { private void chooseFuncPage(MainFuncBean mainFuncBean) {
if ("精彩活动".equals(mainFuncBean.getTitle())) { if ("精彩活动".equals(mainFuncBean.getTitle())) {
ARouter.getInstance()
.build(PathConfig.PATH_MODULEACTIVITY_ACTIVITY_MAIN)
.navigation();
// TODO mMainActivity.setCurrentPage(1, "活动"); // TODO mMainActivity.setCurrentPage(1, "活动");
} else if ("场馆导航".equals(mainFuncBean.getTitle())) { } else if ("场馆导航".equals(mainFuncBean.getTitle())) {
mMainActivity.setCurrentPage(2, "场馆"); mMainActivity.setCurrentPage(2, "场馆");