package com.tejia.lijin.app.ui.recommend;
|
|
import android.content.Context;
|
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.Bundle;
|
import android.os.Handler;
|
import android.os.Message;
|
import android.provider.Settings;
|
import android.text.SpannableString;
|
import android.text.Spanned;
|
import android.text.style.RelativeSizeSpan;
|
import android.util.Log;
|
import android.view.LayoutInflater;
|
import android.view.View;
|
import android.view.ViewGroup;
|
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.Animation;
|
import android.view.animation.AnimationUtils;
|
import android.view.animation.DecelerateInterpolator;
|
import android.webkit.WebSettings;
|
import android.webkit.WebView;
|
import android.webkit.WebViewClient;
|
import android.widget.AdapterView;
|
import android.widget.FrameLayout;
|
import android.widget.ImageView;
|
import android.widget.LinearLayout;
|
import android.widget.RelativeLayout;
|
import android.widget.TextView;
|
import android.widget.Toast;
|
|
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.tejia.lijin.app.BasicTextHttpResponseHandler;
|
import com.tejia.lijin.app.R;
|
import com.tejia.lijin.app.ShoppingApi;
|
import com.tejia.lijin.app.entity.CouponUser;
|
import com.tejia.lijin.app.entity.PushEventData;
|
import com.tejia.lijin.app.entity.TaoBaoGoodsBrief;
|
import com.tejia.lijin.app.entity.common.ImageShowEntity;
|
import com.tejia.lijin.app.entity.goods.GoodsDetailVO;
|
import com.tejia.lijin.app.ui.BaseActivity;
|
import com.tejia.lijin.app.ui.dialog.JumpTaoBaoDialog;
|
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.LoginSelectActivity;
|
import com.tejia.lijin.app.ui.mine.MyFootmarkActivity;
|
import com.tejia.lijin.app.ui.trends.BigImageActivity;
|
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.ImageUtil;
|
import com.tejia.lijin.app.util.SetLabels;
|
import com.tejia.lijin.app.util.Toast_Dialog;
|
import com.tejia.lijin.app.util.TopStatusSettings;
|
import com.tejia.lijin.app.util.clipboard.ClipboardUtil;
|
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.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.common.DimenUtils;
|
import com.wpc.library.util.common.StringUtils;
|
import com.wpc.library.widget.MyGridView;
|
import com.wpc.library.widget.MyScrollView;
|
|
import org.apache.http.Header;
|
import org.json.JSONObject;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Timer;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.ViewPager;
|
|
/**
|
* Created by weikou2015 on 2018/5/11.
|
* 商品详情过渡页--可跳转手淘原生,自我网页
|
*/
|
|
public class GoodsDetailActivity extends BaseActivity implements View.OnClickListener {
|
|
/**************************控件定义开始**************************/
|
private MyScrollView lv_goods_pic;
|
|
private LinearLayout ll_content;
|
|
//顶部导航栏
|
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 TextView tv_currunt_page;
|
private LinearLayout ll_labels;
|
private TextView tv_name;
|
private TextView tv_sales_num;
|
|
//小黄条
|
private String TYPE = "goodsDetail";
|
private TextView tv_notice_content;
|
private LinearLayout ll_notice;
|
private ImageView iv_close;
|
|
//发货地
|
private LinearLayout ll_address;
|
private TextView tv_address;
|
|
//商品店铺信息
|
private LinearLayout ll_shop;
|
private ImageView iv_shop_img, iv_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;
|
|
//权益类型
|
private LinearLayout ll_rights_type;
|
private FlowLayout fl_rights_type;
|
|
//价格信息/红包
|
private RelativeLayout rl_price;
|
private RecyclerView rv_price_info;
|
|
//图文详情
|
private ImageView iv_imgtext_status;
|
private WebView webView;
|
private LinearLayout ll_loading;
|
private ImageView iv_loading;
|
private TextView tv_loading;
|
|
//猜你喜欢
|
private LinearLayout ll_guess_like;
|
private MyGridView gv_guess;
|
|
//底部操作栏
|
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;
|
|
|
//用户领取数据
|
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);
|
lv_goods_pic = 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);
|
tv_top_title4 = findViewById(R.id.tv_top_title4);
|
iv_like_state = findViewById(R.id.iv_like_state);
|
tv_like = findViewById(R.id.tv_like);
|
ll_add_collect = findViewById(R.id.ll_add_collect);
|
ll_labels = findViewById(R.id.ll_labels);
|
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_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);
|
tv_shop_logistics = findViewById(R.id.tv_shop_logistics);
|
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);
|
v_cover = findViewById(R.id.v_cover);
|
v_cover1 = findViewById(R.id.v_cover1);
|
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);
|
|
|
avLoadingIndicatorView = findViewById(R.id.avi);
|
ll_guess_like = findViewById(R.id.ll_guess_like);
|
iv_imgtext_status = findViewById(R.id.iv_imgtext_status);
|
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);
|
|
|
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();
|
final String goodsId = getIntent().getExtras().getString("goodsId");
|
final int goodsType = Integer.parseInt(getIntent().getExtras().getString("goodsType"));
|
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.setWebViewClient(new MWebviewClient());
|
WebSettings settings = webView.getSettings();
|
settings.setJavaScriptEnabled(true);
|
webView.setInitialScale(100);
|
ll_loading.setVisibility(View.VISIBLE);
|
|
avLoadingIndicatorView.setVisibility(View.VISIBLE);
|
Animation ani = AnimationUtils.loadAnimation(this, R.anim.touming); //申明一个动画
|
avLoadingIndicatorView.setAnimation(ani);//为图片绑定动画
|
findViewById(R.id.fl_face).setVisibility(View.VISIBLE);
|
bannerAdapter = new ImageAdapter(mBanners, this);
|
vp_goods_detail.setAdapter(bannerAdapter);
|
vp_goods_detail.setCurrentItem(0, true);
|
|
gAdapter = new RelativeGoodsAdapter(this, gList, "猜你喜欢");
|
gv_guess.setAdapter(gAdapter);
|
|
inAnima = AnimationUtils.loadAnimation(this, R.anim.goods_detail_notify_input);
|
outAnima = AnimationUtils
|
.loadAnimation(this, R.anim.goods_detail_notify_out);
|
inAnima.setAnimationListener(new Animation.AnimationListener() {
|
@Override
|
public void onAnimationStart(Animation animation) {
|
if (couponUsers != null && couponUsers.size() > 0) {
|
CouponUser info = couponUsers.get(0);
|
ll_notification.setVisibility(View.VISIBLE);
|
Glide.with(GoodsDetailActivity.this).load(info.getPicUrl())
|
.placeholder(R.drawable.ic_default_portrait_light).error(R.drawable.ic_default_portrait_light)
|
.transform(new GlideCircleTransform(GoodsDetailActivity.this)).into(iv_notif_portrait);
|
|
tv_notif_name.setText(info.getName());//info.getName()
|
tv_notif_des.setText(info.getMsg());
|
}
|
}
|
|
@Override
|
public void onAnimationEnd(Animation animation) {
|
ll_notification.postDelayed(new Runnable() {
|
@Override
|
public void run() {
|
handler.sendEmptyMessage(0);
|
}
|
}, 3000);
|
}
|
|
@Override
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
});
|
outAnima.setAnimationListener(new Animation.AnimationListener() {
|
@Override
|
public void onAnimationStart(Animation animation) {
|
ll_notification.setVisibility(View.VISIBLE);
|
}
|
|
@Override
|
public void onAnimationEnd(Animation animation) {
|
ll_notification.setVisibility(View.GONE);
|
if (couponUsers.size() > 0)
|
couponUsers.remove(0);
|
if (couponUsers.size() > 0) {
|
ll_notification.postDelayed(new Runnable() {
|
@Override
|
public void run() {
|
handler.sendEmptyMessage(1);
|
}
|
}, 1000);
|
}
|
|
}
|
|
@Override
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
});
|
|
vp_goods_detail.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
@Override
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
}
|
|
@Override
|
public void onPageSelected(int position) {
|
tv_currunt_page.setText((position + 1) + "/" + picNum);
|
}
|
|
@Override
|
public void onPageScrollStateChanged(int state) {
|
|
}
|
});
|
|
lv_goods_pic.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 < (vp_goods_detail.getHeight() - titleHeight * 2)) {//头部
|
setPosition(1);
|
} else if (scrollY >= vp_goods_detail.getHeight() - titleHeight * 2
|
&& scrollY < (vp_goods_detail.getHeight() + webView.getHeight() - titleHeight)
|
&& webView.getVisibility() != View.GONE) {//详情图片
|
setPosition(2);
|
} else if (scrollY >= (vp_goods_detail.getHeight()
|
+ webView.getHeight() - titleHeight + marginTopHeight) && scrollY < (vp_goods_detail.getHeight()
|
+ webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight)
|
&& webView.getVisibility() != View.GONE) {//猜你喜欢
|
setPosition(3);
|
} else if (scrollY >= (vp_goods_detail.getHeight() + webView.getHeight()
|
+ ll_guess_like.getHeight() - titleHeight + marginTopHeight)) {//推荐
|
setPosition(4);
|
} else {
|
setPosition(4);
|
}
|
float baseHeight = vp_goods_detail.getHeight() / 4;
|
if (scrollY >= 1
|
&& scrollY < baseHeight) {
|
if (scrollY / baseHeight < 0.1) {
|
ll_top_title.setVisibility(View.GONE);
|
iv_back.setVisibility(View.VISIBLE);
|
} else if (baseHeight / scrollY < 0.1) {
|
ll_top_title.setVisibility(View.VISIBLE);
|
iv_back.setVisibility(View.GONE);
|
} else {
|
ll_top_title.setVisibility(View.VISIBLE);
|
iv_back.setVisibility(View.VISIBLE);
|
}
|
ll_top_title.setAlpha(scrollY / baseHeight);
|
iv_back.setAlpha(baseHeight / scrollY);
|
|
isScroll = true;
|
Log.i("mResult", "沿Y轴滑动的距离" + scrollY);
|
} else if (scrollY > baseHeight) {
|
ll_top_title.setVisibility(View.VISIBLE);
|
iv_back.setVisibility(View.GONE);
|
ll_top_title.setAlpha(1.0f);
|
isScroll = true;
|
} else if (scrollY < 1) {
|
ll_top_title.setVisibility(View.GONE);
|
iv_back.setVisibility(View.VISIBLE);
|
iv_back.setAlpha(1.0f);
|
}
|
}
|
});
|
|
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);
|
getGoodsDetail(info.getGoodsId(), info.getGoodsType());
|
}
|
});
|
|
toast_dialog = new Toast_Dialog(this);
|
tv_name.setOnLongClickListener(new View.OnLongClickListener() {
|
@Override
|
public boolean onLongClick(View v) {
|
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);
|
toast_dialog.MyDialog("标题复制成功", false);
|
}
|
return false;
|
}
|
});
|
|
|
mChangeHelper = new ConnectivityChangeHelper(this,
|
new ConnectivityChangeHelper.OnConnectivityChangeListener() {
|
|
@Override
|
public void onNetworkUnAvailable() {
|
if (mInfo == null)
|
requestState(3);
|
}
|
|
@Override
|
public void onNetworkAvailable() {
|
requestState(0);
|
if (mInfo == null) {
|
getGoodsDetail(goodsId, goodsType);
|
}
|
}
|
});
|
|
}
|
|
|
private ConnectivityChangeHelper mChangeHelper;
|
private ImageAdapter bannerAdapter;
|
private List<String> mBanners = new ArrayList<>();
|
|
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);
|
}
|
}
|
|
|
@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();
|
}
|
|
|
Handler handler = new Handler() {
|
@Override
|
public void handleMessage(Message msg) {
|
super.handleMessage(msg);
|
if (msg.what == 0) {
|
outAnima.setInterpolator(new AccelerateInterpolator());
|
ll_notification.setAnimation(outAnima);
|
ll_notification.startAnimation(outAnima);
|
} else if (msg.what == 1) {
|
inAnima.setInterpolator(new DecelerateInterpolator());
|
ll_notification.setAnimation(inAnima);
|
ll_notification.startAnimation(inAnima);
|
// inAnima.start();
|
} else if (msg.what == 3) {//关闭弹窗
|
if (dialog != null && dialog.isShowing())
|
dialog.dismiss();
|
}
|
}
|
};
|
|
|
class MWebviewClient extends WebViewClient {
|
@Override
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
if (null != url && url.startsWith("yestv://webviewHeight#")) {
|
int height = Integer.parseInt(url.replace("yestv://webviewHeight#", ""));
|
Log.i("mResult", "webView的高度为:" + height + "");
|
//TODO 测试
|
webView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height));
|
return true;
|
}
|
return super.shouldOverrideUrlLoading(view, url);
|
}
|
|
@Override
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
super.onPageStarted(view, url, favicon);
|
webView.postDelayed(new Runnable() {
|
@Override
|
public void run() {
|
ll_loading.setVisibility(View.GONE);
|
}
|
}, 3000);
|
}
|
}
|
|
private void getAppPageNotification() {
|
ShoppingApi.getAppPageNotification(this, TYPE, new BasicTextHttpResponseHandler() {
|
@Override
|
public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
|
if (jsonObject.optInt("code") == 0) {
|
boolean isClose = jsonObject.optJSONObject("data").optBoolean("canClose");
|
String content = jsonObject.optJSONObject("data").optString("content");
|
final String contentUrl = jsonObject.optJSONObject("data").optString("contentUrl");
|
final String md5 = jsonObject.optJSONObject("data").optString("md5");
|
|
tv_notice_content.setText(content);
|
final SharedPreferences sp = getSharedPreferences("notice", Context.MODE_PRIVATE);
|
if (!sp.getBoolean(md5, false)) {//false 展示,true不展示
|
ll_notice.setVisibility(View.VISIBLE);
|
} else {
|
ll_notice.setVisibility(View.GONE);
|
}
|
|
if (isClose) {
|
iv_close.setImageDrawable(getResources().getDrawable(R.drawable.ic_notice_close));
|
iv_close.setOnClickListener(new View.OnClickListener() {
|
@Override
|
public void onClick(View v) {
|
ll_notice.setVisibility(View.GONE);
|
SharedPreferences.Editor editor = sp.edit();
|
editor.putBoolean(md5, true);
|
editor.commit();
|
}
|
});
|
} else {
|
iv_close.setImageDrawable(getResources().getDrawable(R.drawable.ic_notice_input));
|
}
|
ll_notice.setOnClickListener(new View.OnClickListener() {
|
@Override
|
public void onClick(View v) {
|
Intent intent = new Intent(GoodsDetailActivity.this, ShareBrowserActivity.class);
|
intent.putExtra("url", contentUrl);
|
startActivity(intent);
|
}
|
});
|
}
|
}
|
|
@Override
|
public void onFinish() {
|
super.onFinish();
|
if (!isQuestDetail && avLoadingIndicatorView.isShown()) {
|
avLoadingIndicatorView.hide();
|
}
|
}
|
});
|
|
}
|
|
|
GoodsDetailVO mInfo;
|
List<CouponUser> couponUsers;
|
String from;
|
boolean isQuestDetail;
|
|
|
private void getGoodsDetail(String goodsId, int goodsType) {
|
isQuestDetail = true;
|
ShoppingApi.getGoodsInfo(this, goodsId, goodsType, UserUtil.getUid(getApplicationContext()), 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();
|
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();
|
|
if (mInfo.getGoods() != null && mInfo.getGoods().getLabels() != null && mInfo.getGoods().getLabels().size() > 0) {
|
SetLabels.addLabel(GoodsDetailActivity.this, ll_labels, mInfo.getGoods().getLabels());
|
ll_labels.setVisibility(View.VISIBLE);
|
} else {
|
ll_labels.setVisibility(View.GONE);
|
}
|
|
if (timer != null) {
|
timer.cancel();
|
timer = null;
|
index = 1;
|
}
|
|
isCollect = mInfo.getExtra().isCollected();
|
|
if (couponUsers != null && couponUsers.size() > 0) {
|
inAnima.setInterpolator(new DecelerateInterpolator());
|
ll_notification.setAnimation(inAnima);
|
ll_notification.startAnimation(inAnima);
|
}
|
|
tv_name.setText(mInfo.getGoods().getTitle());
|
webView.loadUrl(mInfo.getExtra().getDetailUrl());
|
|
tv_sales_num.setText("月销 " + mInfo.getGoods().getSalesCount());
|
|
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());
|
|
try {
|
|
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 ? "高" : "低");
|
} catch (Exception e) {
|
|
}
|
} else {
|
ll_shop.setVisibility(View.GONE);
|
}
|
|
|
if (mInfo.getExtra().isCollected()) {
|
setCollectionData(true);
|
} else {
|
setCollectionData(false);
|
}
|
//权益设置
|
|
setRightsData(mInfo.getGoods().getRights());
|
|
//设置价格信息
|
setPriceInfo(mInfo.getGoods());
|
|
//发货地设置
|
if (!StringUtils.isBlank(mInfo.getGoods().getAddress())) {
|
ll_address.setVisibility(View.VISIBLE);
|
tv_address.setText(mInfo.getGoods().getAddress());
|
} else {
|
ll_address.setVisibility(View.GONE);
|
}
|
|
Log.i("mResult", "isLike的值为" + mInfo.getGoods().getGoodsId());
|
|
picNum = mInfo.getGoods().getImgList().size();
|
tv_currunt_page.setText("1/" + picNum);
|
mBanners.clear();
|
mBanners.addAll(mInfo.getGoods().getImgList());
|
bannerAdapter.notifyDataSetChanged();
|
vp_goods_detail.setCurrentItem(0);
|
initFanliAndBuyBtn(mInfo.getExtra().isBuyValid(), mInfo.getExtra().isFanliValid());
|
requestState(0);
|
} else if (jsonObject.optString("code").equalsIgnoreCase("2")) {
|
ll_content.setVisibility(View.GONE);
|
findViewById(R.id.ll_goods_nothing).setVisibility(View.VISIBLE);
|
findViewById(R.id.fl_face).setVisibility(View.VISIBLE);
|
}
|
}
|
|
@Override
|
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
|
super.onFailure(statusCode, headers, responseString, throwable);
|
if (NetUtils.getNetworkState(GoodsDetailActivity.this).equalsIgnoreCase(NetUtils.NETWORK_NONE)) {
|
requestState(3);
|
} else {
|
requestState(2);
|
if (mInfo == null) {
|
Toast.makeText(GoodsDetailActivity.this, "获取商品详情失败,请稍后再试", Toast.LENGTH_SHORT).show();
|
GoodsDetailActivity.this.finish();
|
}
|
|
}
|
}
|
|
@Override
|
public void onFinish() {
|
super.onFinish();
|
Log.e("mResult", "goodsdetail---onFinish()");
|
lv_goods_pic.scrollTo(0, 0);
|
avLoadingIndicatorView.hide();
|
findViewById(R.id.fl_face).setVisibility(View.GONE);
|
ll_content.setVisibility(View.VISIBLE);
|
}
|
});
|
}
|
|
Timer timer;
|
|
JumpTaoBaoDialog dialog;
|
|
|
@Override
|
protected void onResume() {
|
super.onResume();
|
if (mChangeHelper != null)
|
mChangeHelper.registerReceiver();
|
if (goodsDetailPreEventManager != null)
|
goodsDetailPreEventManager.onResume();
|
isVisible = true;
|
}
|
|
@Override
|
protected void onPause() {
|
super.onPause();
|
isVisible = false;
|
mChangeHelper.unregisterReceiver();
|
}
|
|
int type = 0;
|
|
private boolean isCollect = false;
|
private boolean isSpread = false;//图文是否展开
|
|
List<TaoBaoGoodsBrief> gList = new ArrayList<>();
|
RelativeGoodsAdapter gAdapter;
|
|
|
@Override
|
public void onClick(View v) {
|
int titleHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 48);
|
int marginTopHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 8);
|
boolean isLogin = getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false);
|
switch (v.getId()) {
|
case R.id.iv_back:
|
finish();
|
break;
|
case R.id.iv_top_bar_left1:
|
finish();
|
break;
|
case R.id.tv_top_title1:
|
lv_goods_pic.scrollTo(0, 0);
|
setPosition(1);
|
break;
|
case R.id.tv_top_title2:
|
lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() - titleHeight * 2);
|
setPosition(2);
|
break;
|
case R.id.tv_top_title3:
|
lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() + webView.getHeight() - titleHeight + marginTopHeight);
|
setPosition(3);
|
break;
|
case R.id.tv_top_title4:
|
lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight);
|
setPosition(4);
|
break;
|
|
case R.id.ll_add_collect:
|
if (!LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()), true))
|
return;
|
ll_add_collect.setEnabled(false);
|
if (mInfo == null) {
|
Toast.makeText(GoodsDetailActivity.this, "没有获取到商品收藏状态,请稍等", Toast.LENGTH_SHORT).show();
|
ll_add_collect.setEnabled(true);
|
break;
|
}
|
if (isLogin) {
|
collection();
|
} else {
|
ll_add_collect.setEnabled(true);
|
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_buy:
|
goBuy();
|
break;
|
|
case R.id.ll_fanli:
|
goFanli();
|
break;
|
|
case R.id.fl_back_face:
|
finish();
|
break;
|
case R.id.tv_net_setting:
|
startActivity(new Intent(Settings.ACTION_SETTINGS));
|
break;
|
case R.id.tv_refresh:
|
startActivity(new Intent(Settings.ACTION_SETTINGS));
|
break;
|
//查看宝贝详情
|
case R.id.fl_goods_detail:
|
if (mInfo == null || mInfo.getGoods() == null)
|
return;
|
if (isSpread) {
|
webView.setVisibility(View.GONE);
|
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));
|
}
|
isSpread = !isSpread;
|
break;
|
case R.id.tv_shop_see:
|
if (mInfo == null || mInfo.getGoods() == null)
|
return;
|
GoodsCustomEvent.goodsDetailShopDetail(GoodsDetailActivity.this);
|
if (mInfo != null && (!StringUtils.isEmpty(mInfo.getGoods().getShopInfo().getShopLink()))) {
|
Intent intent = new Intent(GoodsDetailActivity.this, ShareBrowserActivity.class);
|
intent.putExtra("url", mInfo.getGoods().getShopInfo().getShopLink());
|
intent.putExtra("title", mInfo.getGoods().getShopInfo().getShopName());
|
startActivity(intent);
|
}
|
PushEventData info = new PushEventData();
|
info.setShopUrl(mInfo.getGoods().getShopInfo().getShopLink());
|
Gson gson = new GsonBuilder().serializeNulls().create();
|
String data = gson.toJson(info);
|
break;
|
|
case R.id.iv_footermark:
|
startActivity(new Intent(GoodsDetailActivity.this, MyFootmarkActivity.class));
|
break;
|
}
|
}
|
|
|
private void setPosition(int position) {
|
tv_top_title1.setTextColor(position == 1 ? getResources().getColor(R.color.main_text_color) : getResources().getColor(R.color.black2));
|
tv_top_title1.setTypeface(position == 1 ? Typeface.defaultFromStyle(Typeface.BOLD) : Typeface.defaultFromStyle(Typeface.NORMAL));
|
v_1.setVisibility(position == 1 ? View.VISIBLE : View.GONE);
|
tv_top_title2.setTextColor(position == 2 ? getResources().getColor(R.color.main_text_color) : getResources().getColor(R.color.black2));
|
tv_top_title2.setTypeface(position == 2 ? Typeface.defaultFromStyle(Typeface.BOLD) : Typeface.defaultFromStyle(Typeface.NORMAL));
|
v_2.setVisibility(position == 2 ? View.VISIBLE : View.GONE);
|
tv_top_title3.setTextColor(position == 3 ? getResources().getColor(R.color.main_text_color) : getResources().getColor(R.color.black2));
|
tv_top_title3.setTypeface(position == 3 ? Typeface.defaultFromStyle(Typeface.BOLD) : Typeface.defaultFromStyle(Typeface.NORMAL));
|
v_3.setVisibility(position == 3 ? View.VISIBLE : View.GONE);
|
tv_top_title4.setTextColor(position == 4 ? getResources().getColor(R.color.main_text_color) : getResources().getColor(R.color.black2));
|
tv_top_title4.setTypeface(position == 4 ? Typeface.defaultFromStyle(Typeface.BOLD) : Typeface.defaultFromStyle(Typeface.NORMAL));
|
v_4.setVisibility(position == 4 ? View.VISIBLE : View.GONE);
|
}
|
|
|
/**
|
* 主要是用于 弹窗拉起淘宝弹窗卡死延时关闭 5秒超时
|
*/
|
private void startTimer() {
|
new Thread(new Runnable() {
|
public void run() {
|
try {
|
Thread.sleep(5000);
|
handler1.sendEmptyMessage(0);
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
}
|
}
|
}).start();
|
}
|
|
Handler handler1 = new Handler() {
|
@Override
|
public void handleMessage(Message msg) {
|
super.handleMessage(msg);
|
if (dialog != null) {
|
if (dialog.isShowing()) {
|
dialog.dismiss();
|
} else {
|
dialog.cancel();
|
dialog = null;
|
}
|
} else {
|
dialog = null;
|
}
|
}
|
};
|
|
|
/**
|
* 添加到收藏
|
*/
|
private void collection() {
|
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 {
|
if (jsonObject.optString("code").equalsIgnoreCase("0")) {
|
isCollect = !isCollect;
|
if (isCollect) {
|
GoodsCustomEvent.goodsDetailCollect(GoodsDetailActivity.this);
|
setCollectionData(true);
|
} else {
|
GoodsCustomEvent.goodsDetailCollectCancel(GoodsDetailActivity.this);
|
setCollectionData(false);
|
}
|
Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("data"), Toast.LENGTH_SHORT).show();
|
} else {
|
Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show();
|
}
|
}
|
|
@Override
|
public void onFinish() {
|
super.onFinish();
|
ll_add_collect.setEnabled(true);
|
}
|
});
|
}
|
|
class ImageAdapter extends PagerAdapter {
|
|
private List<String> cList;
|
|
public ImageAdapter(List<String> list, Context context) {
|
super();
|
this.cList = list;
|
}
|
|
@Override
|
public int getCount() {
|
return cList == null ? 0 : cList.size();
|
}
|
|
@Override
|
public Object instantiateItem(ViewGroup container, final int position) {
|
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(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) {
|
GoodsCustomEvent.goodsDetailDetailImgs(GoodsDetailActivity.this);
|
enlargeImage(position, cList);
|
}
|
});
|
container.addView(view);
|
return view;
|
}
|
|
@Override
|
public void destroyItem(ViewGroup container, int position, Object object) {
|
container.removeView((View) object);
|
}
|
|
@Override
|
public boolean isViewFromObject(View view, Object object) {
|
return view == object;
|
}
|
|
@Override
|
public CharSequence getPageTitle(int position) {
|
return cList.get(position) + "";
|
}
|
|
private void enlargeImage(int position, final List<String> list) {
|
ArrayList<String> cList = (ArrayList<String>) list;
|
Intent intent = new Intent(GoodsDetailActivity.this, BigImageActivity.class);
|
intent.putExtra("position", position);
|
intent.putExtra("imgList", new Gson().toJson(ImageShowEntity.create(cList)));
|
startActivityForResult(intent, 0);
|
}
|
}
|
|
private void setCollectionData(boolean collected) {
|
if (collected) {
|
iv_like_state.setImageResource(R.drawable.icon_collected);
|
tv_like.setText("收藏");
|
} else {
|
iv_like_state.setImageResource(R.drawable.icon_un_collected);
|
tv_like.setText("收藏");
|
tv_like.setTextColor(Color.parseColor("#333333"));
|
}
|
}
|
|
/**
|
* 请求状态 0 数据正常展示;1 返回数据为空;2 网络请求失败;3 没有连接网络
|
*
|
* @param state
|
*/
|
private void requestState(int state) {
|
ll_content.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);
|
}
|
|
@Override
|
protected void onDestroy() {
|
super.onDestroy();
|
if (timer != null) {
|
timer.cancel();
|
timer = null;
|
}
|
handler1.sendEmptyMessage(0);
|
toast_dialog.dialog_dismiss();
|
}
|
|
@Override
|
protected void onNewIntent(Intent intent) {
|
super.onNewIntent(intent);
|
}
|
|
|
private void goFanli() {
|
goodsDetailPreEventManager.startClick(0, new GoodsDetailPreEventManager.IPreEventListener() {
|
@Override
|
public void onPreSuccess() {
|
|
//TODO 返利
|
}
|
});
|
//判断是否有多张券情况
|
}
|
|
private void goBuy() {
|
goodsDetailPreEventManager.startClick(1, new GoodsDetailPreEventManager.IPreEventListener() {
|
|
@Override
|
public void onPreSuccess() {
|
//TODO 购买
|
}
|
});
|
}
|
|
|
private void setRightsData(List<GoodsDetailVO.GoodsRightsVO> rightsList) {
|
if (rightsList == null || rightsList.size() == 0) {
|
ll_rights_type.setVisibility(View.GONE);
|
} 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 onClick(View v) {
|
startActivity(new Intent(getApplicationContext(), ShareBrowserActivity.class).putExtra("url", url));
|
}
|
});
|
}
|
|
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);
|
}
|
}
|
|
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()));
|
rv_price_info.setNestedScrollingEnabled(false);
|
DividerItemDecoration decoration = new DividerItemDecoration();
|
decoration.setSize(DimenUtils.dip2px(getApplicationContext(), 5));
|
rv_price_info.addItemDecoration(decoration);
|
rv_price_info.setAdapter(new GoodsDetailHongBaoListAdapter(getApplicationContext(), goodsInfoVO.getPriceList(), false));
|
|
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);
|
}
|
}
|
}
|
|
});
|
}
|
|
}
|