| | |
| | | package com.tejia.lijin.app.ui.gmtemplate; |
| | | |
| | | import android.content.Intent; |
| | | import android.graphics.drawable.AnimationDrawable; |
| | | import android.os.Build; |
| | | 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.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.wpc.library.RetainViewFragment; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | | import com.wpc.library.okhttp.OkHttpUtils; |
| | | 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.RatioLayout; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | | import com.tejia.lijin.app.R; |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.entity.SecondCategory; |
| | | import com.tejia.lijin.app.entity.TaoBaoGoodsBrief; |
| | | import com.tejia.lijin.app.ui.recommend.RecommendCategoryAdapter; |
| | | import com.tejia.lijin.app.ui.BaseFragmentActivity; |
| | | import com.tejia.lijin.app.util.umengCustomEvent.GoodsCustomEvent; |
| | | import com.tejia.lijin.app.view.BaseFragment; |
| | | import com.viewpagerindicator.ImagePath; |
| | | import com.viewpagerindicator.TabPageIndicator_Gm; |
| | | import com.wpc.library.RetainViewFragment; |
| | | import com.wpc.library.okhttp.OkHttpUtils; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import androidx.fragment.app.FragmentManager; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | |
| | | /** |
| | | * 公共模版显示页面 |
| | | * 通用模版 |
| | | */ |
| | | public class GmTemplateFragment extends RetainViewFragment implements View.OnClickListener { |
| | | private TabPageIndicator_Gm gmtemplate_indicator;//指示器 |
| | | private ViewPager gmtemplate_Pager; |
| | | |
| | | private SwipeRefreshLayout srl_second_category; |
| | | private RecyclerView lv_second_category; |
| | | // private MyGridView gv_category_top; |
| | | // private TextView tv_update_time, tv_name; |
| | | private RecommendCategoryAdapter adapter;//淘宝商品适配 |
| | | private String key; |
| | | private String from; |
| | | private int type = 0;//上级传过来的type 默认为0 表示未传递 |
| | | private GmTemplateTabAdapter adapter; |
| | | /** |
| | | * 导航栏标题 |
| | | */ |
| | | private ArrayList<Map<String, String>> navtitle = new ArrayList<>(); |
| | | |
| | | private ViewPager vp_banner; |
| | | private CirclePageIndicator indicator_category; |
| | | private GmTemplatteTopAdapter bannerAdapter; |
| | | |
| | | private String firstCategory = null;//上级传过来的关键词 |
| | | //获取Activity传递过来的参数 |
| | | private Bundle mBundle; |
| | | private List<SecondCategory> secondList = new ArrayList<>(); |
| | | private List<TaoBaoGoodsBrief> mList = new ArrayList<>(); |
| | | private List<BannerList> mBanners = new ArrayList<>(); |
| | | private int page = 1; |
| | | private ImageView iv_slid_top; |
| | | private boolean isLoad = true; |
| | | View top_view; |
| | | View bottom; |
| | | TextView tv_loading; |
| | | ImageView iv_loading; |
| | | private int count = 1; |
| | | private LinearLayout ll_no_net, ll_no_data, ll_request_failture; |
| | | private ConnectivityChangeHelper mChangeHelper; |
| | | |
| | | private RatioLayout vp_recommend_ratio; //vp_recommend_ratio 轮播滚动 |
| | | private View view_category_top; |
| | | |
| | | String tag = "commoncontent/getNavGoodsList"; |
| | | String tag = "commoncontent/getNavList"; |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | | return R.layout.fragment_second_category; |
| | | return R.layout.activity_gmtemplate; |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | srl_second_category = contentView.findViewById(R.id.srl_second_category); |
| | | lv_second_category = contentView.findViewById(R.id.lv_second_category); |
| | | |
| | | iv_slid_top = contentView.findViewById(R.id.iv_slid_top); |
| | | iv_slid_top.setOnClickListener(this); |
| | | |
| | | top_view = LayoutInflater.from(lv_second_category.getContext()).inflate(R.layout.item_category_top, null); |
| | | view_category_top = top_view.findViewById(R.id.view_category_top); |
| | | // gv_category_top = top_view.findViewById(R.id.gv_category_top); |
| | | vp_banner = top_view.findViewById(R.id.vp_recommend); |
| | | indicator_category = top_view.findViewById(R.id.indicator_recommend);//轮播 小点 |
| | | vp_recommend_ratio = top_view.findViewById(R.id.vp_recommend_ratio);//轮播滚动 布局 |
| | | // tv_name = top_view.findViewById(R.id.tv_name); |
| | | // tv_update_time = top_view.findViewById(R.id.tv_update_time); |
| | | // gv_category_top.getFocusedChild(); |
| | | |
| | | vp_banner.setCurrentItem(0, true); |
| | | bannerAdapter = new GmTemplatteTopAdapter(mBanners, getActivity()); |
| | | vp_banner.setAdapter(bannerAdapter); |
| | | vp_banner.postDelayed(mAutoScroller, 2000); |
| | | |
| | | float hRatio = 260 / 720f; |
| | | float wRatio = 23 / 720f; |
| | | int bottomPo = (int) (DimenUtils.getScreenWidth(getActivity()) * hRatio); |
| | | int rightPo = (int) (DimenUtils.getScreenWidth(getActivity()) * wRatio); |
| | | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(DimenUtils.dip2px(getActivity(), 40), DimenUtils.dip2px(getActivity(), 40)); |
| | | params.setMargins(0, 0, rightPo, bottomPo); |
| | | params.gravity = Gravity.BOTTOM | Gravity.RIGHT; |
| | | iv_slid_top.setLayoutParams(params); |
| | | bottom = LayoutInflater.from(getContext()).inflate(R.layout.item_recyclerview_bottom, null); |
| | | tv_loading = bottom.findViewById(R.id.tv_loading); |
| | | iv_loading = bottom.findViewById(R.id.iv_loading); |
| | | AnimationDrawable animationDrawable = (AnimationDrawable) getResources().getDrawable( |
| | | R.drawable.anim_list_loading); |
| | | iv_loading.setImageDrawable(animationDrawable); |
| | | animationDrawable.start(); |
| | | // Glide.with(this).load(R.drawable.gif_loading).into(iv_loading); |
| | | bottom.setVisibility(View.GONE); |
| | | firstCategory = getArguments().getString("key", null); |
| | | //获取Activity传递过来的参数 |
| | | mBundle = getArguments(); |
| | | // tv_name.setText("精选" + firstCategory.getName()); |
| | | lv_second_category.setLayoutManager(new LinearLayoutManager(lv_second_category.getContext())); |
| | | lv_second_category.setBackgroundColor(getResources().getColor(R.color.register_gray)); |
| | | ////////////////// |
| | | // FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) srl_second_category.getLayoutParams(); |
| | | // layoutParams.setMargins(DimenUtils.dip2px(getContext(), 10), 0, DimenUtils.dip2px(getContext(), 10), 0); |
| | | // srl_second_category.setLayoutParams(layoutParams); |
| | | ///////////////////// |
| | | String from = getArguments().getString("from"); |
| | | if (StringUtils.isEmpty(from)) |
| | | from = "通用模板"; |
| | | adapter = new RecommendCategoryAdapter(lv_second_category.getContext(), mList, firstCategory, from); |
| | | // adapter.isHorizontal = true; |
| | | adapter.isFirst = true; |
| | | lv_second_category.setAdapter(adapter); |
| | | // adapter.addHeaderView(top_view); |
| | | adapter.addFooterView(bottom); |
| | | |
| | | ll_no_net = contentView.findViewById(R.id.ll_no_net); |
| | | ll_no_data = contentView.findViewById(R.id.ll_no_data); |
| | | ll_request_failture = contentView.findViewById(R.id.ll_request_failture); |
| | | contentView.findViewById(R.id.tv_net_setting).setOnClickListener(this); |
| | | contentView.findViewById(R.id.tv_refresh).setOnClickListener(this); |
| | | mChangeHelper = new ConnectivityChangeHelper(ll_no_net.getContext(), |
| | | new ConnectivityChangeHelper.OnConnectivityChangeListener() { |
| | | |
| | | @Override |
| | | public void onNetworkUnAvailable() { |
| | | if (mList.size() == 0) |
| | | requestState(3); |
| | | } |
| | | |
| | | @Override |
| | | public void onNetworkAvailable() { |
| | | requestState(0); |
| | | if (mList.size() == 0) { |
| | | getGoodsList(); |
| | | // getCateGorySecond(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | srl_second_category.setRefreshing(true); |
| | | srl_second_category.setColorSchemeColors(getResources().getColor(R.color.theme)); |
| | | srl_second_category.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | page = 1; |
| | | getGoodsList(); |
| | | // getCateGorySecond(); |
| | | } |
| | | }); |
| | | |
| | | lv_second_category.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 (first == 0) { |
| | | iv_slid_top.setVisibility(View.GONE); |
| | | } |
| | | if (last == total - 1 && mList.size() < count && isLoad) { |
| | | page++; |
| | | isLoad = false; |
| | | tv_loading.setText(getResources().getString(R.string.loading_more_text)); |
| | | iv_loading.setVisibility(View.VISIBLE); |
| | | getGoodsList(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onScrolled(RecyclerView recyclerView, int dx, final int dy) { |
| | | super.onScrolled(recyclerView, dx, dy); |
| | | if (Math.abs(dy) > 10) { |
| | | if (dy > 0) { |
| | | iv_slid_top.setVisibility(View.GONE); |
| | | } else { |
| | | iv_slid_top.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | } |
| | | |
| | | private Runnable mAutoScroller = new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | | PagerAdapter adapter = vp_banner.getAdapter(); |
| | | if (adapter != null && adapter.getCount() != 0) { |
| | | vp_banner.setCurrentItem((vp_banner.getCurrentItem() + 1) |
| | | % adapter.getCount(), true); |
| | | } |
| | | vp_banner.postDelayed(this, 5000); |
| | | getActivity().setTheme(R.style.AppTabTheme5); |
| | | initView(contentView); |
| | | key = getArguments().getString("key"); |
| | | from = getArguments().getString("from"); |
| | | String types = getArguments().getString("type"); |
| | | if (types != null && !types.equals("")) {//上级传过来的type |
| | | double aDouble = Double.valueOf(types); |
| | | type = (int) aDouble;//默认为0 表示未传递 |
| | | } |
| | | }; |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mChangeHelper.registerReceiver(); |
| | | indicator_category.setViewPager(vp_banner); |
| | | |
| | | // MobclickAgent.onPageStart("分类详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | // MobclickAgent.onPageEnd("分类详情页"); |
| | | srl_second_category.setRefreshing(false); |
| | | srl_second_category.destroyDrawingCache(); |
| | | srl_second_category.clearAnimation(); |
| | | GoodsCustomEvent.goodsListCommonTemplate(getContext(), types); |
| | | FragmentManager fm = getChildFragmentManager(); |
| | | adapter = new GmTemplateTabAdapter(fm, navtitle, key, type + "", from); |
| | | gmtemplate_Pager.setAdapter(adapter); |
| | | gmtemplate_indicator.setImgList(imgList); |
| | | gmtemplate_indicator.setViewPager(gmtemplate_Pager); |
| | | getNavList(key);//获取 指示器数据 |
| | | } |
| | | |
| | | |
| | | private void getGoodsList() { |
| | | if (firstCategory == null) { |
| | | srl_second_category.setRefreshing(false); |
| | | return; |
| | | } |
| | | ShoppingApi.getNavGoodsList(lv_second_category.getContext(), page + "", firstCategory, getArguments().getString("cid", ""), |
| | | getArguments().getString("type", ""), 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 { |
| | | bottom.setVisibility(View.GONE); |
| | | srl_second_category.setRefreshing(false); |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | List<TaoBaoGoodsBrief> list = gson.fromJson( |
| | | jsonObject.getJSONObject("data").optJSONArray("list").toString(), |
| | | new TypeToken<List<TaoBaoGoodsBrief>>() { |
| | | }.getType()); |
| | | // tv_update_time.setText(jsonObject.optJSONObject("data").optString("time") + " 新品"); |
| | | if (page == 1) |
| | | mList.clear(); |
| | | mList.addAll(list); |
| | | adapter.notifyDataSetChanged(); |
| | | // adapter.notifyItemRangeChanged(mList.size(), list.size());//倒序刷新列表 |
| | | isLoad = true; |
| | | count = Integer.parseInt(jsonObject.optJSONObject("data").optString("count")); |
| | | |
| | | if (mList.size() == count) { |
| | | bottom.setVisibility(View.VISIBLE); |
| | | iv_loading.setVisibility(View.GONE); |
| | | tv_loading.setText(getResources().getString(R.string.list_no_more)); |
| | | } |
| | | requestState(mList.size() == 0 ? 1 : 0); |
| | | getCateGorySecond(jsonObject);//获取banner数据 |
| | | } else { |
| | | if (mList.size() == 0) |
| | | requestState(2); |
| | | // SingleToast.showToast(lv_second_category.getContext(), jsonObject.optString("msg")); |
| | | Toast.makeText(lv_second_category.getContext(), jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | // Log.i("mResult", "请求错误--" + responseString); |
| | | srl_second_category.setRefreshing(false); |
| | | bottom.setVisibility(View.GONE); |
| | | if (mList.size() == 0) { |
| | | if (NetUtils.getNetworkState(getContext()).equalsIgnoreCase(NetUtils.NETWORK_NONE)) { |
| | | requestState(3); |
| | | } else { |
| | | requestState(2); |
| | | } |
| | | } else { |
| | | if (NetUtils.getNetworkState(getContext()).equalsIgnoreCase(NetUtils.NETWORK_NONE)) { |
| | | // SingleToast.showToast(lv_second_category.getContext(), "网络未连接,请检测网络设置"); |
| | | Toast.makeText(lv_second_category.getContext(), "网络未连接,请检测网络设置", Toast.LENGTH_SHORT).show(); |
| | | } else { |
| | | // SingleToast.showToast(lv_second_category.getContext(), "网络连接异常,请检测网络设置"); |
| | | Toast.makeText(lv_second_category.getContext(), "网络连接异常,请检测网络设置", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | srl_second_category.setRefreshing(false); |
| | | } |
| | | }); |
| | | /** |
| | | * 控件初始化 |
| | | */ |
| | | private void initView(View view) { |
| | | view.findViewById(R.id.ll_top).setVisibility(View.GONE); |
| | | gmtemplate_indicator = view.findViewById(R.id.gmtemplate_indicator); |
| | | gmtemplate_Pager = view.findViewById(R.id.gmtemplate_Pager); |
| | | } |
| | | |
| | | /** |
| | | * 获取 banner 数据 |
| | | * 单击事件 |
| | | * |
| | | * @param jsonObject |
| | | * @param v |
| | | */ |
| | | private void getCateGorySecond(JSONObject jsonObject) { |
| | | // Log.e("eee", "获取 banner 数据: "); |
| | | if (firstCategory == null) { |
| | | srl_second_category.setRefreshing(false); |
| | | return; |
| | | } |
| | | srl_second_category.setRefreshing(false); |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | // if (secondList == null || secondList.size() == 0) { //当数据为0的时候 隐藏九宫格分类 |
| | | //// gv_category_top.setVisibility(View.GONE); |
| | | // } |
| | | |
| | | Gson gson2 = new GsonBuilder().serializeNulls().create(); |
| | | List<BannerList> list2 = gson2.fromJson(jsonObject.optJSONObject("data").optJSONArray("bannerList").toString(), new TypeToken<List<BannerList>>() { |
| | | }.getType()); |
| | | if (mBanners != null && mBanners.size() > 0) { |
| | | mBanners.clear(); |
| | | } |
| | | if (mBanners != null) { |
| | | mBanners.addAll(list2); |
| | | } |
| | | |
| | | if (mBanners == null || mBanners.size() == 0) { //没有数据 隐藏 轮播 |
| | | vp_recommend_ratio.setVisibility(View.GONE); |
| | | view_category_top.setVisibility(View.GONE); |
| | | // if (adapter.haveHeaderView()) { |
| | | // adapter.deleteHeaderView(null); |
| | | // } |
| | | } else { //有条数据的时候 |
| | | if (!adapter.haveHeaderView()) { |
| | | adapter.addHeaderView(top_view); |
| | | } |
| | | vp_recommend_ratio.setVisibility(View.VISIBLE); |
| | | view_category_top.setVisibility(View.VISIBLE); |
| | | if (mBanners.size() > 1) { |
| | | indicator_category.setVisibility(View.VISIBLE);//轮播小点 |
| | | } else { |
| | | indicator_category.setVisibility(View.GONE); |
| | | } |
| | | bannerAdapter.notifyDataSetChanged(); |
| | | } |
| | | |
| | | } else { |
| | | // gv_category_top.setVisibility(View.GONE); |
| | | vp_recommend_ratio.setVisibility(View.GONE); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.iv_slid_top: |
| | | lv_second_category.getLayoutManager().scrollToPosition(0); |
| | | 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)); |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | List<ImagePath> imgList = new ArrayList<>(); |
| | | |
| | | /** |
| | | * 请求状态 0 数据正常展示;1 返回数据为空;2 网络请求失败;3 没有连接网络 |
| | | * 获取通用模板的导航栏 |
| | | * |
| | | * @param state |
| | | * @param title 上级传过来的关键词 |
| | | */ |
| | | private void requestState(int state) { |
| | | srl_second_category.setVisibility(state == 0 ? View.VISIBLE : View.GONE); |
| | | lv_second_category.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); |
| | | private void getNavList(String title) { |
| | | ShoppingApi.getNavList(getContext(), title, type + "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optInt("code") == 0) { |
| | | if (navtitle != null && navtitle.size() > 0) { |
| | | navtitle.clear(); |
| | | } |
| | | if (imgList != null && imgList.size() > 0) { |
| | | imgList.clear(); |
| | | } |
| | | JSONArray json = jsonObject.optJSONArray("data"); |
| | | //当data数组为0时表示没有导航栏 |
| | | if (json == null || json.length() == 0) { |
| | | gmtemplate_indicator.setVisibility(View.GONE); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("name", ""); |
| | | map.put("cid", ""); |
| | | navtitle.add(map); |
| | | } else {//有导航栏 |
| | | gmtemplate_indicator.setVisibility(View.VISIBLE); |
| | | for (int i = 0; i < json.length(); i++) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | ImagePath info = new ImagePath(); |
| | | map.put("name", ((JSONObject) json.get(i)).optString("name", "")); |
| | | map.put("cid", ((JSONObject) json.get(i)).optString("cid", "")); |
| | | navtitle.add(map); |
| | | info.setImgUrl(((JSONObject) json.get(i)).optString("picture", "")); |
| | | imgList.add(info); |
| | | } |
| | | } |
| | | adapter.notifyDataSetChanged(); |
| | | gmtemplate_indicator.notifyDataSetChanged(); |
| | | } else { |
| | | // Toast.makeText(GmTemplate.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | //不论请求是否在服务器存在 都会回调 |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | gmtemplate_indicator = null;//指示器 |
| | | gmtemplate_Pager = null; |
| | | key = null; |
| | | type = 0;//上级传过来的type 默认为0 表示未传递 |
| | | adapter = null; |
| | | OkHttpUtils.getInstance().cancelTag(tag); |
| | | } |
| | | } |