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 d3c4dec5b..8f03351c7 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -342,11 +342,17 @@ public class LiveAudienceActivity extends LiveActivity { private void over() { if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) { + Intent intent = getIntent(); + intent.removeExtra("OPEN"); manager.mLiveAudienceViewHolder.openNewPeopleDialog(); + setIntent(intent); } } public void openSignWindow(String icon,String name,String desc){ SignDialogFragment fragment=new SignDialogFragment(); + fragment.setDesc(desc); + fragment.setName(name); + fragment.setIcon(icon); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "SignWindow"); } /** 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 1832cf62f..37aae4c70 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -1,5 +1,9 @@ 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.graphics.Color; import android.os.Build; @@ -25,6 +29,7 @@ import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.JsWishBean; @@ -46,14 +51,6 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; 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 { private WebView mWebView; @@ -125,7 +122,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - mWebView = (WebView) findViewById(R.id.rlWebview); findViewById(R.id.btn_back).setOnClickListener(v -> dismiss()); mWebView.addJavascriptInterface(new JsInteration(), "androidObject"); @@ -175,7 +171,6 @@ 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)"); } }); @@ -189,10 +184,8 @@ public class LiveHDDialogFragment extends AbsDialogFragment { }); } } - mWebView.setVisibility(View.INVISIBLE); } - private long webHeight = 0; //js调用原生 public class JsInteration { @@ -286,8 +279,17 @@ public class LiveHDDialogFragment extends AbsDialogFragment { } @JavascriptInterface - public void androidSignGift(String name, String desc,String icon) { - ((LiveAudienceActivity) mContext).openSignWindow(icon, name, desc); + public void androidSignGift(String json) { + 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 diff --git a/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java index 55dd7de84..b21ec5c17 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/SignDialogFragment.java @@ -69,8 +69,8 @@ public class SignDialogFragment extends AbsDialogFragment { @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); + TextView mName = (TextView) findViewById(R.id.sign_desc); + TextView mDesc = (TextView) findViewById(R.id.live_sign_desc); ImageView mIcon = (ImageView) findViewById(R.id.icon_sign); Button signBtn = (Button) findViewById(R.id.live_sign_btn); signBtn.setOnClickListener(v -> {