调整新人签到弹框

This commit is contained in:
zlzw 2022-10-12 17:03:26 +08:00
parent fa4042bf42
commit eb2aa91612
3 changed files with 24 additions and 16 deletions

View File

@ -342,11 +342,17 @@ public class LiveAudienceActivity extends LiveActivity {
private void over() { private void over() {
if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) { if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) {
Intent intent = getIntent();
intent.removeExtra("OPEN");
manager.mLiveAudienceViewHolder.openNewPeopleDialog(); manager.mLiveAudienceViewHolder.openNewPeopleDialog();
setIntent(intent);
} }
} }
public void openSignWindow(String icon,String name,String desc){ public void openSignWindow(String icon,String name,String desc){
SignDialogFragment fragment=new SignDialogFragment(); SignDialogFragment fragment=new SignDialogFragment();
fragment.setDesc(desc);
fragment.setName(name);
fragment.setIcon(icon);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "SignWindow"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "SignWindow");
} }
/** /**

View File

@ -1,5 +1,9 @@
package com.yunbao.live.dialog; package com.yunbao.live.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.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
@ -25,6 +29,7 @@ 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.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.CommonAppConfig; 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;
@ -46,14 +51,6 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
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 { public class LiveHDDialogFragment extends AbsDialogFragment {
private WebView mWebView; private WebView mWebView;
@ -125,7 +122,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
@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()); findViewById(R.id.btn_back).setOnClickListener(v -> dismiss());
mWebView.addJavascriptInterface(new JsInteration(), "androidObject"); mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
@ -175,7 +171,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
@Override @Override
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
webHeight = view.getContentHeight();
view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)"); view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)");
} }
}); });
@ -189,10 +184,8 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
}); });
} }
} }
mWebView.setVisibility(View.INVISIBLE);
} }
private long webHeight = 0;
//js调用原生 //js调用原生
public class JsInteration { public class JsInteration {
@ -286,8 +279,17 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
} }
@JavascriptInterface @JavascriptInterface
public void androidSignGift(String name, String desc,String icon) { public void androidSignGift(String json) {
((LiveAudienceActivity) mContext).openSignWindow(icon, name, desc); JSONObject data=JSONObject.parseObject(json);
if(data!=null) {
// 恭喜您第一天簽到成功
((LiveAudienceActivity) mContext).openSignWindow(data.getString("icon"),
data.getString("name"),
"恭喜您" +data.getString("desc")+"簽到成功!"
);
}
//((LiveAudienceActivity) mContext).openSignWindow(icon, name, desc);
} }
@JavascriptInterface @JavascriptInterface

View File

@ -69,8 +69,8 @@ public class SignDialogFragment extends AbsDialogFragment {
@Override @Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
TextView mName = (TextView) findViewById(R.id.live_sign_desc); TextView mName = (TextView) findViewById(R.id.sign_desc);
TextView mDesc = (TextView) findViewById(R.id.sign_desc); TextView mDesc = (TextView) findViewById(R.id.live_sign_desc);
ImageView mIcon = (ImageView) findViewById(R.id.icon_sign); ImageView mIcon = (ImageView) findViewById(R.id.icon_sign);
Button signBtn = (Button) findViewById(R.id.live_sign_btn); Button signBtn = (Button) findViewById(R.id.live_sign_btn);
signBtn.setOnClickListener(v -> { signBtn.setOnClickListener(v -> {