| | |
| | | import android.graphics.drawable.AnimationDrawable; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | |
| | | import androidx.viewpager.widget.PagerAdapter; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.util.Log; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.entity.RecommendGoods; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.wpc.library.RetainViewFragment; |
| | |
| | | private SwipeRefreshLayout srl_second_category; |
| | | private RecyclerView lv_second_category; |
| | | private MyGridView gv_category_top; |
| | | private RecommendCategoryAdapter adapter;//淘宝商品适配 |
| | | private RecommendGoodsAdapter adapter;//淘宝商品适配 |
| | | |
| | | private ViewPager vp_banner; |
| | | private CirclePageIndicator indicator_category; |
| | |
| | | } |
| | | lv_second_category.setLayoutManager(new LinearLayoutManager(lv_second_category.getContext())); |
| | | // lv_second_category.setBackgroundColor(getResources().getColor(R.color.white)); |
| | | adapter = new RecommendCategoryAdapter(lv_second_category.getContext(), mList, |
| | | firstCategory == null ? null : firstCategory.getName(), "firstclass"); |
| | | adapter.isFirst = true; |
| | | // adapter = new RecommendCategoryAdapter(lv_second_category.getContext(), mList, |
| | | // firstCategory == null ? null : firstCategory.getName(), "firstclass"); |
| | | |
| | | adapter = new RecommendGoodsAdapter(lv_second_category.getContext(), mList, "firstclass"); |
| | | |
| | | // adapter.isFirst = true; |
| | | lv_second_category.setAdapter(adapter); |
| | | adapter.addFooterView(bottom); |
| | | |
| | |
| | | @Override |
| | | public void onRefresh() { |
| | | page = 1; |
| | | getGoodsList(); |
| | | getCateGorySecond(); |
| | | getGoodsList(); |
| | | } |
| | | }); |
| | | |
| | |
| | | if (last == total - 1 && mList.size() < count && isLoad) { |
| | | page++; |
| | | isLoad = false; |
| | | tv_loading.setText("正在加载更多数据"); |
| | | tv_loading.setText(getResources().getString(R.string.loading_more_text)); |
| | | iv_loading.setVisibility(View.VISIBLE); |
| | | getGoodsList(); |
| | | } |
| | |
| | | super.onResume(); |
| | | mChangeHelper.registerReceiver(); |
| | | indicator_category.setViewPager(vp_banner); |
| | | MobclickAgent.onPageStart("分类详情页"); |
| | | |
| | | long stayTime = System.currentTimeMillis() - bannerAdapter.clickTime; |
| | | if (bannerAdapter.clickTime > 0 && stayTime > 15 * 1000) { |
| | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("分类详情页"); |
| | | srl_second_category.setRefreshing(false); |
| | | srl_second_category.destroyDrawingCache(); |
| | | srl_second_category.clearAnimation(); |
| | |
| | | if (secondList.size() > 0) |
| | | secondList.clear(); |
| | | secondList.addAll(list); |
| | | gv_category_top.setAdapter(new RecommendTopCategoryAdapter(lv_second_category.getContext(), secondList, firstCategory.getName())); |
| | | gv_category_top.setFocusable(true); |
| | | gv_category_top.setFocusableInTouchMode(true); |
| | | gv_category_top.requestFocus(); |
| | | gv_category_top.requestFocusFromTouch(); |
| | | if (gv_category_top.getAdapter() == null) { |
| | | gv_category_top.setAdapter(new RecommendTopCategoryAdapter(lv_second_category.getContext(), secondList, firstCategory.getName())); |
| | | gv_category_top.setFocusable(true); |
| | | gv_category_top.setFocusableInTouchMode(true); |
| | | gv_category_top.requestFocus(); |
| | | gv_category_top.requestFocusFromTouch(); |
| | | } else { |
| | | ((RecommendTopCategoryAdapter) gv_category_top.getAdapter()).notifyDataSetChanged(); |
| | | } |
| | | if (secondList == null || secondList.size() == 0) { //当数据为0的时候 隐藏九宫格分类 |
| | | gv_category_top.setVisibility(View.GONE); |
| | | } else { |
| | |
| | | jsonObject.optJSONObject("data").optJSONArray("picList").toString(), |
| | | new TypeToken<List<HomeBanner>>() { |
| | | }.getType()); |
| | | // JSONArray array = jsonObject.optJSONObject("data").optJSONArray("picList"); |
| | | // for (int i = 0; i < array.length(); i++) { |
| | | // HomeBanner info = list2.get(i); |
| | | // info.setParams(jsonObject.optJSONObject("data").optJSONArray("picList").getJSONObject(i).optJSONObject("params")); |
| | | // } |
| | | if (mBanners != null && mBanners.size() > 0) { |
| | | mBanners.clear(); |
| | | } |