按照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 {
private Context mContext;
private int fullWidth1;
private int mWidth1;
private int mWidth2;
private int mWidth3;
@ -35,6 +36,9 @@ public class NineGridLayout extends FrameLayout {
private List<?> mDataList;
private Boolean onIsFUll = false;
public void setOnIsFUll(Boolean onIsFUll) {
this.onIsFUll = onIsFUll;
}
public NineGridLayout(Context context) {
this(context, null);
@ -58,11 +62,10 @@ public class NineGridLayout extends FrameLayout {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
float scale = dm.density;
int width = dm.widthPixels - space;
fullWidth1= width;
mDividerWidth = dividerWidth;
if (onIsFUll){
}
mWidth1 = (int) (scale * 220 + 0.5f);
@ -106,7 +109,12 @@ public class NineGridLayout extends FrameLayout {
if (dataSize == 1) {
RoundedImageView imageView = mViewList.get(0);
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) {
imageView.setLayoutParams(mLayoutParams00);
@ -114,7 +122,12 @@ public class NineGridLayout extends FrameLayout {
if (imageView.getVisibility() != VISIBLE) {
imageView.setVisibility(VISIBLE);
}
setHeight(mWidth1);
if (onIsFUll){
setHeight(fullWidth1);
}else {
setHeight(mWidth1);
}
if (mActionListener != null) {
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);
content = itemView.findViewById(R.id.content);
mNineGridLayout = itemView.findViewById(R.id.nine_grid_layout);
mNineGridLayout.setOnIsFUll(true);
shareImg = itemView.findViewById(R.id.shareImg);
shareText = itemView.findViewById(R.id.shareText);
msgImg = itemView.findViewById(R.id.msgImg);

View File

@ -10,6 +10,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.jakewharton.rxbinding3.view.RxView;
@ -111,18 +112,19 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
//直播中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType()));
mType.setVisibility(View.VISIBLE);
mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot);
mLiveIco.setVisibility(View.VISIBLE);
mLiveIco.setImageResource(R.mipmap.icon_main_rest_work);
mNum.setVisibility(View.VISIBLE);
liveType.setVisibility(View.VISIBLE);
mLiveState.setText(mContext.getString(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);
mLiveIco.setVisibility(View.INVISIBLE);
mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot);
// mLiveIco.setVisibility(View.INVISIBLE);
mLiveState.setText(mContext.getString(R.string.rest_state));
liveType.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:paddingBottom="2dp"
android:textColor="@color/color_white"
android:textSize="12sp"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="休息中" />
@ -90,7 +90,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="5dp"
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_constraintEnd_toStartOf="@+id/tv_live_state"
app:layout_constraintTop_toTopOf="@+id/tv_live_state" />
@ -109,7 +109,7 @@
android:textStyle="bold"
app:dt_left_drawable="@mipmap/ic_yola_live_fire"
app:dt_left_height="14dp"
app:dt_left_width="14dp"
app:dt_left_width="11.67dp"
app:layout_constraintBottom_toBottomOf="@+id/name"
app:layout_constraintTop_toTopOf="@+id/name"
app:layout_constraintEnd_toEndOf="parent"
@ -252,11 +252,13 @@
android:textColor="#fff"
android:textSize="12sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/num"
app:layout_constraintBottom_toBottomOf="@+id/num2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/num"
app:layout_constraintTop_toTopOf="@+id/num2"
tools:text="mame" />
<com.yunbao.common.custom.DrawableTextView
android:id="@+id/num2"
android:layout_width="wrap_content"
@ -271,7 +273,7 @@
android:textStyle="bold"
app:dt_left_drawable="@mipmap/ic_yola_live_fire"
app:dt_left_height="14dp"
app:dt_left_width="14dp"
app:dt_left_width="11.67dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="880k" />

View File

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

View File

@ -4,9 +4,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_yola_index"
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
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