feat : 周星礼物 自动化
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.chwl.app.home.adapter
|
||||
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.ui.utils.ImageLoadUtilsV2
|
||||
import com.chwl.app.view.EffectView
|
||||
import com.chwl.core.home.bean.BannerInfo
|
||||
import com.zhpan.bannerview.BaseBannerAdapter
|
||||
import com.zhpan.bannerview.BaseViewHolder
|
||||
@@ -17,6 +17,7 @@ class HomeBannerAdapter : BaseBannerAdapter<BannerInfo?>() {
|
||||
position: Int,
|
||||
pageSize: Int
|
||||
) {
|
||||
ImageLoadUtilsV2.loadImage(helper.findViewById(R.id.iv_cover), item?.bannerPic)
|
||||
val effectView = helper.findViewById<EffectView>(R.id.effectView)
|
||||
effectView.load(item?.bannerPic?:"",item?.fillVo?.imgMap,item?.fillVo?.textMap)
|
||||
}
|
||||
}
|
@@ -60,8 +60,7 @@ class HomeRoomAdapter : BaseMultiItemQuickAdapter<HomeRoomInfo, BaseViewHolder>
|
||||
this.isSmoothScrollbarEnabled
|
||||
}
|
||||
micUserRecyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
val offset =
|
||||
AppUtils.getApp().resources.getDimensionPixelOffset(R.dimen.dp_4) * -1
|
||||
val offset = AppUtils.getApp().resources.getDimensionPixelOffset(R.dimen.dp_4) * -1
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
|
@@ -167,6 +167,7 @@ class HomeRecommendFragment : BaseViewBindingFragment<FragmentHomeRecommendBindi
|
||||
}
|
||||
|
||||
private fun initBanner() {
|
||||
//todo do , 周星自动化
|
||||
val bannerView: BannerViewPager<BannerInfo?> = binding.bannerView as BannerViewPager<BannerInfo?>
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
it?.let {
|
||||
|
@@ -13,12 +13,10 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.chwl.app.MainActivity;
|
||||
import com.chwl.app.NimMiddleActivity;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.databinding.ActivitySplashBinding;
|
||||
import com.chwl.app.other.SplashBitmapTransformation;
|
||||
import com.chwl.app.ui.login.LoginPasswordActivity;
|
||||
import com.chwl.app.utils.HomeUIManager;
|
||||
import com.chwl.core.DemoCache;
|
||||
@@ -38,7 +36,6 @@ import com.chwl.library.language.LanguageHelper;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
import com.example.lib_utils.log.LogUtil;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -129,6 +126,7 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
|
||||
}
|
||||
}
|
||||
//todo 展示闪屏
|
||||
//todo do , 周星自动化
|
||||
private void showSplash(boolean first) {
|
||||
|
||||
if (!TextUtils.isEmpty(DeviceUtil.getAndroidID())) {
|
||||
@@ -142,11 +140,8 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
|
||||
if (mLocalSplashVo != null && !TextUtils.isEmpty(mLocalSplashVo.getPict())) {
|
||||
|
||||
animation();
|
||||
GlideApp.with(this)
|
||||
.load(mLocalSplashVo.getPict())
|
||||
//添加图片处理机制
|
||||
.apply(RequestOptions.bitmapTransform(new SplashBitmapTransformation()))
|
||||
.into(mBinding.ivActivity);
|
||||
//todo do 看下有没有图片适配问题
|
||||
mBinding.ivActivity.load(mLocalSplashVo.getPict(),mLocalSplashVo.getFillVo().getImgMap(), mLocalSplashVo.getFillVo().getTextMap());
|
||||
|
||||
if (mLocalSplashVo.getType() != 0 && !TextUtils.isEmpty(mLocalSplashVo.getLink())) {
|
||||
mBinding.tvJump.setVisibility(View.VISIBLE);
|
||||
|
@@ -58,20 +58,30 @@ class EffectView : FrameLayout {
|
||||
}
|
||||
|
||||
var mCallBack : CallBack? = null
|
||||
var mResourceUrl = ""
|
||||
var mEffectType = EffectType.IMG
|
||||
var hasAnimImg = false; // 图片是否可能带 序列帧动图
|
||||
|
||||
private var mResourceUrl = ""
|
||||
private var mEffectType = EffectType.IMG
|
||||
|
||||
private var mImgUrlMap: HashMap<String, String>? = null
|
||||
private var mTextMap: HashMap<String, String>? = null
|
||||
|
||||
var mImgUrlMap: HashMap<String, String>? = null
|
||||
var mTextMap: HashMap<String, String>? = null
|
||||
|
||||
|
||||
private fun init(context: Context) {
|
||||
|
||||
}
|
||||
|
||||
fun load(url: String?=null,imgUrlMap: HashMap<String, String>? = null,textMap: HashMap<String, String>? = null) {
|
||||
this.mImgUrlMap = imgUrlMap
|
||||
this.mTextMap = textMap
|
||||
if (url.isVerify()) {
|
||||
loadUrl(url!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun loadUrl(url: String) {
|
||||
private fun loadUrl(url: String) {
|
||||
"EffectView loadUrl() url = $url".doLog()
|
||||
mResourceUrl = url
|
||||
GlideUtils.instance().downloadFromUrl2(context,url,object : RequestListener<File?> {
|
||||
@@ -139,12 +149,11 @@ class EffectView : FrameLayout {
|
||||
private fun loadImg(resource: File) {
|
||||
"EffectView loadImg() ".doLog()
|
||||
try {
|
||||
val fis = FileInputStream(resource)
|
||||
val bitmap = BitmapFactory.decodeStream(fis)
|
||||
val split: List<Drawable> = split(bitmap)
|
||||
|
||||
this@EffectView.post {
|
||||
|
||||
val fis = FileInputStream(resource)
|
||||
val bitmap = BitmapFactory.decodeStream(fis)
|
||||
|
||||
val imageView = ImageView(context)
|
||||
this@EffectView.addView(imageView)
|
||||
imageView.setViewWH(
|
||||
@@ -152,25 +161,31 @@ class EffectView : FrameLayout {
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
false
|
||||
)
|
||||
imageView.scaleType = ImageView.ScaleType.FIT_XY
|
||||
|
||||
if (split.isVerify()) {
|
||||
val animationDrawable = AnimationDrawable()
|
||||
for (i in split.indices) {
|
||||
animationDrawable.addFrame(split[i], 200)
|
||||
if (hasAnimImg) {
|
||||
val split: List<Drawable> = split(bitmap)
|
||||
|
||||
if (split.isVerify()) {
|
||||
val animationDrawable = AnimationDrawable()
|
||||
for (i in split.indices) {
|
||||
animationDrawable.addFrame(split[i], 200)
|
||||
}
|
||||
imageView.setImageDrawable(animationDrawable)
|
||||
animationDrawable.isOneShot = false
|
||||
animationDrawable.start()
|
||||
} else {
|
||||
imageView.setImageBitmap(bitmap)
|
||||
}
|
||||
imageView.setImageDrawable(animationDrawable)
|
||||
animationDrawable.isOneShot = false
|
||||
animationDrawable.start()
|
||||
|
||||
"EffectView loadImg() start".doLog()
|
||||
playCallBack(true)
|
||||
} else {
|
||||
imageView.setImageBitmap(bitmap)
|
||||
}
|
||||
|
||||
"EffectView loadImg() start".doLog()
|
||||
playCallBack(true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (e: Exception) {
|
||||
playCallBack(false)
|
||||
"EffectView loadImg() false".doLog()
|
||||
@@ -385,7 +400,7 @@ class EffectView : FrameLayout {
|
||||
}
|
||||
|
||||
override fun onRepeat() {
|
||||
"EffectView loadSvga() SVGACallback onRepeat()".doLog()
|
||||
// "EffectView loadSvga() SVGACallback onRepeat()".doLog()
|
||||
}
|
||||
|
||||
override fun onStep(i: Int, v: Double) {
|
||||
|
@@ -1,23 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/ll_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:riv_corner_radius_bottom_left="8dp"
|
||||
app:riv_corner_radius_bottom_right="8dp"
|
||||
app:riv_corner_radius_top_left="8dp"
|
||||
app:riv_corner_radius_top_right="8dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<com.chwl.app.view.EffectView
|
||||
android:id="@+id/effectView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@@ -14,12 +14,10 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<ImageView
|
||||
<com.chwl.app.view.EffectView
|
||||
android:id="@+id/iv_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:scaleType="centerCrop" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_skip"
|
||||
|
@@ -10,7 +10,7 @@
|
||||
android:layout_height="@dimen/dp_118"
|
||||
android:layout_marginHorizontal="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_9"
|
||||
android:background="@drawable/base_shape_negative_5dp"
|
||||
android:background="@color/transparent"
|
||||
app:bvp_auto_play="true"
|
||||
app:bvp_can_loop="true"
|
||||
android:nestedScrollingEnabled="false"
|
||||
|
@@ -80,6 +80,11 @@ public class BannerInfo implements Parcelable, Serializable, IRouterData {
|
||||
// private boolean isFairy;
|
||||
|
||||
private String bannerUrl;
|
||||
|
||||
// 首页banner , 闪屏页 嵌套头像用 的字段和key
|
||||
private FillVo fillVo;
|
||||
|
||||
|
||||
public BannerInfo(){
|
||||
|
||||
}
|
||||
|
55
core/src/main/java/com/chwl/core/home/bean/FillVo.java
Normal file
55
core/src/main/java/com/chwl/core/home/bean/FillVo.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.chwl.core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 首页banner , 闪屏页 嵌套头像用 的字段和key
|
||||
*/
|
||||
public class FillVo implements Serializable {
|
||||
public String avatar;
|
||||
public long erbanNo;
|
||||
public String nick;
|
||||
public String loverAvatar;
|
||||
public long loverErbanNo;
|
||||
public String loverNick;
|
||||
|
||||
public String picUrl;
|
||||
public String giftName;
|
||||
public int giftId;
|
||||
|
||||
public @interface Key{
|
||||
public String STAR_AVATAR = "avatar";
|
||||
public String STAR_ID = "id";
|
||||
|
||||
public String GIFT_PIC = "gift";
|
||||
public String GIFT_NAME = "name";
|
||||
|
||||
public String CP_AVATAR = "avatar_1";
|
||||
public String CP_ID = "id_1";
|
||||
public String CP_LOVER_AVATAR = "avatar_2";
|
||||
public String CP_LOVER_ID = "id_2";
|
||||
}
|
||||
|
||||
public HashMap<String, String> getImgMap() {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put(Key.STAR_AVATAR,this.avatar);
|
||||
|
||||
map.put(Key.GIFT_PIC,this.picUrl);
|
||||
|
||||
map.put(Key.CP_AVATAR,this.avatar);
|
||||
map.put(Key.CP_LOVER_AVATAR,this.loverAvatar);
|
||||
return map;
|
||||
}
|
||||
public HashMap<String, String> getTextMap() {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put(Key.STAR_ID, String.valueOf(this.erbanNo));
|
||||
|
||||
map.put(Key.GIFT_NAME,this.giftName);
|
||||
|
||||
map.put(Key.CP_ID, String.valueOf(this.erbanNo));
|
||||
map.put(Key.CP_LOVER_ID, String.valueOf(this.loverErbanNo));
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
package com.chwl.core.initial.bean;
|
||||
|
||||
|
||||
import com.chwl.core.home.bean.FillVo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -23,10 +25,21 @@ public class SplashComponent implements Serializable {
|
||||
*/
|
||||
private int type;
|
||||
|
||||
// 首页banner , 闪屏页 嵌套头像用 的字段和key
|
||||
private FillVo fillVo = new FillVo();
|
||||
|
||||
public String getPict() {
|
||||
return pict;
|
||||
}
|
||||
|
||||
public FillVo getFillVo() {
|
||||
return fillVo;
|
||||
}
|
||||
|
||||
public void setFillVo(FillVo fillVo) {
|
||||
this.fillVo = fillVo;
|
||||
}
|
||||
|
||||
public void setPict(String pict) {
|
||||
this.pict = pict;
|
||||
}
|
||||
|
Reference in New Issue
Block a user