1.首页UI对稿

2.房间飘屏动画时长更改
This commit is contained in:
huangjian
2020-12-10 18:28:55 +08:00
parent 60a22a4238
commit f0fb68d542
16 changed files with 60 additions and 79 deletions

View File

@@ -965,6 +965,8 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
private boolean isCreateLevelUp;
private Disposable disposableLevelUp;
private final int ANIM_TIME = 4;
/**
* 开福袋飘屏
*
@@ -975,7 +977,7 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
messagesLuckyGift.add(chatRoomMessage);
if (disposableLuckyGift == null || messagesLuckyGift.size() == 1) {
isCreateLuckyGift = true;
disposableLuckyGift = Observable.interval(0, 6, TimeUnit.SECONDS)
disposableLuckyGift = Observable.interval(0, ANIM_TIME, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(aLong -> {
if (messagesLuckyGift.size() > 0 && !isCreateLuckyGift)
@@ -1023,7 +1025,7 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
messages.add(chatRoomMessage);
if (boxDisposable == null || messages.size() == 1) {
isCreate = true;
boxDisposable = Observable.interval(0, 6, TimeUnit.SECONDS)
boxDisposable = Observable.interval(0, ANIM_TIME, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(aLong -> {
if (messages.size() > 0 && !isCreate)
@@ -1067,7 +1069,7 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
messagesBoxSVGA.add(chatRoomMessage);
if (boxSVGADisposable == null || messagesBoxSVGA.size() == 1) {
isBoxSVGACreate = true;
boxSVGADisposable = Observable.interval(0, 6, TimeUnit.SECONDS)
boxSVGADisposable = Observable.interval(0, ANIM_TIME, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(aLong -> {
if (messagesBoxSVGA.size() > 0 && !isBoxSVGACreate)

View File

@@ -52,31 +52,13 @@ public class BannerAdapter extends StaticPagerAdapter {
BannerInfo bannerInfo = bannerInfoList.get(position);
ImageView imgBanner = (ImageView) mInflater.inflate(R.layout.banner_page_item, container, false);
if (bannerInfo == null) return imgBanner;
String url = bannerInfo.getSkipUri();
// if (isHomeGame){
if (roundingRadius == -1) {
ImageLoadUtils.loadGameBannerRoundBackground(context, bannerInfo.getBannerPic(), imgBanner);
} else {
ImageLoadUtils.loadBannerRoundBackground(context, bannerInfo.getBannerPic(), imgBanner, roundingRadius);
}
// }else {
// ImageLoadUtils.loadBannerRoundBackground(context, bannerInfo.getBannerPic(), imgBanner);
// }
imgBanner.setScaleType(ImageView.ScaleType.FIT_XY);
imgBanner.setOnClickListener(v -> {
// if (TextUtils.isEmpty(url)) return;
// if (bannerInfo.getSkipType() == 3) {
// Intent intent = new Intent(context, CommonWebViewActivity.class);
// intent.putExtra("url", url);
// context.startActivity(intent);
// } else if (bannerInfo.getSkipType() == 2) {
// if (TextUtils.isEmpty(url)) return;
// try {
// AVRoomActivity.start(context, Long.valueOf(url));
// } catch (NumberFormatException e) {
// e.printStackTrace();
// }
// }
CommonJumpHelper.bannerJump(context, bannerInfo);
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(position, bannerInfo);

View File

@@ -34,6 +34,7 @@ public class HomeConcernsAdapter extends BaseQuickAdapter<HomeConcernsInfo, Base
circleImageView.setBorderWidth(UIUtil.dip2px(mContext, 1));
helper.setText(R.id.tv_room_name, item.getFollowType() == 1 ? "" : item.getName());
helper.setGone(R.id.tv_room_name, item.getFollowType() != 1);
helper.setText(R.id.iv_living, item.getFollowType() == 1 ? "我的房间" : "直播中");
helper.setBackgroundRes(R.id.iv_living, item.getFollowType() == 1 ? R.drawable.bg_living_my_room : R.drawable.bg_common_confirm_normal);
circleImageView.setBorderColor(item.getFollowType() == 1 ? Color.parseColor("#FF6B82") : mContext.getResources().getColor(R.color.appColor));

View File

@@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.widget.XRecyclerView.ScaleTransitionPagerTitleView;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
@@ -38,7 +39,7 @@ public class MainMagicIndicatorAdapter extends CommonNavigatorAdapter {
@Override
public IPagerTitleView getTitleView(Context context, final int i) {
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true, 8);
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true);
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(mContext, R.color.color_666666));
scaleTransitionPagerTitleView.setSelectedColor(mIsShowIndicator ? ContextCompat.getColor(mContext, R.color.appColor) : ContextCompat.getColor(mContext, R.color.color_333333));
scaleTransitionPagerTitleView.setMinScale(0.8f);

View File

@@ -34,13 +34,11 @@ public class TopMagicIndicatorAdapter extends CommonNavigatorAdapter {
@Override
public IPagerTitleView getTitleView(Context context, final int i) {
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, false, 2);
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, false);
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(mContext, R.color.white));
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(mContext, R.color.white));
scaleTransitionPagerTitleView.setMinScale(0.85f);
scaleTransitionPagerTitleView.setTextSize(18);
// scaleTransitionPagerTitleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 36);
scaleTransitionPagerTitleView.setText(mTitleList.get(i));
scaleTransitionPagerTitleView.setOnClickListener(view -> {
if (mOnItemSelectListener != null) {

View File

@@ -312,6 +312,7 @@ public class GameHomeFragment extends BaseMvpFragment<IMainFragmentView, MainFra
mFragmentsBottom.add(HomeDynamicFragment.newInstance());
CommonNavigator commonNavigator = new CommonNavigator(getContext());
commonNavigator.setTitleWrapContent(true);
MainMagicIndicatorAdapter magicIndicatorAdapter = new MainMagicIndicatorAdapter(getContext(), tagList, false);
magicIndicatorAdapter.setOnBottomItemSelectListener(this);
commonNavigator.setAdapter(magicIndicatorAdapter);
@@ -658,6 +659,7 @@ public class GameHomeFragment extends BaseMvpFragment<IMainFragmentView, MainFra
mFragments.add(fragment);
}
CommonNavigator commonNavigator = new CommonNavigator(getContext());
commonNavigator.setTitleWrapContent(true);
MainMagicIndicatorAdapter magicIndicatorAdapter = new MainMagicIndicatorAdapter(getContext(), mTabInfoList, true);
magicIndicatorAdapter.setOnItemSelectListener(this);
commonNavigator.setAdapter(magicIndicatorAdapter);
@@ -804,11 +806,6 @@ public class GameHomeFragment extends BaseMvpFragment<IMainFragmentView, MainFra
return;
}
mBinding.rollView.setVisibility(View.VISIBLE);
ViewGroup.LayoutParams layoutParams = mBinding.rollView.getLayoutParams();
int bannerWidth = UIUtil.getScreenWidth(mContext) - UIUtil.dip2px(mContext, 40);
layoutParams.width = bannerWidth;
layoutParams.height = bannerWidth * 90 / 345;
mBinding.rollView.setLayoutParams(layoutParams);
mBinding.rollView.setHintView(new ColorPointHintView(mContext, Color.WHITE, mContext.getResources().getColor(R.color.color_66FFFFFF)) {
@Override
@@ -849,16 +846,6 @@ public class GameHomeFragment extends BaseMvpFragment<IMainFragmentView, MainFra
mBinding.rvAddFriends.setFocusable(false);
addFriendsAdapter = new HomeAddFriendsAdapter();
mBinding.rvAddFriends.setAdapter(addFriendsAdapter);
mBinding.rvAddFriends.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NotNull Rect outRect, @NotNull View view, @NotNull RecyclerView parent, @NotNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
int bottom = ScreenUtil.dip2px(10);
int top = ScreenUtil.dip2px(5);
outRect.set(0, top, 0, bottom);
}
});
}
GameHomeModel.get().getHomePlay()
.doOnError(throwable -> mBinding.tvAddFriends.setVisibility(View.GONE))

View File

@@ -38,7 +38,7 @@ public class JustColorIndicatorAdapter extends CommonNavigatorAdapter {
@Override
public IPagerTitleView getTitleView(Context context, final int i) {
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, false, 0);
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, false);
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(mContext, R.color.color_B3B3B3));
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(mContext, R.color.color_333333));
scaleTransitionPagerTitleView.setAlwaysBold();

View File

@@ -20,16 +20,8 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
*/
private boolean selectedBold;
/** 往y方向平移设置每个tab文字底部对齐, 0.0不平移 */
private float mTranslationY = 0.0f;
private boolean isAlwaysBold;
public ScaleTransitionPagerTitleView(Context context, boolean selectedBold, float translationY) {
this(context, selectedBold);
mTranslationY = translationY;
}
public ScaleTransitionPagerTitleView(Context context, boolean selectedBold) {
super(context);
this.selectedBold = selectedBold;
@@ -45,7 +37,6 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
// 实现颜色渐变
setScaleX(mMinScale + (1.0f - mMinScale) * enterPercent);
setScaleY(mMinScale + (1.0f - mMinScale) * enterPercent);
setTranslationY(1.0f + (1- enterPercent) * mTranslationY);
}
@Override
@@ -54,7 +45,6 @@ public class ScaleTransitionPagerTitleView extends ColorTransitionPagerTitleView
// 实现颜色渐变
setScaleX(1.0f + (mMinScale - 1.0f) * leavePercent);
setScaleY(1.0f + (mMinScale - 1.0f) * leavePercent);
setTranslationY(1.0f + mTranslationY * leavePercent);
}
@Override

View File

@@ -41,6 +41,7 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
* 提供给外部的参数配置
*/
/****************************************************/
private boolean mTitleWrapContent; // 标题包裹内容,不MATCH_PARENT
private boolean mAdjustMode; // 自适应模式适用于数目固定的、少量的title
private boolean mEnablePivotScroll; // 启动中心点滚动
private float mScrollPivotX = 0.5f; // 滚动中心点 0.0f - 1.0f
@@ -98,6 +99,10 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
mAdjustMode = is;
}
public void setTitleWrapContent(boolean is) {
mTitleWrapContent = is;
}
public CommonNavigatorAdapter getAdapter() {
return mAdapter;
}
@@ -159,6 +164,8 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
if (mAdjustMode) {
lp = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT);
lp.weight = mAdapter.getTitleWeight(getContext(), i);
} else if (mTitleWrapContent) {
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
} else {
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
}
@@ -201,6 +208,9 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
PositionData data = new PositionData();
View v = mTitleContainer.getChildAt(i);
if (v != null) {
//这里是更改是缩放中心
v.setPivotX(v.getWidth() / 2f);
v.setPivotY(v.getHeight());
data.mLeft = v.getLeft();
data.mTop = v.getTop();
data.mRight = v.getRight();
@@ -442,6 +452,7 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
}
private NavigatorSelectedListener mNavigatorSelectedListener;
public void setmNavigatorSelectedListener(NavigatorSelectedListener navigatorSelectedListener) {
this.mNavigatorSelectedListener = navigatorSelectedListener;
}

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="2000"
android:duration="500"
android:fromXDelta="100%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="0" />
<translate
android:duration="2000"
android:duration="500"
android:fromXDelta="0"
android:interpolator="@android:anim/accelerate_interpolator"
android:startOffset="4000"
android:startOffset="3500"
android:toXDelta="-100%p" />
</set>

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.makeramen.roundedimageview.RoundedImageView 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:layout_height="match_parent"
android:scaleType="fitXY" />

View File

@@ -59,9 +59,9 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_30"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_15"
android:adjustViewBounds="true"
android:onClick="@{click}"
android:scaleType="fitXY"
android:src="@mipmap/ic_home_ranking" />
@@ -97,8 +97,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/translucent"
app:layout_behavior="com.yizhuan.erban.ui.widget.AppBarLayoutBehavior"
app:elevation="0dp">
app:elevation="0dp"
app:layout_behavior="com.yizhuan.erban.ui.widget.AppBarLayoutBehavior">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
@@ -119,24 +119,26 @@
android:paddingEnd="@dimen/dp_15"
android:visibility="visible" />
<FrameLayout
android:id="@+id/fl_roll_view"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_roll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="5dp"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginBottom="5dp">
<com.jude.rollviewpager.RollPagerView
android:id="@+id/roll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_15"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintDimensionRatio="345:80"
app:layout_constraintTop_toTopOf="parent"
app:rollviewpager_hint_gravity="left"
app:rollviewpager_hint_paddingBottom="8dp"
tools:visibility="visible" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ll_indicator"
@@ -147,6 +149,7 @@
android:focusableInTouchMode="true"
android:orientation="horizontal"
android:paddingStart="14dp"
android:paddingTop="5dp"
android:paddingEnd="15dp"
android:paddingBottom="5dp"
app:layout_constraintStart_toStartOf="parent"
@@ -169,13 +172,12 @@
android:layout_height="wrap_content"
android:drawableRight="@drawable/arrow_right_2"
android:drawablePadding="@dimen/dp_3"
android:gravity="center"
android:gravity="bottom"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_5"
android:paddingTop="5dp"
android:text="更多房间"
android:textColor="@color/color_666666"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="@id/magic_indicator"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/magic_indicator"
app:layout_constraintTop_toTopOf="@id/magic_indicator" />
@@ -192,18 +194,21 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F9F9F9"
android:includeFontPadding="false"
android:paddingStart="16dp"
android:paddingTop="15dp"
android:text="交友扩列"
android:textStyle="bold"
android:textColor="@color/color_333333"
android:textSize="16sp" />
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_add_friends"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F9F9F9"
android:paddingTop="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:visibility="visible" />
</LinearLayout>
@@ -213,12 +218,14 @@
android:id="@+id/fl_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F9F9F9">
android:background="@color/color_F9F9F9"
android:paddingTop="10dp"
android:paddingBottom="5dp">
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
android:id="@+id/magic_indicator_bottom"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:paddingLeft="14dp"
android:paddingRight="14dp" />
</FrameLayout>

View File

@@ -5,7 +5,8 @@
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical">
<View

View File

@@ -5,6 +5,7 @@
android:id="@+id/container_item_room_history"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
tools:background="@color/red">
<FrameLayout
@@ -43,12 +44,12 @@
android:id="@+id/tv_room_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fl_room_history_avatar_container"
tools:text="小小问问小问问小问问问问" />
tools:text="" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -6,5 +6,6 @@
android:background="@color/color_F9F9F9"
android:clipToPadding="false"
android:paddingStart="10dp"
android:paddingTop="2dp"
android:paddingEnd="10dp" />