| | |
| | | lintOptions { |
| | | disable 'MissingTranslation' |
| | | } |
| | | |
| | | defaultConfig { |
| | | applicationId "com.doudou.ysvideo" |
| | | versionCode 109 |
| | | versionName "3.8.9" |
| | | versionName "3.9.0" |
| | | multiDexEnabled = true |
| | | minSdkVersion 17 |
| | | targetSdkVersion 27 |
| | |
| | | android:layout_gravity="bottom" |
| | | android:layout_marginBottom="38dp" |
| | | android:padding="10dip" |
| | | app:fillColor="@color/yellow" |
| | | app:fillColor="@color/banner_indicator_highlight_color" |
| | | app:pageColor="#aaffffff" |
| | | app:radius="5dp" |
| | | app:strokeColor="#00000000" /> |
| | |
| | | android:background="@color/page_header_bg_color" |
| | | android:paddingTop="3dp" |
| | | android:paddingBottom="8dp"></FrameLayout> |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" |
| | | android:background="#616161" /> |
| | | |
| | | |
| | | <android.support.v4.view.ViewPager |
| | | android:id="@+id/pager_recomend_category" |
| | |
| | | android:id="@+id/rl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | | app:ratio="0.5625"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | |
| | | android:lines="2" |
| | | android:textSize="@dimen/video_list_title" |
| | | android:paddingRight="8dp" |
| | | android:textColor="@color/videoTitle" /> |
| | | android:textColor="@color/video_list_title_text_color" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | android:layout_height="match_parent" |
| | | android:paddingLeft="8dp" |
| | | android:paddingRight="8dp"> |
| | | |
| | | <android.support.v4.view.ViewPager |
| | | android:id="@+id/vp_recommend" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="bottom" |
| | | android:padding="10dip" |
| | | app:fillColor="@color/yellow" |
| | | app:fillColor="@color/banner_indicator_highlight_color" |
| | | app:pageColor="#aaffffff" |
| | | app:radius="5dp" |
| | | app:strokeColor="#00000000" /> |
| | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:textColor="@color/item_title_text_color" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="10dp" |
| | |
| | | android:drawablePadding="5dp" |
| | | android:gravity="center" |
| | | android:text="热播推荐" |
| | | android:textColor="@color/item_title_text_color" |
| | | android:textSize="@dimen/video_album_title" /> |
| | | </LinearLayout> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/home_page_bg_color" |
| | |
| | | |
| | | </RelativeLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_ad" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="3dp" |
| | | android:layout_marginRight="3dp" |
| | | android:background="@color/white"> |
| | | android:layout_height="wrap_content"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_ad" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/page_content_bg_color" |
| | | android:paddingLeft="1dp" |
| | | android:paddingRight="1dp"></FrameLayout> |
| | | <!--挡住广告黑边 --> |
| | | <View |
| | | android:layout_width="2dp" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/white"></View> |
| | | |
| | | </FrameLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="12dp" |
| | | android:layout_marginRight="12dp" |
| | | android:paddingTop="12dp" |
| | | android:paddingBottom="12dp" |
| | | |
| | | android:background="@drawable/shape_mine_functions_bg" |
| | | android:orientation="horizontal"> |
| | | android:orientation="horizontal" |
| | | |
| | | android:paddingTop="12dp" |
| | | android:paddingBottom="12dp"> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_mine_favourite" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | |
| | | android:layout_marginTop="0dp" |
| | | android:layout_marginLeft="12dp" |
| | | android:layout_marginTop="0dp" |
| | | android:layout_marginRight="12dp" |
| | | android:background="@drawable/shape_vip_bg" |
| | | android:gravity="center_vertical" |
| | |
| | | android:background="@drawable/shape_vip_open_btn" |
| | | android:text="开通会员" |
| | | android:textColor="#ff885e24" |
| | | |
| | | android:textSize="10sp" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | android:id="@+id/rl_banner" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="12dp" |
| | | android:layout_marginTop="8.5dp" |
| | | android:layout_marginRight="12dp" |
| | | android:visibility="gone"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_banner" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | |
| | | </ImageView> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | xmlns:app1="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | android:orientation="vertical" |
| | | android:paddingLeft="8dp" |
| | | android:paddingRight="8dp"> |
| | | |
| | | <!-- 首页顶部广告容器 --> |
| | | |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" /> |
| | | |
| | | <com.viewpagerindicator.LinePageIndicator |
| | | |
| | | <com.viewpagerindicator.CirclePageIndicator |
| | | android:id="@+id/indicator_recommend" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="bottom" |
| | | app1:strokeWidth="5dp" /> |
| | | android:padding="10dip" |
| | | app:fillColor="@color/banner_indicator_highlight_color" |
| | | app:pageColor="#aaffffff" |
| | | app:radius="5dp" |
| | | app:strokeColor="#00000000" /> |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginLeft="8dp" |
| | | android:layout_marginRight="8dp" |
| | | android:layout_marginTop="8dp" |
| | | android:layout_marginRight="8dp" |
| | | android:visibility="gone"> |
| | | |
| | | <!--<com.lcjian.library.widget.verticalviewpager.VerticalViewPager--> |
| | |
| | | <color name="vip_dialog_cutline_bg_color">#CDCDCD</color> |
| | | |
| | | |
| | | <color name="banner_indicator_highlight_color">#159FFF</color> |
| | | |
| | | |
| | | </resources> |
| | |
| | | <!--专辑标题 --> |
| | | <dimen name="video_album_title">16sp</dimen> |
| | | |
| | | <dimen name="banner_radius">6dp</dimen> |
| | | |
| | | |
| | | </resources> |
| | |
| | | <item name="colorAccent">@color/colorAccent</item> |
| | | <item name="android:windowBackground">@color/bg</item> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:colorControlHighlight">@android:color/transparent</item> |
| | | </style> |
| | | |
| | | <style name="AppTabTheme" parent="AppTheme"> |
| | |
| | | ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); |
| | | ComponentName cn = am.getRunningTasks(1).get(0).topActivity; |
| | | if (!cn.getClassName().equalsIgnoreCase(SplashActivity.class.getName())) { |
| | | Log.i(TAG, "应当展示开屏广告"); |
| | | |
| | | |
| | | //小于30分钟不展示 |
| | | // 测试 |
| | | // if (System.currentTimeMillis() - SplashADFragment.lastShowTime < 1000 * 60 * 30L) |
| | | // return; |
| | | if (System.currentTimeMillis() - SplashADFragment.lastShowTime < 1000 * 60 * 30L) |
| | | return; |
| | | |
| | | if (SplashADFragment.isAdLoaded()) { |
| | | startActivity(new Intent(getApplicationContext(), SplashAdActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); |
| | | return; |
| | | } |
| | | |
| | | AdUtil.AD_TYPE type1 =AdUtil.getAdType(getApplicationContext(), AdPositionEnum.splashHotStart); |
| | | AdUtil.AD_TYPE type1 = AdUtil.getAdType(getApplicationContext(), AdPositionEnum.splashHotStart); |
| | | String pid1 = AdUtil.getAdPid(getApplicationContext(), AdPositionEnum.splashHotStart); |
| | | |
| | | |
| | | |
| | | AdPidInfo adPidInfo1 = null; |
| | |
| | | @Expose |
| | | private String dataKey; |
| | | |
| | | //字体颜色 |
| | | @Expose |
| | | private String color; |
| | | |
| | | public String getDataType() { |
| | | return dataType; |
| | | } |
| | |
| | | public void setDataKey(String dataKey) { |
| | | this.dataKey = dataKey; |
| | | } |
| | | |
| | | public String getColor() { |
| | | return color; |
| | | } |
| | | |
| | | public void setColor(String color) { |
| | | this.color = color; |
| | | } |
| | | } |
New file |
| | |
| | | package com.weikou.beibeivideo.entity.vo; |
| | | |
| | | import com.weikou.beibeivideo.entity.JumpDetail; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public class BannerVO { |
| | | private String picture; |
| | | private BigDecimal ratio; |
| | | private JumpDetail jumpDetail; |
| | | private String params; |
| | | |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public BigDecimal getRatio() { |
| | | return ratio; |
| | | } |
| | | |
| | | public void setRatio(BigDecimal ratio) { |
| | | this.ratio = ratio; |
| | | } |
| | | |
| | | public JumpDetail getJumpDetail() { |
| | | return jumpDetail; |
| | | } |
| | | |
| | | public void setJumpDetail(JumpDetail jumpDetail) { |
| | | this.jumpDetail = jumpDetail; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public Resources getResources() { |
| | | Resources res = super.getResources(); |
| | | // if (res.getConfiguration().fontScale != 1) {//非默认值 |
| | | Configuration newConfig = new Configuration(); |
| | | newConfig.setToDefaults();//设置默认 |
| | | newConfig.fontScale = 1.1f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | // } |
| | | |
| | | try { |
| | | if (Build.BRAND.toLowerCase().equalsIgnoreCase("xiaomi")) { |
| | | if (res.getConfiguration().fontScale != 1.1) { |
| | | newConfig.fontScale = 1.1f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | } else { |
| | | if (res.getConfiguration().fontScale != 1) { |
| | | newConfig.fontScale = 1.0f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | |
| | | //网页加速域名 |
| | | String webSpeedUpHost = data.optString("webSpeedUpHost"); |
| | | ConfigUtil.saveWebSpeedUpHost(getApplicationContext(), webSpeedUpHost); |
| | | //设置我的页面banner |
| | | ConfigUtil.saveMinePageBanner(getApplicationContext(), data.optString("minePageBanner")); |
| | | |
| | | //保存免广告权益持续时间 |
| | | AdUtil.setPPTVNoAdRewardHour(getApplicationContext(), pptvNoAdRewardHour); |
| | | |
| | |
| | | import android.widget.ImageView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.lcjian.library.util.glide.GlideRoundTransform; |
| | | import com.loopj.android.http.JsonHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.entity.CategoryRecommendVideo; |
| | |
| | | public Object instantiateItem(ViewGroup container, final int position) { |
| | | ImageView iv = new ImageView(container.getContext()); |
| | | try { |
| | | Glide.with(container.getContext()).load(mHomeAds.get(position).getPicture()).placeholder(R.drawable.ic_default_cover) |
| | | .error(R.drawable.ic_default_cover).into(iv); |
| | | |
| | | Glide.with(mContext).load(mHomeAds.get(position).getPicture()).transform(new GlideRoundTransform(mContext,6)).placeholder(R.drawable.shape_video_list_cover_placeholder).error(R.drawable.shape_video_list_cover_placeholder) |
| | | .into(iv); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | if (videoType.getName().contains("电影") || videoType.getName().contains("电视剧") || videoType.getName().contains("综艺") || videoType.getName().contains("动漫")) |
| | | column = 3; |
| | | } |
| | | VideoColumn2Adapter adapter = new VideoColumn2Adapter(mContext, mContext.getApplicationContext(), mVideoList, true, column, "categoryRecommend", null); |
| | | VideoColumn2Adapter adapter = new VideoColumn2Adapter(mContext, mContext.getApplicationContext(), mVideoList, false, column, "categoryRecommend", null); |
| | | if (column == 3) |
| | | adapter.initRecyclerViewDisplayWidthColumn3(viewHolder.rv); |
| | | else |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | 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)); |
| | |
| | | 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(); |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.androidquery.AQuery; |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| | |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.util.glide.GlideRoundTransform; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.UMShareListener; |
| | |
| | | import com.weikou.beibeivideo.db.MessageTable; |
| | | import com.weikou.beibeivideo.entity.NewComment; |
| | | import com.weikou.beibeivideo.entity.UserInfo; |
| | | import com.weikou.beibeivideo.entity.vo.BannerVO; |
| | | import com.weikou.beibeivideo.entity.vo.UserInfoVO; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.ui.common.FollowActivity; |
| | |
| | | import com.weikou.beibeivideo.ui.recommend.SearchActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.ConfigUtil; |
| | | import com.weikou.beibeivideo.util.JumpActivityUtil; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | import com.weikou.beibeivideo.widget.BadgeView; |
| | | |
| | |
| | | private ImageView iv_vip; |
| | | private TextView tv_vip_open; |
| | | private LinearLayout ll_vip; |
| | | |
| | | private RatioLayout rl_banner; |
| | | private ImageView iv_banner; |
| | | |
| | | /** |
| | | * 用于表示登录状态 |
| | | */ |
| | |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | mAquery = new AQuery(contentView); |
| | | |
| | | tv_no_network = (TextView) contentView.findViewById(R.id.tv_no_network); |
| | | tv_no_network = contentView.findViewById(R.id.tv_no_network); |
| | | tv_no_network.setOnClickListener(this); |
| | | |
| | | mChangeHelper = new ConnectivityChangeHelper(tv_no_network.getContext(), |
| | |
| | | iv_vip = contentView.findViewById(R.id.mine_iv_vip); |
| | | tv_vip_open = contentView.findViewById(R.id.tv_vip_open); |
| | | ll_vip = contentView.findViewById(R.id.ll_vip); |
| | | |
| | | rl_banner = contentView.findViewById(R.id.rl_banner); |
| | | iv_banner = contentView.findViewById(R.id.iv_banner); |
| | | |
| | | |
| | | mBadgeView = new BadgeView(iv_user_logo.getContext(), rl_mine_message); |
| | |
| | | } else { |
| | | mUpdateBadgeView.hide(); |
| | | } |
| | | //填充 |
| | | BannerVO bannerVO = ConfigUtil.getMinePageBanner(getContext()); |
| | | if (bannerVO == null) { |
| | | rl_banner.setVisibility(View.GONE); |
| | | } else { |
| | | rl_banner.setVisibility(View.VISIBLE); |
| | | rl_banner.setRatio(bannerVO.getRatio().floatValue()); |
| | | Glide.with(this).load(bannerVO.getPicture()).transform(new GlideRoundTransform(getContext(), 5)).into(iv_banner); |
| | | rl_banner.setOnClickListener(new OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | JumpActivityUtil.jumpPage(getActivity(), bannerVO.getJumpDetail(), bannerVO.getParams() != null ? JSONObject.parseObject(bannerVO.getParams().replace( |
| | | "\\" + "\"", "\"")) : null); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | getPersonInfo(); |
| | | } |
| | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.annotations.Expose; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.lcjian.library.util.ScreenUtils; |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.cache.DiskLruCache; |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.viewpagerindicator.LinePageIndicator; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.R; |
| | |
| | | private ViewPager vp_recommend; |
| | | private LinearLayout ll_ad_containner; |
| | | private RatioLayout rl_recommend_top; |
| | | private LinePageIndicator indicator_recommend; |
| | | private CirclePageIndicator indicator_recommend; |
| | | |
| | | private void initHomeAd() { |
| | | View view = LayoutInflater.from(getContext()).inflate(R.layout.recommend_top, null); |
| | |
| | | |
| | | if (mHomeTypes == null) |
| | | mHomeTypes = new ArrayList(); |
| | | mRecommendNewAdapter = new RecommendNewAdapter(getActivity(), mHomeTypes); |
| | | mRecommendNewAdapter = new RecommendNewAdapter(getActivity(), mHomeTypes, ScreenUtils.getScreenWidth(getContext())); |
| | | rv_recommend.setAdapter(mRecommendNewAdapter); |
| | | setAdContent(); |
| | | initHomeAd(); |
| | |
| | | private void setHomeAdsData() { |
| | | if (vp_recommend.getAdapter() == null) { |
| | | vp_recommend.setAdapter(new RecommendTopAdapter(mHomeAds, getActivity(), position == 0 ? false : true)); |
| | | int width = (int) SystemCommon.getScreenWidth(getContext()); |
| | | indicator_recommend.setScreenWidth(width); |
| | | indicator_recommend.setSelectedColor(vp_recommend.getContext().getResources() |
| | | .getColor(R.color.yellow)); |
| | | indicator_recommend.setUnselectedColor(0xbbADA9A7); |
| | | indicator_recommend.setViewPager(vp_recommend); |
| | | indicator_recommend.setViewPager(vp_recommend); |
| | | } else |
| | |
| | | this.headerView = view; |
| | | } |
| | | |
| | | public RecommendNewAdapter(Activity context, List contentList) { |
| | | public RecommendNewAdapter(Activity context, List contentList, int recyclerViewWidth) { |
| | | this.mContext = context; |
| | | this.contentList = contentList; |
| | | this.recyclerViewWidth = recyclerViewWidth; |
| | | inflater = LayoutInflater.from(mContext); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | private int recyclerViewWidth = -1; |
| | | |
| | | @Override |
| | | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { |
| | | if (viewHolder instanceof HeaderViewHolder) |
| | |
| | | |
| | | holder.rv_content.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); |
| | | |
| | | |
| | | int contentWidth = recyclerViewWidth - DimenUtils.dip2px(mContext, 16); |
| | | if (homeType.getColumns() > 3) {//第一排为小视频 |
| | | adapter = new VideoRecommendAdapter(mContext, mContext, homeType.getVideoInfoList(), homeType.isNeedAd(), Integer.MAX_VALUE, "recommend", homeType.getName(), null, new ExpressAdManager.IAdShowListener() { |
| | | @Override |
| | |
| | | holder.rv_content.scrollToPosition(0); |
| | | } |
| | | }); |
| | | adapter.initRecyclerViewDisplayWidthRow1(holder.rv_content); |
| | | adapter.initRecyclerViewDisplayWidthRow1(holder.rv_content, contentWidth); |
| | | } else { |
| | | adapter = new VideoRecommendAdapter(mContext, mContext, homeType.getVideoInfoList(), homeType.isNeedAd(), homeType.getColumns(), "recommend", homeType.getName(), null); |
| | | if (homeType.getColumns() == 2) |
| | | adapter.initRecyclerViewDisplayWidthColumn2(holder.rv_content, bigPictureIndex); |
| | | adapter.initRecyclerViewDisplayWidthColumn2(holder.rv_content, contentWidth, bigPictureIndex); |
| | | else if (homeType.getColumns() == 3) |
| | | adapter.initRecyclerViewDisplayWidthColumn3(holder.rv_content); |
| | | adapter.initRecyclerViewDisplayWidthColumn3(holder.rv_content, contentWidth); |
| | | else |
| | | adapter.initRecyclerViewDisplayWidthRow1(holder.rv_content); |
| | | adapter.initRecyclerViewDisplayWidthRow1(holder.rv_content, contentWidth); |
| | | } |
| | | |
| | | |
| | | if (homeType.getVideoInfoList() != null && homeType.getVideoInfoList().size() > 0) { |
| | | holder.rv_content.setAdapter(adapter); |
| | | } |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.lcjian.library.util.glide.GlideRoundTransform; |
| | | import com.weikou.beibeivideo.entity.HomeAd; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; |
| | | import com.weikou.beibeivideo.util.AppMarket; |
| | | import com.weikou.beibeivideo.util.CustomShareDialog; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.weikou.beibeivideo.util.downutil.DownFiles; |
| | | import com.weikou.beibeivideo.R; |
| | | |
| | |
| | | // if (isReview && (!sp.getBoolean("isReview", false))) {//去好评 |
| | | // AppMarket.mateAppMarket(mContext); |
| | | // } else { |
| | | if (mHomeAds.get(position).getLinkType() == 1) { |
| | | intent = new Intent(v.getContext(), |
| | | VideoDetailActivity2.class); |
| | | intent.putExtra("video_info", mHomeAds.get(position) |
| | | .getVideo()); |
| | | intent.putExtra("from", "homeAd"); |
| | | } else if (mHomeAds.get(position).getLinkType() == 5) { |
| | | try { |
| | | JSONObject object = new JSONObject(mHomeAds |
| | | .get(position).getParams() |
| | | .replace("\\", "")); |
| | | String thumb = object.optString("thumb"); |
| | | String title = object.optString("title"); |
| | | String desc = object.optString("desc"); |
| | | String path = object.optString("path"); |
| | | String username = object.optString("username"); |
| | | String url = object.optString("url"); |
| | | if (mHomeAds.get(position).getLinkType() == 1) { |
| | | intent = new Intent(v.getContext(), |
| | | VideoDetailActivity2.class); |
| | | intent.putExtra("video_info", mHomeAds.get(position) |
| | | .getVideo()); |
| | | intent.putExtra("from", "homeAd"); |
| | | } else if (mHomeAds.get(position).getLinkType() == 5) { |
| | | try { |
| | | JSONObject object = new JSONObject(mHomeAds |
| | | .get(position).getParams() |
| | | .replace("\\", "")); |
| | | String thumb = object.optString("thumb"); |
| | | String title = object.optString("title"); |
| | | String desc = object.optString("desc"); |
| | | String path = object.optString("path"); |
| | | String username = object.optString("username"); |
| | | String url = object.optString("url"); |
| | | |
| | | CustomShareDialog.Builder builder = new CustomShareDialog.Builder(mContext); |
| | | builder.setMessage(desc); |
| | | builder.setUrl(url); |
| | | builder.setContentImage(thumb); |
| | | builder.setTitle(title); |
| | | builder.setPath(path); |
| | | builder.setUserName(username); |
| | | builder.setNegativeButton("取消分享", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | } |
| | | }); |
| | | builder.create().show(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | } else { |
| | | try { |
| | | intent = new Intent(v.getContext(), Class |
| | | .forName(mHomeAds.get(position).getClazz())); |
| | | JSONObject object = new JSONObject(mHomeAds |
| | | .get(position).getParams() |
| | | .replace("\\", "")); |
| | | if (mHomeAds.get(position).getClazz().contains("FXBrowserActivity") && object.optString("url").endsWith(".apk")) { |
| | | startDownLoadFile(object.optString("url")); |
| | | return; |
| | | CustomShareDialog.Builder builder = new CustomShareDialog.Builder(mContext); |
| | | builder.setMessage(desc); |
| | | builder.setUrl(url); |
| | | builder.setContentImage(thumb); |
| | | builder.setTitle(title); |
| | | builder.setPath(path); |
| | | builder.setUserName(username); |
| | | builder.setNegativeButton("取消分享", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | } |
| | | if (mHomeAds.get(position).getParams() != null) { |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<String> its = object.keys(); |
| | | while (its.hasNext()) { |
| | | String key = its.next(); |
| | | String value = object.optString(key); |
| | | intent.putExtra(key, value); |
| | | intent.putExtra("isPush", true); |
| | | } |
| | | } |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | builder.create().show(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (intent != null) |
| | | v.getContext().startActivity(intent); |
| | | |
| | | } else { |
| | | try { |
| | | intent = new Intent(v.getContext(), Class |
| | | .forName(mHomeAds.get(position).getClazz())); |
| | | JSONObject object = new JSONObject(mHomeAds |
| | | .get(position).getParams() |
| | | .replace("\\", "")); |
| | | if (mHomeAds.get(position).getClazz().contains("FXBrowserActivity") && object.optString("url").endsWith(".apk")) { |
| | | startDownLoadFile(object.optString("url")); |
| | | return; |
| | | } |
| | | if (mHomeAds.get(position).getParams() != null) { |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<String> its = object.keys(); |
| | | while (its.hasNext()) { |
| | | String key = its.next(); |
| | | String value = object.optString(key); |
| | | intent.putExtra(key, value); |
| | | intent.putExtra("isPush", true); |
| | | } |
| | | } |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | if (intent != null) |
| | | v.getContext().startActivity(intent); |
| | | } |
| | | |
| | | // } |
| | | }); |
| | | // imageLoader.displayImage(mHomeAds.get(position).getPicture(), view, options); |
| | | Glide.with(mContext).load(mHomeAds.get(position).getPicture()).placeholder(R.drawable.ic_default_cover).error(R.drawable.ic_default_cover) |
| | | .into(view); |
| | | Glide.with(mContext).load(mHomeAds.get(position).getPicture()).transform(new GlideRoundTransform(mContext,6)).placeholder(R.drawable.shape_video_list_cover_placeholder).error(R.drawable.shape_video_list_cover_placeholder) |
| | | .into(view); |
| | | container.addView(view); |
| | | return view; |
| | | } |
| | |
| | | public void onClick(View v) { |
| | | myClick(info, v); |
| | | } |
| | | }, info,1); |
| | | }, info,1,-1); |
| | | } else if (holder instanceof VideoAdHolder) { |
| | | final VideoAdHolder viewHolder = (VideoAdHolder) holder; |
| | | final ExpressAdContainer ad = videoContent.getAd(); |
| | |
| | | else |
| | | itemClickListener.onClick(info); |
| | | } |
| | | }, info, columns); |
| | | }, info, columns,-1); |
| | | |
| | | |
| | | } else if (viewHolder instanceof RecommendVideoAdHolder) {//广告 |
| | |
| | | return true; |
| | | } else if (url.contains("/tbopen/") || url.startsWith("tbopen://")) { |
| | | return true; |
| | | } else if (url.startsWith("tenvideo2://") || url.startsWith("iqiyi://") || url.startsWith("youku://")) { |
| | | } else if (url.startsWith("tenvideo2://") || url.startsWith("iqiyi://") || url.startsWith("youku://") || url.startsWith("imgotv://")) { |
| | | try { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | startActivity(intent); |
| | |
| | | showMenu(); |
| | | } |
| | | break; |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |
| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.bumptech.glide.request.target.DrawableImageViewTarget; |
| | | import com.lcjian.library.util.ScreenUtils; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.qq.e.ads.nativ.NativeUnifiedADData; |
| | |
| | | |
| | | private String from; |
| | | private String tag; |
| | | |
| | | //大图所在位置 |
| | | private int firstBigPosition = -1; |
| | | |
| | | //内容区的宽度 |
| | | private int contentWidth; |
| | | |
| | | |
| | | public void setHeaderView(View headerView) { |
| | |
| | | } |
| | | } |
| | | if (lastRow) |
| | | outRect.bottom = DimenUtils.dipToPixels(8, view.getContext()); |
| | | outRect.bottom = DimenUtils.dipToPixels(8, view.getContext()); |
| | | else |
| | | outRect.bottom = 0; |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 获取每行的宽度 |
| | | * 计算每行宽度 |
| | | * |
| | | * @param activity |
| | | * @param column |
| | | * @param position |
| | | * @return |
| | | */ |
| | | public static int getItemWidth(Activity activity, int column, int padding) { |
| | | int deviceWidth = DimenUtils.getScreenWidth(activity); |
| | | if (column == 3) |
| | | return (deviceWidth - DimenUtils.dip2px(activity, 3 * 2) - padding) / 3; |
| | | else if (column == 2) |
| | | return (deviceWidth - DimenUtils.dip2px(activity, 3) - padding) / 2; |
| | | else |
| | | return (int) (deviceWidth / 2.5f); |
| | | public int getItemWidth(int position, String typeName) { |
| | | if (columns > 3) |
| | | return (int) (contentWidth / 2.5); |
| | | //计算间隔 |
| | | int spanSize = getItemSpanSize(position); |
| | | |
| | | |
| | | int width = 0; |
| | | switch (spanSize) { |
| | | case 6: |
| | | width = contentWidth; |
| | | break; |
| | | case 2: {//一行3列 |
| | | int padding = DimenUtils.dipToPixels(2 * 3, mContext); |
| | | width = (contentWidth - padding * 2) / 3; |
| | | break; |
| | | } |
| | | case 3: {//一行2列 |
| | | int padding = DimenUtils.dipToPixels(3 * 2, mContext); |
| | | width = (contentWidth - padding) / 2; |
| | | break; |
| | | } |
| | | } |
| | | if (contentWidth < 0) |
| | | Log.i(TAG, String.format("%s column:%s position:%s spansize:%s width:%s", typeName, columns + "", position + "", spanSize, width)); |
| | | return width; |
| | | } |
| | | |
| | | |
| | | private int getItemSpanSize(int position) { |
| | | int type = getItemViewType(position); |
| | | if (type == TYPE_FOOTER || type == TYPE_HEADER) { |
| | | return 6; |
| | | } else { |
| | | if (getContentPosition(position) == firstBigPosition) { |
| | | return 6; |
| | | } else |
| | | return 6 / columns; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 初始化内容区宽度 |
| | | * |
| | | * @param rv |
| | | */ |
| | | private void initContentWidth(RecyclerView rv, int viewWidth) { |
| | | |
| | | int padding = 0; |
| | | padding += rv.getPaddingLeft(); |
| | | padding += rv.getPaddingRight(); |
| | | contentWidth = viewWidth - padding; |
| | | } |
| | | |
| | | /** |
| | | * 设置列表的显示样式(一行2列) |
| | |
| | | * @param rv |
| | | * @param firstBigPosition 第一个数据是否以大图显示 |
| | | */ |
| | | public void initRecyclerViewDisplayWidthColumn2(RecyclerView rv, int firstBigPosition) { |
| | | public void initRecyclerViewDisplayWidthColumn2(RecyclerView rv, int viewWidth, int firstBigPosition) { |
| | | initContentWidth(rv, viewWidth); |
| | | this.firstBigPosition = firstBigPosition; |
| | | if (rv.getLayoutManager() == null || !(rv.getLayoutManager() instanceof GridLayoutManager)) { |
| | | RecyclerView.LayoutManager layoutManager = new GridLayoutManager(rv.getContext(), 6); |
| | | rv.setLayoutManager(layoutManager); |
| | |
| | | ((GridLayoutManager) rv.getLayoutManager()).setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { |
| | | @Override |
| | | public int getSpanSize(int position) { |
| | | int type = getItemViewType(position); |
| | | if (type == TYPE_FOOTER || type == TYPE_HEADER) { |
| | | return 6; |
| | | } else { |
| | | if (getContentPosition(position) == firstBigPosition) { |
| | | return 6; |
| | | } else |
| | | return 3; |
| | | } |
| | | return getItemSpanSize(position); |
| | | } |
| | | }); |
| | | for (int i = 0; i < rv.getItemDecorationCount(); i++) { |
| | | rv.removeItemDecoration(rv.getItemDecorationAt(i)); |
| | | i--; |
| | | } |
| | | |
| | | int padding = 0; |
| | | padding += rv.getPaddingLeft(); |
| | | padding += rv.getPaddingRight(); |
| | | |
| | | int count = rv.getItemDecorationCount(); |
| | | for (int i = 0; i < count; i++) { |
| | |
| | | * |
| | | * @param rv |
| | | */ |
| | | public void initRecyclerViewDisplayWidthColumn2(RecyclerView rv) { |
| | | initRecyclerViewDisplayWidthColumn2(rv, -1); |
| | | public void initRecyclerViewDisplayWidthColumn2(RecyclerView rv, int viewWidth) { |
| | | initRecyclerViewDisplayWidthColumn2(rv, viewWidth, -1); |
| | | } |
| | | |
| | | |
| | | public void initRecyclerViewDisplayWidthRow1(RecyclerView rv) { |
| | | public void initRecyclerViewDisplayWidthRow1(RecyclerView rv, int viewWidth) { |
| | | initContentWidth(rv, viewWidth); |
| | | // if (rv.getLayoutManager() == null || !(rv.getLayoutManager() instanceof LinearLayoutManager)) { |
| | | LinearLayoutManager layoutManager = new LinearLayoutManager(rv.getContext()); |
| | | layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| | |
| | | int padding = 0; |
| | | padding += rv.getPaddingLeft(); |
| | | padding += rv.getPaddingRight(); |
| | | itemWidth = getItemWidth(activity, Integer.MAX_VALUE, padding); |
| | | itemWidth = contentWidth; |
| | | rv.addItemDecoration(itemDecorationRow); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param rv |
| | | */ |
| | | public void initRecyclerViewDisplayWidthColumn3(RecyclerView rv) { |
| | | public void initRecyclerViewDisplayWidthColumn3(RecyclerView rv, int viewWidth) { |
| | | initContentWidth(rv, viewWidth); |
| | | if (rv.getLayoutManager() == null || !(rv.getLayoutManager() instanceof GridLayoutManager)) { |
| | | RecyclerView.LayoutManager layoutManager = new GridLayoutManager(rv.getContext(), 6); |
| | | rv.setLayoutManager(layoutManager); |
| | |
| | | ((GridLayoutManager) rv.getLayoutManager()).setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { |
| | | @Override |
| | | public int getSpanSize(int position) { |
| | | int type = getItemViewType(position); |
| | | if (type == TYPE_FOOTER || type == TYPE_HEADER) |
| | | return 6; |
| | | else |
| | | return 2; |
| | | return getItemSpanSize(position); |
| | | } |
| | | }); |
| | | for (int i = 0; i < rv.getItemDecorationCount(); i++) { |
| | |
| | | if ((viewHolder instanceof HeaderViewHolder) || (viewHolder instanceof FooterViewHolder)) { |
| | | return; |
| | | } |
| | | |
| | | if (headerView != null) |
| | | p = p - 1; |
| | | |
| | | final VideoContent content = contentList.get(p); |
| | | |
| | | ViewGroup.LayoutParams params = viewHolder.itemView.getLayoutParams(); |
| | | if (columns > 3) { |
| | | if (itemWidth != null) { |
| | | params.width = itemWidth; |
| | | } |
| | | } else { |
| | | params.width = ViewGroup.LayoutParams.MATCH_PARENT; |
| | | } |
| | | // if (columns > 3) { |
| | | // if (itemWidth != null) { |
| | | // params.width = itemWidth; |
| | | // } |
| | | // } else { |
| | | params.width = getItemWidth(p,""); |
| | | // } |
| | | |
| | | if (viewHolder instanceof VideoHolder) { |
| | | VideoHolder holder = (VideoHolder) viewHolder; |
| | |
| | | else |
| | | itemClickListener.onClick(info); |
| | | } |
| | | }, info, columns); |
| | | }, info, columns, getItemWidth(p, info.getName())); |
| | | } else if (viewHolder instanceof RecommendVideoAdHolder) {//广告 |
| | | final RecommendVideoAdHolder holder = (RecommendVideoAdHolder) viewHolder; |
| | | if (columns == 2) { |
| | |
| | | GDTNativeADUnifiedManager.renderSinglePicture(iv_picture, holder.tv_movie_title, nv, ad.getGdt2Unfied()); |
| | | holder.fl_container.removeAllViews(); |
| | | holder.fl_container.addView(v); |
| | | // ExpressAdManager.fillAd(ad, holder.fl_container); |
| | | } |
| | | } |
| | | |
| | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.weikou.beibeivideo.entity.HomeAd; |
| | | import com.weikou.beibeivideo.entity.vo.BannerVO; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 网页加速域名 |
| | | * |
| | | * @param context |
| | | * @param hosts |
| | | */ |
| | | public static void saveWebSpeedUpHost(Context context, String hosts) { |
| | | saveConfig("webSpeedUpHost", hosts, context); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 我的页面banner |
| | | * |
| | | * @param context |
| | | * @param content |
| | | */ |
| | | public static void saveMinePageBanner(Context context, String content) { |
| | | saveConfig("minePageBanner", content, context); |
| | | } |
| | | |
| | | public static BannerVO getMinePageBanner(Context context) { |
| | | try { |
| | | String config = getConfig("minePageBanner", context); |
| | | if (StringUtils.isEmpty(config)) { |
| | | BannerVO bannerVO = new Gson().fromJson(config, BannerVO.class); |
| | | return bannerVO; |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private static void saveConfig(String key, String value, Context context) { |
| | | SharedPreferences.Editor editor = context.getSharedPreferences("config", Context.MODE_PRIVATE).edit(); |
| | | editor.putString(key, value); |
| | |
| | | public class CSJConstant { |
| | | |
| | | //首页大广告 |
| | | public static String RECOMMEND_BIG_IMG_AD = "945375047"; |
| | | public static String RECOMMEND_BIG_IMG_AD = "945981946"; |
| | | |
| | | //VIVO开屏 |
| | | public static String SPLASH_AD_VIVO = "887378583"; |
| | |
| | | //加载大图 |
| | | int deviceWidth = DimenUtils.getScreenWidth(mContext); |
| | | deviceWidth = DimenUtils.px2dip(mContext, deviceWidth); |
| | | int width = deviceWidth - 8 * 2; |
| | | int width = deviceWidth -9 * 2; |
| | | int height = (int) (width * 0.8); |
| | | String pid = null; |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | pid = CSJConstant.RECOMMEND_BIG_IMG_AD; |
| | | height = (int) (width * 0.56); |
| | | height = (int) (width * 0.78); |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt) { |
| | | pid = BeibeiConstant.GDT_RECOMMAND_NATIVE; |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Typeface; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.support.annotation.NonNull; |
| | | import android.support.annotation.Nullable; |
| | | import android.text.SpannableString; |
| | | import android.text.Spanned; |
| | | import android.text.style.AbsoluteSizeSpan; |
| | | import android.text.style.StyleSpan; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.LinearLayout; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.load.DataSource; |
| | | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| | | import com.bumptech.glide.load.engine.GlideException; |
| | | import com.bumptech.glide.load.resource.bitmap.CenterCrop; |
| | | import com.bumptech.glide.request.RequestListener; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | | import com.bumptech.glide.request.target.Target; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.util.glide.GlideRoundTransform; |
| | |
| | | |
| | | public class VideoUIUtil { |
| | | |
| | | private static final String TAG = "VideoUIUtil"; |
| | | |
| | | public static void setVideoListItem(Context mContext, VideoHolder viewHolder, View.OnClickListener itemOnClickListener, final VideoInfo info, int columns) { |
| | | public static void setVideoListItem(Context mContext, VideoHolder viewHolder, View.OnClickListener itemOnClickListener, final VideoInfo info, int columns, int itemWidth) { |
| | | viewHolder.ll_video_show.setVisibility(View.VISIBLE); |
| | | float ratio = 0; |
| | | if (columns == 2) { |
| | | viewHolder.rl_ratio.setRatio(0.562f); |
| | | ratio = 0.562f; |
| | | } else if (columns == 3) { |
| | | viewHolder.rl_ratio.setRatio(1.39f); |
| | | ratio = 1.39f; |
| | | } else { |
| | | viewHolder.rl_ratio.setRatio(0.562f); |
| | | ratio = 0.562f; |
| | | } |
| | | viewHolder.rl_ratio.setRatio(ratio); |
| | | |
| | | String picture = ""; |
| | | if (columns == 2) { |
| | |
| | | } |
| | | |
| | | viewHolder.rl_ratio.setTag(picture); |
| | | viewHolder.rl_ratio.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Glide.with(mContext).load(viewHolder.rl_ratio.getTag() + "").apply(new RequestOptions().centerCrop()).transform(new GlideRoundTransform(mContext, 6)).transition(withCrossFade()).placeholder(R.drawable.shape_video_list_cover_placeholder).into(viewHolder.iv_movie_cover); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (itemWidth > 0) { |
| | | ViewGroup.LayoutParams params = viewHolder.iv_movie_cover.getLayoutParams(); |
| | | ViewGroup.LayoutParams params1 = viewHolder.view.getLayoutParams(); |
| | | params.width = itemWidth; |
| | | params.height = (int) (itemWidth * ratio); |
| | | params1.width = itemWidth; |
| | | try { |
| | | Glide.with(mContext).load(picture).apply(new RequestOptions().centerCrop()).transform(new GlideRoundTransform(mContext, 6)).transition(withCrossFade()).placeholder(R.drawable.shape_video_list_cover_placeholder).diskCacheStrategy(DiskCacheStrategy.ALL).into(viewHolder.iv_movie_cover); |
| | | } catch (IllegalArgumentException e) { |
| | | Log.i(TAG, e.getMessage()); |
| | | } |
| | | }); |
| | | } else { |
| | | viewHolder.rl_ratio.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Glide.with(mContext).load(viewHolder.rl_ratio.getTag() + "").apply(new RequestOptions().centerCrop()).transform(new GlideRoundTransform(mContext, 6)).transition(withCrossFade()).placeholder(R.drawable.shape_video_list_cover_placeholder).diskCacheStrategy(DiskCacheStrategy.ALL).into(viewHolder.iv_movie_cover); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (info.getTag() != null && info.getTag().contains("评分")) { |
| | | info.setTag(""); |
| | |
| | | viewHolder.iv_high.setVisibility(View.GONE); |
| | | } |
| | | |
| | | viewHolder.tv_movie_sub_title.setText(info.getSubTitle()==null?"":info.getSubTitle()); |
| | | viewHolder.tv_movie_sub_title.setText(info.getSubTitle() == null ? "" : info.getSubTitle()); |
| | | } |
| | | |
| | | public static void setHomeVideoListItem(Context mContext, VideoHolder holder, View.OnClickListener itemOnClickListener, HomeVideo info, boolean big) { |
| | |
| | | package com.lzj.gallery.library.adapter; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.viewpager.widget.PagerAdapter; |
| | | |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import androidx.viewpager.widget.PagerAdapter; |
| | | |
| | | /** |
| | | * Created by Administrator on 2018/11/28. |
| | | * banner的适配器 |
| | |
| | | private int textColor; |
| | | private int highLightTextColor; |
| | | |
| | | private int textSpecialColorPosition = -1; |
| | | private int textSpecialColor; |
| | | |
| | | private OnTabReselectedListener mTabReselectedListener; |
| | | |
| | | public MainTabPageIndicator(Context context) { |
| | |
| | | public void setTextColor(int textColor, int highLightTextColor) { |
| | | this.textColor = textColor; |
| | | this.highLightTextColor = highLightTextColor; |
| | | } |
| | | |
| | | public void setTextSpecialColor(int position, int color) { |
| | | this.textSpecialColorPosition = position; |
| | | this.textSpecialColor = color; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | for (int i = 0; i < mTabLayout.getChildCount(); i++) { |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextSize(15); |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextColor(textColor); |
| | | if (i == textSpecialColorPosition) { |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextColor(textSpecialColor); |
| | | } else { |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextColor(textColor); |
| | | } |
| | | ((TextView) mTabLayout.getChildAt(i)).setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); |
| | | } |
| | | ((TextView) tabView).setTextColor(highLightTextColor); |
| | |
| | | tabView.setOnClickListener(mTabClickListener); |
| | | tabView.setText(text); |
| | | if (textColor > 0) { |
| | | tabView.setTextColor(textColor); |
| | | if (index == textSpecialColorPosition) { |
| | | tabView.setTextColor(textSpecialColor); |
| | | } else |
| | | tabView.setTextColor(textColor); |
| | | } else { |
| | | tabView.setTextColor(R.color.black1); |
| | | } |
| | |
| | | include ':library-DownloadProvider' |
| | | include ':library-common' |
| | | include ':library-APPUpdate' |
| | | include ':gallery' |
| | | include ':BuWanVideo' |