admin
2021-05-08 f93ff67ed4681f416a653370aa1e7995a56940ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
package com.tejia.lijin.app.ui.BrandRebate;
 
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
 
import com.app.hubert.guide.util.ScreenUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.viewpagerindicator.LinePageIndicator;
import com.wpc.library.okhttp.OkHttpUtils;
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.RatioLayout;
import com.tejia.lijin.app.BasicTextHttpResponseHandler;
import com.tejia.lijin.app.R;
import com.tejia.lijin.app.ShoppingApi;
import com.tejia.lijin.app.ShoppingApplication;
import com.tejia.lijin.app.entity.HomeBanner;
import com.tejia.lijin.app.entity.PushEventData;
import com.tejia.lijin.app.entity.TaoBaoGoodsBrief;
import com.tejia.lijin.app.ui.BaseActivity;
import com.tejia.lijin.app.ui.category.CategoryAdapter2;
import com.tejia.lijin.app.ui.invite.ShareBrowserActivity;
import com.tejia.lijin.app.ui.jdSpecial.JdSpecialTopAdapter;
import com.tejia.lijin.app.util.GlideCircleTransform;
import com.tejia.lijin.app.util.ToolUtil;
import com.tejia.lijin.app.util.TopStatusSettings;
import com.tejia.lijin.app.util.ui.ColorUtil;
import com.tejia.lijin.app.util.umengCustomEvent.BrandRebateEvent;
 
import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONObject;
 
import java.util.ArrayList;
import java.util.List;
 
 
/**
 * 品牌店铺信息
 */
public class BrandInfoActivity extends BaseActivity implements View.OnClickListener {
    private TextView tv_middle, tv_top_bar_left;
    private SwipeRefreshLayout activity_braninfo_sr;//下拉刷新
    private RecyclerView activity_braninfo_rv;
    private RatioLayout brandinfo_topbanner;//广告banner
    private ViewPager brandinfo_recommend;//banner viewpage
    private LinePageIndicator indicator_recommend;//banner指示器
    private JdSpecialTopAdapter bannerAdapter;
    private List<HomeBanner> mBanners = new ArrayList<>();
 
    private LinearLayoutCompat braninfo_Shopone;//店铺一
    private LinearLayoutCompat braninfo_Shoptwo;//店铺二
    private LinearLayoutCompat braninfo_Shopthree;//店铺三
    private TextView braninfo_top_store;//进店
    private TextView braninfo_top_store2;//进店
    private TextView braninfo_top_store3;//进店
    private ImageView braninfo_top_img;//店铺头像
    private TextView braninfo_top_sellerNick;//店铺名字
    private TextView braninfo_top_userType;//店鋪類型
    private ImageView braninfo_top_img2;//店铺头像
    private TextView braninfo_top_sellerNick2;//店铺名字
    private TextView braninfo_top_userType2;//店鋪類型
    private ImageView braninfo_top_img3;//店铺头像
    private TextView braninfo_top_sellerNick3;//店铺名字
    private TextView braninfo_top_userType3;//店鋪類型
 
    private LinearLayout ll_go_scan;//无商品
    private CategoryAdapter2 adapter;//淘宝商品适配
    private List<TaoBaoGoodsBrief> mList = new ArrayList<>();
    private String shopLink = null;//店铺链接
    private String shopLink2 = null;//店铺链接
    private String shopLink3 = null;//店铺链接
 
    private View bottom;
    private TextView tv_loading;
    private ImageView iv_loading;
    private ImageView ll_go_scan2img;//缺省页
    private TextView ll_go_scan2txt;//缺省页提示
    private int page = 1;
    private boolean isLoad = true;
    private int count = 1;
 
    private String tag1 = "brand/getShopInfo";
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ToolUtil.setCustomDensity(this, ShoppingApplication.application);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_braninfo);
        TopStatusSettings.setStatusViewAndDeepColor(this);// 计算状态栏高度并设置
        inint();//初始化控件
 
//        tv_middle.setText("品牌返利");
        activity_braninfo_rv.setLayoutManager(new LinearLayoutManager(this));
 
        View top_view = LayoutInflater.from(this).inflate(R.layout.item_braninfo_top, null);
        //banner
        brandinfo_topbanner = top_view.findViewById(R.id.brandinfo_topbanner);
        brandinfo_recommend = top_view.findViewById(R.id.brandinfo_recommend);
        indicator_recommend = top_view.findViewById(R.id.brandinfo_indicator_recommend);
        //店铺布局
 
        braninfo_Shopone = top_view.findViewById(R.id.braninfo_Shopone);
        braninfo_Shoptwo = top_view.findViewById(R.id.braninfo_Shoptwo);
        braninfo_Shopthree = top_view.findViewById(R.id.braninfo_Shopthree);
        braninfo_top_img = top_view.findViewById(R.id.braninfo_top_img);
        braninfo_top_sellerNick = top_view.findViewById(R.id.braninfo_top_sellerNick);
        braninfo_top_userType = top_view.findViewById(R.id.braninfo_top_userType);
        braninfo_top_store = top_view.findViewById(R.id.braninfo_top_store);
        braninfo_top_img2 = top_view.findViewById(R.id.braninfo_top_img2);
        braninfo_top_sellerNick2 = top_view.findViewById(R.id.braninfo_top_sellerNick2);
        braninfo_top_userType2 = top_view.findViewById(R.id.braninfo_top_userType2);
        braninfo_top_store2 = top_view.findViewById(R.id.braninfo_top_store2);
        braninfo_top_img3 = top_view.findViewById(R.id.braninfo_top_img3);
        braninfo_top_sellerNick3 = top_view.findViewById(R.id.braninfo_top_sellerNick3);
        braninfo_top_userType3 = top_view.findViewById(R.id.braninfo_top_userType3);
        braninfo_top_store3 = top_view.findViewById(R.id.braninfo_top_store3);
//        braninfo_top_good = top_view.findViewById(R.id.braninfo_top_good);
        braninfo_top_store.setOnClickListener(this);//店铺进店一
        braninfo_top_store2.setOnClickListener(this);//店铺进店二
        braninfo_top_store3.setOnClickListener(this);//店铺进店三
        adapter = new CategoryAdapter2(this, mList, null, "search");
        activity_braninfo_rv.setAdapter(adapter);
//        adapter.isHorizontal = true;
 
        bottom = LayoutInflater.from(this).inflate(R.layout.item_recyclerview_bottom2, null);
        tv_loading = bottom.findViewById(R.id.tv_loading2);
        iv_loading = bottom.findViewById(R.id.iv_loading2);
        ll_go_scan = bottom.findViewById(R.id.ll_go_scan2);
        ll_go_scan2img = bottom.findViewById(R.id.ll_go_scan2img);
        ll_go_scan2txt = bottom.findViewById(R.id.ll_go_scan2txt);
        AnimationDrawable animationDrawable = (AnimationDrawable) getResources().getDrawable(R.drawable.anim_list_loading);
        iv_loading.setImageDrawable(animationDrawable);
        animationDrawable.start();
        bottom.setVisibility(View.GONE);
        adapter.addHeaderView(top_view);
        adapter.addFooterView(bottom);
        getShopInfo(getIntent().getStringExtra("sid"));
        //banner
        bannerAdapter = new JdSpecialTopAdapter(mBanners, this);
        brandinfo_recommend.setAdapter(bannerAdapter);
        indicator_recommend.setViewPager(brandinfo_recommend);
        OnClickListener();//註冊单击事件
    }
 
 
    /**
     * 註冊单击事件
     */
    private void OnClickListener() {
        tv_top_bar_left.setOnClickListener(this);
        activity_braninfo_rv.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                LinearLayoutManager manager = (LinearLayoutManager) recyclerView.getLayoutManager();
                int first = manager.findFirstVisibleItemPosition();
                int last = manager.findLastVisibleItemPosition();
                int total = manager.getItemCount();
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
//                    if (mList != null && last == total - 1 && mList.size() < count && isLoad && mList.size() != 0) {
                    if (last == total - 1 && mList.size() < count && isLoad) {
                        page++;
                        isLoad = false;
                        tv_loading.setText("正在加载更多数据");
                        iv_loading.setVisibility(View.VISIBLE);
                        getShopInfo(getIntent().getStringExtra("sid"));
                    }
                }
            }
        });
        //viewpager 轮播滚动
        brandinfo_recommend.postDelayed(mAutoScroller, 2000);
        tv_middle.setText(getIntent().getStringExtra("shopname"));
    }
 
    private Runnable mAutoScroller = new Runnable() {
 
        @Override
        public void run() {
            PagerAdapter adapter = brandinfo_recommend.getAdapter();
            if (adapter != null && adapter.getCount() != 0) {
                brandinfo_recommend.setCurrentItem((brandinfo_recommend.getCurrentItem() + 1)
                        % adapter.getCount(), true);
            }
            brandinfo_recommend.postDelayed(this, 5000);
        }
    };
 
    //防止重复刷新
    private boolean refresh1 = true;//
 
    /**
     * 初始化控件
     */
    private void inint() {
        tv_middle = findViewById(R.id.tv_top_bar_middle);
        tv_top_bar_left = findViewById(R.id.tv_top_bar_left);
        activity_braninfo_sr = findViewById(R.id.activity_braninfo_sr);
        activity_braninfo_rv = findViewById(R.id.activity_braninfo_rv);
        if (activity_braninfo_sr != null) {
//            fragment_brand_fragment_sf.setRefreshing(true);
            activity_braninfo_sr.setColorSchemeColors(getResources().getColor(R.color.theme));
            activity_braninfo_sr.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
                @Override
                public void onRefresh() {
                    if (refresh1) {
                        page = 1;
                        getShopInfo(getIntent().getStringExtra("sid"));
                    }
                }
            });
        }
    }
 
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            //j返回
            case R.id.tv_top_bar_left:
                finish();
                break;
            case R.id.braninfo_top_store://进店
                if (shopLink != null) {
                    BrandRebateEvent.brandintoshop(this);//品牌-进店
                    Intent intent = new Intent(this, ShareBrowserActivity.class);
                    intent.putExtra("url", shopLink);
                    intent.putExtra("title", braninfo_top_sellerNick.getText().toString());
                    startActivity(intent);
                    PushEventData info = new PushEventData();
                    info.setShopUrl(shopLink);
                    Gson gson = new GsonBuilder().serializeNulls().create();
                    String data = gson.toJson(info);
                }
                break;
            case R.id.braninfo_top_store2://进店
                if (shopLink2 != null) {
                    BrandRebateEvent.brandintoshop(this);//品牌-进店
                    Intent intent = new Intent(this, ShareBrowserActivity.class);
                    intent.putExtra("url", shopLink2);
                    intent.putExtra("title", braninfo_top_sellerNick2.getText().toString());
                    startActivity(intent);
                    PushEventData info = new PushEventData();
                    info.setShopUrl(shopLink2);
                    Gson gson = new GsonBuilder().serializeNulls().create();
                    String data = gson.toJson(info);
                }
                break;
            case R.id.braninfo_top_store3://进店
                if (shopLink3 != null) {
                    BrandRebateEvent.brandintoshop(this);//品牌-进店
                    Intent intent = new Intent(this, ShareBrowserActivity.class);
                    intent.putExtra("url", shopLink3);
                    intent.putExtra("title", braninfo_top_sellerNick3.getText().toString());
                    startActivity(intent);
                    PushEventData info = new PushEventData();
                    info.setShopUrl(shopLink3);
                    Gson gson = new GsonBuilder().serializeNulls().create();
                    String data = gson.toJson(info);
                }
                break;
            default:
                break;
        }
    }
 
    /**
     * 获取品牌店铺详情
     *
     * @param id 店铺ID
     */
    private void getShopInfo(String id) {
        refresh1 = false;
        SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE);
        ShoppingApi.getShopInfo(this, page + "", id, (sp.getBoolean("isLogin", false) ? sp.getString("uid", "0") : null), new BasicTextHttpResponseHandler() {
            @Override
            public void onStart() {
                super.onStart();
                if (page > 1) {
                    bottom.setVisibility(View.VISIBLE);
                } else {
                    bottom.setVisibility(View.GONE);
                }
            }
 
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optInt("code") == 0) {
                    JSONArray shop = jsonObject.optJSONObject("data").optJSONArray("shopList");
                    if (page == 1) {
                        setBanner(jsonObject.optJSONObject("data").optJSONArray("picList"));//Banner
                    }
                    if (shop != null && shop.length() > 0) {
                        if (shop.length() >= 1) {//店铺一
                            braninfo_Shopone.setVisibility(View.VISIBLE);
                            JSONObject mshop = (JSONObject) shop.get(0);
                            braninfo_top_sellerNick.setText(mshop.optString("shopName"));//title标题
                            setTopimg(BrandInfoActivity.this, mshop.optString("shopIcon"), braninfo_top_img);
                            String show[] = showImageFace(mshop.optInt("userType"));
                            setShape(4, show[0], show[0], show[1], braninfo_top_userType);
                            setShape(100,ColorUtil.getHexString(getResources().getColor(R.color.theme)),  ColorUtil.getHexString(getResources().getColor(R.color.theme)), "进店", braninfo_top_store);
                            shopLink = mshop.getString("shopLink");
                        }
                        if (shop.length() >= 2) {//店铺二
                            braninfo_Shoptwo.setVisibility(View.VISIBLE);
                            JSONObject mshop = (JSONObject) shop.get(1);
                            braninfo_top_sellerNick2.setText(mshop.optString("shopName"));
                            setTopimg(BrandInfoActivity.this, mshop.optString("shopIcon"), braninfo_top_img2);
                            String show[] = showImageFace(mshop.optInt("userType"));
                            setShape(4, show[0], show[0], show[1], braninfo_top_userType2);
                            setShape(100, ColorUtil.getHexString(getResources().getColor(R.color.theme)), ColorUtil.getHexString(getResources().getColor(R.color.theme)), "进店", braninfo_top_store2);
                            shopLink2 = mshop.getString("shopLink");
                        }
                        if (shop.length() == 3) {//店铺三
                            braninfo_Shopthree.setVisibility(View.VISIBLE);
                            JSONObject mshop = (JSONObject) shop.get(2);
                            braninfo_top_sellerNick3.setText(mshop.optString("shopName"));
                            setTopimg(BrandInfoActivity.this, mshop.optString("shopIcon"), braninfo_top_img3);
                            String show[] = showImageFace(mshop.optInt("userType"));
                            setShape(4, show[0], show[0], show[1], braninfo_top_userType3);
                            setShape(100, ColorUtil.getHexString(getResources().getColor(R.color.theme)), ColorUtil.getHexString(getResources().getColor(R.color.theme)), "进店", braninfo_top_store3);
                            shopLink3 = mshop.getString("shopLink");
                        }
                    } else {
                        braninfo_Shopone.setVisibility(View.GONE);
                        braninfo_Shoptwo.setVisibility(View.GONE);
                        braninfo_Shopthree.setVisibility(View.GONE);
                    }
 
//                    Log.e("eee", "onSuccessPerfect: ");
//                    braninfo_top_good.setText("店铺好评率" + shop.optString("goodRatePercentage") + "%");
                    Gson gson = new GsonBuilder().serializeNulls().create();
                    List<TaoBaoGoodsBrief> list = gson.fromJson(jsonObject.optJSONObject("data").
                            optJSONArray("list").toString(), new TypeToken<List<TaoBaoGoodsBrief>>() {
                    }.getType());
                    if (page == 1) {
                        mList.clear();
                    }
                    if (list.size() > 0) {
                        mList.addAll(list);
                    }
 
                    if (mList.size() >= count && mList.size() > 2) {
                        bottom.setVisibility(View.VISIBLE);
                        iv_loading.setVisibility(View.GONE);
                        ll_go_scan.setVisibility(View.GONE);
                        tv_loading.setText(getResources().getString(R.string.list_no_more));
                    } else {
                        if (jsonObject.optJSONObject("data").optJSONArray("picList").toString().equals("[]") &&
                                jsonObject.optJSONObject("data").optJSONArray("shopList").toString().equals("[]") &&
                                jsonObject.optJSONObject("data").optJSONArray("list").toString().equals("[]")) {
                            bottom.setVisibility(View.VISIBLE);
                            ll_go_scan.setVisibility(View.VISIBLE);
                            brandinfo_topbanner.setVisibility(View.GONE);
                            ViewGroup.LayoutParams linearParams = (ViewGroup.LayoutParams) ll_go_scan.getLayoutParams(); //取控件textView当前的布局参数 linearParams.height = 20;// 控件的高强制设成20
                            linearParams.height = (int) (SystemCommon.getScreenHeight(BrandInfoActivity.this) - 350);// 控件的宽强制设成30
                            ll_go_scan.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
                            ll_go_scan2img.setImageDrawable(null);
                            ll_go_scan2img.setBackground(BrandInfoActivity.this.getResources().getDrawable(R.drawable.ic_no_ticket2));
                            ll_go_scan2txt.setText("这个品牌太懒了忘记给大家优惠券了~");
                            ll_go_scan2txt.setTextColor(Color.parseColor("#333333"));
                            ll_go_scan.setBackgroundColor(Color.parseColor("#F3F3F3"));
                        }
                        //返回的数据为空
                        else if (StringUtils.isEmpty(jsonObject.getJSONObject("data").optJSONArray("list").toString())
                                || jsonObject.getJSONObject("data").optJSONArray("list").toString().equals("[]")) {
                            bottom.setVisibility(View.VISIBLE);
                            ll_go_scan.setVisibility(View.VISIBLE);
                            ViewGroup.LayoutParams linearParams = (ViewGroup.LayoutParams) ll_go_scan.getLayoutParams(); //取控件textView当前的布局参数 linearParams.height = 20;// 控件的高强制设成20
                            linearParams.height = ScreenUtils.dp2px(BrandInfoActivity.this, 380);// 控件的宽强制设成30
                            ll_go_scan.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
                            ll_go_scan2img.setImageDrawable(null);
                            ll_go_scan2img.setBackground(BrandInfoActivity.this.getResources().getDrawable(R.drawable.ic_no_ticket2));
                            ll_go_scan2txt.setText("这个品牌太懒了忘记给大家优惠券了~");
                            ll_go_scan2txt.setTextColor(Color.parseColor("#333333"));
                            ll_go_scan.setBackgroundColor(Color.parseColor("#F3F3F3"));
                        } else if (bottom.getVisibility() == View.VISIBLE) {
                            bottom.setVisibility(View.GONE);
                        }
                        adapter.notifyDataSetChanged();
                    }
 
                } else {
                    bottom.setVisibility(View.VISIBLE);
                    ll_go_scan.setVisibility(View.VISIBLE);
                }
            }
 
            @Override
            public void onFinish() {
                super.onFinish();
                isLoad = true;
                refresh1 = true;
                activity_braninfo_sr.setRefreshing(false);
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) {
                super.onFailure(statusCode, headers, jsonObject, e);
                refresh1 = true;
                activity_braninfo_sr.setRefreshing(false);
            }
        });
    }
 
    /**
     * 设置Banner
     *
     * @param picList
     */
    private void setBanner(JSONArray picList) {
        //顶部banner
        Gson gson = new GsonBuilder().serializeNulls().create();
        List<HomeBanner> list1 = null;
        if (picList != null) {
            list1 = gson.fromJson(picList.toString(), new TypeToken<List<HomeBanner>>() {
            }.getType());
            float width = SystemCommon.getScreenWidth(this);
            indicator_recommend.setLineWidth((width - (DimenUtils.dip2px(this, 30))) / list1.size());
            indicator_recommend.setGapWidth(0);
            indicator_recommend.setSelectedColor(this.getResources().getColor(R.color.white));
            indicator_recommend.setUnselectedColor(this.getResources().getColor(R.color.transport_white3));
            indicator_recommend.setStrokeWidth(DimenUtils.dip2px(this, 2));
        }
        if (list1 == null || list1.size() == 0) {
            brandinfo_topbanner.setVisibility(View.GONE);
        } else {
            if (page == 1) {
                brandinfo_topbanner.setVisibility(View.VISIBLE);
                mBanners.clear();
                mBanners.addAll(list1);
                bannerAdapter.notifyDataSetChanged();
            }
            if (mBanners.size() == 1) {
                indicator_recommend.setVisibility(View.GONE);
            }
        }
    }
 
    /**
     * 设置店铺头像
     *
     * @param brandInfoActivity
     * @param shopIcon
     * @param braninfo_top_img
     */
    private void setTopimg(Context brandInfoActivity, String shopIcon, ImageView braninfo_top_img) {
        Glide.with(brandInfoActivity)
                .load(shopIcon)
                .transform(new GlideCircleTransform(brandInfoActivity))
                .diskCacheStrategy(DiskCacheStrategy.RESOURCE)//保存最终图片
                .into(braninfo_top_img);
    }
 
    /**
     * 设置 Shaped
     *
     * @param radius
     * @param stroke
     * @param textcolor
     * @param text
     * @param view
     */
    private void setShape(int radius, String stroke, String textcolor, String text, TextView view) {
        //动态改变shape
        GradientDrawable shape = new GradientDrawable();
        shape.setCornerRadius(ScreenUtils.dp2px(braninfo_top_img.getContext(), radius));//4
        //设置颜色
        shape.setStroke(ScreenUtils.dp2px(braninfo_top_img.getContext(), 1), Color.parseColor(stroke));//"#ffe5005c"
        view.setBackground(shape);
        view.setText(text);//"并夕夕"
        view.setTextColor(Color.parseColor(textcolor));//"#fff50008"
    }
 
    /**
     * 判断淘宝京东拼多多
     *
     * @param shop
     */
    private String[] showImageFace(int shop) {
        String str[] = new String[2];
        // 创建一个SpannableString对象,以便插入用ImageSpan对象封装的图像
        if (shop == 10) {//淘宝
//            tv.setBackground(getResources().getDrawable(R.drawable.ic_tmall));
            str[0] = "#FF6A05";
            str[1] = "淘宝";
        } else if (shop == 11) {//天猫
            str[0] = "#FF0036";
            str[1] = "天猫";
        } else if (shop == 20 || shop == 21) {//京东
            str[0] = "#E42219";
            str[1] = "京东";
        } else {// (shop == 30)拼多多
            str[0] = "#F50008";
            str[1] = "拼多多";
        }
        return str;
    }
 
    @Override
    protected void onDestroy() {
        super.onDestroy();
        ll_go_scan = null;
        adapter = null;//淘宝商品适配
        mList = null;
        bottom = null;
 
        shopLink = null;//店铺链接
        tv_loading = null;
        iv_loading = null;
        page = 0;
        isLoad = false;
        count = 0;
        if (brandinfo_recommend != null) {
            brandinfo_recommend.removeCallbacks(mAutoScroller);
        }
        OkHttpUtils.getInstance().cancelTag(tag1);
    }
}