From 399ac289f80b7a40aa4210341db6b447cacdcf14 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 09 八月 2022 17:42:33 +0800 Subject: [PATCH] 广告升级,隐私政策整改 --- app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java | 2466 ++++++++++++++++++---------------------------------------- 1 files changed, 765 insertions(+), 1,701 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java b/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java index 8967e95..4bebab3 100644 --- a/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java +++ b/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java @@ -1,316 +1,204 @@ package com.tejia.lijin.app.ui.recommend; +import android.app.Dialog; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.Color; 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.provider.Settings; -import android.text.SpannableStringBuilder; +import android.text.SpannableString; import android.text.Spanned; -import android.text.TextUtils; -import android.text.style.ForegroundColorSpan; +import android.text.style.RelativeSizeSpan; import android.util.Log; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.view.animation.AccelerateInterpolator; 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 android.widget.AbsListView; import android.widget.AdapterView; -import android.widget.BaseAdapter; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.ListView; -import android.widget.PopupWindow; +import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -import com.alibaba.baichuan.android.trade.AlibcTrade; -import com.alibaba.baichuan.android.trade.AlibcTradeSDK; -import com.alibaba.baichuan.android.trade.model.AlibcShowParams; -import com.alibaba.baichuan.android.trade.model.OpenType; -import com.alibaba.baichuan.android.trade.page.AlibcBasePage; -import com.alibaba.baichuan.android.trade.page.AlibcDetailPage; -import com.alibaba.baichuan.trade.biz.AlibcConstants; -import com.alibaba.baichuan.trade.biz.applink.adapter.AlibcFailModeType; -import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams; -import com.alibaba.baichuan.trade.biz.login.AlibcLogin; -import com.alibaba.baichuan.trade.biz.login.AlibcLoginCallback; +import com.androidquery.AQuery; import com.bumptech.glide.Glide; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import com.nostra13.universalimageloader.core.DisplayImageOptions; -import com.nostra13.universalimageloader.core.ImageLoader; -import com.nostra13.universalimageloader.core.assist.ImageScaleType; -import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; -import com.sina.weibo.sdk.share.WbShareCallback; import com.tejia.lijin.app.BasicTextHttpResponseHandler; -import com.tejia.lijin.app.BuXinConstant; import com.tejia.lijin.app.R; import com.tejia.lijin.app.ShoppingApi; -import com.tejia.lijin.app.callBack.DragFloatActionInterface; -import com.tejia.lijin.app.callBack.LonginTaobaoCallback; -import com.tejia.lijin.app.callBack.MiDuoTradeCallback; import com.tejia.lijin.app.entity.CouponInfo; import com.tejia.lijin.app.entity.CouponUser; -import com.tejia.lijin.app.entity.FreeSingleTicket; import com.tejia.lijin.app.entity.GoodsDetail; import com.tejia.lijin.app.entity.PushEventData; -import com.tejia.lijin.app.entity.ShareUser; import com.tejia.lijin.app.entity.TaoBaoGoodsBrief; -import com.tejia.lijin.app.entity.TbPidInfo; -import com.tejia.lijin.app.entity.TopMenuRightPopContent; -import com.tejia.lijin.app.entity.UserInfo; import com.tejia.lijin.app.entity.common.ImageShowEntity; -import com.tejia.lijin.app.entity.share.SingleGoodsShareInfo; +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.dialog.ReceiveCouponHintDialog; -import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; +import com.tejia.lijin.app.ui.goods.GoodsDetailHongBaoListAdapter; +import com.tejia.lijin.app.ui.goods.GoodsDetailPreEventManager; import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; -import com.tejia.lijin.app.ui.mine.Collect28Activity; -import com.tejia.lijin.app.ui.mine.FreeSingleTicketAdapter; import com.tejia.lijin.app.ui.mine.LoginSelectActivity; import com.tejia.lijin.app.ui.mine.MyFootmarkActivity; -import com.tejia.lijin.app.ui.mine.ShoppingTrolleyActivity; import com.tejia.lijin.app.ui.trends.BigImageActivity; -import com.tejia.lijin.app.util.ApkUtil; import com.tejia.lijin.app.util.Constant; -import com.tejia.lijin.app.util.DragFloatActionButton; +import com.tejia.lijin.app.util.FlowLayout; import com.tejia.lijin.app.util.GlideCircleTransform; import com.tejia.lijin.app.util.GlideRoundTransform; +import com.tejia.lijin.app.util.GoodsBuyJumpUtil; import com.tejia.lijin.app.util.ImageUtil; -import com.tejia.lijin.app.util.InitAlibcSdk; -import com.tejia.lijin.app.util.KeFuUtil; -import com.tejia.lijin.app.util.LoginTaobao; -import com.tejia.lijin.app.util.RecordImageTextVideo; import com.tejia.lijin.app.util.SetLabels; import com.tejia.lijin.app.util.Toast_Dialog; -import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; +import com.tejia.lijin.app.util.TopStatusSettings; import com.tejia.lijin.app.util.clipboard.ClipboardUtil; +import com.tejia.lijin.app.util.goods.GoodsBuyUtil; import com.tejia.lijin.app.util.ui.GoodsDetailUtil; +import com.tejia.lijin.app.util.ui.dialog.DialogUtil; 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.umeng.analytics.MobclickAgent; +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 com.wpc.library.util.NetUtils; -import com.wpc.library.util.SystemCommon; import com.wpc.library.util.common.DimenUtils; import com.wpc.library.util.common.StringUtils; import com.wpc.library.widget.MyGridView; -import com.wpc.library.widget.MyListView; import com.wpc.library.widget.MyScrollView; import org.apache.http.Header; import org.json.JSONObject; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Timer; -import java.util.TimerTask; +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. * 鍟嗗搧璇︽儏杩囨浮椤�--鍙烦杞墜娣樺師鐢燂紝鑷垜缃戦〉 */ -public class GoodsDetailActivity extends BaseActivity implements View.OnClickListener, WbShareCallback, DragFloatActionInterface { - private ImageView iv_top_left, iv_back, iv_shop_img, iv_shop_type, iv_notif_portrait, - iv_imgtext_status, iv_share, iv_top_right, iv_like_state, iv_loading, iv_footermark, iv_rate; - private TextView tv_top_title1, tv_top_title2, tv_top_title3, tv_top_title4, tv_shop_name, - tv_shop_des, tv_shop_service, tv_shop_logistics, tv_shop_des_grade, tv_shop_logistics_grade, - tv_shop_service_grade, tv_notif_name, tv_notif_des, tv_shop_see, tv_goods_des, - tv_currunt_page, tv_goods_price_before, tv_sales_num, tv_coupon_show, tv_goods_price_coupon, - tv_rebate_num, tv_coupon_num, tv_command_num, tv_coupon_date, tv_loading, - tv_share_money_num, tv_buy, tv_rate, tv_like; - private FrameLayout fl_back_face, fl_content, fl_receive_coupon, - fl_command_copy; - private LinearLayout fl_buy, ll_share_gain, ll_goods_detail_transition_top, ll_guess_like, - ll_send_order, ll_add_collect, ll_labels, ll_no_net, ll_no_data, ll_request_failture, - ll_notification, ll_loading, ll_coupon, ll_top_title, ll_command_copy; - //鍙戣揣鍦帮紝鐩镐技鎼滅储 - private LinearLayout ll_address, ll_same; - private TextView tv_address; +public class GoodsDetailActivity extends BaseActivity implements View.OnClickListener { + private static final String TAG = "GoodsDetailActivity"; + /**************************鎺т欢瀹氫箟寮�濮�**************************/ + private MyScrollView sv_goods; - //浣i噾鏋勬垚淇℃伅 - TextView tv_fanli_composition; - LinearLayout ll_fanli_composition; + private LinearLayout ll_content; - private View v_1, v_2, v_3, v_4, v_cover, v_cover1, v_cover2; - private MyGridView gv_guess, gv_relative; - private MyScrollView lv_goods_pic; - private WebView webView; + //椤堕儴瀵艰埅鏍� + private ImageView iv_back, iv_top_left; + private LinearLayout ll_top_title; + private TextView tv_top_title1, tv_top_title2, tv_top_title3, tv_top_title4; + private View v_1, v_2, v_3, v_4, v_cover, v_cover1; + + //鍟嗗搧鍩虹淇℃伅 private ViewPager vp_goods_detail; - private ConnectivityChangeHelper mChangeHelper; - private ImageAdapter bannerAdapter; - private List<String> mBanners = new ArrayList<>(); + private TextView tv_currunt_page; + private LinearLayout ll_labels; + private TextView tv_name; + private TextView tv_sales_num; - private int picNum = 1; - String goodsId; - String goodsTaoBaoId; - private DisplayImageOptions options = new DisplayImageOptions.Builder() - .showImageForEmptyUri(R.drawable.ic_goods_default) - .showImageOnFail(R.drawable.ic_goods_default) - .showImageOnLoading(R.drawable.ic_goods_default) - .resetViewBeforeLoading(true).cacheInMemory(true) - .cacheOnDisk(true).imageScaleType(ImageScaleType.EXACTLY) - .considerExifParams(true) - .displayer(new FadeInBitmapDisplayer(300)).build(); - - private Map<String, String> exParams;//yhhpass鍙傛暟 - AlibcShowParams alibcShowParams; - AlibcTaokeParams alibcTaokeParams; + //灏忛粍鏉� private String TYPE = "goodsDetail"; private TextView tv_notice_content; private LinearLayout ll_notice; private ImageView iv_close; - AVLoadingIndicatorView avLoadingIndicatorView; - //鎺ㄨ崘璇� - private LinearLayout ll_recommend; - private TextView tv_recommend; + //鍙戣揣鍦� + private LinearLayout ll_address; + private TextView tv_address; - //鍙d护澶嶅埗 - private TextView tv_copy_link; + //鍟嗗搧搴楅摵淇℃伅 + private LinearLayout ll_shop; + private ImageView iv_shop_img; + private TextView tv_shop_type; + private TextView tv_shop_name; + private TextView tv_shop_des, tv_shop_service, tv_shop_logistics, tv_shop_des_grade, tv_shop_logistics_grade, + tv_shop_service_grade; - Animation inAnima; - Animation outAnima; + //鏉冪泭绫诲瀷 + private LinearLayout ll_rights_type; + private FlowLayout fl_rights_type; - int index = 1; - ListView lv_share_des; + //浠锋牸淇℃伅/绾㈠寘 + private RelativeLayout rl_price; + private RecyclerView rv_price_info; - PopupWindow mTopRightPopupWindow; - private List<TopMenuRightPopContent> mulList = new ArrayList<>(); - TopMenuRightPopContentAdapter shareFromAdapter; - private Toast_Dialog toast_dialog; + //鍥炬枃璇︽儏 + private FrameLayout fl_goods_detail; + private ImageView iv_imgtext_status; + private DWebView webView; + private LinearLayout ll_loading; + private ImageView iv_loading; + private TextView tv_loading; + private View view_goods_imgs_tag;//鐢ㄦ潵鏍囪瘑瀵艰埅鏍忛�変腑 - boolean isScroll = false; - boolean isVisible = false; - long inputTime = 0; + //鐚滀綘鍠滄 + private LinearLayout ll_guess_like; + private MyGridView gv_guess; - //搴曢儴鎸夐挳 - - private LinearLayout ll_coupon_container; - - /** - * 鍏嶅崟寮�濮� - */ - //鍏嶅崟 - private TextView tv_coupon_date_miandan, tv_coupon_num_miandan; - private FrameLayout fl_coupon_miandan; - private TextView tv_big_btn; - private LinearLayout ll_bottom; - - /* - 鍟嗗搧璇︽儏鍏嶅崟鍒稿脊妗嗘帴鍙� - */ - private void getGoodsMianDanCouponList() { - if (pd == null) - pd = new ShapeLoadingDialog.Builder(this).build(); - if (!pd.isShowing()) - pd.show(); - String uid = getSharedPreferences("user", MODE_PRIVATE) - .getString("uid", ""); - ShoppingApi.getGoodsCouponList(this, uid, Constant.GOODS_TYPE_TB, goodsId, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - if (jsonObject.optString("code").equalsIgnoreCase("0")) { - initPopubWindow(jsonObject.optJSONObject("data")); - } else { - Toast.makeText(GoodsDetailActivity.this, - jsonObject.optString("msg"), Toast.LENGTH_LONG).show(); - } - } - - @Override - public void onFinish() { - super.onFinish(); - pd.dismiss(); - } - }); - } - - private View view_share_buy_divider; - - private void initShareAndBuyBtn(boolean shareValid, boolean fanliValid) { - if (view_share_buy_divider == null) - view_share_buy_divider = findViewById(R.id.view_share_buy_divider); - if (shareValid && fanliValid) { - fl_buy.setVisibility(View.VISIBLE); - ll_share_gain.setVisibility(View.VISIBLE); - view_share_buy_divider.setVisibility(View.GONE); - } else if (shareValid) { - ll_share_gain.setVisibility(View.VISIBLE); - ll_share_gain.setBackgroundResource(R.drawable.shape_go_share_full); - fl_buy.setVisibility(View.GONE); - view_share_buy_divider.setVisibility(View.VISIBLE); - } else if (fanliValid) { - fl_buy.setVisibility(View.VISIBLE); - fl_buy.setBackgroundResource(R.drawable.shape_go_fanli_full); - ll_share_gain.setVisibility(View.GONE); - view_share_buy_divider.setVisibility(View.VISIBLE); - } else { - fl_buy.setVisibility(View.GONE); - ll_share_gain.setVisibility(View.GONE); - } - } - - /** - * 鍏嶅崟缁撴潫 - */ - - @Override - protected void onCreate(Bundle arg0) { - super.onCreate(arg0); - setContentView(R.layout.activity_goods_detail_transition); - TopStatusSettings.setStatusViewAndDeepColor2(this); - from = getIntent().getStringExtra("from"); - if (StringUtils.isEmpty(from)) - from = ""; - GoodsCustomEvent.goodsDetail(this, from); - inputTime = System.currentTimeMillis(); - - //鎺ㄨ崘璇� - ll_recommend = findViewById(R.id.ll_recommend); - tv_recommend = findViewById(R.id.tv_recommend); - //澶嶅埗閾炬帴 - findViewById(R.id.ll_copy_link).setOnClickListener(this); - tv_copy_link = findViewById(R.id.tv_copy_link); - tv_copy_link.setText("澶嶅埗鍙d护"); - - ll_coupon_container = findViewById(R.id.ll_coupon_container); + //搴曢儴鎿嶄綔鏍� + private LinearLayout ll_bottom, ll_add_collect; + private ImageView iv_like_state; + private TextView tv_like; + private LinearLayout ll_fanli, ll_buy; + private TextView tv_fanli_money_num, tv_buy; - lv_goods_pic = findViewById(R.id.lv_goods_pic); + //鐢ㄦ埛棰嗗彇鏁版嵁 + private LinearLayout ll_notification; + private ImageView iv_notif_portrait; + private TextView tv_notif_name, tv_notif_des; + + + //鐘舵�佹暟鎹� + private FrameLayout fl_face, fl_back_face; + private LinearLayout ll_goods_nothing; + private ImageView iv_back_face; + private AVLoadingIndicatorView avLoadingIndicatorView; + private LinearLayout ll_no_net, ll_no_data, ll_request_failture; + + /**************************鎺т欢瀹氫箟缁撴潫**************************/ + + private GoodsDetailPreEventManager goodsDetailPreEventManager; + + private void initView() { + ll_content = findViewById(R.id.ll_content); + sv_goods = findViewById(R.id.lv_goods_pic); tv_top_title1 = findViewById(R.id.tv_top_title1); tv_top_title2 = findViewById(R.id.tv_top_title2); tv_top_title3 = findViewById(R.id.tv_top_title3); @@ -319,13 +207,10 @@ tv_like = findViewById(R.id.tv_like); ll_add_collect = findViewById(R.id.ll_add_collect); ll_labels = findViewById(R.id.ll_labels); - ll_send_order = findViewById(R.id.ll_send_order); - tv_share_money_num = findViewById(R.id.tv_share_money_num); tv_buy = findViewById(R.id.tv_buy); ll_top_title = findViewById(R.id.ll_top_title); iv_shop_img = findViewById(R.id.iv_shop_img); - iv_shop_type = findViewById(R.id.iv_shop_type); - tv_shop_see = findViewById(R.id.tv_shop_see); + tv_shop_type = findViewById(R.id.tv_shop_type); tv_shop_name = findViewById(R.id.tv_shop_name); tv_shop_des = findViewById(R.id.tv_shop_des); tv_shop_service = findViewById(R.id.tv_shop_service); @@ -333,104 +218,129 @@ tv_shop_des_grade = findViewById(R.id.tv_shop_des_grade); tv_shop_logistics_grade = findViewById(R.id.tv_shop_logistics_grade); tv_shop_service_grade = findViewById(R.id.tv_shop_service_grade); - iv_footermark = findViewById(R.id.iv_footermark); -// iv_like = findViewById(R.id.iv_like); v_cover = findViewById(R.id.v_cover); v_cover1 = findViewById(R.id.v_cover1); - v_cover2 = findViewById(R.id.v_cover2); - ll_goods_detail_transition_top = findViewById(R.id.ll_goods_detail_transition_top); v_1 = findViewById(R.id.v_1); v_2 = findViewById(R.id.v_2); v_3 = findViewById(R.id.v_3); v_4 = findViewById(R.id.v_4); + + fl_face = findViewById(R.id.fl_face); + + avLoadingIndicatorView = findViewById(R.id.avi); - ll_share_gain = findViewById(R.id.ll_share_gain); ll_guess_like = findViewById(R.id.ll_guess_like); - fl_buy = findViewById(R.id.fl_buy); iv_imgtext_status = findViewById(R.id.iv_imgtext_status); - iv_share = findViewById(R.id.iv_share); - iv_top_right = findViewById(R.id.iv_top_bar_right); + fl_goods_detail = findViewById(R.id.fl_goods_detail); ll_loading = findViewById(R.id.ll_loading); tv_loading = findViewById(R.id.tv_loading); iv_loading = findViewById(R.id.iv_loading); + webView = findViewById(R.id.webView); + view_goods_imgs_tag = findViewById(R.id.view_goods_imgs_tag); + + + vp_goods_detail = findViewById(R.id.vp_goods_img); + tv_currunt_page = findViewById(R.id.tv_page_num); + tv_sales_num = findViewById(R.id.tv_sales_num); + + //鍙戣揣鍦帮紝鐩镐技鎼滅储 + ll_address = findViewById(R.id.ll_address); + tv_address = findViewById(R.id.tv_address); + + gv_guess = findViewById(R.id.gv_guess_like); + fl_back_face = findViewById(R.id.fl_back_face); + iv_notif_portrait = findViewById(R.id.iv_notif_portrait); + tv_notif_name = findViewById(R.id.tv_notif_name); + tv_notif_des = findViewById(R.id.tv_notif_des); + + iv_top_left = findViewById(R.id.iv_top_bar_left1); + iv_back = findViewById(R.id.iv_back); + + ll_bottom = findViewById(R.id.ll_bottom); + + ll_notification = findViewById(R.id.ll_notification); + + tv_notice_content = findViewById(R.id.tv_notice_content); + ll_notice = findViewById(R.id.ll_notice); + iv_close = findViewById(R.id.iv_close); + + ll_no_net = findViewById(R.id.ll_no_net); + ll_no_data = findViewById(R.id.ll_no_data); + ll_request_failture = findViewById(R.id.ll_request_failture); + tv_name = findViewById(R.id.tv_name); + ll_shop = findViewById(R.id.ll_shop); + ll_rights_type = findViewById(R.id.ll_rights_type); + fl_rights_type = findViewById(R.id.fl_rights_type); + + //浠锋牸淇℃伅/绾㈠寘 + rl_price = findViewById(R.id.rl_price); + rv_price_info = findViewById(R.id.rv_price_info); + + ll_fanli = findViewById(R.id.ll_fanli); + ll_buy = findViewById(R.id.ll_buy); + tv_fanli_money_num = findViewById(R.id.tv_fanli_money_num); + } + + private void initData() { + //umeng缁熻 + GoodsCustomEvent.goodsDetail(this, from); + inputTime = System.currentTimeMillis(); + + String tempGoodsType = ""; + String tempGoodsId = ""; + + + //鑾峰彇鍟嗗搧ID + tempGoodsId = getIntent().getExtras().getString("goodsId"); + if (StringUtils.isNullOrEmpty(tempGoodsId)) + tempGoodsId = getIntent().getExtras().getString("id"); + final String goodsId = tempGoodsId; + + + //鑾峰彇鍟嗗搧绫诲瀷 + tempGoodsType = getIntent().getExtras().getString("goodsType"); + if (StringUtils.isNullOrEmpty(tempGoodsType)) + tempGoodsType = getIntent().getExtras().getInt("goodsType", 0) + ""; + if (tempGoodsType.equalsIgnoreCase("0")) + tempGoodsType = Constant.GOODS_TYPE_TB + ""; + + + final int goodsType = Integer.parseInt(tempGoodsType); + + + from = getIntent().getExtras().getString("from"); + tv_loading.setText("瀹濊礉璇︽儏椤靛姞杞戒腑..."); AnimationDrawable animationDrawable = (AnimationDrawable) getResources().getDrawable( R.drawable.anim_list_loading); iv_loading.setImageDrawable(animationDrawable); animationDrawable.start(); - - webView = findViewById(R.id.webView); 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); Animation ani = AnimationUtils.loadAnimation(this, R.anim.touming); //鐢虫槑涓�涓姩鐢� avLoadingIndicatorView.setAnimation(ani);//涓哄浘鐗囩粦瀹氬姩鐢� - vp_goods_detail = findViewById(R.id.vp_goods_img); - tv_currunt_page = findViewById(R.id.tv_page_num); - tv_goods_price_before = findViewById(R.id.tv_goods_price_before); - tv_sales_num = findViewById(R.id.tv_sales_num); - tv_coupon_show = findViewById(R.id.tv_coupon_show); - tv_goods_price_coupon = findViewById(R.id.tv_goods_price_coupon); - tv_rebate_num = findViewById(R.id.tv_rebate_num); - tv_coupon_num = findViewById(R.id.tv_coupon_num); - tv_command_num = findViewById(R.id.tv_command_num); - tv_coupon_date = findViewById(R.id.tv_coupon_date); - fl_receive_coupon = findViewById(R.id.fl_receive_coupon); - fl_command_copy = findViewById(R.id.fl_command_copy); - ll_coupon = findViewById(R.id.ll_coupon); - - - //鍙戣揣鍦帮紝鐩镐技鎼滅储 - ll_same = findViewById(R.id.ll_same); - ll_address = findViewById(R.id.ll_address); - tv_address = findViewById(R.id.tv_address); - - - ll_command_copy = findViewById(R.id.ll_command_copy); - gv_relative = findViewById(R.id.gv_relative); - gv_guess = findViewById(R.id.gv_guess_like); - fl_back_face = findViewById(R.id.fl_back_face); - findViewById(R.id.fl_face).setVisibility(View.VISIBLE); - iv_notif_portrait = findViewById(R.id.iv_notif_portrait); - tv_notif_name = findViewById(R.id.tv_notif_name); - tv_notif_des = findViewById(R.id.tv_notif_des); - lv_share_des = findViewById(R.id.lv_share_des); - lv_share_des.setClickable(false); - - //杩斿埄姣斾緥淇℃伅 - tv_rate = findViewById(R.id.tv_rate); - iv_rate = findViewById(R.id.iv_rate); - - ll_fanli_composition = findViewById(R.id.ll_fanli_composition); - tv_fanli_composition = findViewById(R.id.tv_fanli_composition); - - + fl_face.setVisibility(View.VISIBLE); bannerAdapter = new ImageAdapter(mBanners, this); vp_goods_detail.setAdapter(bannerAdapter); vp_goods_detail.setCurrentItem(0, true); - iv_top_left = findViewById(R.id.iv_top_bar_left1); - iv_back = findViewById(R.id.iv_back); - tv_goods_des = findViewById(R.id.tv_goods_des); - - ll_bottom = findViewById(R.id.ll_bottom); - tv_big_btn = findViewById(R.id.tv_big_btn); - - goodsId = getIntent().getExtras().getString("id"); - rAdapter = new RelativeGoodsAdapter(this, rList, "鐩稿叧鎺ㄨ崘"); - gv_relative.setAdapter(rAdapter); gAdapter = new RelativeGoodsAdapter(this, gList, "鐚滀綘鍠滄"); gv_guess.setAdapter(gAdapter); - ll_notification = findViewById(R.id.ll_notification); + inAnima = AnimationUtils.loadAnimation(this, R.anim.goods_detail_notify_input); outAnima = AnimationUtils .loadAnimation(this, R.anim.goods_detail_notify_out); -// ll_notification.startAnimation(inAnima); -// inAnima.start(); inAnima.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { @@ -489,53 +399,6 @@ } }); - tv_notice_content = findViewById(R.id.tv_notice_content); - ll_notice = findViewById(R.id.ll_notice); - iv_close = findViewById(R.id.iv_close); - getAppPageNotification(); - - fl_content = findViewById(R.id.fl_content); - ll_no_net = findViewById(R.id.ll_no_net); - ll_no_data = findViewById(R.id.ll_no_data); - ll_request_failture = findViewById(R.id.ll_request_failture); - findViewById(R.id.tv_net_setting).setOnClickListener(this); - findViewById(R.id.tv_refresh).setOnClickListener(this); - findViewById(R.id.fl_goods_detail).setOnClickListener(this); - - iv_top_left.setOnClickListener(this); - iv_back.setOnClickListener(this); - tv_top_title1.setOnClickListener(this); - tv_top_title2.setOnClickListener(this); - tv_top_title3.setOnClickListener(this); - tv_top_title4.setOnClickListener(this); - ll_add_collect.setOnClickListener(this); - ll_send_order.setOnClickListener(this); - ll_share_gain.setOnClickListener(this); - fl_receive_coupon.setOnClickListener(this); - fl_back_face.setOnClickListener(this); - fl_buy.setOnClickListener(this); - iv_footermark.setOnClickListener(this); -// iv_like.setOnClickListener(this); - ll_top_title.setVisibility(View.GONE); - iv_share.setOnClickListener(this); - iv_top_right.setOnClickListener(this); - tv_shop_see.setOnClickListener(this); - fl_command_copy.setOnClickListener(this); - v_cover2.setOnClickListener(this); - //鐩镐技鎼滅储鐐瑰嚮 - ll_same.setOnClickListener(this); - - iv_rate.setOnClickListener(this); - - tv_big_btn.setOnClickListener(this); - - if (getSharedPreferences("user", MODE_PRIVATE).getString("is_goods_web_detail", "0").equalsIgnoreCase("1")) { - Intent intent = new Intent(GoodsDetailActivity.this, GoodsDetailBrowerActivity.class); - intent.putExtra("id", goodsId); - startActivity(intent); - finish(); - } - vp_goods_detail.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { @@ -553,30 +416,20 @@ } }); - lv_goods_pic.setOnScrollListener(new MyScrollView.OnScrollListener() { + sv_goods.setOnScrollListener(new MyScrollView.OnScrollListener() { @Override public void onScroll(int scrollY) { int titleHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 48); int marginTopHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 8); - if (scrollY < (ll_goods_detail_transition_top.getHeight() - titleHeight * 2)) {//澶撮儴 + if (scrollY < fl_goods_detail.getTop()) {//澶撮儴 setPosition(1); - } else if (scrollY >= ll_goods_detail_transition_top.getHeight() - titleHeight * 2 - && scrollY < (ll_goods_detail_transition_top.getHeight() + webView.getHeight() - titleHeight) - && webView.getVisibility() != View.GONE) {//璇︽儏鍥剧墖 + } else if (scrollY >= (fl_goods_detail.getTop() - titleHeight) + && scrollY < view_goods_imgs_tag.getTop()) {//璇︽儏鍥剧墖 setPosition(2); - } else if (scrollY >= (ll_goods_detail_transition_top.getHeight() - + webView.getHeight() - titleHeight + marginTopHeight) && scrollY < (ll_goods_detail_transition_top.getHeight() - + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight) - && webView.getVisibility() != View.GONE) {//鐚滀綘鍠滄 - setPosition(3); - } else if (scrollY >= (ll_goods_detail_transition_top.getHeight() + webView.getHeight() - + ll_guess_like.getHeight() - titleHeight + marginTopHeight)) {//鎺ㄨ崘 - setPosition(4); } else { - setPosition(4); } - float baseHeight = ll_goods_detail_transition_top.getHeight() / 4; + float baseHeight = vp_goods_detail.getHeight() / 4; if (scrollY >= 1 && scrollY < baseHeight) { if (scrollY / baseHeight < 0.1) { @@ -607,87 +460,54 @@ } }); - gv_relative.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { - TaoBaoGoodsBrief info = (TaoBaoGoodsBrief) adapterView.getAdapter().getItem(position); - goodsId = info.getGoodsId(); - getGoodsDetail(); - } - }); + ll_top_title.setVisibility(View.GONE); + + findViewById(R.id.tv_net_setting).setOnClickListener(this); + findViewById(R.id.tv_refresh).setOnClickListener(this); + findViewById(R.id.fl_goods_detail).setOnClickListener(this); + + iv_top_left.setOnClickListener(this); + iv_back.setOnClickListener(this); + tv_top_title1.setOnClickListener(this); + tv_top_title2.setOnClickListener(this); + tv_top_title3.setOnClickListener(this); + tv_top_title4.setOnClickListener(this); + ll_add_collect.setOnClickListener(this); + fl_back_face.setOnClickListener(this); + + ll_fanli.setOnClickListener(this); + ll_buy.setOnClickListener(this); + + if (getSharedPreferences("user", MODE_PRIVATE).getString("is_goods_web_detail", "0").equalsIgnoreCase("1")) { + Intent intent = new Intent(GoodsDetailActivity.this, GoodsDetailBrowerActivity.class); + intent.putExtra("id", goodsId); + startActivity(intent); + finish(); + } + gv_guess.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { TaoBaoGoodsBrief info = (TaoBaoGoodsBrief) adapterView.getAdapter().getItem(position); - goodsId = info.getGoodsId(); - getGoodsDetail(); + getGoodsDetail(info.getGoodsId(), info.getGoodsType()); } }); - initMianDanView(); - initTopRightPopupWindow(); toast_dialog = new Toast_Dialog(this); - tv_goods_des.setOnLongClickListener(new View.OnLongClickListener() { + tv_name.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { - if (tv_goods_des.getText() != null && !StringUtils.isEmpty(tv_goods_des.getText().toString())) { - String str1 = tv_goods_des.getText().toString(); + if (tv_name.getText() != null && !StringUtils.isEmpty(tv_name.getText().toString())) { + String str1 = tv_name.getText().toString(); String substr1 = str1.replaceFirst("## ", ""); ClipboardUtil.copy(getApplicationContext(), substr1); -// SingleToast.showToast(ll_novice.getContext(), "澶嶅埗鎴愬姛"); - toast_dialog.MyDialog("鏍囬澶嶅埗鎴愬姛", false); } return false; } }); - acbutton = findViewById(R.id.actionButton); - acbutton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //鐧婚檰 - if (getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) { - LoginTaobao.getLoginTaobao(GoodsDetailActivity.this, new LonginTaobaoCallback() { - @Override - public void onSuccess() { - startActivity(new Intent(GoodsDetailActivity.this, ShoppingTrolleyActivity.class)); - } - @Override - public void onError() { - Toast.makeText(GoodsDetailActivity.this, "鐧婚檰娣樺疂澶辫触", Toast.LENGTH_SHORT).show(); - } - }); - } else { - Intent intent = new Intent(GoodsDetailActivity.this, LoginSelectActivity.class); - intent.putExtra("from", "娣樺疂"); - startActivity(intent); - } - } - }); - img = findViewById(R.id.actionButton_img); - //鑾峰彇 鍙栨秷鎮诞鎺т欢鐨勫楂� - ViewTreeObserver vto2 = img.getViewTreeObserver(); - vto2.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - img.getViewTreeObserver().removeGlobalOnLayoutListener(this); - //浼犲叆 涓荤晫闈� 鎸囧畾鎺т欢鐨勫楂� - if (acbutton != null) { - acbutton.setWidthHeight((int) (img.getWidth() * 0.77), (int) (img.getHeight() * 0.77)); - } - img.setVisibility(View.GONE);//闅愯棌 - } - }); - // 璐墿杞︽樉绀� - RecordImageTextVideo textVideo = new RecordImageTextVideo(this); - //鏈嶅姟鍣ㄨ鏄剧ず 璐墿杞�&&鏈湴涔熻鏄剧ず - if (textVideo.getCart_float().equals("1") && textVideo.getLocalCart_float() != 1 && getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) { - acbutton.setVisibility(View.VISIBLE); - } else {//闅愯棌璐墿杞� - acbutton.setVisibility(View.GONE); - } mChangeHelper = new ConnectivityChangeHelper(this, new ConnectivityChangeHelper.OnConnectivityChangeListener() { @@ -701,93 +521,108 @@ public void onNetworkAvailable() { requestState(0); if (mInfo == null) { - getGoodsDetail(); + getGoodsDetail(goodsId, goodsType); } } }); - tv_buy.postDelayed(new Runnable() { - @Override - public void run() { - if ((!isDestroyed()) && isVisible && isScroll) { - PushEventData info = new PushEventData(); - info.setGoodsId(goodsId); - info.setGoodsType("2"); - Gson gson = new GsonBuilder().serializeNulls().create(); - String data = gson.toJson(info); - GoldPushEventRequest.request(GoodsDetailActivity.this, "scanGoods", data); - } - } - }, 15 * 1000); + } - private ImageView img; - private DragFloatActionButton acbutton; - /** - * 鍒濆鍖栧彸涓婅鎻愮ず - */ - private void initTopRightPopupWindow() { - View view = getLayoutInflater().inflate(R.layout.item_share_from_filter, - null, false); - // 鍒涘缓PopupWindow瀹炰緥,200,150鍒嗗埆鏄搴﹀拰楂樺害 - mTopRightPopupWindow = new PopupWindow(view, (int) (SystemCommon.getScreenWidth(this) / 2), ViewGroup.LayoutParams.WRAP_CONTENT, true); - // 璁剧疆鍔ㄧ敾鏁堟灉 [R.style.AnimationFade 鏄嚜宸变簨鍏堝畾涔夊ソ鐨刔 -// pw_filter.setAnimationStyle(R.style.pop_multiple); - mTopRightPopupWindow.setTouchable(true); - mTopRightPopupWindow.setOutsideTouchable(false); - mTopRightPopupWindow.setFocusable(false); - ListView lv = view.findViewById(R.id.lv_filter_pw); -// mulList.add(new TopMenuRightPopContent("澶嶅埗閾炬帴", R.drawable.ic_goods_detail_copy_link)); - mulList.add(new TopMenuRightPopContent("甯姪涓績", R.drawable.ic_goods_detail_help_center)); - mulList.add(new TopMenuRightPopContent("鏂版墜鏀荤暐", R.drawable.ic_goods_detail_novice)); - mulList.add(new TopMenuRightPopContent("鑱旂郴瀹㈡湇", R.drawable.ic_goods_detail_contact_kefu)); - mulList.add(new TopMenuRightPopContent("鎴戣鍚愭Ы", R.drawable.ic_goods_detail_criticism)); - shareFromAdapter = new TopMenuRightPopContentAdapter(this, mulList); - lv.setAdapter(shareFromAdapter); + private ConnectivityChangeHelper mChangeHelper; + private ImageAdapter bannerAdapter; + private List<String> mBanners = new ArrayList<>(); - lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - mTopRightPopupWindow.dismiss(); - v_cover.setVisibility(View.GONE); - GoodsCustomEvent - .goodsDetailMoreBtn(GoodsDetailActivity.this, mulList.get(position).getName()); - SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); -// if (position == 0) { -// ClipboardManager manager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); -// ClipData myClip = ClipData.newPlainText("text", h5Url); -// manager.setPrimaryClip(myClip); -// Toast.makeText(GoodsDetailActivity.this, "閾炬帴澶嶅埗鎴愬姛", Toast.LENGTH_LONG).show(); -// } else - if (position == 0) { - Intent intent1 = new Intent(GoodsDetailActivity.this, ShareBrowserActivity.class); - intent1.putExtra("title", "甯姪涓績"); - intent1.putExtra("url", sp.getString("help", "")); - startActivity(intent1); - } else if (position == 1) { - RecordImageTextVideo textVideo = new RecordImageTextVideo(GoodsDetailActivity.this); - String url = textVideo.getvideoMoreUrl(); - if (StringUtils.isEmpty(url)) { - url = textVideo.gettxtImgUtl(); - } - Intent intent = new Intent(GoodsDetailActivity.this, ShareBrowserActivity.class); - intent.putExtra("url", url); - startActivity(intent); - } else if (position == 2) { -// startActivity(new Intent(GoodsDetailActivity.this, ContactUsActivity.class)); - KeFuUtil.jumpKeFu(GoodsDetailActivity.this, "鍟嗗搧璇︽儏"); - } else if (position == 3) { - startActivity(new Intent(GoodsDetailActivity.this, GoComplainActivity.class)); - } - } - }); - mTopRightPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { - @Override - public void onDismiss() { - v_cover2.setVisibility(View.GONE); - } - }); + private int picNum = 1; + + + Animation inAnima; + Animation outAnima; + + int index = 1; + + private Toast_Dialog toast_dialog; + + boolean isScroll = false; + boolean isVisible = false; + long inputTime = 0; + + + private View view_share_buy_divider; + + private void initFanliAndBuyBtn(boolean buyValid, boolean fanliValid) { + if (view_share_buy_divider == null) + view_share_buy_divider = findViewById(R.id.view_share_buy_divider); + if (buyValid && fanliValid) { + ll_buy.setVisibility(View.VISIBLE); + ll_fanli.setVisibility(View.VISIBLE); + view_share_buy_divider.setVisibility(View.GONE); + } else if (fanliValid) { + ll_fanli.setVisibility(View.VISIBLE); + ll_fanli.setBackgroundResource(R.drawable.shape_go_fanli_full); + ll_buy.setVisibility(View.GONE); + view_share_buy_divider.setVisibility(View.VISIBLE); + } else if (buyValid) { + ll_buy.setVisibility(View.VISIBLE); + ll_buy.setBackgroundResource(R.drawable.shape_go_share_full); + ll_fanli.setVisibility(View.GONE); + view_share_buy_divider.setVisibility(View.VISIBLE); + } else { + ll_buy.setVisibility(View.GONE); + ll_fanli.setVisibility(View.GONE); + } } + + + GoodsDetailNotifyDialog notifyDialog; + + @Override + protected void onCreate(Bundle arg0) { + super.onCreate(arg0); + setContentView(R.layout.activity_goods_detail_new); + TopStatusSettings.setStatusViewAndDeepColor2(this); + from = getIntent().getStringExtra("from"); + if (StringUtils.isEmpty(from)) + from = ""; + initView(); + initData(); + getAppPageNotification(); + + +// notifyDialog = new GoodsDetailNotifyDialog.Builder(GoodsDetailActivity.this).setMessage("娴嬭瘯12123123").setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { +// @Override +// public void onLeftClick() { +// } +// +// @Override +// public void onRightClick() { +// DialogUtil.dismiss(notifyDialog); +// goFanli(); +// } +// }).create(); +// +// DialogUtil.show(notifyDialog); + + } + + public void showNotifyDialog(String btnName, String link) { + DialogUtil.dismiss(notifyDialog); + + 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); + } + Handler handler = new Handler() { @Override @@ -801,9 +636,7 @@ inAnima.setInterpolator(new DecelerateInterpolator()); ll_notification.setAnimation(inAnima); ll_notification.startAnimation(inAnima); -// inAnima.start(); - } else if (msg.what == 2) { - lv_share_des.setSelection(0); + inAnima.start(); } else if (msg.what == 3) {//鍏抽棴寮圭獥 if (dialog != null && dialog.isShowing()) dialog.dismiss(); @@ -824,6 +657,19 @@ 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 public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); @@ -834,6 +680,7 @@ } }, 3000); } + } private void getAppPageNotification() { @@ -891,40 +738,23 @@ } - GoodsDetail mInfo; - boolean isNative = true; - TbPidInfo tInfo; + GoodsDetailVO mInfo; List<CouponUser> couponUsers; - List<ShareUser> sList; - ShareExampleAdapter shareAdapter; - // ProgressDialog pd; String from; - String noRebateHelpLink; boolean isQuestDetail; - private void getGoodsDetail() { + private void getGoodsDetail(String goodsId, int goodsType) { isQuestDetail = true; - String uid = getSharedPreferences("user", MODE_PRIVATE).getString("uid", "0"); - ShoppingApi.getGoodsInfoTB(this, goodsId, uid, from, new BasicTextHttpResponseHandler() { + ShoppingApi.getGoodsInfo(this, goodsId, goodsType, UserUtil.getUid(getApplicationContext()), from, new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { -// findViewById(R.id.fl_face).setVisibility(View.GONE); -// findViewById(R.id.ll_goods_nothing).setVisibility(View.GONE); -// fl_content.setVisibility(View.VISIBLE); if (jsonObject.optString("code").equalsIgnoreCase("0")) { - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - params.bottomMargin = DimenUtils.dip2px(GoodsDetailActivity.this, 50); - lv_goods_pic.setLayoutParams(params); - Gson gson = new GsonBuilder().serializeNulls().create(); - mInfo = gson.fromJson(jsonObject.optJSONObject("data").toString(), GoodsDetail.class); - getGoodsRecommend(); - - h5Url = mInfo.getExtra().getH5Url();//浜у搧h5 閾炬帴 + mInfo = gson.fromJson(jsonObject.optJSONObject("data").toString(), GoodsDetailVO.class); + getGoodsRecommend(mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType()); + goodsDetailPreEventManager = new GoodsDetailPreEventManager(GoodsDetailActivity.this, mInfo); couponUsers = mInfo.getExtra().getListCouponUser(); - sList = mInfo.getExtra().getListShareUser(); - noRebateHelpLink = mInfo.getExtra().getShare().getHelpLink(); if (mInfo.getGoods() != null && mInfo.getGoods().getLabels() != null && mInfo.getGoods().getLabels().size() > 0) { SetLabels.addLabel(GoodsDetailActivity.this, ll_labels, mInfo.getGoods().getLabels()); @@ -932,21 +762,13 @@ } else { ll_labels.setVisibility(View.GONE); } - if (sList.size() <= 0) { - lv_share_des.setVisibility(View.GONE); - } else { - lv_share_des.setVisibility(View.VISIBLE); - } - shareAdapter = new ShareExampleAdapter(sList); - lv_share_des.setAdapter(shareAdapter); + if (timer != null) { timer.cancel(); timer = null; index = 1; } - startTimer(sList.size()); - goodsTaoBaoId = mInfo.getGoods().getGoodsId(); isCollect = mInfo.getExtra().isCollected(); if (couponUsers != null && couponUsers.size() > 0) { @@ -954,125 +776,71 @@ ll_notification.setAnimation(inAnima); ll_notification.startAnimation(inAnima); } - ImageUtil.showImageFace(GoodsDetailActivity.this, mInfo.getGoods().getTitle(), mInfo.getGoods().getShopType(), tv_goods_des); - tv_goods_price_before.setText(mInfo.getGoods().getPriceName() + " 楼" + mInfo.getGoods().getZkPrice()); + + tv_name.setText(mInfo.getGoods().getTitle()); webView.loadUrl(mInfo.getExtra().getDetailUrl()); - tv_sales_num.setText("鏈堥攢 " + mInfo.getGoods().getSalesCount()); - tv_rebate_num.setText(" 杩�" + mInfo.getGoods().getMoneyInfo().getFanliMoney()); + if (StringUtils.isNullOrEmpty(mInfo.getGoods().getSalesCount())) { + tv_sales_num.setText(""); + } else + tv_sales_num.setText(GoodsDetailUtil.getSalesTypeDesc(mInfo.getGoods().getSalesType()) + " " + mInfo.getGoods().getSalesCount()); - tv_share_money_num.setText(mInfo.getGoods().getMoneyInfo().getShareMoney()); + if (mInfo.getGoods().getShopInfo() != null) { + ll_shop.setVisibility(View.VISIBLE); + Glide.with(GoodsDetailActivity.this).load(mInfo.getGoods().getShopInfo().getShopIcon()) + .placeholder(R.drawable.ic_goods_default) + .error(R.drawable.ic_goods_default) + .transform(new GlideRoundTransform(GoodsDetailActivity.this, + 5)).into(iv_shop_img); + tv_shop_name.setText(mInfo.getGoods().getShopInfo().getShopName()); - //璁剧疆姣斾緥淇℃伅 - if (!StringUtils.isEmpty(mInfo.getGoods().getMoneyInfo().getRateInfo())) { - tv_rate.setVisibility(View.VISIBLE); - tv_rate.setText(mInfo.getGoods().getMoneyInfo().getRateInfo()); + try { + GoodsDetailUtil.fillShopType(tv_shop_type, mInfo.getGoods().getShopType()); + + if (!StringUtils.isNullOrEmpty(mInfo.getGoods().getShopInfo().getScoreGoods())) { + tv_shop_des.setText("瀹濊礉鎻忚堪: " + mInfo.getGoods().getShopInfo().getScoreGoods()); + tv_shop_service.setText("鍗栧鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreSeller()); + tv_shop_logistics.setText("鐗╂祦鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreLogistics()); + tv_shop_des_grade.setText(mInfo.getGoods().getShopInfo().getScoreGoodsD() == 0 ? "骞�" : + mInfo.getGoods().getShopInfo().getScoreGoodsD() == 1 ? "楂�" : "浣�"); + tv_shop_service_grade.setText(mInfo.getGoods().getShopInfo().getScoreSellerD() == 0 ? "骞�" : + mInfo.getGoods().getShopInfo().getScoreSellerD() == 1 ? "楂�" : "浣�"); + tv_shop_logistics_grade.setText(mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 0 ? "骞�" : + mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 1 ? "楂�" : "浣�"); + } else { + tv_shop_des.setVisibility(View.INVISIBLE); + tv_shop_service.setVisibility(View.INVISIBLE); + tv_shop_logistics.setVisibility(View.INVISIBLE); + tv_shop_des_grade.setVisibility(View.INVISIBLE); + tv_shop_service_grade.setVisibility(View.INVISIBLE); + tv_shop_logistics_grade.setVisibility(View.INVISIBLE); + } + } catch (Exception e) { + + } } else { - tv_rate.setVisibility(View.GONE); + ll_shop.setVisibility(View.GONE); } - if (!StringUtils.isEmpty(mInfo.getGoods().getMoneyInfo().getRateInfoHelpUrl())) { - iv_rate.setVisibility(View.VISIBLE); - } else { - iv_rate.setVisibility(View.GONE); - } - - //璁剧疆鎺ㄨ崘淇℃伅 - if (StringUtils.isEmpty(mInfo.getGoods().getDescription())) { - ll_recommend.setVisibility(View.GONE); - } else { - ll_recommend.setVisibility(View.VISIBLE); - tv_recommend.setText(mInfo.getGoods().getDescription()); - } - //璁剧疆琛ヨ创淇℃伅 - if (!StringUtils.isBlank(mInfo.getGoods().getMoneyInfo().getCompositionInfo())) { - tv_fanli_composition.setText(mInfo.getGoods().getMoneyInfo().getCompositionInfo()); - } - - - - Glide.with(GoodsDetailActivity.this).load(mInfo.getGoods().getShopInfo().getShopIcon()) - .placeholder(R.drawable.ic_goods_default) - .error(R.drawable.ic_goods_default) - .transform(new GlideRoundTransform(GoodsDetailActivity.this, - 5)).into(iv_shop_img); - tv_shop_name.setText(mInfo.getGoods().getShopInfo().getShopName()); - iv_shop_type.setImageDrawable(mInfo.getGoods().getShopInfo().getUserType() == 0 ? - getResources().getDrawable(R.drawable.ic_shop_type_taobao) : - getResources().getDrawable(R.drawable.ic_shop_type_tmall)); - tv_shop_des.setText("瀹濊礉鎻忚堪: " + mInfo.getGoods().getShopInfo().getScoreGoods()); - tv_shop_service.setText("鍗栧鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreSeller()); - tv_shop_logistics.setText("鐗╂祦鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreLogistics()); - tv_shop_des_grade.setText(mInfo.getGoods().getShopInfo().getScoreGoodsD() == 0 ? "骞�" : - mInfo.getGoods().getShopInfo().getScoreGoodsD() == 1 ? "楂�" : "浣�"); - tv_shop_service_grade.setText(mInfo.getGoods().getShopInfo().getScoreSellerD() == 0 ? "骞�" : - mInfo.getGoods().getShopInfo().getScoreSellerD() == 1 ? "楂�" : "浣�"); - tv_shop_logistics_grade.setText(mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 0 ? "骞�" : - mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 1 ? "楂�" : "浣�"); - if (mInfo.getGoods().getOtherInfo().getRewardCoupon() != null) { - tv_reward_money.setText(mInfo.getGoods().getOtherInfo().getRewardCoupon().getMaxMoney()); - tv_reward_hint.setText(mInfo.getGoods().getOtherInfo().getRewardCoupon().getDesc()); - } if (mInfo.getExtra().isCollected()) { setCollectionData(true); } else { setCollectionData(false); } + //鏉冪泭璁剧疆 - if (mInfo.getGoods().isHasCoupon()) { - if (mInfo.getGoods().getCouponInfoList() == null) { - List<CouponInfo> couponInfoList = new ArrayList<>(); - couponInfoList.add(mInfo.getGoods().getCouponInfo()); - mInfo.getGoods().setCouponInfoList(couponInfoList); - } + setRightsData(mInfo.getGoods().getRights()); - if (mInfo.getGoods().getCouponInfoList().size() > 3) - initCouponInfo(mInfo.getGoods().getCouponInfoList().subList(0, 3)); - else - initCouponInfo(mInfo.getGoods().getCouponInfoList()); - - if (StringUtils.isEmpty(mInfo.getGoods().getCouponInfo().getToken())) { - ll_command_copy.setVisibility(View.GONE); - } else { - ll_command_copy.setVisibility(View.VISIBLE); - tv_command_num.setText(mInfo.getGoods().getCouponInfo().getToken()); - } - tv_buy.setText(mInfo.getGoods().getMoneyInfo().getFanliMoney()); - - tv_coupon_num.setText("楼 " + mInfo.getGoods().getCouponInfo().getAmount()); - - String couponDate = StringUtils.isEmpty(mInfo.getGoods().getCouponInfo().getStartTime()) ? "" : - mInfo.getGoods().getCouponInfo().getStartTime() + "-" + mInfo.getGoods().getCouponInfo().getEndTime(); - tv_coupon_date.setText("浣跨敤鏈熼檺锛�" + couponDate); - tv_goods_price_coupon.setText(mInfo.getGoods().getCouponPrice()); -// NewbieGuide.with(GoodsDetailActivity.this) -// .setLabel("guideDetail") -//// .alwaysShow(true)//鎬绘槸鏄剧ず锛岃皟璇曟椂鍙互鎵撳紑 -// .addGuidePage(GuidePage.newInstance() -// .addHighLight(fl_buy, HighLight.Shape.ROUND_RECTANGLE, -// 20, 20, null) -// .setLayoutRes(R.layout.item_guide_detail2, R.id.iv_next) -// .setEverywhereCancelable(false) -// ).show(); - } else { - ll_command_copy.setVisibility(View.GONE); - tv_buy.setText(mInfo.getGoods().getMoneyInfo().getFanliMoney()); - tv_coupon_show.setVisibility(View.GONE); - ll_coupon.setVisibility(View.GONE); - tv_goods_price_coupon.setText(mInfo.getGoods().getZkPrice()); - } + //璁剧疆浠锋牸淇℃伅 + setPriceInfo(mInfo.getGoods()); //鍙戣揣鍦拌缃� - if (!StringUtils.isBlank(mInfo.getGoods().getProvCity())) { + if (!StringUtils.isBlank(mInfo.getGoods().getAddress())) { ll_address.setVisibility(View.VISIBLE); - tv_address.setText(mInfo.getGoods().getProvCity()); + tv_address.setText(mInfo.getGoods().getAddress()); + } else { + ll_address.setVisibility(View.GONE); } - //涓�閿彂鍗曡缃� - GoodsDetailUtil.initSendOrderView(GoodsDetailActivity.this, mInfo.getExtra()); - - fl_buy.setVisibility(mInfo.getExtra().isFanliValid() ? View.VISIBLE : View.GONE); - tv_rebate_num.setVisibility(mInfo.getExtra().isFanliValid() ? View.VISIBLE : View.GONE); - Log.i("mResult", "isLike鐨勫�间负" + mInfo.getGoods().getGoodsId()); @@ -1082,14 +850,12 @@ mBanners.addAll(mInfo.getGoods().getImgList()); bannerAdapter.notifyDataSetChanged(); vp_goods_detail.setCurrentItem(0); - isNative = mInfo.getExtra().isNative(); - setMianDanData(); - initShareAndBuyBtn(mInfo.getExtra().isShareValid(), mInfo.getExtra().isFanliValid()); + initFanliAndBuyBtn(mInfo.getExtra().isBuyValid(), mInfo.getExtra().isFanliValid()); requestState(0); + sv_goods.scrollTo(0, 0); } else if (jsonObject.optString("code").equalsIgnoreCase("2")) { - fl_content.setVisibility(View.GONE); findViewById(R.id.ll_goods_nothing).setVisibility(View.VISIBLE); - findViewById(R.id.fl_face).setVisibility(View.VISIBLE); + fl_face.setVisibility(View.VISIBLE); } } @@ -1112,201 +878,25 @@ public void onFinish() { super.onFinish(); Log.e("mResult", "goodsdetail---onFinish()"); - lv_goods_pic.scrollTo(0, 0); + sv_goods.scrollTo(0, 0); avLoadingIndicatorView.hide(); - findViewById(R.id.fl_face).setVisibility(View.GONE); - fl_content.setVisibility(View.VISIBLE); } }); } Timer timer; - /** - * 鍚姩鍒嗕韩鎻愮ず鏍弔imer - */ - private void startTimer(final int length) { - timer = new Timer(); - timer.schedule(new TimerTask() { - @Override - public void run() { - if (index <= length) { - lv_share_des.smoothScrollBy(DimenUtils.dip2px(GoodsDetailActivity.this, 62), 1000); - index++; - } else { - index = 1; - handler.sendEmptyMessage(2); - } - } - }, 2000, 3000); - } - - private void getGoodsRecommend() { - ShoppingApi.getGuessAndRecommend(this, goodsId, mInfo.getGoods().getGoodsType() + "", new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - if (jsonObject.optString("code").equalsIgnoreCase("0")) { - gList.clear(); - Gson gson = new GsonBuilder().serializeNulls().create(); - List<TaoBaoGoodsBrief> list1 = gson.fromJson( - jsonObject.optJSONObject("data").optJSONArray("listGuess").toString(), - new TypeToken<List<TaoBaoGoodsBrief>>() { - }.getType()); - List<TaoBaoGoodsBrief> list2 = gson.fromJson( - jsonObject.optJSONObject("data").optJSONArray("listQuality").toString(), - new TypeToken<List<TaoBaoGoodsBrief>>() { - }.getType()); - if (list1 != null && list1.size() > 0) { - gList.addAll(list1); - gAdapter.notifyDataSetChanged(); - } - if (list2 != null && list2.size() > 0) { - rList.addAll(list2); - rAdapter.notifyDataSetChanged(); - } - - if (gList.size() == 0) { - findViewById(R.id.fl_top_title3).setVisibility(View.GONE); - ll_guess_like.setVisibility(View.GONE); - } - if (rList.size() == 0) { - findViewById(R.id.fl_top_title4).setVisibility(View.GONE); - findViewById(R.id.ll_relative_goods).setVisibility(View.GONE); - } - } - } - - }); - } - JumpTaoBaoDialog dialog; - boolean isFirst = true; - - - List<CouponInfo> couponInfoList = new ArrayList<>(); - GoodsDetailCouponAdapter couponAdapter = null; - CouponInfo tempCouponInfo; - MyListView couponListView; - - - private void initCouponInfo(List<CouponInfo> couponList) { - if (couponList != null && couponList.size() > 0) { - couponInfoList.clear(); - couponInfoList.addAll(couponList); - if (couponAdapter == null) { - couponAdapter = new GoodsDetailCouponAdapter(this, couponInfoList, new GoodsDetailCouponAdapter.IRecieveCoupon() { - @Override - public void recieve(CouponInfo info) { - tempCouponInfo = info; - recieveCoupon(info); - } - }); - } - - if (couponListView == null) { - couponListView = new MyListView(this); - couponListView.setDivider(null); - couponListView.setDividerHeight(DimenUtils.dip2px(this, 3)); - ll_coupon_container.removeAllViews(); - ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - couponListView.setLayoutParams(params); - ll_coupon_container.addView(couponListView, params); - - final LinearLayout footerView = new LinearLayout(this); - footerView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); - footerView.setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - TextView textView = new TextView(this); - textView.setText("鐐瑰嚮鏌ョ湅鏇村 "); - textView.setTextSize(11); - textView.setTextColor(Color.rgb(102, 102, 102)); - footerView.addView(textView); - footerView.setBackground(null); - - ImageView imageView = new ImageView(this); - imageView.setImageResource(R.drawable.ic_arrow_down); - footerView.addView(imageView); - footerView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - initCouponInfo(mInfo.getGoods().getCouponInfoList()); - couponListView.removeFooterView(footerView); - } - }); - if (mInfo.getGoods().getCouponInfoList() != null && mInfo.getGoods().getCouponInfoList().size() > 3) - couponListView.addFooterView(footerView); - couponListView.setAdapter(couponAdapter); - } - couponAdapter.notifyDataSetChanged(); - } - } @Override protected void onResume() { super.onResume(); + if (mChangeHelper != null) + mChangeHelper.registerReceiver(); + if (goodsDetailPreEventManager != null) + goodsDetailPreEventManager.onResume(); isVisible = true; - mChangeHelper.registerReceiver(); -// vp_goods_detail.postDelayed(mAutoScroller, 5000); - SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); - boolean isLogin = sp.getBoolean("isLogin", false); - - //VIP涓嶅湪灞曠ず瓒呯骇浼氬憳 - UserInfo user = UserUtil.getUserInfo(this); - if (user != null && user.isVip()) { - ll_reward_coupon.setVisibility(View.GONE); - } else - ll_reward_coupon.setVisibility(View.VISIBLE); - - setMianDanData(); - - if (isLogin) { - if (isClick == 1 && !isTBStartBind) { - if (isFirst) { - getTaoBaoH5AuthInfo("zigou"); - } else { - getTaoBaoH5AuthInfo2("zigou"); - } - } else if (isClick == 2 && !isTBStartBind) { - if (mInfo != null) { - if (isFirst) { - getTaoBaoH5AuthInfo("share"); - } else { - getTaoBaoH5AuthInfo2("share"); - isClick = 0; - } - } else { - Toast.makeText(GoodsDetailActivity.this, "鏆傛湭鑾峰彇鍒板垎浜繑鍒╋紝璇风◢绛�", Toast.LENGTH_LONG).show(); - isClick = 0; - } - } else if (isClick == 3) { - if (isCollect) { - setCollectionData(true); - } else { - collection(); - } - isClick = 0; - } else if (isClick == 4) { - if (AlibcLogin.getInstance().isLogin()) { - isClick = 0; - startActivity(new Intent(GoodsDetailActivity.this, ShoppingTrolleyActivity.class)); - } -// else { -// tbLogin(); -// } - } else if (isClick == 5) { - isClick = 0; - startActivity(new Intent(GoodsDetailActivity.this, Collect28Activity.class)); - } else if (isClick == 7) { - sendOrder(); - isClick = 0; - } else if (isClick == 8) {//澶嶅埗娣樺彛浠� - commandCopy(); - isClick = 0; - } else if (isClick == 9) {//璺宠浆濂栧姳鍒歌幏鍙� - jumpDetail(); - isClick = 0; - } - } } @Override @@ -1314,95 +904,16 @@ super.onPause(); isVisible = false; mChangeHelper.unregisterReceiver(); - timer(); } - - String clickUrl = ""; - String couponUrl = ""; - private String h5Url = "";//浜у搧閾炬帴 int type = 0; - /** - * 鑾峰彇PID 淇℃伅 - */ - private void getTBLinkInfo(String uid) { - if (pd == null) - pd = new ShapeLoadingDialog.Builder(this).build(); - if (!pd.isShowing()) - pd.show(); - ShoppingApi.getTBLinkInfo(this, uid, goodsId, "goodsDetail", from, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - if (jsonObject.optString("code").equalsIgnoreCase("0")) { - Gson gson = new GsonBuilder().serializeNulls().create(); - isNative = jsonObject.optJSONObject("data").optBoolean("native"); - type = Integer.parseInt(jsonObject.optJSONObject("data").optString("type")); - if (jsonObject.optJSONObject("data").optJSONObject("tbPidInfo") != null) - tInfo = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("tbPidInfo").toString(), TbPidInfo.class); - JSONObject object = jsonObject.optJSONObject("data").optJSONObject("link"); - if (object != null) { - clickUrl = object.optString("clickUrl"); - couponUrl = object.optString("couponUrl"); - } - Log.e("mResult", "getTBLinkInfo():type---" + type + "---isLogin---" + AlibcLogin.getInstance().isLogin()); - if ((!StringUtils.isEmpty(from)) && from.equalsIgnoreCase("miandan")) { - getGoodsMianDanCouponList(); - } else { - goBuy(); - pd.dismiss(); - } - } - } - - @Override - public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { - super.onFailure(statusCode, headers, jsonObject, e); - pd.dismiss(); - } - }); - } - private boolean isCollect = false; - private int isClick = 0; private boolean isSpread = false;//鍥炬枃鏄惁灞曞紑 List<TaoBaoGoodsBrief> gList = new ArrayList<>(); RelativeGoodsAdapter gAdapter; - List<TaoBaoGoodsBrief> rList = new ArrayList<>(); - RelativeGoodsAdapter rAdapter; - long lastShareTimeClick = 0; - long lastBuyTimeClick = 0; - //鏄惁涓哄鍒堕摼鎺ユ寜閽� - boolean copyLink = false; - - //寮�濮嬪垎浜� - private void startShare(boolean isLogin) { - if (mInfo == null || mInfo.getGoods() == null) - return; - long cTime = System.currentTimeMillis(); - if (cTime - lastShareTimeClick < 500) { - lastShareTimeClick = cTime; - return; - } - lastShareTimeClick = cTime; - isTBStartBind = false; - GoodsCustomEvent.goodsDetailShare(GoodsDetailActivity.this); - if (isLogin) { - if (mInfo != null) { - getTaoBaoH5AuthInfo("share"); - } else { - Toast.makeText(GoodsDetailActivity.this, "鏆傛湭鑾峰彇鍒板垎浜繑鍒╋紝璇风◢绛�", Toast.LENGTH_LONG).show(); - } - } else { - isClick = 2; - Toast.makeText(GoodsDetailActivity.this, "璇峰厛鐧诲綍鏉挎牀蹇渷璐﹀彿", Toast.LENGTH_LONG).show(); - Intent intent = new Intent(GoodsDetailActivity.this, LoginSelectActivity.class); - intent.putExtra("from", "娣樺疂"); - startActivity(intent); - } - } @Override public void onClick(View v) { @@ -1416,41 +927,29 @@ case R.id.iv_top_bar_left1: finish(); break; - case R.id.iv_share: - case R.id.iv_top_bar_right: - if (mTopRightPopupWindow.isShowing()) { - mTopRightPopupWindow.dismiss(); - } else { - v_cover2.setVisibility(View.VISIBLE); - mTopRightPopupWindow.showAsDropDown(iv_share); - } - break; - case R.id.v_cover2: - mTopRightPopupWindow.dismiss(); - break; case R.id.tv_top_title1: - lv_goods_pic.scrollTo(0, 0); + sv_goods.scrollTo(0, 0); setPosition(1); break; - case R.id.tv_top_title2: - lv_goods_pic.scrollTo(0, ll_goods_detail_transition_top.getHeight() - titleHeight * 2); + case R.id.tv_top_title2://璇︽儏 + sv_goods.scrollTo(0, fl_goods_detail.getTop()); setPosition(2); break; - case R.id.tv_top_title3: - lv_goods_pic.scrollTo(0, ll_goods_detail_transition_top.getHeight() + webView.getHeight() - titleHeight + marginTopHeight); + case R.id.tv_top_title3://鐚滀綘鍠滄 + sv_goods.scrollTo(0, (int) ll_guess_like.getTop()); setPosition(3); break; - case R.id.tv_top_title4: - lv_goods_pic.scrollTo(0, ll_goods_detail_transition_top.getHeight() + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight); + case R.id.tv_top_title4://鎺ㄨ崘 + Log.i(TAG, (int) ll_guess_like.getTop() + ""); + sv_goods.scrollTo(0, (int) ll_guess_like.getTop()); setPosition(4); break; case R.id.ll_add_collect: - if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", true)) + if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()), true)) return; ll_add_collect.setEnabled(false); if (mInfo == null) { -// SingleToast.showToast(GoodsDetailActivity.this, "娌℃湁鑾峰彇鍒板晢鍝佹敹钘忕姸鎬�,璇风◢绛�!"); Toast.makeText(GoodsDetailActivity.this, "娌℃湁鑾峰彇鍒板晢鍝佹敹钘忕姸鎬�,璇风◢绛�", Toast.LENGTH_SHORT).show(); ll_add_collect.setEnabled(true); break; @@ -1459,54 +958,18 @@ collection(); } else { ll_add_collect.setEnabled(true); - isClick = 3; Intent intent = new Intent(GoodsDetailActivity.this, LoginSelectActivity.class); intent.putExtra("from", "娣樺疂"); startActivity(intent); Toast.makeText(GoodsDetailActivity.this, "璇峰厛鐧诲綍鏉挎牀蹇渷璐﹀彿", Toast.LENGTH_SHORT).show(); } break; - case R.id.ll_copy_link: - if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", true)) - return; - copyLink = true; - startShare(isLogin); + case R.id.ll_buy: + goBuy(); break; - //鍒嗕韩濂栭噾 - case R.id.ll_share_gain: - if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", true)) - return; - copyLink = false; - startShare(isLogin); - break; - //棰嗗埜 - case R.id.fl_receive_coupon: - if (mInfo == null || mInfo.getGoods() == null) - return; - long cTime1 = System.currentTimeMillis(); - if (cTime1 - lastBuyTimeClick < 500) { - lastBuyTimeClick = cTime1; - break; - } - lastBuyTimeClick = cTime1; - GoodsCustomEvent.goodsDetailCouponClick(this); - - break; - case R.id.tv_big_btn: - case R.id.fl_buy: - if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", true)) - return; - if (mInfo == null || mInfo.getGoods() == null) - return; - long cTime2 = System.currentTimeMillis(); - if (cTime2 - lastBuyTimeClick < 500) { - lastBuyTimeClick = cTime2; - break; - } - lastBuyTimeClick = cTime2; - GoodsCustomEvent.goodsDetailBuyCommon(this); - buyOrGainCoupon(isLogin); + case R.id.ll_fanli: + goFanli(); break; case R.id.fl_back_face: @@ -1524,12 +987,10 @@ return; if (isSpread) { webView.setVisibility(View.GONE); -// ll_imgs.removeAllViews(); iv_imgtext_status.setImageDrawable(getResources().getDrawable(R.drawable.ic_detail_img_close)); } else { webView.setVisibility(View.VISIBLE); iv_imgtext_status.setImageDrawable(getResources().getDrawable(R.drawable.ic_detail_img_open)); -// getImgText(); } isSpread = !isSpread; break; @@ -1547,193 +1008,14 @@ info.setShopUrl(mInfo.getGoods().getShopInfo().getShopLink()); Gson gson = new GsonBuilder().serializeNulls().create(); String data = gson.toJson(info); - GoldPushEventRequest.request(GoodsDetailActivity.this, "inShop", data); break; - case R.id.fl_command_copy: - if (isLogin) - commandCopy(); - else - commandCopyHint(); - break; - case R.id.iv_footermark: startActivity(new Intent(GoodsDetailActivity.this, MyFootmarkActivity.class)); break; - - case R.id.ll_same: - if (mInfo == null || mInfo.getGoods() == null) - return; - Intent intent = new Intent(this, SearchResultActivity.class); - intent.putExtra("content", mInfo.getGoods().getTitle()); - startActivity(intent); - break; } } - private void jumpDetail() { - Intent intent; - if ((!StringUtils.isEmpty(mInfo.getGoods().getOtherInfo().getRewardCoupon().getJumpDetail().getActivity()))) { - try { - intent = new Intent(this, Class.forName(mInfo.getGoods().getOtherInfo().getRewardCoupon().getJumpDetail().getActivity())); - } catch (Exception e) { - e.printStackTrace(); - return; - } - if (mInfo.getGoods().getOtherInfo().getRewardCoupon().getParams() != null) { - @SuppressWarnings("unchecked") - Iterator<String> its = mInfo.getGoods().getOtherInfo().getRewardCoupon().getParams().keySet().iterator(); - while (its.hasNext()) { - String key = its.next(); - String value = mInfo.getGoods().getOtherInfo().getRewardCoupon().getParams().getString(key); - intent.putExtra(key, value); - } - } - startActivity(intent); - } - } - - /* - *棰嗗埜鎻愮ず - */ - private void receiveCouponHint(final String couponUrl) { - final SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); - boolean receiveCouponHint = sp.getBoolean("receiveCouponHint", true); - if (!receiveCouponHint) { - receiveCoupon(couponUrl); - } else { - ReceiveCouponHintDialog.Builder builder = new ReceiveCouponHintDialog.Builder(GoodsDetailActivity.this); - builder.setMessage("鏈櫥褰曟棤杩斿埄锛岀‘瀹氬厤璐归鍒革紵").setTitle("娓╅Θ鎻愮ず") - .setPositiveButton("鍘婚鍒�", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface cDialog, int which) { - cDialog.dismiss(); - SharedPreferences.Editor editor = sp.edit(); - editor.putBoolean("receiveCouponHint", false); - editor.commit(); - receiveCoupon(couponUrl); - } - }) - .setNegativeButton("鍘荤櫥褰�", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(GoodsDetailActivity.this, LoginSelectActivity.class); - intent.putExtra("from", "娣樺疂"); - startActivity(intent); - isClick = 1; - dialog.dismiss(); - } - }).create().show(); - } - } - - private void receiveCoupon(String couponUrl) { - if (ApkUtil.checkAPP(GoodsDetailActivity.this, "com.taobao.taobao")) { - alibcShowParams = new AlibcShowParams(); - alibcShowParams.setOpenType(OpenType.Native); - } else { - alibcShowParams = new AlibcShowParams(); - alibcShowParams.setOpenType(OpenType.Auto); - } - alibcTaokeParams = new AlibcTaokeParams("", "", ""); - alibcTaokeParams.setPid(BuXinConstant.BAICHUAN_PID); - alibcTaokeParams.setAdzoneid(BuXinConstant.BAICHUAN_ADZONE_ID); - alibcTaokeParams.pid = BuXinConstant.BAICHUAN_PID; - alibcTaokeParams.adzoneid = BuXinConstant.BAICHUAN_ADZONE_ID; - alibcTaokeParams.extraParams = new HashMap<>(); - alibcTaokeParams.extraParams.put("taokeAppkey", BuXinConstant.TAO_BAO_KE_KEY); - - exParams = new HashMap<>(); - exParams.put(AlibcConstants.ISV_CODE, "appisvcode"); - exParams.put("alibaba", "闃块噷宸村反");//鑷畾涔夊弬鏁伴儴鍒嗭紝鍙换鎰忓鍒犳敼 - - if (!StringUtils.isEmpty(couponUrl)) { - jumpWeb(couponUrl); - } else { - AlibcDetailPage basePage = new AlibcDetailPage(goodsId); - jumpNative(basePage); - } - - boolean isLogin = getSharedPreferences("user", MODE_PRIVATE) - .getBoolean("isLogin", false); - String msg = "璐拱鍚庢湁杩斿埄锛屽垎浜悗鏈夊閲�"; - if (!isLogin) { - msg = "鏈櫥褰曪紝鏃犺繑鍒�"; - } - if (dialog == null) { - JumpTaoBaoDialog.Builder builder1 = new JumpTaoBaoDialog.Builder(GoodsDetailActivity.this); - builder1.setMessage(msg); - builder1.setPlatform(1); - dialog = builder1.create(); - } else { - if (dialog != null && dialog.isShowing()) - dialog.dismiss(); - } - - dialog.show(); - isClick = 0; - timer();//5绉掕秴鏃跺叧闂� 寮圭獥 - } - - - private void recieveCoupon(CouponInfo couponInfo) { - if (couponInfo == null) - return; - - boolean isLogin = getSharedPreferences("user", MODE_PRIVATE) - .getBoolean("isLogin", false); - if (!isLogin) { - receiveCouponHint(couponInfo.getLink()); - } else { - if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", true)) - return; - if (couponInfo.isShopCoupon()) { - receiveCoupon(couponInfo.getLink()); - } else - buyOrGainCoupon(isLogin); - } - } - - /* - *棰嗗埜鎻愮ず - */ - private void commandCopyHint() { - final SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); - boolean commandHint = sp.getBoolean("receiveCouponHint", true); - if (!commandHint) { - commandCopy(); - } else { - ReceiveCouponHintDialog.Builder builder = new ReceiveCouponHintDialog.Builder(GoodsDetailActivity.this); - builder.setMessage("鏈櫥褰曟棤杩斿埄锛岀‘瀹氬厤璐归鍒革紵").setTitle("娓╅Θ鎻愮ず") - .setPositiveButton("鍘婚鍒�", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface cDialog, int which) { - cDialog.dismiss(); - SharedPreferences.Editor editor = sp.edit(); - editor.putBoolean("receiveCouponHint", false); - editor.commit(); - commandCopy(); - } - }) - .setNegativeButton("鍘荤櫥褰�", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(GoodsDetailActivity.this, LoginSelectActivity.class); - intent.putExtra("from", "娣樺疂"); - startActivity(intent); - dialog.dismiss(); - isClick = 8; - } - }).create().show(); - } - } - - private void commandCopy() { - ClipboardUtil.copy(getApplicationContext(), mInfo.getGoods().getCouponInfo().getToken()); - - Toast.makeText(GoodsDetailActivity.this, "娣樺彛浠ゅ鍒舵垚鍔�", - Toast.LENGTH_SHORT).show(); - } private void setPosition(int position) { tv_top_title1.setTextColor(position == 1 ? getResources().getColor(R.color.main_text_color) : getResources().getColor(R.color.black2)); @@ -1750,112 +1032,11 @@ v_4.setVisibility(position == 4 ? View.VISIBLE : View.GONE); } - private void buyOrGainCoupon(boolean isLogin) { - isClick = 1; - isTBStartBind = false; - if (!isLogin) { - Toast.makeText(GoodsDetailActivity.this, "璇峰厛鐧诲綍鏉挎牀蹇渷璐﹀彿", Toast.LENGTH_LONG).show(); - Intent intent = new Intent(GoodsDetailActivity.this, LoginSelectActivity.class); - intent.putExtra("from", "娣樺疂"); - startActivity(intent); - return; - } -// if (!AlibcLogin.getInstance().isLogin()) { -// tbLogin(); -// return; -// } - getTaoBaoH5AuthInfo("zigou"); -// getTBLinkInfo(getSharedPreferences("user", MODE_PRIVATE).getString("uid", "")); - } - - private void goBuy() { - Log.e("mResult", "goBuy():type---" + type); - Log.e("mResult", "isNative:" + isNative); - isClick = 0; - if (mInfo != null && mInfo.getGoods() != null) { - GoodsCustomEvent.goodsDetailBuyToTaobao(GoodsDetailActivity.this, mInfo.getGoods().getCouponInfo() == null ? "鏃犲埜" : "鏈夊埜"); - if (mInfo.getGoods().isHasCoupon()) { - mInfo.getGoods().getCouponInfo().setToken(couponUrl); - } - showGoods(); - } - } - - /** - * 鎵撳紑鎸囧畾閾炬帴 - */ - public void showGoods() { -// Log.e("mResult", "showGoods():type---" + type); - if (TextUtils.isEmpty(goodsId)) { - Toast.makeText(GoodsDetailActivity.this, "鏆傛湭鑾峰彇鍒板晢鍝佷俊鎭�", - Toast.LENGTH_SHORT).show(); - return; - } - alibcShowParams = new AlibcShowParams(); - if (!isNative) { - alibcShowParams.setOpenType(OpenType.Auto); - } else if (ApkUtil.checkAPP(GoodsDetailActivity.this, "com.taobao.taobao")) { - alibcShowParams.setOpenType(OpenType.Native); - } else { - alibcShowParams.setOpenType(OpenType.Auto); - } - alibcShowParams.setBackUrl("alisdk://"); - alibcTaokeParams = new AlibcTaokeParams("", "", ""); - if (tInfo != null) { - alibcTaokeParams = new AlibcTaokeParams("", "", ""); - alibcTaokeParams.setPid(tInfo.getPid()); - alibcTaokeParams.setAdzoneid(tInfo.getAdZoneId()); - alibcTaokeParams.pid = tInfo.getPid(); - alibcTaokeParams.adzoneid = tInfo.getAdZoneId(); - alibcTaokeParams.extraParams = new HashMap<>(); - alibcTaokeParams.extraParams.put("taokeAppkey", tInfo.getAppKey()); - } - exParams = new HashMap<>(); - exParams.put(AlibcConstants.ISV_CODE, "appisvcode"); - exParams.put("alibaba", "闃块噷宸村反");//鑷畾涔夊弬鏁伴儴鍒嗭紝鍙换鎰忓鍒犳敼 - - if (type == 1) { -// Log.e("mResult", (!StringUtils.isEmpty(couponUrl)) ? couponUrl : clickUrl); - if (!StringUtils.isEmpty(clickUrl) || !StringUtils.isEmpty(couponUrl)) { - String url = (!StringUtils.isEmpty(couponUrl)) ? couponUrl : clickUrl; - jumpWeb(url); - } - } else { - if (!StringUtils.isEmpty(clickUrl) || !StringUtils.isEmpty(couponUrl)) { - String url = (!StringUtils.isEmpty(couponUrl)) ? couponUrl : clickUrl; - jumpWeb(url); - } else { - Toast.makeText(GoodsDetailActivity.this, "杩涘叆璇︽儏", Toast.LENGTH_LONG).show(); - AlibcDetailPage basePage = new AlibcDetailPage(goodsId); -// AlibcTrade.openByBizCode(GoodsDetailActivity.this, basePage, alibcShowParams, alibcTaokeParams, exParams, new MiDuoTradeCallback("")); - jumpNative(basePage); - } - } - boolean isLogin = getSharedPreferences("user", MODE_PRIVATE) - .getBoolean("isLogin", false); - String msg = "璐拱鍚庢湁杩斿埄锛屽垎浜悗鏈夊閲�"; - if (!isLogin) { - msg = "鏈櫥褰曪紝鏃犺繑鍒�"; - } - if (dialog == null) { - JumpTaoBaoDialog.Builder builder = new JumpTaoBaoDialog.Builder(GoodsDetailActivity.this); - builder.setPlatform(1).setMessage(msg); - dialog = builder.create(); - } else { - if (dialog != null && dialog.isShowing()) - dialog.dismiss(); - } - - dialog.show(); - isClick = 0; - timer();//5绉掕秴鏃跺叧闂� 寮圭獥 - } - /** * 涓昏鏄敤浜� 寮圭獥鎷夎捣娣樺疂寮圭獥鍗℃寤舵椂鍏抽棴 5绉掕秴鏃� */ - private void timer() { + private void startTimer() { new Thread(new Runnable() { public void run() { try { @@ -1885,43 +1066,12 @@ } }; - private void getTaobaoShareLink() { - final ShapeLoadingDialog pb = new ShapeLoadingDialog.Builder(this).build(); - pb.show(); - Log.e("mResult", "getTaobaoShareLink()"); - String uid = getSharedPreferences("user", MODE_PRIVATE).getString("uid", "0"); - ShoppingApi.createShareLink(this, uid, mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType() + "", from, null, null, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - - if (jsonObject.optString("code").equalsIgnoreCase("0")) { - JSONObject data = jsonObject.optJSONObject("data"); - SingleGoodsShareInfo shareInfo = new Gson().fromJson(data.toString(), SingleGoodsShareInfo.class); - shareInfo.setGoodsInfo(mInfo.getGoods()); - Intent intent = new Intent(GoodsDetailActivity.this, ShareGoodsImageActivity31.class); - intent.putExtra("shareInfo", shareInfo); - if (copyLink) { - ClipboardUtil.copy(getApplicationContext(), shareInfo.getCommentText()); - Toast.makeText(GoodsDetailActivity.this, "澶嶅埗鎴愬姛", Toast.LENGTH_SHORT).show(); - } else - startActivity(intent); - } - } - - @Override - public void onFinish() { - super.onFinish(); - pb.dismiss(); - } - }); - } /** * 娣诲姞鍒版敹钘� */ private void collection() { - String uid = getSharedPreferences("user", MODE_PRIVATE).getString("uid", "0"); - ShoppingApi.collectionGoods(GoodsDetailActivity.this, goodsId, uid, isCollect ? "2" : "1", + ShoppingApi.collectionGoods(GoodsDetailActivity.this, mInfo.getGoods().getGoodsId(), UserUtil.getUid(getApplicationContext()), isCollect ? "2" : "1", mInfo.getGoods().getGoodsType() + "", new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { @@ -1934,10 +1084,8 @@ GoodsCustomEvent.goodsDetailCollectCancel(GoodsDetailActivity.this); setCollectionData(false); } -// SingleToast.showToast(GoodsDetailActivity.this, jsonObject.optString("data")); Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("data"), Toast.LENGTH_SHORT).show(); } else { -// SingleToast.showToast(GoodsDetailActivity.this, jsonObject.optString("msg")); Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); } } @@ -1948,224 +1096,6 @@ ll_add_collect.setEnabled(true); } }); - } - - /** - * 涓�閿彂鍗� - */ - private void sendOrder() { - GoodsDetailUtil.sendOrder(this, mInfo, goodsId, ll_send_order); - } - - private boolean isFirstLogin = true; - - private void tbLogin() { - final AlibcLogin alibcLogin = AlibcLogin.getInstance(); - Log.e("detail", "tbLogin--" + alibcLogin.isLogin()); -// if (!alnibcLogin.isLogin()) { - isTBStartBind = true; - alibcLogin.showLogin(new AlibcLoginCallback() { - - @Override - public void onSuccess(int i, String s, String s1) { - SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); - SharedPreferences.Editor editor = sp.edit(); - editor.putString("TrolleyTransformationLink", ""); - editor.commit(); -// boolean isLogin = sp.getBoolean("isLogin", false); -// if (isLogin) { -// if (AlibcLogin.getInstance().isLogin()) { -// TrolleyTransformationLink transformationLink = new TrolleyTransformationLink(GoodsDetailActivity.this); -// transformationLink.getTaoBaoCartConfig("login"); -// } -// } - if (isClick == 4) { - startActivity(new Intent(GoodsDetailActivity.this, ShoppingTrolleyActivity.class)); - isClick = 0; - } - - bindInfo(); - } - - @Override - public void onFailure(int code, String msg) { - if (isFirstLogin) { - InitAlibcSdk.init(); - isFirstLogin = false; - } - isTBStartBind = false; - isClick = 0; - Toast.makeText(GoodsDetailActivity.this, "鐧诲綍澶辫触锛岃绋嶅�欏啀璇�", - Toast.LENGTH_LONG).show(); - MobclickAgent.reportError(GoodsDetailActivity.this, "GoodsDetailActivity---code:" + code + "---msg:" + msg); - } - }); -// } - } - - /** - * 缁戝畾娣樺疂璐﹀彿 - * - * @param uid - */ - boolean isTBStartBind = false; - - private void bindInfo() { - if (isClick == 1 || isClick == 2) { - Log.e("detail", authLink); - if (!StringUtils.isEmpty(authLink)) { - GoodsCustomEvent.goodsDetailTaobaoAuth(GoodsDetailActivity.this, isClick == 1 ? "璐拱" : "鍒嗕韩"); -// AlibcTrade.openByUrl(GoodsDetailActivity.this, "", authLink, null, new WebViewClient(), -// new WebChromeClient(), alibcShowParams, null, null, -// new MiDuoTradeCallback("")); - -// AlibcTradeUtil.openByUrl(GoodsDetailActivity.this, authLink, null, new WebViewClient(), -// new WebChromeClient(), alibcShowParams, null, null); - AlibcTradeUtil.openAuthLink(GoodsDetailActivity.this, authLink); - } - isFirst = false; - } - Log.e("detail", "bindInfo--isClick---" + isClick); - isTBStartBind = false; - } - - private void bindInfo2() { - SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); - String uid = sp.getString("uid", ""); - getTBLinkInfo(uid); - isTBStartBind = false; - } - - /** - * 鏄惁闇�瑕佹窐瀹濇巿鏉� - * - * @param source - */ - String authLink; - String orderJS; - String orderUrl; - ShapeLoadingDialog pd; - - private void getTaoBaoH5AuthInfo(final String source) { - if (pd == null) - pd = new ShapeLoadingDialog.Builder(this).build(); - if (!pd.isShowing()) - pd.show(); - Log.e("detail", "getTaoBaoH5AuthInfo--" + source); - String uid = getSharedPreferences("user", MODE_PRIVATE).getString("uid", null); - ShoppingApi.getTaoBaoAuthInfo(GoodsDetailActivity.this, uid, goodsId, source, true, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - if (jsonObject.optInt("code") == 0) { - isClick = source.equalsIgnoreCase("share") ? 2 - : source.equalsIgnoreCase("zigou") ? 1 : 0; - authLink = jsonObject.optJSONObject("data").getString("authLink"); - orderJS = jsonObject.optJSONObject("data").getString("orderJS"); - orderUrl = jsonObject.optJSONObject("data").getString("orderUrl"); - Log.e("detail", "authLink--" + authLink); - if (!StringUtils.isEmpty(authLink)) { - if (AlibcLogin.getInstance().isLogin()) { - bindInfo(); - } else { - tbLogin(); - } - } - pd.dismiss(); - } else if (jsonObject.optInt("code") == 1) { - if (source.equalsIgnoreCase("share")) { - getTaobaoShareLink(); - pd.dismiss(); - } else if (source.equalsIgnoreCase("zigou")) { - getTBLinkInfo(getSharedPreferences("user", MODE_PRIVATE).getString("uid", "")); - } - } else { - pd.dismiss(); - } - } - - @Override - public void onFinish() { - super.onFinish(); - isFirst = false; - } - - @Override - public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { - super.onFailure(statusCode, headers, responseString, throwable); -// SingleToast.showToast(GoodsDetailActivity.this, "璇锋眰澶辫触"); - pd.dismiss(); - Toast.makeText(GoodsDetailActivity.this, "璇锋眰澶辫触", Toast.LENGTH_SHORT).show(); - } - - }); - } - - private void getTaoBaoH5AuthInfo2(final String source) { - String uid = getSharedPreferences("user", MODE_PRIVATE).getString("uid", null); - ShoppingApi.getTaoBaoAuthInfo(GoodsDetailActivity.this, uid, goodsId, source, false, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, final JSONObject jsonObject) throws Exception { -// Log.e("mResult", "getTaoBaoH5AuthInfo2:code:" + jsonObject.optInt("code")); - if (jsonObject.optInt("code") == 1) { - if (source.equalsIgnoreCase("share")) { - getTaobaoShareLink(); - } else if (source.equalsIgnoreCase("zigou")) { -// Log.e("mResult", "getTaoBaoH5AuthInfo2():isLogin---" + AlibcLogin.getInstance().isLogin()); - if (AlibcLogin.getInstance().isLogin()) { - getTBLinkInfo(getSharedPreferences("user", MODE_PRIVATE).getString("uid", "")); - } else { - tbBuyLogin(); - } - } - } else { -// Log.e("mResult", "getTaoBaoH5AuthInfo2:" + jsonObject.optString("msg")); - runOnUiThread(new Runnable() { - @Override - public void run() { - String msg = jsonObject.optString("msg"); - if (!StringUtils.isEmpty(msg)) { -// SingleToast.showToast(GoodsDetailActivity.this, msg); - Toast.makeText(GoodsDetailActivity.this, msg, Toast.LENGTH_SHORT).show(); - } - } - }); - } - } - - @Override - public void onFinish() { - super.onFinish(); - if (source.equalsIgnoreCase("share")) { - isClick = 0; - } - isFirst = true; - } - }); - } - - private void tbBuyLogin() { - isTBStartBind = true; -// Log.e("mResult", "寮�濮嬬櫥褰�"); - AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() { - - @Override - public void onSuccess(int i, String s, String s1) { - bindInfo2(); - } - - @Override - public void onFailure(int i, String s) { - isClick = 0; -// Log.e("mResult", "鐧诲綍澶辫触"); - runOnUiThread(new Runnable() { - @Override - public void run() { - Toast.makeText(GoodsDetailActivity.this, "鐧诲綍澶辫触锛岃绋嶅�欏啀璇�", - Toast.LENGTH_LONG).show(); - } - }); - } - }); } class ImageAdapter extends PagerAdapter { @@ -2187,8 +1117,7 @@ View view = LayoutInflater.from(GoodsDetailActivity.this) .inflate(R.layout.item_goods_detail_top_img, null); ImageView iv = view.findViewById(R.id.iv_goods_img); -// Glide.with(mContext).load(cList.get(position)).error(R.drawable.ic_goods_default).placeholder(R.drawable.ic_goods_default).into(iv); - ImageLoader.getInstance().displayImage(cList.get(position), iv, options);//鏆傛椂娉ㄩ噴 + Glide.with(getApplicationContext()).load(cList.get(position)).error(R.drawable.ic_goods_default).placeholder(R.drawable.ic_goods_default).into(iv); iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -2221,19 +1150,6 @@ intent.putExtra("position", position); intent.putExtra("imgList", new Gson().toJson(ImageShowEntity.create(cList))); startActivityForResult(intent, 0); -// v_cover.setVisibility(View.VISIBLE); -// //閫忔槑鍔ㄧ敾 -// ObjectAnimator animator = ObjectAnimator.ofFloat(v_cover, "alpha", 0F, 1F); -// animator.setDuration(150);//400 -// //涓哄姩鐢昏缃洃鍚� -// animator.addListener(new AnimatorListenerAdapter() { -// @Override -// public void onAnimationEnd(Animator animation) { -// super.onAnimationEnd(animation); -// v_cover.setVisibility(View.GONE); -// } -// }); -// animator.start(); } } @@ -2241,7 +1157,6 @@ if (collected) { iv_like_state.setImageResource(R.drawable.icon_collected); tv_like.setText("鏀惰棌"); -// tv_like.setTextColor(Color.parseColor("#E5005C")); } else { iv_like_state.setImageResource(R.drawable.icon_un_collected); tv_like.setText("鏀惰棌"); @@ -2255,160 +1170,16 @@ * @param state */ private void requestState(int state) { - fl_content.setVisibility(state == 0 ? View.VISIBLE : View.GONE); +// fl_face.setVisibility(state != 0 ? View.VISIBLE : View.GONE); ll_no_data.setVisibility(state == 1 ? View.VISIBLE : View.GONE); ll_request_failture.setVisibility(state == 2 ? View.VISIBLE : View.GONE); ll_no_net.setVisibility(state == 3 ? View.VISIBLE : View.GONE); - } - - class ShareExampleAdapter extends BaseAdapter { - - List<ShareUser> mList; - - public ShareExampleAdapter(List<ShareUser> list) { - mList = list; - } - - @Override - public int getCount() { - return mList == null ? 0 : mList.size(); - } - - @Override - public Object getItem(int position) { - return mList.get(position); - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public View getView(int position, View view, ViewGroup parent) { - Holder holder = null; - if (view == null) { - holder = new Holder(); - view = LayoutInflater.from(GoodsDetailActivity.this).inflate(R.layout.item_share_example, null); - holder.iv_portrait = view.findViewById(R.id.iv_portrait); - holder.tv_name = view.findViewById(R.id.tv_name); - holder.tv_des = view.findViewById(R.id.tv_des); - holder.iv_gift_img = view.findViewById(R.id.iv_gift_img); - view.setTag(holder); - } else { - holder = (Holder) view.getTag(); - } - - Glide.with(GoodsDetailActivity.this).load(mList.get(position).getPicUrl()).placeholder(R.drawable.ic_default_portrait_light) - .error(R.drawable.ic_default_portrait_light) - .transform(new GlideCircleTransform(GoodsDetailActivity.this)).into(holder.iv_portrait); - Glide.with(GoodsDetailActivity.this).load(mList.get(position).getShareBonusPic()).into(holder.iv_gift_img); - - holder.tv_name.setText(mList.get(position).getName()); - - String str = mList.get(position).getMsg(); - int count = str.indexOf("濂栭噾"); - SpannableStringBuilder builder = new SpannableStringBuilder(str); - builder.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.detail_sharelist_reward_num)) - , count, str.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); - holder.tv_des.setText(builder); - - return view; - } - - class Holder { - ImageView iv_portrait; - TextView tv_name; - TextView tv_des; - ImageView iv_gift_img; - } - - } - - - private void initPopubWindow(JSONObject jsonObject) { - final String helpLink = jsonObject.optString("helpLink"); - View customView = getLayoutInflater().inflate(R.layout.item_show_free_single_coupon, - null, false); - // 鍒涘缓PopupWindow瀹炰緥,200,150鍒嗗埆鏄搴﹀拰楂樺害 - float height = SystemCommon.getScreenHeight(this); - final PopupWindow pw_free_single_ticket = new PopupWindow(customView, ViewGroup.LayoutParams.MATCH_PARENT, (int) (height * 0.75), true); - // 璁剧疆鍔ㄧ敾鏁堟灉 [R.style.AnimationFade 鏄嚜宸变簨鍏堝畾涔夊ソ鐨刔 -// pw_filter.setAnimationStyle(R.style.pop_multiple); - pw_free_single_ticket.setTouchable(true); - pw_free_single_ticket.setOutsideTouchable(true); - pw_free_single_ticket.setFocusable(false); - pw_free_single_ticket.setAnimationStyle(R.style.bottomstyle); - TextView tv_free_single_coupon_num = customView.findViewById(R.id.tv_free_single_ticket_num); - LinearLayout ll_no_ticket = customView.findViewById(R.id.ll_no_ticket); - TextView tv_confirm = customView.findViewById(R.id.tv_confirm); - RecyclerView rv_free_single_ticket = customView.findViewById(R.id.rv_free_single_ticket); - - TextView tv_limit = new TextView(this); - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, - FrameLayout.LayoutParams.WRAP_CONTENT); - tv_limit.setLayoutParams(params); - tv_limit.setTextColor(Color.parseColor(jsonObject.optJSONObject("tip").optString("fontColor"))); - tv_limit.setTextSize(14); - tv_limit.setGravity(Gravity.CENTER); - tv_limit.setText(jsonObject.optJSONObject("tip").optString("content")); - tv_limit.setPadding(0, DimenUtils.dip2px(this, 16), 0, 0); - tv_free_single_coupon_num.setText("鍓╀綑" + jsonObject.optString("count") + "寮犲厤鍗曞埜"); - - LinearLayoutManager manager = new LinearLayoutManager(this); - rv_free_single_ticket.setLayoutManager(manager); - DividerItemDecoration decoration = new DividerItemDecoration(); - decoration.setSize(DimenUtils.dip2px(this, 8)); - rv_free_single_ticket.addItemDecoration(decoration); - Gson gson = new GsonBuilder().serializeNulls().create(); - final List<FreeSingleTicket> fList = gson.fromJson(jsonObject.optJSONArray( - "list").toString(), - new TypeToken<List<FreeSingleTicket>>() { - }.getType()); - if (fList == null || fList.size() == 0) { - rv_free_single_ticket.setVisibility(View.GONE); - ll_no_ticket.setVisibility(View.VISIBLE); + if (mInfo == null) { + fl_face.setVisibility(View.VISIBLE); } else { - rv_free_single_ticket.setVisibility(View.VISIBLE); - ll_no_ticket.setVisibility(View.GONE); + fl_face.setVisibility(View.GONE); } - final FreeSingleTicketAdapter adapter = new FreeSingleTicketAdapter(this, fList, helpLink); - rv_free_single_ticket.setAdapter(adapter); - adapter.addHeaderView(tv_limit); - tv_confirm.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - pw_free_single_ticket.dismiss(); - v_cover1.setVisibility(View.GONE); - FreeSingleTicket info = null;//閫変腑鐨勫厤鍗曞埜 - for (int i = 0; i < adapter.mCBFlag.size(); i++) { - if (adapter.mCBFlag.get(i)) { - info = fList.get(i); - } - } - if (info != null) { - useFreeSingleTicket(info); - } - } - }); - pw_free_single_ticket.setOnDismissListener(new PopupWindow.OnDismissListener() { - @Override - public void onDismiss() { - v_cover1.setVisibility(View.GONE); - } - }); - v_cover1.setOnClickListener(new View.OnClickListener() {//璁剧疆鑳屾櫙绌虹偣鍑讳簨浠� - @Override - public void onClick(View v) { - v_cover1.setVisibility(View.GONE); - } - }); - pw_free_single_ticket.showAtLocation(getWindow().getDecorView(), Gravity.BOTTOM, 0, 0); - v_cover1.setVisibility(View.VISIBLE); - isClick = 0; } - - @Override protected void onDestroy() { @@ -2424,90 +1195,383 @@ @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); - } - @Override - public void onWbShareCancel() { - Toast.makeText(this, "鍒嗕韩鍙栨秷", Toast.LENGTH_LONG).show(); + + private void goFanli() { + if (mInfo.getGoods().getCouponInfoList() != null && mInfo.getGoods().getCouponInfoList().size() > 1) { + new GoodsDetailHongBaoAndCouponSelectDialog.Builder(this).setCouponList(mInfo.getGoods().getCouponInfoList()).setItemClickListener(new GoodsDetailHongBaoAndCouponSelectDialog.OnItemClickListener() { + @Override + public void onClick(int p) { + goFanli(mInfo.getGoods().getCouponInfoList().get(p)); + } + }).create().show(); + } else { + goFanli(null); + } + //鍒ゆ柇鏄惁鏈夊寮犲埜鎯呭喌 } - @Override - public void onWbShareFail() { - Toast.makeText(this, "鍒嗕韩澶辫触", Toast.LENGTH_LONG).show(); + private GoodsDetailNoLoginFailiDialog mGoodsDetailNoLoginFailiDialog; + + private void goFanli(final CouponInfo 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(); + } } - @Override - public void onWbShareSuccess() { - Toast.makeText(this, "鍒嗕韩鎴愬姛", Toast.LENGTH_LONG).show(); + private void goBuy() { + final List<GoodsDetailVO.GoodsHongBaoListVO> hongBaoList = new ArrayList<>(); + hongBaoList.addAll(mInfo.getGoods().getPriceList()); + for (int i = 0; i < hongBaoList.size(); i++) { + if (hongBaoList.get(i).getType() != 2) { + hongBaoList.remove(i--); + } + } + if (hongBaoList.size() > 1) { + new GoodsDetailHongBaoAndCouponSelectDialog.Builder(this).setHongBaoList(hongBaoList).setItemClickListener(new GoodsDetailHongBaoAndCouponSelectDialog.OnItemClickListener() { + @Override + public void onClick(int p) { + goBuy(hongBaoList.get(p)); + } + }).create().show(); + } else { + if (hongBaoList.size() > 0) + goBuy(hongBaoList.get(0)); + } } - /** - * 杩斿洖 鏄惁杩涘叆 鍒犻櫎鍖哄煙 - * - * @param Width 瀹藉害璺濈鍒ゆ柇锛堣喘鐗╄溅鍒拌揪鎸囧畾瀹藉害 true锛屽惁鍒檉alse锛� - * @param Heigh 楂樺害璺濈鍒ゆ柇锛堣喘鐗╄溅鍒拌揪鎸囧畾楂樺害 true锛屽惁鍒檉alse锛� - */ - @Override - public void isReturn(boolean Width, boolean Heigh) { - if (Width && Heigh) { - acbutton.setVisibility(View.GONE); -// img.setVisibility(View.GONE); - if (acbutton.getVisibility() == View.GONE) { - acbutton.postDelayed(new Runnable() { + private void goBuy(final GoodsDetailVO.GoodsHongBaoListVO lijinVO) { + goodsDetailPreEventManager.startClick(1, false, new GoodsDetailPreEventManager.IPreEventListener() { + @Override + public void onPreSuccess() { + buyRequest(lijinVO); + } + }); + } + + + private void setRightsData(List<GoodsDetailVO.GoodsRightsVO> rightsList) { + if (rightsList == null || rightsList.size() == 0) { + ll_rights_type.setVisibility(View.GONE); + return; + } else { + ll_rights_type.setVisibility(View.VISIBLE); + } + fl_rights_type.removeAllViews(); + LayoutInflater inflater = LayoutInflater.from(this); + for (GoodsDetailVO.GoodsRightsVO rights : rightsList) { + View root = inflater.inflate(R.layout.item_goods_detail_rights, null); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); + params.setMargins(0, DimenUtils.dip2px(getApplicationContext(), 8), DimenUtils.dip2px(getApplicationContext(), 10), 0); +// root.setLayoutParams(params); + + AQuery query = new AQuery(root); + GradientDrawable gd = new GradientDrawable(); + gd.setCornerRadius(DimenUtils.dip2px(getApplicationContext(), 10)); + gd.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT); + TextView tv_money = query.id(R.id.tv_money).getTextView(); + TextView tv_desc = query.id(R.id.tv_desc).getTextView(); + if (rights.getType() == 1) { + gd.setColors(new int[]{Color.parseColor("#FFEF9A"), Color.parseColor("#FFFFFF")}); + tv_money.setTextColor(Color.parseColor("#FFB218")); + tv_desc.setTextColor(Color.parseColor("#FFB218")); + tv_money.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_goods_detail_rights_coupon, 0, 0, 0); + } else { + gd.setColors(new int[]{Color.parseColor("#FFE4E8"), Color.parseColor("#FFFFFF")}); + tv_money.setTextColor(Color.parseColor("#FF2B4B")); + tv_desc.setTextColor(Color.parseColor("#FF2B4B")); + if (rights.getType() == 2) { + tv_money.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_goods_detail_rights_lijin, 0, 0, 0); + } else { + tv_money.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_goods_detail_rights_hb, 0, 0, 0); + } + + } + + ((LinearLayout) query.id(R.id.ll_content).getView()).setBackground(gd); + + if (!StringUtils.isNullOrEmpty(rights.getDescLink())) { + tv_desc.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.icon_goods_detail_rights_lijin, 0); + final String url = rights.getDescLink(); + tv_desc.setOnClickListener(new View.OnClickListener() { @Override - public void run() { - img.setVisibility(View.GONE); - // 璐墿杞﹂殣钘� - RecordImageTextVideo textVideo = new RecordImageTextVideo(GoodsDetailActivity.this); - textVideo.setLocalCart_float(1);//涓嶅湪鏄剧ず璐墿杞� + public void onClick(View v) { + startActivity(new Intent(getApplicationContext(), ShareBrowserActivity.class).putExtra("url", url)); } - }, 200); + }); } + + SpannableString moneyString = new SpannableString(rights.getMoney()); + moneyString.setSpan(new RelativeSizeSpan(1.5f), 1, (rights.getMoney().indexOf(".") > -1 ? rights.getMoney().indexOf(".") : rights.getMoney().length()), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + tv_money.setText(moneyString); + tv_desc.setText(rights.getDesc()); + fl_rights_type.addView(root, params); } } - /** - * 鏄剧ず鐘舵�� - * - * @param isDrag 绉诲姩鐘舵�侊紙璐墿杞︾Щ鍔╰rue锛屽仠姝alse锛� - * @param display 鏄惁鏄剧ず锛堣喘鐗╄溅鏄剧ずtrue锛岄殣钘� false锛� - */ - @Override - public void isDrag(boolean isDrag, boolean display) { - //绉诲姩涓� - if (isDrag) { - img.setVisibility(View.VISIBLE); - } else {//鍋滄绉诲姩 - if (display) {//鏄剧ず - img.setVisibility(View.VISIBLE); - } else {//闅愯棌 - img.setVisibility(View.GONE); - } + private void setPriceInfo(GoodsDetailVO.GoodsInfoVO goodsInfoVO) { + if (goodsInfoVO.getPriceList() == null || goodsInfoVO.getPriceList().size() == 0) { + rl_price.setVisibility(View.GONE); + } else { + rl_price.setVisibility(View.VISIBLE); } + + rv_price_info.setLayoutManager(new LinearLayoutManager(rv_price_info.getContext())); + DividerItemDecoration decoration = new DividerItemDecoration(); + decoration.setSize(DimenUtils.dip2px(getApplicationContext(), 5)); + rv_price_info.addItemDecoration(decoration); + rv_price_info.setAdapter(new GoodsDetailHongBaoListAdapter(getApplicationContext(), goodsInfoVO.getPriceList(), new GoodsDetailHongBaoListAdapter.ListClickListener() { + + @Override + public void onHongBaoClick(int p, GoodsDetailVO.GoodsHongBaoListVO info) { + if (info.getType() == 4) { + goFanli(null); + } else { + goBuy(info); + } + } + + @Override + public void onCouponClick(int p) { + + } + }, + false, true)); + + tv_fanli_money_num.setText(goodsInfoVO.getMoneyInfo().getFanliMoney()); + tv_buy.setText(goodsInfoVO.getMoneyInfo().getHongBaoMoney()); } + + + private void getGoodsRecommend(String goodsId, int goodsType) { + ShoppingApi.getGuessAndRecommend(this, goodsId, goodsType + "", new BasicTextHttpResponseHandler() { + @Override + public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { + if (jsonObject.optString("code").equalsIgnoreCase("0")) { + gList.clear(); + Gson gson = new GsonBuilder().serializeNulls().create(); + List<TaoBaoGoodsBrief> list1 = gson.fromJson( + jsonObject.optJSONObject("data").optJSONArray("listGuess").toString(), + new TypeToken<List<TaoBaoGoodsBrief>>() { + }.getType()); + List<TaoBaoGoodsBrief> list2 = gson.fromJson( + jsonObject.optJSONObject("data").optJSONArray("listQuality").toString(), + new TypeToken<List<TaoBaoGoodsBrief>>() { + }.getType()); + if (list1 != null && list1.size() > 0) { + gList.addAll(list1); + gAdapter.notifyDataSetChanged(); + } + if (list2 != null && list2.size() > 0) { + gList.addAll(list2); + gAdapter.notifyDataSetChanged(); + } + + if (gList.size() == 0) { + findViewById(R.id.fl_top_title3).setVisibility(View.GONE); + ll_guess_like.setVisibility(View.GONE); + } + if (gList.size() == 0) { + findViewById(R.id.fl_top_title4).setVisibility(View.GONE); + findViewById(R.id.ll_relative_goods).setVisibility(View.GONE); + } + } + } + + }); + } + + + private void buyRequest(GoodsDetailVO.GoodsHongBaoListVO goodsHongBaoListVO) { + + ShoppingApi.buyWithLijin(getApplicationContext(), mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType(), goodsHongBaoListVO.getId(), UserUtil.getUid(getApplicationContext()), from, new BasicTextHttpResponseHandler() { + + @Override + public void onStart() { + super.onStart(); + DialogUtil.show(loadingDialog); + } + + @Override + public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { + super.onSuccessPerfect(statusCode, headers, jsonObject); + int code = jsonObject.optInt("code"); + if (code == 0) { + JSONObject data = jsonObject.optJSONObject("data"); + JSONObject link = data.optJSONObject("link"); + 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) { + //鐢ㄦ埛鏈轰細宸茬粡鐢ㄥ畬浜� + 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 onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { + super.onFailure(statusCode, headers, jsonObject, e); + } + + @Override + public void onFinish() { + super.onFinish(); + DialogUtil.dismiss(loadingDialog); + } + }); + + } + + private void fanliRequest(CouponInfo couponInfo) { + GoodsBuyUtil.GoodsBuyRequestInfo requestInfo = new GoodsBuyUtil.GoodsBuyRequestInfo(); + requestInfo.setGoodsId(mInfo.getGoods().getGoodsId()); + requestInfo.setGoodsType(mInfo.getGoods().getGoodsType()); + if (couponInfo != null) + requestInfo.setCouponLink(couponInfo.getLink()); + requestInfo.setUid(UserUtil.getUid(getApplicationContext())); + requestInfo.setFrom(from); + + //杩斿埄 + GoodsBuyUtil.fanli(this, getApplicationContext(), requestInfo, new GoodsBuyUtil.IBuyGoodsResultListener() { + @Override + public void onConvertLinkStart() { + DialogUtil.show(loadingDialog); + } + + @Override + public void onConvertLinkSuccess() { + DialogUtil.dismiss(loadingDialog); + } + + @Override + public void onConvertLinkFail(String msg) { + DialogUtil.dismiss(loadingDialog); + } + + @Override + public void onConvertLinkComplete() { + DialogUtil.dismiss(loadingDialog); + } + + @Override + public void onJumpThirdAppStart() { + + } + + @Override + public void onJumpThirdAppSuccess() { + + } + + @Override + public void onJumpThirdAppFail() { + + } + }); + + } + /** - * 鐧惧窛璇︽儏椤佃烦杞綉椤� + * 鑾峰彇璐拱鏈轰細淇℃伅 */ - private void jumpWeb(String url) { - alibcShowParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeJumpBROWER); -// AlibcTrade.openByUrl(GoodsDetailActivity.this, "", -// url, null, new WebViewClient(), new WebChromeClient(), -// alibcShowParams, alibcTaokeParams, exParams, new MiDuoTradeCallback("")); + private void getBuyChanceInfoRequest() { + ShoppingApi.getUserLijinCreatedInfo(getApplicationContext(), mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType(), UserUtil.getUid(getApplicationContext()), new BasicTextHttpResponseHandler() { + @Override + public void onStart() { + super.onStart(); + } - AlibcTradeSDK.setTaokeParams(alibcTaokeParams); - AlibcTradeUtil.openByUrl(GoodsDetailActivity.this, - url, null, new WebViewClient(), new WebChromeClient(), - alibcShowParams, alibcTaokeParams, null); + @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); + } + }); + + } - /** - * 鐧惧窛璇︽儏椤佃烦杞師鐢� - */ - private void jumpNative(AlibcBasePage basePage) { - AlibcTrade.openByBizCode(GoodsDetailActivity.this, basePage, null, - new WebViewClient(), new WebChromeClient(), "", alibcShowParams, - alibcTaokeParams, exParams, new MiDuoTradeCallback("")); - } } -- Gitblit v1.8.0