| | |
| | | import android.graphics.Typeface; |
| | | import android.graphics.drawable.AnimationDrawable; |
| | | import android.graphics.drawable.GradientDrawable; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | |
| | | import android.view.animation.Animation; |
| | | import android.view.animation.AnimationUtils; |
| | | import android.view.animation.DecelerateInterpolator; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebResourceRequest; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | |
| | | import com.tejia.lijin.app.entity.TaoBaoGoodsBrief; |
| | | import com.tejia.lijin.app.entity.common.ImageShowEntity; |
| | | import com.tejia.lijin.app.entity.goods.GoodsDetailVO; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.ui.BaseActivity; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailHongBaoAndCouponSelectDialog; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailJumpLoaingDialog; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailNoLoginFailiDialog; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailNotifyDialog; |
| | | import com.tejia.lijin.app.ui.dialog.JumpTaoBaoDialog; |
| | | import com.tejia.lijin.app.ui.goods.GoodsDetailHongBaoListAdapter; |
| | |
| | | import com.tejia.lijin.app.util.umengCustomEvent.GoodsCustomEvent; |
| | | import com.tejia.lijin.app.util.user.LoginAndInviteStatusUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.tejia.lijin.app.util.web.RebateJavaInterfaceBS; |
| | | import com.wang.avi.AVLoadingIndicatorView; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | | import com.wpc.library.recyclerviewhelper.DividerItemDecoration; |
| | |
| | | import java.util.List; |
| | | import java.util.Timer; |
| | | |
| | | import androidx.annotation.RequiresApi; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | import androidx.viewpager.widget.PagerAdapter; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | import wendu.dsbridge.DWebView; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2018/5/11. |
| | |
| | | //图文详情 |
| | | private FrameLayout fl_goods_detail; |
| | | private ImageView iv_imgtext_status; |
| | | private WebView webView; |
| | | private DWebView webView; |
| | | private LinearLayout ll_loading; |
| | | private ImageView iv_loading; |
| | | private TextView tv_loading; |
| | |
| | | webView.setWebViewClient(new MWebviewClient()); |
| | | WebSettings settings = webView.getSettings(); |
| | | settings.setJavaScriptEnabled(true); |
| | | settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); |
| | | settings.setUseWideViewPort(true); |
| | | webView.setInitialScale(100); |
| | | RebateJavaInterfaceBS javaInterface1 = new RebateJavaInterfaceBS(GoodsDetailActivity.this, |
| | | null, null, new TextView(this), null, webView, null); |
| | | webView.addJavascriptObject(javaInterface1, "yestv"); |
| | | |
| | | ll_loading.setVisibility(View.VISIBLE); |
| | | |
| | | avLoadingIndicatorView.setVisibility(View.VISIBLE); |
| | |
| | | initData(); |
| | | getAppPageNotification(); |
| | | |
| | | // new GoodsDetailJumpLoaingDialog.Builder(this).setHasAd(true).setAdPid("").setNotify("铂金会员免广告,礼金提高100%", "http://www.baidu.com").setPlatform(Constant.GOODS_TYPE_TB).setOnCloseListener(new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { |
| | | |
| | | // notifyDialog = new GoodsDetailNotifyDialog.Builder(GoodsDetailActivity.this).setMessage("测试12123123").setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { |
| | | // @Override |
| | | // public void onClose(boolean auto) { |
| | | // public void onLeftClick() { |
| | | // } |
| | | // }).create().show(); |
| | | // |
| | | // @Override |
| | | // public void onRightClick() { |
| | | // DialogUtil.dismiss(notifyDialog); |
| | | // goFanli(); |
| | | // } |
| | | // }).create(); |
| | | // |
| | | // DialogUtil.show(notifyDialog); |
| | | |
| | | } |
| | | |
| | | public void showNotifyDialog() { |
| | | if (notifyDialog == null) |
| | | notifyDialog = new GoodsDetailNotifyDialog.Builder(this).setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { |
| | | @Override |
| | | public void onLeftClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | } |
| | | public void showNotifyDialog(String btnName, String link) { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | |
| | | @Override |
| | | public void onRightClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | goFanli(); |
| | | } |
| | | }).create(); |
| | | notifyDialog = new GoodsDetailNotifyDialog.Builder(this).setIconResource(R.drawable.icon_goods_detail_notify).setLeftBtnInfo(btnName, link).setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { |
| | | @Override |
| | | public void onLeftClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onRightClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | goFanli(); |
| | | } |
| | | }).create(); |
| | | DialogUtil.show(notifyDialog); |
| | | } |
| | | |
| | |
| | | if (null != url && url.startsWith("yestv://webviewHeight#")) { |
| | | int height = Integer.parseInt(url.replace("yestv://webviewHeight#", "")); |
| | | Log.i("mResult", "webView的高度为:" + height + ""); |
| | | //TODO 测试 |
| | | webView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height)); |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | } |
| | | |
| | | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { |
| | | String url = request.getUrl().toString(); |
| | | if (null != url && url.startsWith("yestv://webviewHeight#")) { |
| | | int height = Integer.parseInt(url.replace("yestv://webviewHeight#", "")); |
| | | Log.i("mResult", "webView的高度为:" + height + ""); |
| | | webView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height)); |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, request); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | }, 3000); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void getAppPageNotification() { |
| | |
| | | //判断是否有多张券情况 |
| | | } |
| | | |
| | | private GoodsDetailNoLoginFailiDialog mGoodsDetailNoLoginFailiDialog; |
| | | |
| | | private void goFanli(final CouponInfo couponInfo) { |
| | | goodsDetailPreEventManager.startClick(0, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | fanliRequest(couponInfo); |
| | | } |
| | | }); |
| | | |
| | | if (UserUtil.isLogin(getApplicationContext())) { |
| | | goodsDetailPreEventManager.startClick(0, true, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | fanliRequest(couponInfo); |
| | | } |
| | | }); |
| | | } else { |
| | | DialogUtil.dismiss(mGoodsDetailNoLoginFailiDialog); |
| | | mGoodsDetailNoLoginFailiDialog = new GoodsDetailNoLoginFailiDialog.Builder(this).setOnButtonClickListener(new GoodsDetailNoLoginFailiDialog.Builder.IDialogButtonClick() { |
| | | @Override |
| | | public void onLeftClick() { |
| | | DialogUtil.dismiss(mGoodsDetailNoLoginFailiDialog); |
| | | fanliRequest(couponInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void onRightClick() { |
| | | DialogUtil.dismiss(mGoodsDetailNoLoginFailiDialog); |
| | | goodsDetailPreEventManager.startClick(0, true, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | fanliRequest(couponInfo); |
| | | } |
| | | }); |
| | | } |
| | | }).create(); |
| | | mGoodsDetailNoLoginFailiDialog.show(); |
| | | } |
| | | } |
| | | |
| | | private void goBuy() { |
| | |
| | | } |
| | | |
| | | private void goBuy(final GoodsDetailVO.GoodsHongBaoListVO lijinVO) { |
| | | goodsDetailPreEventManager.startClick(1, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | goodsDetailPreEventManager.startClick(1, false, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | buyRequest(lijinVO); |
| | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (loadingDialog != null && !loadingDialog.isShowing()) |
| | | loadingDialog.show(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (code == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | JSONObject link = data.optJSONObject("link"); |
| | | if (link != null) { |
| | | GoodsBuyJumpUtil.jumpTB(GoodsDetailActivity.this, null, link.optString("clickUrl"), null, new GoodsBuyUtil.IBuyGoodsResultListener() { |
| | | |
| | | @Override |
| | | public void onConvertLinkStart() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkFail(String msg) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkComplete() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppStart() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppFail() { |
| | | |
| | | } |
| | | }); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | |
| | | if (link != null) { |
| | | final String linkUrl = link.optString("clickUrl"); |
| | | GoodsBuyJumpUtil.jumpTB(GoodsDetailActivity.this, null, linkUrl, linkUrl, userLevel, null); |
| | | } |
| | | String todayLeftCount = data.optString("todayLeftCount"); |
| | | if (!StringUtils.isNullOrEmpty(todayLeftCount)) { |
| | | Toast.makeText(GoodsDetailActivity.this, todayLeftCount, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | if (code == 2001) { |
| | | //用户机会已经用完了 |
| | | showNotifyDialog(); |
| | | } else |
| | | Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | getBuyChanceInfoRequest(); |
| | | } else { |
| | | notifyDialog = new GoodsDetailNotifyDialog.Builder(GoodsDetailActivity.this).setMessage(jsonObject.optString("msg")).setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { |
| | | @Override |
| | | public void onLeftClick() { |
| | | } |
| | | |
| | | @Override |
| | | public void onRightClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | goFanli(); |
| | | } |
| | | }).create(); |
| | | DialogUtil.show(notifyDialog); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | if (loadingDialog != null && loadingDialog.isShowing()) |
| | | loadingDialog.dismiss(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | }); |
| | | |
| | |
| | | GoodsBuyUtil.fanli(this, getApplicationContext(), requestInfo, new GoodsBuyUtil.IBuyGoodsResultListener() { |
| | | @Override |
| | | public void onConvertLinkStart() { |
| | | if (loadingDialog != null && !loadingDialog.isShowing()) |
| | | loadingDialog.show(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkSuccess() { |
| | | |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkFail(String msg) { |
| | | |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkComplete() { |
| | | if (loadingDialog != null && loadingDialog.isShowing()) |
| | | loadingDialog.dismiss(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * 获取购买机会信息 |
| | | */ |
| | | private void getBuyChanceInfoRequest() { |
| | | //TODO 判断是否还有机会(返回当前剩余多少次,还能解锁多少次),如果有机会需要看激励视频广告 |
| | | ShoppingApi.getUserLijinCreatedInfo(getApplicationContext(), mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType(), UserUtil.getUid(getApplicationContext()), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | if (jsonObject.optInt("code") == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | int leftCount = data.optInt("leftCount"); |
| | | // if (leftCount <= 0) { |
| | | JSONObject openInfo = data.optJSONObject("openInfo"); |
| | | if (openInfo != null) { |
| | | showNotifyDialog(openInfo.optString("btnName"), openInfo.optString("vipLink")); |
| | | } else { |
| | | showNotifyDialog(null, null); |
| | | } |
| | | // } |
| | | |
| | | |
| | | } else { |
| | | Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | Toast.makeText(GoodsDetailActivity.this, "网络请求出错", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | } |