调整礼物UI

新增新人签到弹框
This commit is contained in:
zlzw 2022-10-12 16:05:33 +08:00
parent 62dc81d971
commit d86e68060c
15 changed files with 216 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

View File

@ -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");
}
/**
* 打开礼物窗口
*/

View File

@ -99,7 +99,7 @@ public class GiftTopAdapter extends RecyclerView.Adapter<GiftTopAdapter.Vh> {
if(position == choice){
mName.setTextColor(Color.parseColor("#FFBE41"));
}else{
mName.setTextColor(Color.parseColor("#FFFFFF"));
mName.setTextColor(Color.parseColor("#B6B6B6"));
}
}
}

View File

@ -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,9 +175,23 @@ 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 {
@ -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;

View File

@ -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);
}
}

View File

@ -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");

View File

@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="360dp" android:height="306dp">
<shape android:shape="rectangle">
<solid android:color="#ff000000" />
<solid android:color="#B3000000" />
<gradient android:type="linear" android:useLevel="true" android:startColor="#ff181a34" android:endColor="#ff080a1b" android:angle="0" />
<corners android:topLeftRadius="8dp" android:topRightRadius="8dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>

View File

@ -3,7 +3,7 @@
<item android:width="1dp" android:height="23dp">
<shape android:shape="rectangle">
<solid android:color="#ff626262" />
<corners android:topLeftRadius="1dp" android:topRightRadius="1dp" android:bottomLeftRadius="1dp" android:bottomRightRadius="1dp" />
<corners android:topLeftRadius="1.5dp" android:topRightRadius="1.5dp" android:bottomLeftRadius="1dp" android:bottomRightRadius="1dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="182dp" android:height="33dp">
<shape android:shape="rectangle">
<solid android:color="#ffffffff" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="16dp" android:bottomRightRadius="16dp" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -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 @@
<LinearLayout
android:id="@+id/group"
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_height="300dp"
android:gravity="bottom"
android:layout_below="@id/gift_tab_layout"
android:orientation="vertical">

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="251dp"
android:layout_height="371dp"
android:background="@mipmap/bg_live_sign">
<TextView
android:id="@+id/live_sign_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
android:text="恭喜您第一天簽到成功!"
android:textColor="#FFFFFF"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/icon_sign"
android:layout_width="87dp"
android:layout_height="87dp"
android:layout_marginBottom="27dp"
app:layout_constraintBottom_toTopOf="@+id/live_sign_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/live_sign_desc"
app:srcCompat="@drawable/img_rank_empty" />
<Button
android:id="@+id/live_sign_btn"
android:layout_width="183dp"
android:layout_height="32dp"
android:layout_marginBottom="26dp"
android:background="@drawable/bg_live_sign_btn"
android:text="確認收下"
android:textColor="#FE730D"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/sign_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#651308"
android:text="萌新勛章"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/icon_sign" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:mfl_ratio="1.3"
app:mfl_ratio="1.1"
android:background="@drawable/bg_live_gift_items"
>
@ -28,7 +28,7 @@
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="28dp">
android:layout_marginTop="8dp">
<ImageView
android:id="@+id/icon"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -352,8 +352,13 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
if (bean != null) {
String link = bean.getLink();
if (bean.getType() == 2) {
if (bean.getLink().isEmpty()) {
ToastUtil.show("暫無法簽到,請稍後再試");
return;
} else {
gotoRoomKey.put("OPEN", "NEWUSER");
}
}
if (link.contains("http")) {
WebViewActivity.forward(mContext, link, true);
} else {