[Modify]分区功能ui调整

This commit is contained in:
wushaocheng
2023-05-29 14:23:48 +08:00
parent 45b2f30f24
commit 9ca41b702a
16 changed files with 76 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ package com.yizhuan.erban.ui.setting
import android.content.Context
import android.content.Intent
import android.view.View
import androidx.activity.viewModels
import com.netease.nim.uikit.StatusBarUtil
import com.yizhuan.erban.R
@@ -34,8 +35,13 @@ class AreaSelectActivity : BaseViewBindingActivity<ActivityAreaSelectBinding>()
binding.recyclerView.adapter = mPartitionAdapter
setViewModel.partitionLiveData.observe(this) {
mPartitionAdapter.setSelectId(it.userPartitionId)
mPartitionAdapter.setNewData(it.partitionInfos)
if ((it.partitionInfos?.size ?: 0) > 0) {
mPartitionAdapter.setSelectId(it.userPartitionId)
mPartitionAdapter.setNewData(it.partitionInfos)
binding.tvTip.visibility = View.VISIBLE
} else {
binding.tvTip.visibility = View.GONE
}
}
setViewModel.changePartitionLiveData.observe(this) {

View File

@@ -1,5 +1,7 @@
package com.yizhuan.erban.ui.setting.adapter
import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
@@ -21,12 +23,20 @@ class PartitionAdapter :
override fun convert(helper: BaseViewHolder, item: PartitionBean) {
helper.setText(R.id.tvArea, item.desc)
val ivPartitionSelect = helper.getView<AppCompatImageView>(R.id.iv_partition_select)
val isSelect = selectPosition == helper.layoutPosition
if (selectId == item.id && selectPosition == -1) {
ivPartitionSelect.visibility = View.VISIBLE
helper.getView<ConstraintLayout>(R.id.cs_bg).isSelected = true
} else if (selectPosition != -1) {
helper.getView<ConstraintLayout>(R.id.cs_bg).isSelected = isSelect
if (isSelect) {
ivPartitionSelect.visibility = View.VISIBLE
} else {
ivPartitionSelect.visibility = View.GONE
}
} else {
ivPartitionSelect.visibility = View.GONE
helper.getView<ConstraintLayout>(R.id.cs_bg).isSelected = false
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

View File

@@ -2,4 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<corners android:radius="@dimen/dp_10" />
</shape>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_ededed" android:state_selected="true" />
<item android:drawable="@drawable/bg_ffffff" android:state_selected="false" />
<item android:drawable="@drawable/bg_gradient_cc66ff_9cb3ff_13" android:state_selected="true" />
<item android:drawable="@drawable/bg_ffffff_10" android:state_selected="false" />
</selector>

View File

@@ -9,17 +9,32 @@
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:layout_height="@dimen/dp_44"
android:layout_marginTop="@dimen/dp_44"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:overScrollMode="never"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_bar"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvTip"
android:text="@string/more_partitions_are_in_the_worksn"
android:textSize="@dimen/sp_14"
android:textColor="@color/color_B3B3C3"
android:layout_marginTop="@dimen/dp_45"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,24 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cs_bg"
android:background="@drawable/selector_partition_bg"
android:layout_marginStart="@dimen/dp_18"
android:layout_marginEnd="@dimen/dp_18"
android:layout_marginTop="@dimen/dp_15"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40">
android:layout_height="48dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvArea"
android:textColor="@color/text_title_color"
android:textSize="@dimen/sp_14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintBottom_toBottomOf="parent"
tools:text="華語區"/>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_ededed"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_partition_select"
android:layout_marginEnd="@dimen/dp_15"
android:src="@drawable/ic_partition_select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="80dp"
@@ -80,14 +81,21 @@
</LinearLayout>
<ImageView
<TextView
android:id="@+id/iv_living"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:scaleType="centerInside"
android:src="@drawable/ic_dy_in_room"
android:background="@drawable/ic_dy_square_in_room"
android:drawablePadding="@dimen/dp_2"
android:gravity="center_vertical"
android:paddingStart="@dimen/dp_8"
android:paddingEnd="0dp"
android:text="@string/room_in_live"
android:textColor="@color/color_9168FA"
android:textSize="@dimen/sp_10"
app:drawableStartCompat="@drawable/ic_square_live"
android:visibility="gone"/>
<TextView
@@ -102,7 +110,7 @@
android:paddingStart="20dp"
android:paddingEnd="@dimen/dp_5"
android:textColor="@color/appColor"
android:textSize="@dimen/dp_10"
android:textSize="@dimen/sp_10"
tools:text="177"
tools:visibility="gone" />

View File

@@ -5251,5 +5251,6 @@
<string name="place">قليل</string>
<string name="switching_partition">تبديل منطقة</string>
<string name="succeeded_in_switching_the_partition">تبديل منطقة بنجاح~</string>
<string name="more_partitions_are_in_the_worksn"> يتم إعداد المزيد من المناطق ، لذا ترقبوا ~</string>
</resources>

View File

@@ -5212,5 +5212,6 @@
<string name="place">Bit</string>
<string name="switching_partition">Change region</string>
<string name="succeeded_in_switching_the_partition">Change region successfully~</string>
<string name="more_partitions_are_in_the_worksn">More partitions are being prepared, stay tuned~</string>
</resources>

View File

@@ -5239,5 +5239,6 @@
<string name="place">orang</string>
<string name="switching_partition">Ubah server</string>
<string name="succeeded_in_switching_the_partition">Ubah server berhasil~</string>
<string name="more_partitions_are_in_the_worksn">Lebih banyak partisi sedang disiapkan, pantau terus~</string>
</resources>

View File

@@ -5245,5 +5245,6 @@
<string name="place">biraz</string>
<string name="switching_partition">Bölge değiştir</string>
<string name="succeeded_in_switching_the_partition">Bölümü başarıyla değiştir~</string>
<string name="more_partitions_are_in_the_worksn">Daha fazla bölge hazırlanıyor, bu yüzden bizi izlemeye devam edin~</string>
</resources>

View File

@@ -5241,5 +5241,6 @@
<string name="place"></string>
<string name="switching_partition">切換分區</string>
<string name="succeeded_in_switching_the_partition">切換分區成功~</string>
<string name="more_partitions_are_in_the_worksn">更多分区正在准备中,敬请期待~</string>
</resources>

View File

@@ -5241,5 +5241,6 @@
<string name="place"></string>
<string name="switching_partition">切換分區</string>
<string name="succeeded_in_switching_the_partition">切換分區成功~</string>
<string name="more_partitions_are_in_the_worksn">更多分区正在准备中,敬请期待~</string>
</resources>

View File

@@ -5212,5 +5212,6 @@
<string name="place">Bit</string>
<string name="switching_partition">Change region</string>
<string name="succeeded_in_switching_the_partition">Change region successfully~</string>
<string name="more_partitions_are_in_the_worksn">More partitions are being prepared, stay tuned~</string>
</resources>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB