11111
This commit is contained in:
parent
966e8bbddb
commit
a26b136430
@ -2,13 +2,15 @@ package com.yunbao.live.adapter;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import android.text.TextUtils;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
@ -21,11 +23,12 @@ import com.yunbao.live.dialog.LivePromotionDialogFragment;
|
|||||||
public class LivePromotionAdapter extends RefreshAdapter<LivePromotionBean> {
|
public class LivePromotionAdapter extends RefreshAdapter<LivePromotionBean> {
|
||||||
|
|
||||||
|
|
||||||
String mLiveUid;
|
String mLiveUid;
|
||||||
LivePromotionDialogFragment fs;
|
LivePromotionDialogFragment fs;
|
||||||
|
|
||||||
public LivePromotionAdapter(Context context, String mLiveUids, LivePromotionDialogFragment f) {
|
public LivePromotionAdapter(Context context, String mLiveUids, LivePromotionDialogFragment f) {
|
||||||
super(context);
|
super(context);
|
||||||
mLiveUid=mLiveUids;
|
mLiveUid = mLiveUids;
|
||||||
this.fs = f;
|
this.fs = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +63,7 @@ public class LivePromotionAdapter extends RefreshAdapter<LivePromotionBean> {
|
|||||||
|
|
||||||
public Vh(@NonNull View itemView) {
|
public Vh(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
text = (TextView)itemView.findViewById(R.id.text);
|
text = (TextView) itemView.findViewById(R.id.text);
|
||||||
img = (ImageView) itemView.findViewById(R.id.img);
|
img = (ImageView) itemView.findViewById(R.id.img);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,11 +73,13 @@ public class LivePromotionAdapter extends RefreshAdapter<LivePromotionBean> {
|
|||||||
itemView.setOnClickListener(new View.OnClickListener() {
|
itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String url = CommonAppConfig.HOST +"/"+bean.getActive_src()+"?uid="+CommonAppConfig.getInstance().getUid()+"&token="+CommonAppConfig.getInstance().getToken()
|
String url = CommonAppConfig.HOST + "/" + bean.getActive_src() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()
|
||||||
+"&anchorUid="+mLiveUid
|
+ "&anchorUid=" + mLiveUid
|
||||||
+"&active_id="+bean.getActive_id();
|
+ "&active_id=" + bean.getActive_id();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString("url", url);
|
bundle.putString("url", url);
|
||||||
|
int show = TextUtils.isEmpty(bean.getShow_type()) ? 0 : Integer.parseInt(bean.getShow_type());
|
||||||
|
bundle.putInt("show_type", show);
|
||||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.yunbao.live.bean;
|
package com.yunbao.live.bean;
|
||||||
|
|
||||||
public class LivePromotionBean {
|
public class LivePromotionBean {
|
||||||
String active_name, active_img, active_src,active_id;
|
String active_name, active_img, active_src, active_id, show_type;
|
||||||
|
|
||||||
public String getActive_id() {
|
public String getActive_id() {
|
||||||
return active_id;
|
return active_id;
|
||||||
@ -34,4 +34,13 @@ public class LivePromotionBean {
|
|||||||
public void setActive_src(String active_src) {
|
public void setActive_src(String active_src) {
|
||||||
this.active_src = active_src;
|
this.active_src = active_src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getShow_type() {
|
||||||
|
return show_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LivePromotionBean setShow_type(String show_type) {
|
||||||
|
this.show_type = show_type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package com.yunbao.live.dialog;
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
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.Gravity;
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.webkit.JavascriptInterface;
|
import android.webkit.JavascriptInterface;
|
||||||
@ -20,7 +25,6 @@ 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;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.live.R;
|
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;
|
||||||
@ -33,6 +37,7 @@ import static com.yunbao.common.utils.RouteUtil.PATH_GOOGLE;
|
|||||||
public class LiveHDDialogFragment extends AbsDialogFragment {
|
public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||||
|
|
||||||
private WebView mWebView;
|
private WebView mWebView;
|
||||||
|
private int showType = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -60,12 +65,29 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
|||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Window window = getDialog().getWindow();
|
||||||
|
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
WindowManager.LayoutParams windowParams = window.getAttributes();
|
||||||
|
windowParams.dimAmount = 0.0f;
|
||||||
|
windowParams.y = 100;
|
||||||
|
window.setAttributes(windowParams);
|
||||||
|
Dialog dialog = getDialog();
|
||||||
|
if (dialog != null) {
|
||||||
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||||
|
dialog.getWindow().setLayout((int) (dm.widthPixels), (int) (dm.heightPixels * (showType == 0 ? 0.5 : 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
mWebView = (WebView) findViewById(R.id.rlWebview);
|
mWebView = (WebView) findViewById(R.id.rlWebview);
|
||||||
|
findViewById(R.id.btn_back).setOnClickListener(v -> dismiss());
|
||||||
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||||
mWebView.getSettings().setDomStorageEnabled(true);
|
mWebView.getSettings().setDomStorageEnabled(true);
|
||||||
@ -85,6 +107,12 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
}
|
}
|
||||||
|
showType = bundle.getInt("show_type");
|
||||||
|
if (showType==0){
|
||||||
|
findViewById(R.id.title_laout).setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
findViewById(R.id.title_laout).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
mWebView.loadUrl(bundle.getString("url"));
|
mWebView.loadUrl(bundle.getString("url"));
|
||||||
mWebView.setWebViewClient(new WebViewClient() {
|
mWebView.setWebViewClient(new WebViewClient() {
|
||||||
@Override
|
@Override
|
||||||
@ -172,11 +200,11 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
|||||||
|
|
||||||
public void onTrickerySendGiftInto(JsWishBean id) {
|
public void onTrickerySendGiftInto(JsWishBean id) {
|
||||||
Log.i("tvs", "來了" + id);
|
Log.i("tvs", "來了" + id);
|
||||||
if (id!=null){
|
if (id != null) {
|
||||||
dismiss();
|
dismiss();
|
||||||
Log.i("tvs","來了111"+id);
|
Log.i("tvs", "來了111" + id);
|
||||||
if (mContext instanceof LiveAudienceActivity){
|
if (mContext instanceof LiveAudienceActivity) {
|
||||||
Log.i("tvs","來了333"+id);
|
Log.i("tvs", "來了333" + id);
|
||||||
((LiveAudienceActivity) mContext).openGiftWindow(id.getGiftId(), "1");
|
((LiveAudienceActivity) mContext).openGiftWindow(id.getGiftId(), "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,53 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout 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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<WebView android:id="@+id/rlWebview"
|
<RelativeLayout
|
||||||
|
android:id="@+id/title_laout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:background="@color/white"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_more"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:padding="9dp"
|
||||||
|
android:src="@mipmap/btn_more_black"
|
||||||
|
android:tint="@color/textColor"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/rlWebview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user