update:活动中心的弹窗改为Activity

fix:修复ZhuangBanActivity.java调用的xml资源冲突问题
This commit is contained in:
zlzw 2022-08-24 15:45:32 +08:00
parent 5f2fdd7052
commit 84596b0191
6 changed files with 122 additions and 22 deletions

View File

@ -38,6 +38,7 @@ public abstract class AbsActivity extends AppCompatActivity {
protected String mTag; protected String mTag;
protected Activity mContext; protected Activity mContext;
protected List<LifeCycleListener> mLifeCycleListeners; protected List<LifeCycleListener> mLifeCycleListeners;
protected boolean isFullWindow;
@Override @Override
public Resources getResources() { public Resources getResources() {
@ -51,6 +52,11 @@ public abstract class AbsActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
isFullWindow=getIntent().getBooleanExtra("isFull",false);
if(isFullWindow){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mTag = this.getClass().getSimpleName(); mTag = this.getClass().getSimpleName();
setStatusBar(); setStatusBar();

View File

@ -827,11 +827,10 @@ public class LiveAudienceActivity extends LiveActivity {
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
Log.i("tag", url); Log.i("tag", url);
Bundle bundle1 = new Bundle(); Intent intent=new Intent(mContext,ZhuangBanActivity.class);
bundle1.putString("url", url); intent.putExtra("url", url);
liveHDDialogFragment = new LiveHDDialogFragment(true); intent.putExtra("isFull",true);
liveHDDialogFragment.setArguments(bundle1); mContext.startActivity(intent);
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
break; break;
} }

View File

@ -1,5 +1,9 @@
package com.yunbao.live.activity; package com.yunbao.live.activity;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -7,7 +11,6 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.MediaStore; import android.provider.MediaStore;
import androidx.annotation.RequiresApi;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -18,9 +21,12 @@ import android.webkit.WebChromeClient;
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.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import androidx.annotation.RequiresApi;
import com.adjust.sdk.Adjust; import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent; import com.adjust.sdk.AdjustEvent;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
@ -40,10 +46,6 @@ import com.yunbao.live.R;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
public class ZhuangBanActivity extends AbsActivity { public class ZhuangBanActivity extends AbsActivity {
private ProgressBar mProgressBar; private ProgressBar mProgressBar;
@ -53,10 +55,11 @@ public class ZhuangBanActivity extends AbsActivity {
private ValueCallback<Uri> mValueCallback; private ValueCallback<Uri> mValueCallback;
private ValueCallback<Uri[]> mValueCallback2; private ValueCallback<Uri[]> mValueCallback2;
private SVGAImageView svga; private SVGAImageView svga;
private FrameLayout title;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.activity_zhuang_ban; return R.layout.activity_zhuang_ban_new;
} }
@Override @Override
@ -66,9 +69,12 @@ public class ZhuangBanActivity extends AbsActivity {
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
mProgressBar = (ProgressBar) findViewById(R.id.progressbar); mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
svga = (SVGAImageView) findViewById(R.id.svga); svga = (SVGAImageView) findViewById(R.id.svga);
title=findViewById(R.id.ft_title);
if (isFullWindow){
title.setVisibility(View.GONE);
}
mWebView = new WebView(mContext); mWebView = new WebView(mContext);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.topMargin = DpUtil.dp2px(1); params.topMargin = DpUtil.dp2px(1);
mWebView.setLayoutParams(params); mWebView.setLayoutParams(params);
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);

View File

@ -1,16 +1,20 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.app.Dialog; import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.Display;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowManager; import android.view.WindowManager;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import android.webkit.WebSettings; import android.webkit.WebSettings;
@ -20,7 +24,6 @@ import android.webkit.WebViewClient;
import com.adjust.sdk.Adjust; import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent; import com.adjust.sdk.AdjustEvent;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.JsWishBean; import com.yunbao.common.bean.JsWishBean;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
@ -29,10 +32,6 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
public class LiveHDDialogFragment extends AbsDialogFragment { public class LiveHDDialogFragment extends AbsDialogFragment {
private WebView mWebView; private WebView mWebView;
@ -73,7 +72,24 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
WindowManager.LayoutParams params = window.getAttributes(); WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT; params.width = WindowManager.LayoutParams.MATCH_PARENT;
if(isFullWindow){ if(isFullWindow){
Display display=null;
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.R) {
display= requireContext().getDisplay();
window.getInsetsController().hide(WindowInsets.Type.statusBars());
window.getInsetsController().hide(WindowInsets.Type.navigationBars());
}else {
display=window.getWindowManager().getDefaultDisplay();
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
window.getDecorView().setBackgroundColor(Color.parseColor("#10000000"));
params.height = WindowManager.LayoutParams.MATCH_PARENT; params.height = WindowManager.LayoutParams.MATCH_PARENT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window.getDecorView().setMinimumHeight(display.getMode().getPhysicalHeight());
window.getDecorView().setMinimumWidth(display.getMode().getPhysicalWidth());
}
window.getDecorView().setPadding(10,-10,0,0);
}else { }else {
params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.height = WindowManager.LayoutParams.WRAP_CONTENT;
} }
@ -192,6 +208,10 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
dismiss(); dismiss();
((LiveAudienceActivity) mContext).openGiftWindow(); ((LiveAudienceActivity) mContext).openGiftWindow();
} }
@JavascriptInterface
public void androidGoBack(){
dismiss();
}
} }
/** /**

View File

@ -379,7 +379,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
liveNewPeople.setVisibility(View.VISIBLE); liveNewPeople.setVisibility(View.VISIBLE);
newPeopleUrl = peopleInfo.getLink(); newPeopleUrl = peopleInfo.getLink();
} }
}, throwable -> throwable.printStackTrace()).isDisposed(); }, Throwable::printStackTrace).isDisposed();
} }
@Override @Override

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/ft_title"
android:layout_width="match_parent"
android:layout_height="65dp"
android:background="@color/white"
android:paddingTop="19dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/titleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textColor="@color/textColor"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_back"
android:tint="@color/textColor" />
</RelativeLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressbar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="3dp"
android:progressDrawable="@drawable/bg_horizontal_progressbar"/>
<LinearLayout
android:orientation="vertical"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"/>
</RelativeLayout>
</LinearLayout>