[Modify]修改福袋礼物面板问题
This commit is contained in:
@@ -707,7 +707,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
rvLuckyMsg.setAdapter(luckyMsgAdapter);
|
rvLuckyMsg.setAdapter(luckyMsgAdapter);
|
||||||
rvLuckyMsg.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
|
rvLuckyMsg.setLayoutManager(new ScollLinearLayoutManager(context, ScollLinearLayoutManager.HORIZONTAL, false));
|
||||||
rvLuckyMsg.setOnTouchListener((v, event) -> true);
|
rvLuckyMsg.setOnTouchListener((v, event) -> true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -789,7 +789,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
mStarWeekBanner.setAdapter(new StarWeekAdapter());
|
mStarWeekBanner.setAdapter(new StarWeekAdapter());
|
||||||
mStarWeekBanner.setPageMargin(UIUtil.dip2px(context, 10))
|
mStarWeekBanner.setPageMargin(UIUtil.dip2px(context, 10))
|
||||||
.setScrollDuration(1200)
|
.setScrollDuration(1200)
|
||||||
.setInterval(4000)
|
.setInterval(4500)
|
||||||
.setRevealWidth(BannerUtils.dp2px(0f))
|
.setRevealWidth(BannerUtils.dp2px(0f))
|
||||||
.setOnPageClickListener((clickedView, position) -> {
|
.setOnPageClickListener((clickedView, position) -> {
|
||||||
DialogWebViewActivity.start(context, UriProvider.getWeekStarUrl(), true);
|
DialogWebViewActivity.start(context, UriProvider.getWeekStarUrl(), true);
|
||||||
|
@@ -0,0 +1,53 @@
|
|||||||
|
package com.yizhuan.erban.ui.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearSmoothScroller;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
public class ScollLinearLayoutManager extends LinearLayoutManager {
|
||||||
|
private float MILLISECONDS_PER_INCH = 1f; //修改可以改变数据,越大速度越慢
|
||||||
|
private Context contxt;
|
||||||
|
|
||||||
|
public ScollLinearLayoutManager(Context context, @RecyclerView.Orientation int orientation,
|
||||||
|
boolean reverseLayout) {
|
||||||
|
super(context, orientation, reverseLayout);
|
||||||
|
this.contxt = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
|
||||||
|
LinearSmoothScroller linearSmoothScroller =
|
||||||
|
new LinearSmoothScroller(recyclerView.getContext()) {
|
||||||
|
@Override
|
||||||
|
public PointF computeScrollVectorForPosition(int targetPosition) {
|
||||||
|
return ScollLinearLayoutManager.this
|
||||||
|
.computeScrollVectorForPosition(targetPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
//This returns the milliseconds it takes to
|
||||||
|
//scroll one pixel.
|
||||||
|
@Override
|
||||||
|
protected float calculateSpeedPerPixel
|
||||||
|
(DisplayMetrics displayMetrics) {
|
||||||
|
return MILLISECONDS_PER_INCH / displayMetrics.density;
|
||||||
|
//返回滑动一个pixel需要多少毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
linearSmoothScroller.setTargetPosition(position);
|
||||||
|
startSmoothScroll(linearSmoothScroller);
|
||||||
|
}
|
||||||
|
|
||||||
|
//可以用来设置速度
|
||||||
|
public void setSpeedSlow(float x) {
|
||||||
|
//自己在这里用density去乘,希望不同分辨率设备上滑动速度相同
|
||||||
|
//0.3f是自己估摸的一个值,可以根据不同需求自己修改
|
||||||
|
MILLISECONDS_PER_INCH = contxt.getResources().getDisplayMetrics().density * 0.3f + (x);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -37,7 +37,7 @@
|
|||||||
android:textSize="@dimen/sp_10"
|
android:textSize="@dimen/sp_10"
|
||||||
android:textColor="@color/color_EB547C"
|
android:textColor="@color/color_EB547C"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginEnd="@dimen/dp_15"
|
android:layout_marginEnd="@dimen/dp_13"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
Reference in New Issue
Block a user