| | |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.Color; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | import android.support.annotation.NonNull; |
| | |
| | | import android.support.v4.view.ViewPager; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | |
| | | import com.weikou.beibeivideo.ui.dialog.UserProtocolDialog; |
| | | import com.weikou.beibeivideo.ui.recommend.RecommendFragment; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.weikou.beibeivideo.util.UmengEventUtil; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | import com.weikou.beibeivideo.util.cache.DiskLruCacheManager; |
| | |
| | | } |
| | | |
| | | String cacheValue = DiskLruCacheManager.getInstance(BeibeiVideoApplication.application).getCache(getKey("getCategories")); |
| | | |
| | | indicator = new MainTabPageIndicator( |
| | | pager.getContext()); |
| | | |
| | | if (!StringUtils.isBlank(cacheValue)) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | |
| | | if (list.get(i).getDataType().equalsIgnoreCase("novel")) { |
| | | list.remove(i--); |
| | | } |
| | | if (!StringUtils.isEmpty(list.get(i).getColor())) { |
| | | indicator.setTextSpecialColor(i, Color.parseColor(list.get(i).getColor())); |
| | | } |
| | | } |
| | | |
| | | categories.addAll(list); |
| | |
| | | adapter = new HomePageAdapter( |
| | | getChildFragmentManager(), categories); |
| | | pager.setAdapter(adapter); |
| | | indicator = new MainTabPageIndicator( |
| | | pager.getContext()); |
| | | |
| | | indicator.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); |
| | | |
| | | indicator.setTextColor(getResources().getColor(R.color.nav_text_color), getResources().getColor(R.color.nav_highloght_text_color)); |
| | | indicator.setViewPager(pager, 0); |
| | | fl_indicator.addView(indicator); |
| | | pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { |
| | |
| | | if (categories.get(i).getDataType().equalsIgnoreCase("novel")) { |
| | | categories.remove(i--); |
| | | } |
| | | if (!StringUtils.isEmpty(categories.get(i).getColor())) { |
| | | indicator.setTextSpecialColor(i, Color.parseColor(categories.get(i).getColor())); |
| | | } |
| | | } |
| | | |
| | | adapter.notifyDataSetChanged(); |