admin
2022-01-28 760aee20870a34e6130a1c12237c5b747e2b00bd
MGVideo/src/com/mugua/mgvideo/ui/main/CategoryFragment.java
@@ -44,6 +44,7 @@
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;
@@ -82,6 +83,15 @@
    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);
@@ -102,6 +112,12 @@
    @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);
@@ -240,11 +256,8 @@
                        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());
@@ -265,11 +278,7 @@
                        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());
@@ -389,10 +398,8 @@
                                                 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());
@@ -416,10 +423,8 @@
                                                 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>>() {
@@ -467,10 +472,8 @@
                                                 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>>() {