短剧优化
This commit is contained in:
parent
004a5b2a53
commit
aa62dda844
@ -410,6 +410,8 @@ public class WebViewActivity extends AbsActivity {
|
|||||||
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
|
||||||
//看直播
|
//看直播
|
||||||
gotoLive(event.getLiveId());
|
gotoLive(event.getLiveId());
|
||||||
|
}else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
||||||
|
RouteUtil.forwardCommunityActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,16 @@ public class DialogUitl {
|
|||||||
showSimpleTipDialog(context, null, content);
|
showSimpleTipDialog(context, null, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showBackDialog(Context context, String content, String cancel, String sure, SimpleCallback callback) {
|
||||||
|
if (context instanceof Activity) {
|
||||||
|
if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new Builder(context).setTitle(content).setCancelable(true).isShowContent(false).setCancelString(cancel).setConfirmString(sure).setClickCallback(callback).build().show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void showSimpleTipDialog(Context context, String title, String content) {
|
public static void showSimpleTipDialog(Context context, String title, String content) {
|
||||||
if (context instanceof Activity) {
|
if (context instanceof Activity) {
|
||||||
if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) {
|
if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) {
|
||||||
@ -351,6 +361,7 @@ public class DialogUitl {
|
|||||||
private String mHint;
|
private String mHint;
|
||||||
private int mInputType;
|
private int mInputType;
|
||||||
private int mLength;
|
private int mLength;
|
||||||
|
boolean isShowContent;
|
||||||
private SimpleCallback mClickCallback;
|
private SimpleCallback mClickCallback;
|
||||||
private SimpleCallback3 mClickCallback3;
|
private SimpleCallback3 mClickCallback3;
|
||||||
private SimpleCallbackView mSimpleCallbackView;
|
private SimpleCallbackView mSimpleCallbackView;
|
||||||
@ -393,6 +404,11 @@ public class DialogUitl {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder isShowContent(boolean isShow) {
|
||||||
|
isShowContent = isShow;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setCancelable(boolean cancelable) {
|
public Builder setCancelable(boolean cancelable) {
|
||||||
mCancelable = cancelable;
|
mCancelable = cancelable;
|
||||||
return this;
|
return this;
|
||||||
@ -471,6 +487,9 @@ public class DialogUitl {
|
|||||||
if (mLength > 0 && content instanceof EditText) {
|
if (mLength > 0 && content instanceof EditText) {
|
||||||
content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mLength)});
|
content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mLength)});
|
||||||
}
|
}
|
||||||
|
if (!isShowContent) {
|
||||||
|
content.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm);
|
TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm);
|
||||||
if (!TextUtils.isEmpty(mConfirmString)) {
|
if (!TextUtils.isEmpty(mConfirmString)) {
|
||||||
btnConfirm.setText(mConfirmString);
|
btnConfirm.setText(mConfirmString);
|
||||||
|
@ -683,4 +683,9 @@ public class JavascriptInterfaceUtils {
|
|||||||
ToastUtil.showDebug("网页跳客服页面");
|
ToastUtil.showDebug("网页跳客服页面");
|
||||||
RouteUtil.forwardCustomerService(url);
|
RouteUtil.forwardCustomerService(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void androidtoCommunityVideo() {
|
||||||
|
RouteUtil.forwardCommunityActivity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,13 @@ public class RouteUtil {
|
|||||||
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
||||||
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
||||||
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
||||||
|
public static final String PATH_COMMUNITY_Activity="/main/MainHomeCommunityActivity";
|
||||||
|
|
||||||
|
|
||||||
|
public static void forwardCommunityActivity() {
|
||||||
|
ARouter.getInstance().build(PATH_COMMUNITY_Activity)
|
||||||
|
.navigation();
|
||||||
|
}
|
||||||
public static void forwardFansActivity(String uid) {
|
public static void forwardFansActivity(String uid) {
|
||||||
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
||||||
.withString(Constants.TO_UID, uid)
|
.withString(Constants.TO_UID, uid)
|
||||||
|
@ -628,7 +628,7 @@
|
|||||||
<string name="accept">accept</string>
|
<string name="accept">accept</string>
|
||||||
<string name="all">whole</string>
|
<string name="all">whole</string>
|
||||||
<string name="alumb">Album</string>
|
<string name="alumb">Album</string>
|
||||||
<string name="cancel">cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="camera">camera</string>
|
<string name="camera">camera</string>
|
||||||
<string name="pic_choose_look">Picture selection/Preview</string>
|
<string name="pic_choose_look">Picture selection/Preview</string>
|
||||||
<string name="preview">Preview</string>
|
<string name="preview">Preview</string>
|
||||||
@ -1447,4 +1447,7 @@ Limited ride And limited avatar frame</string>
|
|||||||
<string name="game_review_view_sound_off">Mute</string>
|
<string name="game_review_view_sound_off">Mute</string>
|
||||||
|
|
||||||
<string name="sys_msg_cancel">Cancel</string>
|
<string name="sys_msg_cancel">Cancel</string>
|
||||||
|
<string name="community_back">Are you sure to return?</string>
|
||||||
|
|
||||||
|
<string name="back_community_sure">Sure</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1445,4 +1445,8 @@
|
|||||||
<string name="main_suspension_war_order">直播通行證</string>
|
<string name="main_suspension_war_order">直播通行證</string>
|
||||||
|
|
||||||
<string name="sys_msg_cancel">取消</string>
|
<string name="sys_msg_cancel">取消</string>
|
||||||
|
|
||||||
|
<string name="community_back">是否確認返回?</string>
|
||||||
|
|
||||||
|
<string name="back_community_sure">確定</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1445,4 +1445,8 @@
|
|||||||
|
|
||||||
<string name="sys_msg_cancel">取消</string>
|
<string name="sys_msg_cancel">取消</string>
|
||||||
|
|
||||||
|
<string name="community_back">是否確認返回?</string>
|
||||||
|
|
||||||
|
<string name="back_community_sure">確定</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1442,4 +1442,8 @@
|
|||||||
|
|
||||||
<string name="sys_msg_cancel">取消</string>
|
<string name="sys_msg_cancel">取消</string>
|
||||||
|
|
||||||
|
<string name="community_back">是否確認返回?</string>
|
||||||
|
|
||||||
|
<string name="back_community_sure">確定</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1451,4 +1451,8 @@ Limited ride And limited avatar frame</string>
|
|||||||
|
|
||||||
<string name="sys_msg_cancel">Cancel</string>
|
<string name="sys_msg_cancel">Cancel</string>
|
||||||
|
|
||||||
|
<string name="community_back">Are you sure to return?</string>
|
||||||
|
|
||||||
|
<string name="back_community_sure">Sure</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -860,6 +860,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
if (!TextUtils.isEmpty(event.getMethod())) {
|
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||||
if (TextUtils.equals(event.getMethod(), "closeLiveRoom")) {
|
if (TextUtils.equals(event.getMethod(), "closeLiveRoom")) {
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
}else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
||||||
|
RouteUtil.forwardCommunityActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,13 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
.setLiveZhuangBana(true).
|
.setLiveZhuangBana(true).
|
||||||
setDialogClose(true).
|
setDialogClose(true).
|
||||||
setPageClose(false), "androidObject");
|
setPageClose(false), "androidObject");
|
||||||
|
|
||||||
|
|
||||||
|
/* mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(getActivity(), mWebView)
|
||||||
|
.setLiveZhuangBana(true).
|
||||||
|
setDialogClose(true).
|
||||||
|
setPageClose(false), "androidObject");*/
|
||||||
|
|
||||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||||
mWebView.getSettings().setDomStorageEnabled(true);
|
mWebView.getSettings().setDomStorageEnabled(true);
|
||||||
String appCachePath = mContext.getCacheDir().getAbsolutePath();
|
String appCachePath = mContext.getCacheDir().getAbsolutePath();
|
||||||
@ -417,6 +424,8 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
||||||
|
RouteUtil.forwardCommunityActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,9 @@
|
|||||||
<activity android:name=".activity.UserAvatarSelectActivity"
|
<activity android:name=".activity.UserAvatarSelectActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity android:name=".activity.BattlePassActivity" />
|
<activity android:name=".activity.BattlePassActivity" />
|
||||||
|
|
||||||
|
<activity android:name=".activity.MainHomeCommunityActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
|
import com.yunbao.common.utils.L;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
|
import com.yunbao.main.R;
|
||||||
|
import com.yunbao.main.fragment.MainHomeCommunityVideoFragment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短剧
|
||||||
|
*/
|
||||||
|
@Route(path = RouteUtil.PATH_COMMUNITY_Activity)
|
||||||
|
public class MainHomeCommunityActivity extends AbsActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.activity_main_home_community;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void main() {
|
||||||
|
MainHomeCommunityVideoFragment communityVideoFragment = new MainHomeCommunityVideoFragment();
|
||||||
|
|
||||||
|
FragmentManager FM = getSupportFragmentManager();//获取管理器
|
||||||
|
FragmentTransaction FT = FM.beginTransaction();//获取启动器
|
||||||
|
FT.replace(R.id.fragment, communityVideoFragment);//替换碎片
|
||||||
|
FT.addToBackStack(null);//是否启动回退栈
|
||||||
|
FT.commit();//提交
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,8 +10,10 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Message;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
@ -19,6 +21,10 @@ import android.webkit.ValueCallback;
|
|||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
@ -48,10 +54,17 @@ import org.greenrobot.eventbus.Subscribe;
|
|||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class MainHomeCommunityVideoFragment extends BaseFragment {
|
public class MainHomeCommunityVideoFragment extends BaseFragment {
|
||||||
WebView mWebView;
|
WebView mWebView;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
LinearLayout back;
|
||||||
|
|
||||||
|
boolean isShow = true;
|
||||||
|
|
||||||
|
Timer timer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
@ -118,6 +131,80 @@ public class MainHomeCommunityVideoFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
back = findViewById(R.id.back);
|
||||||
|
back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showBackDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mWebView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
back.setVisibility(View.VISIBLE);
|
||||||
|
if (timer != null) {
|
||||||
|
timer.cancel();
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
updateKnowledge();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mWebView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
back.setVisibility(View.VISIBLE);
|
||||||
|
if (timer != null) {
|
||||||
|
timer.cancel();
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
updateKnowledge();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateKnowledge();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showBackDialog() {
|
||||||
|
DialogUitl.showBackDialog(mContext, getString(R.string.community_back), getString(R.string.cancel), getString(R.string.back_community_sure), new DialogUitl.SimpleCallback() {
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
onDestroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
showBackDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateKnowledge() {
|
||||||
|
timer = new Timer();
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
back.setVisibility(View.GONE);
|
||||||
|
isShow = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 5 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copy(String content) {
|
private void copy(String content) {
|
||||||
@ -143,64 +230,60 @@ public class MainHomeCommunityVideoFragment extends BaseFragment {
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onJavascriptInterfaceEvent2(JavascriptInterfaceEvent event) {
|
public void onJavascriptInterfaceEvent2(JavascriptInterfaceEvent event) {
|
||||||
if (TextUtils.equals(event.getMethod(), "postWeakBalance")) {
|
if (TextUtils.equals(event.getMethod(), "postWeakBalance")) {
|
||||||
LiveNetManager.get(mContext).
|
LiveNetManager.get(mContext).getCoolConfig(new com.yunbao.common.http.base.HttpCallback<CoolConfig>() {
|
||||||
getCoolConfig(new com.yunbao.common.http.base.HttpCallback<CoolConfig>() {
|
@Override
|
||||||
|
public void onSuccess(CoolConfig data) {
|
||||||
|
new XPopup.Builder(mContext).enableDrag(false).autoOpenSoftInput(false).maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34)).asCustom(new CinemaTicketPopupWindow(mContext, data.setTicketCount(event.getCoolConfig().getTicketCount()), new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(CoolConfig data) {
|
public void onCallBack(String data) {
|
||||||
new XPopup.Builder(mContext)
|
if (TextUtils.equals(data, "2")) {
|
||||||
.enableDrag(false)
|
DialogUitl.showSimpleDialog(mContext, mContext.getString(com.yunbao.live.R.string.live_coin_not_enough), false, new DialogUitl.SimpleCallback2() {
|
||||||
.autoOpenSoftInput(false)
|
@Override
|
||||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
.asCustom(new CinemaTicketPopupWindow(mContext, data.setTicketCount(event.getCoolConfig().getTicketCount()), new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() {
|
mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1));
|
||||||
@Override
|
}
|
||||||
public void onCallBack(String data) {
|
|
||||||
if (TextUtils.equals(data, "2")) {
|
|
||||||
DialogUitl.showSimpleDialog(mContext, mContext.getString(com.yunbao.live.R.string.live_coin_not_enough), false,
|
|
||||||
new DialogUitl.SimpleCallback2() {
|
|
||||||
@Override
|
|
||||||
public void onConfirmClick(Dialog dialog, String content) {
|
|
||||||
mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelClick() {
|
public void onCancelClick() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (TextUtils.equals(data, "1")) {
|
} else if (TextUtils.equals(data, "1")) {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "兑换成功" : "Successful exchange");
|
ToastUtil.show(WordUtil.isNewZh() ? "兑换成功" : "Successful exchange");
|
||||||
mWebView.post(new Runnable() {
|
mWebView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
NativeCallbackModel model = new NativeCallbackModel();
|
NativeCallbackModel model = new NativeCallbackModel();
|
||||||
model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||||
String nativeJson = new JsonUtil().toJson(model);
|
String nativeJson = new JsonUtil().toJson(model);
|
||||||
mWebView.evaluateJavascript("javascript:nativeCallback('" + nativeJson + "')", new ValueCallback<String>() {
|
mWebView.evaluateJavascript("javascript:nativeCallback('" + nativeJson + "')", new ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceiveValue(String value) {
|
public void onReceiveValue(String value) {
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
})).show();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
ToastUtil.show(error);
|
|
||||||
}
|
}
|
||||||
});
|
})).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void onPausePlay(){
|
|
||||||
|
public void onPausePlay() {
|
||||||
mWebView.onPause();
|
mWebView.onPause();
|
||||||
}
|
}
|
||||||
public void onResumePlay(){
|
|
||||||
|
public void onResumePlay() {
|
||||||
mWebView.onResume();
|
mWebView.onResume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,6 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
ViewPager2 viewPager;
|
ViewPager2 viewPager;
|
||||||
private MagicIndicator mIndicator;
|
private MagicIndicator mIndicator;
|
||||||
|
|
||||||
|
|
||||||
public MainHomeCommunityViewHolder(Context context, ViewGroup parentView, MainActivity mainActivity) {
|
public MainHomeCommunityViewHolder(Context context, ViewGroup parentView, MainActivity mainActivity) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@ -198,7 +197,11 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (viewPager != null) {
|
if (viewPager != null) {
|
||||||
viewPager.setCurrentItem(index);
|
if (index == 1) {
|
||||||
|
RouteUtil.forwardCommunityActivity();
|
||||||
|
} else {
|
||||||
|
viewPager.setCurrentItem(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -225,29 +228,30 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onPauseVideo() {
|
public void onPauseVideo() {
|
||||||
if(fragments==null || fragments.isEmpty()){
|
if (fragments == null || fragments.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BaseFragment fragment = fragments.get(viewPager.getCurrentItem());
|
BaseFragment fragment = fragments.get(viewPager.getCurrentItem());
|
||||||
if(fragment==null){
|
if (fragment == null) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (fragment instanceof MainHomeCommunityVideoFragment) {
|
|
||||||
// viewPager.setCurrentItem(0, false);
|
|
||||||
((MainHomeCommunityVideoFragment)fragment).onPausePlay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void onResumePlay() {
|
|
||||||
if(fragments==null || fragments.isEmpty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BaseFragment fragment = fragments.get(viewPager.getCurrentItem());
|
|
||||||
if(fragment==null){
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fragment instanceof MainHomeCommunityVideoFragment) {
|
if (fragment instanceof MainHomeCommunityVideoFragment) {
|
||||||
// viewPager.setCurrentItem(0, false);
|
// viewPager.setCurrentItem(0, false);
|
||||||
((MainHomeCommunityVideoFragment)fragment).onResumePlay();
|
((MainHomeCommunityVideoFragment) fragment).onPausePlay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResumePlay() {
|
||||||
|
if (fragments == null || fragments.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BaseFragment fragment = fragments.get(viewPager.getCurrentItem());
|
||||||
|
if (fragment == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fragment instanceof MainHomeCommunityVideoFragment) {
|
||||||
|
// viewPager.setCurrentItem(0, false);
|
||||||
|
((MainHomeCommunityVideoFragment) fragment).onResumePlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
main/src/main/res/drawable/background_community_video.xml
Normal file
14
main/src/main/res/drawable/background_community_video.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:topLeftRadius="90dp"
|
||||||
|
android:bottomLeftRadius="90dp" />
|
||||||
|
<gradient
|
||||||
|
android:startColor="#f0eff2"
|
||||||
|
android:endColor="#f0eff2"
|
||||||
|
android:angle="90"
|
||||||
|
/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
13
main/src/main/res/layout/activity_main_home_community.xml
Normal file
13
main/src/main/res/layout/activity_main_home_community.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/color_white"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout 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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
@ -8,9 +8,32 @@
|
|||||||
android:id="@+id/webView"
|
android:id="@+id/webView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="68dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:background="@drawable/background_community_video"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:src="@mipmap/icon_back_community"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/black1"
|
||||||
|
android:text="@string/back" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
BIN
main/src/main/res/mipmap-xxhdpi/icon_back_community.png
Normal file
BIN
main/src/main/res/mipmap-xxhdpi/icon_back_community.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Loading…
Reference in New Issue
Block a user