按照UI提的修改UI

This commit is contained in:
ningwenqiang 2024-11-06 16:32:06 +08:00
parent 251a428f80
commit d95206b871
12 changed files with 46 additions and 16 deletions

View File

@ -19,6 +19,7 @@ import java.util.List;
public class NineGridLayout extends FrameLayout { public class NineGridLayout extends FrameLayout {
private Context mContext; private Context mContext;
private int fullWidth1;
private int mWidth1; private int mWidth1;
private int mWidth2; private int mWidth2;
private int mWidth3; private int mWidth3;
@ -35,6 +36,9 @@ public class NineGridLayout extends FrameLayout {
private List<?> mDataList; private List<?> mDataList;
private Boolean onIsFUll = false; private Boolean onIsFUll = false;
public void setOnIsFUll(Boolean onIsFUll) {
this.onIsFUll = onIsFUll;
}
public NineGridLayout(Context context) { public NineGridLayout(Context context) {
this(context, null); this(context, null);
@ -58,11 +62,10 @@ public class NineGridLayout extends FrameLayout {
DisplayMetrics dm = context.getResources().getDisplayMetrics(); DisplayMetrics dm = context.getResources().getDisplayMetrics();
float scale = dm.density; float scale = dm.density;
int width = dm.widthPixels - space; int width = dm.widthPixels - space;
fullWidth1= width;
mDividerWidth = dividerWidth; mDividerWidth = dividerWidth;
if (onIsFUll){
}
mWidth1 = (int) (scale * 220 + 0.5f); mWidth1 = (int) (scale * 220 + 0.5f);
@ -106,7 +109,12 @@ public class NineGridLayout extends FrameLayout {
if (dataSize == 1) { if (dataSize == 1) {
RoundedImageView imageView = mViewList.get(0); RoundedImageView imageView = mViewList.get(0);
if (mLayoutParams00 == null) { if (mLayoutParams00 == null) {
mLayoutParams00 = new LayoutParams(mWidth1, mWidth1); if (onIsFUll){
mLayoutParams00 = new LayoutParams(fullWidth1, fullWidth1);
}else {
mLayoutParams00 = new LayoutParams(mWidth1, mWidth1);
}
} }
if (imageView.getLayoutParams() != mLayoutParams00) { if (imageView.getLayoutParams() != mLayoutParams00) {
imageView.setLayoutParams(mLayoutParams00); imageView.setLayoutParams(mLayoutParams00);
@ -114,7 +122,12 @@ public class NineGridLayout extends FrameLayout {
if (imageView.getVisibility() != VISIBLE) { if (imageView.getVisibility() != VISIBLE) {
imageView.setVisibility(VISIBLE); imageView.setVisibility(VISIBLE);
} }
setHeight(mWidth1); if (onIsFUll){
setHeight(fullWidth1);
}else {
setHeight(mWidth1);
}
if (mActionListener != null) { if (mActionListener != null) {
mActionListener.displayImage(list.get(0), imageView); mActionListener.displayImage(list.get(0), imageView);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

View File

@ -109,6 +109,7 @@ public class MainHomeComAdapter2 extends RefreshAdapter<ActiveBean> {
attentionImg = itemView.findViewById(R.id.attentionImg); attentionImg = itemView.findViewById(R.id.attentionImg);
content = itemView.findViewById(R.id.content); content = itemView.findViewById(R.id.content);
mNineGridLayout = itemView.findViewById(R.id.nine_grid_layout); mNineGridLayout = itemView.findViewById(R.id.nine_grid_layout);
mNineGridLayout.setOnIsFUll(true);
shareImg = itemView.findViewById(R.id.shareImg); shareImg = itemView.findViewById(R.id.shareImg);
shareText = itemView.findViewById(R.id.shareText); shareText = itemView.findViewById(R.id.shareText);
msgImg = itemView.findViewById(R.id.msgImg); msgImg = itemView.findViewById(R.id.msgImg);

View File

@ -10,6 +10,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.jakewharton.rxbinding3.view.RxView; import com.jakewharton.rxbinding3.view.RxView;
@ -111,18 +112,19 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
//直播中 //直播中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType())); mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType()));
mType.setVisibility(View.VISIBLE); mType.setVisibility(View.VISIBLE);
mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot); mLiveIco.setImageResource(R.mipmap.icon_main_rest_work);
mLiveIco.setVisibility(View.VISIBLE);
mNum.setVisibility(View.VISIBLE); mNum.setVisibility(View.VISIBLE);
liveType.setVisibility(View.VISIBLE); liveType.setVisibility(View.VISIBLE);
mLiveState.setText(mContext.getString(R.string.lives_state)); mLiveState.setText(mContext.getString(R.string.lives_state));
} else { } else {
views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//休息中 //休息中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING)); mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING));
mType.setVisibility(View.GONE); mType.setVisibility(View.GONE);
// mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot); mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot);
mLiveIco.setVisibility(View.INVISIBLE); // mLiveIco.setVisibility(View.INVISIBLE);
mLiveState.setText(mContext.getString(R.string.rest_state)); mLiveState.setText(mContext.getString(R.string.rest_state));
liveType.setVisibility(View.GONE); liveType.setVisibility(View.GONE);
mNum.setVisibility(View.GONE); mNum.setVisibility(View.GONE);

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#fff"/>
</shape>

View File

@ -78,7 +78,7 @@
android:paddingEnd="6dp" android:paddingEnd="6dp"
android:paddingBottom="2dp" android:paddingBottom="2dp"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="12sp" android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="休息中" /> tools:text="休息中" />
@ -90,7 +90,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:src="@mipmap/icon_main_rest_work" android:background="@drawable/oval_white"
app:layout_constraintBottom_toBottomOf="@+id/tv_live_state" app:layout_constraintBottom_toBottomOf="@+id/tv_live_state"
app:layout_constraintEnd_toStartOf="@+id/tv_live_state" app:layout_constraintEnd_toStartOf="@+id/tv_live_state"
app:layout_constraintTop_toTopOf="@+id/tv_live_state" /> app:layout_constraintTop_toTopOf="@+id/tv_live_state" />
@ -109,7 +109,7 @@
android:textStyle="bold" android:textStyle="bold"
app:dt_left_drawable="@mipmap/ic_yola_live_fire" app:dt_left_drawable="@mipmap/ic_yola_live_fire"
app:dt_left_height="14dp" app:dt_left_height="14dp"
app:dt_left_width="14dp" app:dt_left_width="11.67dp"
app:layout_constraintBottom_toBottomOf="@+id/name" app:layout_constraintBottom_toBottomOf="@+id/name"
app:layout_constraintTop_toTopOf="@+id/name" app:layout_constraintTop_toTopOf="@+id/name"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -252,11 +252,13 @@
android:textColor="#fff" android:textColor="#fff"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/num" app:layout_constraintBottom_toBottomOf="@+id/num2"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/num" app:layout_constraintTop_toTopOf="@+id/num2"
tools:text="mame" /> tools:text="mame" />
<com.yunbao.common.custom.DrawableTextView <com.yunbao.common.custom.DrawableTextView
android:id="@+id/num2" android:id="@+id/num2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -271,7 +273,7 @@
android:textStyle="bold" android:textStyle="bold"
app:dt_left_drawable="@mipmap/ic_yola_live_fire" app:dt_left_drawable="@mipmap/ic_yola_live_fire"
app:dt_left_height="14dp" app:dt_left_height="14dp"
app:dt_left_width="14dp" app:dt_left_width="11.67dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
tools:text="880k" /> tools:text="880k" />

View File

@ -8,7 +8,6 @@
<com.yunbao.common.custom.MyViewPager <com.yunbao.common.custom.MyViewPager
android:id="@+id/viewPager" android:id="@+id/viewPager"
android:background="@mipmap/bg_main_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:canScroll="false" /> app:canScroll="false" />

View File

@ -4,9 +4,16 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/bg_yola_index"
android:orientation="vertical"> android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/man_bg_2"
app:layout_constraintDimensionRatio="1.512" />
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B