| | |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | |
| | | |
| | | private CirclePageIndicator indicator_theme; |
| | | |
| | | public static CategoryFragment newInstance(boolean showSearchBar) { |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putBoolean("searchBar", showSearchBar); |
| | | CategoryFragment fragment = new CategoryFragment(); |
| | | fragment.setArguments(bundle); |
| | | return fragment; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | |
| | | if (getArguments() != null && getArguments().getBoolean("searchBar", false)) { |
| | | contentView.findViewById(R.id.rl_search_bar).setVisibility(View.VISIBLE); |
| | | } else { |
| | | contentView.findViewById(R.id.rl_search_bar).setVisibility(View.GONE); |
| | | } |
| | | |
| | | tv_no_network = (TextView) contentView.findViewById(R.id.tv_no_network); |
| | | tv_no_network.setOnClickListener(this); |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getCategories")); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoType> categories = gson.fromJson( |
| | | |
| | | List<VideoType> categories = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<VideoType>>() { |
| | | }.getType()); |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getHotStars")); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HotVideoType> hotStars = gson.fromJson( |
| | | List<HotVideoType> hotStars = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<HotVideoType>>() { |
| | | }.getType()); |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | hotSearchs = gson.fromJson(jsonObject |
| | | |
| | | hotSearchs = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<String>>() { |
| | | }.getType()); |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoType> categories = gson.fromJson( |
| | | |
| | | List<VideoType> categories = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoType>>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HotVideoType> hotStars = gson.fromJson( |
| | | |
| | | List<HotVideoType> hotStars = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<HotVideoType>>() { |