feat:完成【首页-派对】部分UI
@@ -2,33 +2,24 @@ package com.nnbc123.app.common.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.Config;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.Outline;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.ImageView;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
import com.google.android.material.imageview.ShapeableImageView;
|
||||
import com.google.android.material.shape.CornerFamily;
|
||||
import com.google.android.material.shape.ShapeAppearanceModel;
|
||||
import com.nnbc123.app.R;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
/**
|
||||
* 自定义View,实现圆角,圆形等效果
|
||||
*
|
||||
* @author zhy
|
||||
*/
|
||||
public class RectRoundImageView extends ImageView {
|
||||
public class RectRoundImageView extends ShapeableImageView {
|
||||
|
||||
/**
|
||||
* TYPE_CIRCLE / TYPE_ROUND
|
||||
@@ -37,42 +28,11 @@ public class RectRoundImageView extends ImageView {
|
||||
public static final int TYPE_CIRCLE = 0;
|
||||
public static final int TYPE_ROUND = 1;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private Bitmap mSrc;
|
||||
|
||||
/**
|
||||
* 圆角的大小
|
||||
*/
|
||||
private int mRadius = 8;
|
||||
|
||||
/**
|
||||
* 控件的宽度
|
||||
*/
|
||||
private int mWidth;
|
||||
/**
|
||||
* 控件的高度
|
||||
*/
|
||||
private int mHeight;
|
||||
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getmRadius() {
|
||||
return mRadius;
|
||||
}
|
||||
|
||||
public void setmRadius(int mRadius) {
|
||||
this.mRadius = mRadius;
|
||||
}
|
||||
|
||||
public RectRoundImageView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
@@ -98,17 +58,6 @@ public class RectRoundImageView extends ImageView {
|
||||
for (int i = 0; i < n; i++) {
|
||||
int attr = a.getIndex(i);
|
||||
switch (attr) {
|
||||
case R.styleable.RectRoundImageView_src:
|
||||
// mSrc = BitmapFactory.decodeResource(getResources(),
|
||||
// a.getResourceId(attr, 0));
|
||||
InputStream is = getResources().openRawResource(a.getResourceId(attr, 0));
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inTempStorage = new byte[100 * 1024];
|
||||
opts.inPreferredConfig = Config.RGB_565;
|
||||
opts.inPurgeable = true;
|
||||
opts.inSampleSize = 4;
|
||||
mSrc = BitmapFactory.decodeStream(is, null, opts);
|
||||
break;
|
||||
case R.styleable.RectRoundImageView_type:
|
||||
type = a.getInt(attr, 0);// 默认为Circle
|
||||
break;
|
||||
@@ -121,197 +70,25 @@ public class RectRoundImageView extends ImageView {
|
||||
}
|
||||
setScaleType(ScaleType.CENTER_CROP);
|
||||
a.recycle();
|
||||
setup(type, mRadius);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算控件的高度和宽度
|
||||
*/
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
Drawable drawable = getDrawable();
|
||||
if (null != drawable) {
|
||||
mSrc = drawableToBitmap(getDrawable());
|
||||
}
|
||||
/**
|
||||
* 设置宽度
|
||||
*/
|
||||
int specMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int specSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
|
||||
if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
|
||||
{
|
||||
mWidth = specSize;
|
||||
} else {
|
||||
// 由图片决定的宽
|
||||
int desireByImg = getPaddingLeft() + getPaddingRight()
|
||||
+ mSrc.getWidth();
|
||||
if (specMode == MeasureSpec.AT_MOST)// wrap_content
|
||||
{
|
||||
mWidth = Math.min(desireByImg, specSize);
|
||||
} else
|
||||
mWidth = desireByImg;
|
||||
}
|
||||
|
||||
/***
|
||||
* 设置高度
|
||||
*/
|
||||
|
||||
specMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
specSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
|
||||
{
|
||||
mHeight = specSize;
|
||||
} else {
|
||||
int desire = getPaddingTop() + getPaddingBottom()
|
||||
+ mSrc.getHeight();
|
||||
|
||||
if (specMode == MeasureSpec.AT_MOST)// wrap_content
|
||||
{
|
||||
mHeight = Math.min(desire, specSize);
|
||||
} else
|
||||
mHeight = desire;
|
||||
}
|
||||
|
||||
setMeasuredDimension(mWidth, mHeight);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制
|
||||
*/
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
|
||||
switch (type) {
|
||||
// 如果是TYPE_CIRCLE绘制圆形
|
||||
case TYPE_CIRCLE:
|
||||
int min = Math.min(mWidth, mHeight);
|
||||
/**
|
||||
* 长度如果不一致,按小的值进行压缩
|
||||
*/
|
||||
if (null != mSrc) {
|
||||
mSrc = Bitmap.createScaledBitmap(mSrc, min, min, false);
|
||||
canvas.drawBitmap(createCircleImage(mSrc, min), 0, 0, null);
|
||||
private void setup(int type, int cornerSize) {
|
||||
if (type == TYPE_CIRCLE) {
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
int min = Math.min(view.getWidth(), view.getHeight());
|
||||
int left = (view.getWidth() - min) / 2;
|
||||
int top = (view.getHeight() - min) / 2;
|
||||
outline.setOval(left, top, min, min);
|
||||
}
|
||||
break;
|
||||
case TYPE_ROUND:
|
||||
canvas.drawBitmap(createFramedPhoto(mWidth, mHeight, mSrc, mRadius), 0, 0, null);
|
||||
break;
|
||||
});
|
||||
setClipToOutline(true);
|
||||
} else if (type == TYPE_ROUND) {
|
||||
setShapeAppearanceModel(ShapeAppearanceModel.builder()
|
||||
.setAllCorners(CornerFamily.ROUNDED, cornerSize)
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drawable → Bitmap
|
||||
*
|
||||
* @param drawable
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static Bitmap drawableToBitmap(Drawable drawable) {
|
||||
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
|
||||
|
||||
drawable.getIntrinsicHeight(),
|
||||
|
||||
drawable.getOpacity() != PixelFormat.OPAQUE ? Config.ARGB_8888
|
||||
|
||||
: Config.RGB_565);
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
|
||||
//canvas.setBitmap(bitmap);
|
||||
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
|
||||
drawable.draw(canvas);
|
||||
|
||||
return bitmap;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据原图和变长绘制圆形图片
|
||||
*
|
||||
* @param source
|
||||
* @param min
|
||||
* @return
|
||||
*/
|
||||
private Bitmap createCircleImage(Bitmap source, int min) {
|
||||
final Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
Bitmap target = Bitmap.createBitmap(min, min, Config.RGB_565);
|
||||
/**
|
||||
* 产生一个同样大小的画布
|
||||
*/
|
||||
Canvas canvas = new Canvas(target);
|
||||
/**
|
||||
* 首先绘制圆形
|
||||
*/
|
||||
canvas.drawCircle(min / 2, min / 2, min / 2, paint);
|
||||
/**
|
||||
* 使用SRC_IN,参考上面的说明
|
||||
*/
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
/**
|
||||
* 绘制图片
|
||||
*/
|
||||
canvas.drawBitmap(source, 0, 0, paint);
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据原图添加圆角
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
private Bitmap createRoundConerImage(Bitmap source) {
|
||||
final Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
Bitmap target = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(target);
|
||||
RectF rect = new RectF(0, 0, source.getWidth(), source.getHeight());
|
||||
canvas.drawRoundRect(rect, mRadius, mRadius, paint);
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
canvas.drawBitmap(source, 0, 0, paint);
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param x 图像的宽度
|
||||
* @param y 图像的高度
|
||||
* @param image 源图片
|
||||
* @param outerRadiusRat 圆角的大小
|
||||
* @return 圆角图片
|
||||
*/
|
||||
Bitmap createFramedPhoto(int x, int y, Bitmap image, float outerRadiusRat) {
|
||||
//根据源文件新建一个darwable对象
|
||||
Drawable imageDrawable = new BitmapDrawable(image);
|
||||
// 新建一个新的输出图片
|
||||
Bitmap output = Bitmap.createBitmap(x, y, Config.ARGB_8888);
|
||||
|
||||
Canvas canvas = new Canvas(output);
|
||||
|
||||
// 新建一个矩形
|
||||
RectF outerRect = new RectF(0, 0, x, y);
|
||||
|
||||
// 产生一个红色的圆角矩形
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setColor(Color.RED);
|
||||
canvas.drawRoundRect(outerRect, outerRadiusRat, outerRadiusRat, paint);
|
||||
|
||||
// 将源图片绘制到这个圆角矩形上
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
imageDrawable.setBounds(0, 0, x, y);
|
||||
canvas.saveLayer(outerRect, paint, Canvas.ALL_SAVE_FLAG);
|
||||
imageDrawable.draw(canvas);
|
||||
canvas.restore();
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,128 @@
|
||||
package com.nnbc123.app.home.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nnbc123.app.R;
|
||||
import com.nnbc123.app.ui.widget.XRecyclerView.ScaleTransitionPagerTitleView;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.indicators.DrawableIndicator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeMagicIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
|
||||
private final List<? extends CharSequence> mTitleList;
|
||||
|
||||
private int textSize = 20;
|
||||
private float minScale = 0.7f;
|
||||
protected int mNormalColor = Color.BLACK;
|
||||
protected int mSelectedColor = Color.BLACK;
|
||||
private boolean showIndicator = true;
|
||||
private int resId = R.drawable.home_bg_indicator;
|
||||
|
||||
public HomeMagicIndicatorAdapter(Context context, List<? extends CharSequence> charSequences ) {
|
||||
this.mTitleList = charSequences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mTitleList == null ? 0 : mTitleList.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPagerTitleView getTitleView(Context context, final int i) {
|
||||
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true);
|
||||
scaleTransitionPagerTitleView.setNormalColor(mNormalColor);
|
||||
scaleTransitionPagerTitleView.setSelectedColor(mSelectedColor);
|
||||
scaleTransitionPagerTitleView.setMinScale(minScale);
|
||||
scaleTransitionPagerTitleView.setTextSize(textSize);
|
||||
scaleTransitionPagerTitleView.setAutoResetPivot(true);
|
||||
// int padding = UIUtil.dip2px(context, 5);
|
||||
// scaleTransitionPagerTitleView.setPadding(padding, 0, padding, 0);
|
||||
scaleTransitionPagerTitleView.setText(mTitleList.get(i));
|
||||
scaleTransitionPagerTitleView.setOnClickListener(view -> {
|
||||
if (mOnItemSelectListener != null) {
|
||||
mOnItemSelectListener.onItemSelect(i, scaleTransitionPagerTitleView);
|
||||
}
|
||||
|
||||
});
|
||||
return scaleTransitionPagerTitleView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPagerIndicator getIndicator(Context context) {
|
||||
if (!showIndicator) return null;
|
||||
DrawableIndicator indicator = new DrawableIndicator(context);
|
||||
indicator.setMode(DrawableIndicator.MODE_MATCH_EDGE);
|
||||
indicator.setIndicatorDrawable(context.getResources().getDrawable(resId));
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, UIUtil.dip2px(context, 28));
|
||||
lp.gravity = Gravity.CENTER_VERTICAL;
|
||||
indicator.setLayoutParams(lp);
|
||||
return indicator;
|
||||
}
|
||||
|
||||
public void setResId(int resId) {
|
||||
this.resId = resId;
|
||||
}
|
||||
|
||||
public int getTextSize() {
|
||||
return textSize;
|
||||
}
|
||||
|
||||
public void setTextSize(int textSize) {
|
||||
this.textSize = textSize;
|
||||
}
|
||||
|
||||
public float getMinScale() {
|
||||
return minScale;
|
||||
}
|
||||
|
||||
public void setMinScale(float minScale) {
|
||||
this.minScale = minScale;
|
||||
}
|
||||
|
||||
public int getSelectedColor() {
|
||||
return mSelectedColor;
|
||||
}
|
||||
|
||||
public void setSelectedColor(int selectedColor) {
|
||||
mSelectedColor = selectedColor;
|
||||
}
|
||||
|
||||
public int getNormalColor() {
|
||||
return mNormalColor;
|
||||
}
|
||||
|
||||
public void setNormalColor(int normalColor) {
|
||||
mNormalColor = normalColor;
|
||||
}
|
||||
|
||||
public boolean isShowIndicator() {
|
||||
return showIndicator;
|
||||
}
|
||||
|
||||
public void setShowIndicator(boolean showIndicator) {
|
||||
this.showIndicator = showIndicator;
|
||||
}
|
||||
|
||||
private OnItemSelectListener mOnItemSelectListener;
|
||||
|
||||
public void setOnItemSelectListener(OnItemSelectListener onItemSelectListener) {
|
||||
mOnItemSelectListener = onItemSelectListener;
|
||||
}
|
||||
|
||||
public interface OnItemSelectListener {
|
||||
void onItemSelect(int position, TextView view);
|
||||
}
|
||||
}
|
@@ -1,13 +1,17 @@
|
||||
package com.nnbc123.app.home.fragment
|
||||
|
||||
import android.graphics.Color
|
||||
import android.view.Gravity
|
||||
import android.widget.LinearLayout
|
||||
import com.chuhai.utils.ktx.getColorById
|
||||
import com.chuhai.utils.ktx.singleClick
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.app.avroom.adapter.RoomVPAdapter
|
||||
import com.nnbc123.app.base.BaseBindingFragment
|
||||
import com.nnbc123.app.databinding.HomeFragmentBinding
|
||||
import com.nnbc123.app.home.activity.MoreRoomActivity
|
||||
import com.nnbc123.app.home.adapter.MainMagicIndicatorAdapter
|
||||
import com.nnbc123.app.home.adapter.HomeMagicIndicatorAdapter
|
||||
import com.nnbc123.app.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.nnbc123.library.annatation.ActLayoutRes
|
||||
@@ -19,6 +23,7 @@ import com.nnbc123.library.annatation.ActLayoutRes
|
||||
@ActLayoutRes(R.layout.home_fragment)
|
||||
class HomeFragment2 : BaseBindingFragment<HomeFragmentBinding>() {
|
||||
override fun initiate() {
|
||||
ImmersionBar.with(this).titleBarMarginTop(mBinding.magicIndicator).init()
|
||||
initTab()
|
||||
initEvent()
|
||||
}
|
||||
@@ -41,10 +46,10 @@ class HomeFragment2 : BaseBindingFragment<HomeFragmentBinding>() {
|
||||
val fragmentList = listOf(PartyFragment2(), MakeFriendsFragment())
|
||||
val commonNavigator = CommonNavigator(context)
|
||||
commonNavigator.setTitleWrapContent(true)
|
||||
val magicIndicatorAdapter = MainMagicIndicatorAdapter(context, tagList)
|
||||
magicIndicatorAdapter.setResId(R.drawable.ic_home_indicator_center)
|
||||
magicIndicatorAdapter.textSize = 16
|
||||
magicIndicatorAdapter.minScale = 0.85f
|
||||
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
||||
val magicIndicatorAdapter = HomeMagicIndicatorAdapter(context, tagList)
|
||||
magicIndicatorAdapter.normalColor = Color.parseColor("#696D7A")
|
||||
magicIndicatorAdapter.selectedColor = Color.parseColor("#2B2D33")
|
||||
commonNavigator.adapter = magicIndicatorAdapter
|
||||
mBinding.magicIndicator.navigator = commonNavigator
|
||||
commonNavigator.titleContainer.showDividers = LinearLayout.SHOW_DIVIDER_MIDDLE
|
||||
|
@@ -1,11 +1,21 @@
|
||||
package com.nnbc123.app.home.fragment
|
||||
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
||||
import com.nnbc123.app.base.BaseBindingFragment
|
||||
import com.nnbc123.app.databinding.HomePartyFragmentBinding
|
||||
import com.nnbc123.app.home.HomeViewModel
|
||||
import com.nnbc123.app.home.adapter.PartyHotMessageAdapter
|
||||
import com.nnbc123.app.home.adapter.PartyRoomAdapter
|
||||
import com.nnbc123.app.home.dialog.RecommendRoomDialog
|
||||
import com.nnbc123.app.home.helper.BannerHelper
|
||||
import com.nnbc123.app.ui.utils.load
|
||||
import com.nnbc123.app.ui.webview.CommonWebViewActivity
|
||||
import com.nnbc123.core.auth.AuthModel
|
||||
import com.nnbc123.core.statistic.StatisticManager
|
||||
import com.nnbc123.core.statistic.protocol.StatisticsProtocol
|
||||
import com.nnbc123.library.annatation.ActLayoutRes
|
||||
|
||||
/**
|
||||
@@ -14,20 +24,106 @@ import com.nnbc123.library.annatation.ActLayoutRes
|
||||
**/
|
||||
@ActLayoutRes(R.layout.home_party_fragment)
|
||||
class PartyFragment2 : BaseBindingFragment<HomePartyFragmentBinding>() {
|
||||
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
//仅埋点使用,不影响业务逻辑
|
||||
private val abcArray = arrayOf("A", "B", "C", "D")
|
||||
private var currMatchClick = abcArray[0]
|
||||
|
||||
override fun initiate() {
|
||||
initResource()
|
||||
initHotMessage()
|
||||
initBanner()
|
||||
requireActivity().supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container_view, PartyRoomFragment())
|
||||
.commitAllowingStateLoss()
|
||||
mBinding.bannerView.apply {
|
||||
loadData()
|
||||
}
|
||||
|
||||
private fun loadData() {
|
||||
homeViewModel.getHomeResource()
|
||||
homeViewModel.getBannerInfo()
|
||||
}
|
||||
|
||||
private fun initHotMessage() {
|
||||
mBinding.hotMessage.apply {
|
||||
setOrientation(ViewPager2.ORIENTATION_VERTICAL)
|
||||
setAdapter(PartyHotMessageAdapter())
|
||||
setLifecycleRegistry(lifecycle)
|
||||
}.create()
|
||||
mBinding.bannerView.refreshData(ArrayList<String>().apply {
|
||||
mBinding.hotMessage.refreshData(ArrayList<String>().apply {
|
||||
repeat(3) {
|
||||
add(it.toString())
|
||||
}
|
||||
})
|
||||
|
||||
mBinding.hotMessage.isVisible = true
|
||||
}
|
||||
|
||||
private fun initResource(){
|
||||
homeViewModel.resourceLiveData.observe(this) {
|
||||
if (it.isNullOrEmpty()) {
|
||||
mBinding.groupResource.isVisible = false
|
||||
return@observe
|
||||
}
|
||||
mBinding.groupResource.isVisible = true
|
||||
val resourceViews = arrayOf(
|
||||
mBinding.ivResource0,
|
||||
mBinding.ivResource1,
|
||||
mBinding.ivResource2,
|
||||
mBinding.ivResource3
|
||||
)
|
||||
for (i in resourceViews.indices) {
|
||||
resourceViews[i].load(it[i].icon)
|
||||
resourceViews[i].setOnClickListener { _ ->
|
||||
currMatchClick = abcArray[i]
|
||||
StatisticManager.Instance().onEvent(
|
||||
"${currMatchClick}_match_click",
|
||||
"资源位点击",
|
||||
mapOf("user_id" to AuthModel.get().currentUid.toString())
|
||||
)
|
||||
when {
|
||||
it[i].resourceType == 5 -> {
|
||||
CommonWebViewActivity.start(context, it[i].resourceContent)
|
||||
}
|
||||
i == 3 -> {
|
||||
dialogManager.showProgressDialog(mContext)
|
||||
homeViewModel.getHomeChatPick()
|
||||
}
|
||||
else -> {
|
||||
dialogManager.showProgressDialog(mContext)
|
||||
homeViewModel.getResourceJumpInfo(it[i].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
homeViewModel.resourceJumpLiveData.observe(this) {
|
||||
dialogManager.dismissDialog()
|
||||
it?.let {
|
||||
if (it.isPick) {
|
||||
AVRoomActivity.start(context, it.uid)
|
||||
StatisticManager.Instance().onEvent(
|
||||
"${currMatchClick}_match_success",
|
||||
"资源位匹配成功",
|
||||
mapOf("user_id" to AuthModel.get().currentUid.toString())
|
||||
)
|
||||
} else {
|
||||
RecommendRoomDialog.newInstance(it).show(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initBanner() {
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
BannerHelper.setBanner(mBinding.rollView, it) { _, _ ->
|
||||
StatisticManager.Instance()
|
||||
.onEvent(StatisticsProtocol.EVENT_HOME_BANNER_CLICK, "首页_banner")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -22,6 +22,8 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
|
||||
|
||||
private boolean isAlwaysBold;
|
||||
|
||||
private boolean autoResetPivot;
|
||||
|
||||
public ScaleTransitionPagerTitleView(Context context, boolean selectedBold) {
|
||||
super(context);
|
||||
this.selectedBold = selectedBold;
|
||||
@@ -34,6 +36,10 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
|
||||
@Override
|
||||
public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) {
|
||||
super.onEnter(index, totalCount, enterPercent, leftToRight);
|
||||
if (autoResetPivot) {
|
||||
setPivotX(getWidth() / 2f);
|
||||
setPivotY(getHeight() / 2f);
|
||||
}
|
||||
// 实现颜色渐变
|
||||
setScaleX(mMinScale + (1.0f - mMinScale) * enterPercent);
|
||||
setScaleY(mMinScale + (1.0f - mMinScale) * enterPercent);
|
||||
@@ -42,6 +48,10 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
|
||||
@Override
|
||||
public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) {
|
||||
super.onLeave(index, totalCount, leavePercent, leftToRight);
|
||||
if (autoResetPivot) {
|
||||
setPivotX(getWidth() / 2f);
|
||||
setPivotY(getHeight() / 2f);
|
||||
}
|
||||
// 实现颜色渐变
|
||||
setScaleX(1.0f + (mMinScale - 1.0f) * leavePercent);
|
||||
setScaleY(1.0f + (mMinScale - 1.0f) * leavePercent);
|
||||
@@ -82,4 +92,8 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setAutoResetPivot(boolean state) {
|
||||
autoResetPivot = state;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -184,7 +184,7 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
|
||||
if (mAdapter != null) {
|
||||
mIndicator = mAdapter.getIndicator(getContext());
|
||||
if (mIndicator instanceof View) {
|
||||
LayoutParams lp = (LayoutParams) ((View) mIndicator).getLayoutParams();
|
||||
ViewGroup.LayoutParams lp = ((View) mIndicator).getLayoutParams();
|
||||
if (lp == null) {
|
||||
lp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
}
|
||||
|
@@ -0,0 +1,177 @@
|
||||
package com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.indicators;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
import com.nnbc123.app.ui.widget.magicindicator.FragmentContainerHelper;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.model.PositionData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class DrawableIndicator extends View implements IPagerIndicator {
|
||||
public static final int MODE_MATCH_EDGE = 0; // drawable宽度 == title宽度 - 2 * mXOffset
|
||||
public static final int MODE_WRAP_CONTENT = 1; // drawable宽度 == title内容宽度 - 2 * mXOffset
|
||||
public static final int MODE_EXACTLY = 2;
|
||||
|
||||
private int mMode; // 默认为MODE_MATCH_EDGE模式
|
||||
private Drawable mIndicatorDrawable;
|
||||
|
||||
// 控制动画
|
||||
private Interpolator mStartInterpolator = new LinearInterpolator();
|
||||
private Interpolator mEndInterpolator = new LinearInterpolator();
|
||||
|
||||
private float mDrawableHeight;
|
||||
private float mDrawableWidth;
|
||||
private float mYOffset;
|
||||
private float mXOffset;
|
||||
|
||||
private List<PositionData> mPositionDataList;
|
||||
private Rect mDrawableRect = new Rect();
|
||||
|
||||
public DrawableIndicator(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
if (mIndicatorDrawable == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPositionDataList == null || mPositionDataList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算锚点位置
|
||||
PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
|
||||
PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1);
|
||||
|
||||
float leftX;
|
||||
float nextLeftX;
|
||||
float rightX;
|
||||
float nextRightX;
|
||||
if (mMode == MODE_MATCH_EDGE) {
|
||||
leftX = current.mLeft + mXOffset;
|
||||
nextLeftX = next.mLeft + mXOffset;
|
||||
rightX = current.mRight - mXOffset;
|
||||
nextRightX = next.mRight - mXOffset;
|
||||
mDrawableRect.top = (int) mYOffset;
|
||||
mDrawableRect.bottom = (int) (getHeight() - mYOffset);
|
||||
} else if (mMode == MODE_WRAP_CONTENT) {
|
||||
leftX = current.mContentLeft + mXOffset;
|
||||
nextLeftX = next.mContentLeft + mXOffset;
|
||||
rightX = current.mContentRight - mXOffset;
|
||||
nextRightX = next.mContentRight - mXOffset;
|
||||
mDrawableRect.top = (int) (current.mContentTop - mYOffset);
|
||||
mDrawableRect.bottom = (int) (current.mContentBottom + mYOffset);
|
||||
} else { // MODE_EXACTLY
|
||||
leftX = current.mLeft + (current.width() - mDrawableWidth) / 2;
|
||||
nextLeftX = next.mLeft + (next.width() - mDrawableWidth) / 2;
|
||||
rightX = current.mLeft + (current.width() + mDrawableWidth) / 2;
|
||||
nextRightX = next.mLeft + (next.width() + mDrawableWidth) / 2;
|
||||
mDrawableRect.top = (int) (getHeight() - mDrawableHeight - mYOffset);
|
||||
mDrawableRect.bottom = (int) (getHeight() - mYOffset);
|
||||
}
|
||||
|
||||
mDrawableRect.left = (int) (leftX + (nextLeftX - leftX) * mStartInterpolator.getInterpolation(positionOffset));
|
||||
mDrawableRect.right = (int) (rightX + (nextRightX - rightX) * mEndInterpolator.getInterpolation(positionOffset));
|
||||
mIndicatorDrawable.setBounds(mDrawableRect);
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mIndicatorDrawable != null) {
|
||||
mIndicatorDrawable.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPositionDataProvide(List<PositionData> dataList) {
|
||||
mPositionDataList = dataList;
|
||||
}
|
||||
|
||||
public Drawable getIndicatorDrawable() {
|
||||
return mIndicatorDrawable;
|
||||
}
|
||||
|
||||
public void setIndicatorDrawable(Drawable indicatorDrawable) {
|
||||
mIndicatorDrawable = indicatorDrawable;
|
||||
}
|
||||
|
||||
public Interpolator getStartInterpolator() {
|
||||
return mStartInterpolator;
|
||||
}
|
||||
|
||||
public void setStartInterpolator(Interpolator startInterpolator) {
|
||||
mStartInterpolator = startInterpolator;
|
||||
}
|
||||
|
||||
public Interpolator getEndInterpolator() {
|
||||
return mEndInterpolator;
|
||||
}
|
||||
|
||||
public void setEndInterpolator(Interpolator endInterpolator) {
|
||||
mEndInterpolator = endInterpolator;
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return mMode;
|
||||
}
|
||||
|
||||
public void setMode(int mode) {
|
||||
if (mode == MODE_EXACTLY || mode == MODE_MATCH_EDGE || mode == MODE_WRAP_CONTENT) {
|
||||
mMode = mode;
|
||||
} else {
|
||||
throw new IllegalArgumentException("mode " + mode + " not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
public float getDrawableHeight() {
|
||||
return mDrawableHeight;
|
||||
}
|
||||
|
||||
public void setDrawableHeight(float drawableHeight) {
|
||||
mDrawableHeight = drawableHeight;
|
||||
}
|
||||
|
||||
public float getDrawableWidth() {
|
||||
return mDrawableWidth;
|
||||
}
|
||||
|
||||
public void setDrawableWidth(float drawableWidth) {
|
||||
mDrawableWidth = drawableWidth;
|
||||
}
|
||||
|
||||
public float getYOffset() {
|
||||
return mYOffset;
|
||||
}
|
||||
|
||||
public void setYOffset(float yOffset) {
|
||||
mYOffset = yOffset;
|
||||
}
|
||||
|
||||
public float getXOffset() {
|
||||
return mXOffset;
|
||||
}
|
||||
|
||||
public void setXOffset(float xOffset) {
|
||||
mXOffset = xOffset;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_bg_indicator.webp
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_bg_top.webp
Normal file
After Width: | Height: | Size: 143 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_ic_my_room.webp
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_ic_rank.webp
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_ic_resource_more.webp
Normal file
After Width: | Height: | Size: 18 KiB |
12
app/src/main/res/drawable/home_ic_search.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="16"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:pathData="M12.687,11.944C13.705,10.751 14.283,9.237 14.283,7.642C14.283,3.973 11.31,1 7.642,1C3.974,1 1,3.974 1,7.642C1,11.31 3.974,14.284 7.642,14.284C8.299,14.284 8.953,14.187 9.581,13.996C9.857,13.91 10.012,13.617 9.927,13.341C9.843,13.065 9.552,12.909 9.275,12.991C8.746,13.152 8.195,13.234 7.642,13.233C4.554,13.233 2.05,10.73 2.05,7.642C2.05,4.554 4.554,2.05 7.642,2.05C10.73,2.05 13.233,4.554 13.233,7.642C13.233,9.107 12.653,10.492 11.639,11.536C11.408,11.774 11.411,12.154 11.646,12.388L14.107,14.849C14.312,15.051 14.642,15.05 14.846,14.846C15.05,14.642 15.051,14.312 14.849,14.107L12.687,11.944Z"
|
||||
android:strokeWidth="0.2"
|
||||
android:fillColor="#B8B7C7"
|
||||
android:fillType="nonZero"
|
||||
android:strokeColor="#B8B7C7"/>
|
||||
</vector>
|
@@ -67,7 +67,7 @@
|
||||
android:layout_marginBottom="4dp"
|
||||
android:onClick="@{click}"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_home_rank" />
|
||||
android:src="@drawable/home_ic_rank" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_my_room"
|
||||
@@ -78,7 +78,7 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click}"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_home_my_room"
|
||||
android:src="@drawable/home_ic_my_room"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -1,63 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/home_bg_top"
|
||||
app:layout_constraintDimensionRatio="375:250"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.nnbc123.app.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/magic_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/magic_indicator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="@id/magic_indicator">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_search"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="23dp"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_room_temp"
|
||||
android:drawableStart="@mipmap/ic_search_main"
|
||||
android:drawablePadding="6dp"
|
||||
android:background="@drawable/shape_white_16dp_round"
|
||||
android:drawableStart="@drawable/home_ic_search"
|
||||
android:drawablePadding="@dimen/dp_7"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="13dp"
|
||||
android:text="搜索房间/昵称/ID"
|
||||
android:textColor="#9EB5C5"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ranking"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="23dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_home_rank" />
|
||||
android:paddingStart="@dimen/dp_9"
|
||||
android:paddingEnd="@dimen/dp_32"
|
||||
android:text="搜索ID、房间"
|
||||
android:textColor="#B8B7C7"
|
||||
android:textSize="@dimen/dp_12" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_my_room"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_home_my_room"
|
||||
android:visibility="gone" />
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home_ic_my_room"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ranking"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home_ic_rank" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@@ -32,169 +32,122 @@
|
||||
app:contentScrim="@color/transparent"
|
||||
app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll_resource"
|
||||
android:layout_width="match_parent"
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_0"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintDimensionRatio="171:88"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_resource_1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_3"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintDimensionRatio="171:88"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_resource_0"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_resource_0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_7"
|
||||
android:layout_marginEnd="@dimen/dp_3"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintDimensionRatio="113:48"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_resource_3"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_resource_0"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_resource_0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="@dimen/dp_3"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintDimensionRatio="113:48"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_resource_4"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_resource_2"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_resource_2" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintDimensionRatio="113:48"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_resource_1"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_resource_3"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_resource_2" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_resource"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_0"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/ic_resource_0"
|
||||
app:layout_constraintDimensionRatio="94:120"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.274" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/ic_resource_1"
|
||||
app:layout_constraintDimensionRatio="120:56"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_resource_2"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_resource_0"
|
||||
app:layout_constraintWidth_percent="0.355" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:src="@drawable/ic_resource_2"
|
||||
app:layout_constraintDimensionRatio="120:56"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_resource_0"
|
||||
app:layout_constraintWidth_percent="0.355" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_resource_3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/ic_resource_3"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_resource_0"
|
||||
app:layout_constraintDimensionRatio="243:56"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintWidth_percent="0.705" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="11dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="bottom"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_resource_3"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_resource_3">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:src="@drawable/ic_home_pick_avatar0" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_home_pick_avatar1" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_home_pick_avatar2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_online_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:drawableStart="@drawable/shape_circle_82fbff_small"
|
||||
android:drawablePadding="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_resource_3"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_resource_3"
|
||||
tools:text="999人组队中" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_gift_service"
|
||||
app:layout_constraintDimensionRatio="694:148"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_resource_3"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_resource_0"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_resource_0">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="21dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:src="@drawable/ic_home_hot" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_gift_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="11dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="iv_resource_0,iv_resource_1,iv_resource_2,iv_resource_3,iv_resource_4"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.zhpan.bannerview.BannerViewPager
|
||||
android:id="@+id/banner_view"
|
||||
android:id="@+id/hot_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginHorizontal="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:visibility="gone"
|
||||
app:bvp_indicator_visibility="gone"
|
||||
app:bvp_interval="3000"
|
||||
app:bvp_scroll_duration="500" />
|
||||
app:bvp_scroll_duration="500"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_resource_2"
|
||||
tools:background="@drawable/default_banner"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_roll_view"
|
||||
android:layout_width="match_parent"
|
||||
<com.nnbc123.app.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/roll_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintDimensionRatio="345:80"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/hot_message"
|
||||
app:rollviewpager_hint_gravity="left"
|
||||
app:rollviewpager_hint_paddingBottom="8dp"
|
||||
tools:background="@drawable/default_banner"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15">
|
||||
|
||||
<com.nnbc123.app.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/roll_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="345:80"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:rollviewpager_hint_gravity="left"
|
||||
app:rollviewpager_hint_paddingBottom="8dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
android:layout_marginStart="@dimen/dp_19"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:paddingBottom="@dimen/dp_4"
|
||||
android:text="热门推荐"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="@dimen/dp_16"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/roll_view" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
|
@@ -29,5 +29,5 @@ COMPILE_SDK_VERSION=32
|
||||
MIN_SDK_VERSION=21
|
||||
TARGET_SDK_VERSION=32
|
||||
|
||||
version_name=1.3.2
|
||||
version_code=132
|
||||
version_name=2.0.0
|
||||
version_code=2000
|
@@ -141,6 +141,8 @@ dependencies {
|
||||
// 网络请求chrome数据调试
|
||||
api 'com.facebook.stetho:stetho:1.5.1'
|
||||
api 'com.facebook.stetho:stetho-okhttp3:1.5.1'
|
||||
|
||||
api 'com.geyifeng.immersionbar:immersionbar:3.2.2'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|