界面修改
This commit is contained in:
parent
f8ea294d6d
commit
b5aa768f5b
@ -0,0 +1,27 @@
|
||||
package com.yunbao.common.views.weight;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
public class MarqueeTextView extends AppCompatTextView {
|
||||
public MarqueeTextView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MarqueeTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MarqueeTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused() {
|
||||
return true;
|
||||
}
|
||||
}
|
39
common/src/main/res/layout/item_sidebar_lives.xml
Normal file
39
common/src/main/res/layout/item_sidebar_lives.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="16dp">
|
||||
|
||||
<FrameLayout
|
||||
|
||||
android:layout_width="119dp"
|
||||
android:layout_height="119dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/live_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_margin="6dp"
|
||||
android:textColor="#FFF6F7FB"
|
||||
android:textSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -98,6 +98,7 @@
|
||||
android:layout_gravity="center" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -370,7 +370,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
sidebarList.setEmptyLayoutId(R.layout.view_no_data_live);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 2, GridLayoutManager.VERTICAL, false);
|
||||
sidebarList.setLayoutManager(gridLayoutManager);
|
||||
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 5, 0);
|
||||
sidebarList.setLoadMoreEnable(false);
|
||||
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 6, 0);
|
||||
decoration.setOnlySetItemOffsetsButNoDraw(true);
|
||||
sidebarList.setItemDecoration(decoration);
|
||||
Display mDisplay = getWindowManager().getDefaultDisplay();
|
||||
|
@ -32,7 +32,7 @@ public class SidebarAdapter extends RefreshAdapter<AnchorRecommendItemModel> {
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
return new SidebarLiveItemViewHolder(mInflater.inflate(R.layout.item_main_home_lives, parent, false));
|
||||
return new SidebarLiveItemViewHolder(mInflater.inflate(R.layout.item_sidebar_lives, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@ -9,15 +8,14 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.jakewharton.rxbinding3.view.RxView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.custom.RatioRoundImageView;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.formatBigNum;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.utils.MainIconUtil;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -29,29 +27,16 @@ import kotlin.Unit;
|
||||
* 直播页面布局
|
||||
*/
|
||||
public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView mCover, liveType, mLiveIco, mType, pkico, drPkIco, pkAvatar;
|
||||
private RatioRoundImageView bgs;
|
||||
private View views;
|
||||
private TextView mLiveState, mTitle, mName, mNum;
|
||||
private ImageView mCover, liveType;
|
||||
private TextView mName;
|
||||
|
||||
public SidebarLiveItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
//展示普通布局,隐藏周星榜布局
|
||||
itemView.findViewById(R.id.live_info_view).setVisibility(View.VISIBLE);
|
||||
itemView.findViewById(R.id.lt_week_list).setVisibility(View.GONE);
|
||||
|
||||
mCover = itemView.findViewById(R.id.cover);
|
||||
bgs = itemView.findViewById(R.id.bgs);
|
||||
liveType = itemView.findViewById(R.id.live_type);
|
||||
views = itemView.findViewById(R.id.views);
|
||||
mLiveIco = (ImageView) itemView.findViewById(R.id.tv_live_ico);
|
||||
mLiveState = (TextView) itemView.findViewById(R.id.tv_live_state);
|
||||
mType = (ImageView) itemView.findViewById(R.id.type);
|
||||
mTitle = (TextView) itemView.findViewById(R.id.title);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mNum = (TextView) itemView.findViewById(R.id.num);
|
||||
pkico = (ImageView) itemView.findViewById(R.id.pk_ico);
|
||||
drPkIco = (ImageView) itemView.findViewById(R.id.dr_pk_ico);
|
||||
pkAvatar = (ImageView) itemView.findViewById(R.id.pk_avatar);
|
||||
mName = itemView.findViewById(R.id.name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,51 +58,10 @@ public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder {
|
||||
.load(bean.getContentPicSizeThree())
|
||||
.into(liveType);
|
||||
}
|
||||
ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover);
|
||||
bgs.setVisibility(View.VISIBLE);
|
||||
pkico.setVisibility(View.GONE);
|
||||
pkAvatar.setVisibility(View.GONE);
|
||||
drPkIco.setVisibility(View.GONE);
|
||||
if (bean.getDrpkStatus() != null && bean.getDrpkStatus().equals("1")) {
|
||||
drPkIco.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (bean.getPkAvatarThumb() != null && !bean.getPkAvatarThumb().equals("")) {
|
||||
ImgLoader.display(mContext, bean.getPkAvatarThumb(), pkAvatar);
|
||||
pkico.setVisibility(View.VISIBLE);
|
||||
pkAvatar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
ImgLoader.display(itemView.getContext(),bean.getThumb(),mCover);
|
||||
|
||||
mName.setText(bean.getUserNicename());
|
||||
if (TextUtils.isEmpty(bean.getTitle())) {
|
||||
if (mTitle.getVisibility() == View.VISIBLE) {
|
||||
mTitle.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
if (mTitle.getVisibility() != View.VISIBLE) {
|
||||
mTitle.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mTitle.setText(bean.getTitle());
|
||||
}
|
||||
mNum.setText(formatBigNum.formatBigNum(bean.getHotNum()));
|
||||
views.setVisibility(View.GONE);
|
||||
if ("1".equals(bean.getIslive())) {
|
||||
views.setVisibility(View.VISIBLE);
|
||||
//直播中
|
||||
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Integer.parseInt(bean.getType())));
|
||||
mType.setVisibility(View.VISIBLE);
|
||||
mLiveIco.setImageResource(R.mipmap.icon_main_rest_work);
|
||||
mNum.setVisibility(View.VISIBLE);
|
||||
liveType.setVisibility(View.VISIBLE);
|
||||
mLiveState.setText(R.string.lives_state);
|
||||
} else {
|
||||
views.setVisibility(View.VISIBLE);
|
||||
//休息中
|
||||
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING));
|
||||
mType.setVisibility(View.GONE);
|
||||
mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot);
|
||||
mLiveState.setText(R.string.rest_state);
|
||||
liveType.setVisibility(View.GONE);
|
||||
mNum.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
RxView.clicks(itemView)
|
||||
.throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件
|
||||
.subscribe(new Observer<Unit>() {
|
||||
@ -143,14 +87,7 @@ public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
}
|
||||
});
|
||||
views.setVisibility(View.GONE);
|
||||
mLiveIco.setVisibility(View.GONE);
|
||||
mLiveState.setVisibility(View.GONE);
|
||||
mNum.setVisibility(View.GONE);
|
||||
pkAvatar.setVisibility(View.GONE);
|
||||
pkico.setVisibility(View.GONE);
|
||||
mTitle.setVisibility(View.GONE);
|
||||
drPkIco.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="1500"
|
||||
android:fromYDelta="100%p"
|
||||
android:toYDelta="0" />
|
||||
</set>
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="1500"
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="-100%p" />;
|
||||
</set>
|
@ -72,20 +72,21 @@
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#70000000" />
|
||||
android:background="#90000000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="56dp"
|
||||
android:paddingEnd="8dp">
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingTop="56dp"
|
||||
>
|
||||
|
||||
<com.ms.banner.Banner
|
||||
android:id="@+id/banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_height="77dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
app:delay_time="3000"
|
||||
app:indicator_drawable_selected="@drawable/bg_home_indicator_selected"
|
||||
|
@ -153,7 +153,7 @@
|
||||
android:layout_height="21dp"
|
||||
android:layout_below="@id/lin"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/bg_live_item"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
@ -236,8 +236,8 @@
|
||||
android:background="@drawable/bg_live_item"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
@ -258,7 +258,7 @@
|
||||
<!--心愿单-->
|
||||
<LinearLayout
|
||||
android:id="@+id/wish_list_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="21dp"
|
||||
android:layout_alignTop="@id/btn_votes"
|
||||
android:layout_marginStart="10dp"
|
||||
@ -266,8 +266,8 @@
|
||||
android:background="@drawable/bg_live_item"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
@ -280,7 +280,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:flipInterval="1000"
|
||||
android:flipInterval="5000"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:inAnimation="@anim/anim_marquee_in"
|
||||
android:outAnimation="@anim/anim_marquee_out"/>
|
||||
|
@ -10,12 +10,18 @@
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
<TextView
|
||||
<com.yunbao.common.views.weight.MarqueeTextView
|
||||
android:id="@+id/wish_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:scrollHorizontally="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:focusable="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
@ -137,13 +137,15 @@ public class FloatBannerView extends FrameLayout {
|
||||
|
||||
}
|
||||
});
|
||||
TranslateAnimation animationTranslate2 = new TranslateAnimation(0, -targetX / 1.2f, 0, -targetY / 1.2f);
|
||||
ScaleAnimation scaleAnimation2 = new ScaleAnimation(1f, 0.8f, 1f, 0.8f);
|
||||
TranslateAnimation animationTranslate2 = new TranslateAnimation(0, -bannerLayout4.getX()/0.8f, 0, bannerLayout4.getY()*0.8f);
|
||||
AlphaAnimation animationAlpha = new AlphaAnimation(1, 0);
|
||||
AnimationSet animationSet2 = new AnimationSet(true);
|
||||
animationSet2.setFillAfter(true);
|
||||
animationSet2.setDuration(700);
|
||||
animationSet2.setDuration(800);
|
||||
animationSet2.addAnimation(animationTranslate2);
|
||||
animationSet2.addAnimation(animationAlpha);
|
||||
animationSet2.addAnimation(scaleAnimation2);
|
||||
animationSet2.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
Loading…
Reference in New Issue
Block a user