package com.tejia.lijin.app.ui.BrandRebate;
|
|
import android.os.Bundle;
|
import android.view.View;
|
import android.widget.LinearLayout;
|
import android.widget.TextView;
|
|
import com.wpc.library.widget.MyGridView;
|
import com.tejia.lijin.app.R;
|
import com.tejia.lijin.app.entity.BranShopInfo;
|
import com.tejia.lijin.app.ui.BaseActivity;
|
import com.tejia.lijin.app.util.TopStatusSettings;
|
import com.tejia.lijin.app.util.umengCustomEvent.BrandRebateEvent;
|
|
import org.json.JSONException;
|
|
import java.util.ArrayList;
|
|
/**
|
* 所有有店铺
|
*/
|
public class BrandInfoAllActivity extends BaseActivity implements View.OnClickListener {
|
private TextView tv_left, tv_middle;
|
private MyGridView gv_category_top;
|
private LinearLayout brandinfoall_loading2;
|
private Bundle str = new Bundle();
|
private String name;
|
|
|
@Override
|
protected void onCreate(Bundle savedInstanceState) {
|
super.onCreate(savedInstanceState);
|
setContentView(R.layout.activity_brandinfoall);
|
TopStatusSettings.setStatusViewAndDeepColor(this);
|
inint();
|
OnClickListener();
|
gv_category_top.setNumColumns(4);
|
// gv_category_top.getFocusedChild();
|
str = getIntent().getBundleExtra("bList");
|
name = getIntent().getStringExtra("arg");
|
tv_middle.setText(name);
|
try {
|
settop(str);
|
} catch (JSONException e) {
|
e.printStackTrace();
|
}
|
BrandRebateEvent.brandhistorylist(this);//品牌-浏览历史列表
|
}
|
|
private void inint() {
|
tv_left = findViewById(R.id.tv_top_bar_left);
|
tv_middle = findViewById(R.id.tv_top_bar_middle);
|
gv_category_top = findViewById(R.id.brandinfoall_top);
|
brandinfoall_loading2 = findViewById(R.id.brandinfoall_loading2);
|
}
|
|
private void OnClickListener() {
|
tv_left.setOnClickListener(this);
|
}
|
|
|
/**
|
* 设置九宫格数据
|
*
|
* @param list
|
*/
|
private void settop(Bundle list) throws JSONException {
|
// fragment_brand_fragment_sf.setRefreshing(false);
|
ArrayList<BranShopInfo> mList = new ArrayList<>();
|
for (int i = 1; i <= list.size(); i++) {
|
BranShopInfo vJSON = (BranShopInfo) list.getSerializable("info" + i);
|
mList.add(vJSON);
|
}
|
if (mList.size() > 24) {
|
brandinfoall_loading2.setVisibility(View.VISIBLE);
|
} else {
|
brandinfoall_loading2.setVisibility(View.INVISIBLE);
|
}
|
//传入id 判断是不是 精选页arg
|
gv_category_top.setAdapter(new BrandInfoAllAdapter(this, mList));
|
// gv_category_top.setFocusable(true);
|
// gv_category_top.setFocusableInTouchMode(true);
|
// gv_category_top.requestFocus();
|
// gv_category_top.requestFocusFromTouch();
|
}
|
|
@Override
|
public void onClick(View v) {
|
switch (v.getId()) {
|
//返回
|
case R.id.tv_top_bar_left:
|
finish();
|
break;
|
default:
|
break;
|
}
|
}
|
|
@Override
|
protected void onDestroy() {
|
super.onDestroy();
|
gv_category_top = null;
|
brandinfoall_loading2 = null;
|
str = null;
|
tv_left = null;
|
tv_middle = null;
|
|
}
|
}
|