diff --git a/common/src/main/res/mipmap-xxhdpi/bg_live_sign.png b/common/src/main/res/mipmap-xxhdpi/bg_live_sign.png new file mode 100644 index 000000000..4fb2b562d Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_live_sign.png differ diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index af2da7e0a..b943e6dd0 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -70,6 +70,7 @@ import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LiveTotalDialog; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.SidebarLiveAudience; +import com.yunbao.live.dialog.SignDialogFragment; import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveRoomChangeEvent; @@ -344,7 +345,10 @@ public class LiveAudienceActivity extends LiveActivity { manager.mLiveAudienceViewHolder.openNewPeopleDialog(); } } - + public void openSignWindow(String icon,String name,String desc){ + SignDialogFragment fragment=new SignDialogFragment(); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "SignWindow"); + } /** * 打开礼物窗口 */ diff --git a/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java b/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java index 268d52c36..5ddca3a1d 100644 --- a/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java @@ -99,7 +99,7 @@ public class GiftTopAdapter extends RecyclerView.Adapter { if(position == choice){ mName.setTextColor(Color.parseColor("#FFBE41")); }else{ - mName.setTextColor(Color.parseColor("#FFFFFF")); + mName.setTextColor(Color.parseColor("#B6B6B6")); } } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index 02eac1439..657f3d016 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -4,6 +4,8 @@ import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import android.text.TextUtils; import android.util.Log; import android.view.Display; @@ -28,6 +30,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.bean.JsWishBean; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; @@ -47,6 +50,10 @@ import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentManager; + public class LiveHDDialogFragment extends AbsDialogFragment { private WebView mWebView; @@ -151,6 +158,11 @@ public class LiveHDDialogFragment extends AbsDialogFragment { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, bundle.getInt("height", -1)); mWebView.setLayoutParams(params); } + if (bundle.getInt("width", -1) != -1) { + ViewGroup.LayoutParams params = mWebView.getLayoutParams(); + params.width = bundle.getInt("width", -1); + mWebView.setLayoutParams(params); + } mWebView.loadUrl(bundle.getString("url")); mWebView.setWebViewClient(new WebViewClient() { @Override @@ -163,10 +175,24 @@ public class LiveHDDialogFragment extends AbsDialogFragment { @Override public void onPageFinished(WebView view, String url) { + webHeight = view.getContentHeight(); + view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)"); } }); + if (bundle.getBoolean("banScrollY", false)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mWebView.setOnScrollChangeListener(new View.OnScrollChangeListener() { + @Override + public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { + mWebView.scrollTo(0, scrollY);//只改变Y值,即限制左右滑动 + } + }); + } + } } + private long webHeight = 0; + //js调用原生 public class JsInteration { @JavascriptInterface @@ -258,6 +284,14 @@ public class LiveHDDialogFragment extends AbsDialogFragment { } + @JavascriptInterface + public void androidSignGift(String name, String desc,String icon) { + ((LiveAudienceActivity) mContext).openSignWindow(icon, name, desc); + } + + @JavascriptInterface + public void setHeight(String height, String width) { + } } private LiveRoomCheckLivePresenter mCheckLivePresenter; diff --git a/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java new file mode 100644 index 000000000..55dd7de84 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java @@ -0,0 +1,91 @@ +package com.yunbao.live.dialog; + +import android.app.Dialog; +import android.os.Bundle; +import android.view.Gravity; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentManager; + +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.live.R; + +public class SignDialogFragment extends AbsDialogFragment { + String icon; + String name; + String desc; + + @Override + protected int getLayoutId() { + return R.layout.dialog_live_sign; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return true; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = DpUtil.dp2px(250); + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + params.gravity = Gravity.CENTER; + window.setAttributes(params); + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public void setName(String name) { + this.name = name; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + return super.onCreateDialog(savedInstanceState); + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + TextView mName = (TextView) findViewById(R.id.live_sign_desc); + TextView mDesc = (TextView) findViewById(R.id.sign_desc); + ImageView mIcon = (ImageView) findViewById(R.id.icon_sign); + Button signBtn = (Button) findViewById(R.id.live_sign_btn); + signBtn.setOnClickListener(v -> { + dismiss(); + }); + mName.setText(name); + mDesc.setText(desc); + ImgLoader.display(mContext,icon,mIcon); + + } + + @Override + public void show(@NonNull FragmentManager manager, @Nullable String tag) { + super.show(manager, tag); + + + } +} diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index e2550d39a..4fe0164e6 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -368,6 +368,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; bundle.putString("url", url); bundle.putInt("show_type", 0); + bundle.putInt("height",DpUtil.dp2px(530)); + bundle.putBoolean("banScrollY",true); LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); liveHDDialogFragment.setArguments(bundle); liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); diff --git a/live/src/main/res/drawable/bg_live_gift.xml b/live/src/main/res/drawable/bg_live_gift.xml index 0f713fa4a..85c7fb5ae 100644 --- a/live/src/main/res/drawable/bg_live_gift.xml +++ b/live/src/main/res/drawable/bg_live_gift.xml @@ -2,7 +2,7 @@ - + diff --git a/live/src/main/res/drawable/bg_live_gift_package_line.xml b/live/src/main/res/drawable/bg_live_gift_package_line.xml index 662427256..4b1bd7801 100644 --- a/live/src/main/res/drawable/bg_live_gift_package_line.xml +++ b/live/src/main/res/drawable/bg_live_gift_package_line.xml @@ -3,7 +3,7 @@ - + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_sign_btn.xml b/live/src/main/res/drawable/bg_live_sign_btn.xml new file mode 100644 index 000000000..7b4ff28d7 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_sign_btn.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_vip_blue.png b/live/src/main/res/drawable/bg_live_vip_blue.png new file mode 100644 index 000000000..7cb07cc0a Binary files /dev/null and b/live/src/main/res/drawable/bg_live_vip_blue.png differ diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml index 400f81382..705ccce74 100644 --- a/live/src/main/res/layout/dialog_live_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml @@ -42,7 +42,7 @@ android:layout_alignParentEnd="true" android:layout_height="32dp" android:layout_marginEnd="12dp" - android:background="@drawable/bg_live_vip_gold" + android:background="@drawable/bg_live_vip_blue" android:gravity="center" android:orientation="horizontal"> @@ -120,7 +120,7 @@ diff --git a/live/src/main/res/layout/dialog_live_sign.xml b/live/src/main/res/layout/dialog_live_sign.xml new file mode 100644 index 000000000..ae85b7a8c --- /dev/null +++ b/live/src/main/res/layout/dialog_live_sign.xml @@ -0,0 +1,57 @@ + + + + + + + + +