feat: 用户吧龄显示 & UI 优化

This commit is contained in:
HuanCheng65 2022-08-04 12:27:29 +08:00
parent 4a0bf0d41e
commit f37366d931
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
7 changed files with 65 additions and 24 deletions

View File

@ -279,7 +279,7 @@
android:label="@string/title_theme_settings" android:label="@string/title_theme_settings"
android:windowSoftInputMode="adjustResize" /> android:windowSoftInputMode="adjustResize" />
<activity <activity
android:name=".activities.EditProfileActivity" android:name=".ui.editprofile.view.EditProfileActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden" android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:label="@string/title_activity_edit_profile" android:label="@string/title_activity_edit_profile"
android:windowSoftInputMode="adjustResize" /> android:windowSoftInputMode="adjustResize" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<litepal> <litepal>
<dbname value="tblite" /> <dbname value="tblite" />
<version value="28" /> <version value="29" />
<list> <list>
<mapping class="com.huanchengfly.tieba.post.models.database.Account" /> <mapping class="com.huanchengfly.tieba.post.models.database.Account" />
<mapping class="com.huanchengfly.tieba.post.models.database.Draft" /> <mapping class="com.huanchengfly.tieba.post.models.database.Draft" />

View File

@ -71,6 +71,9 @@ class UserActivity : BaseActivity() {
@BindView(R.id.user_sex) @BindView(R.id.user_sex)
lateinit var sexTv: TextView lateinit var sexTv: TextView
@BindView(R.id.user_tb_age)
lateinit var tbAgeTv: TextView
@BindView(R.id.user_center_action_btn) @BindView(R.id.user_center_action_btn)
lateinit var actionBtn: TintMaterialButton lateinit var actionBtn: TintMaterialButton
@ -86,6 +89,9 @@ class UserActivity : BaseActivity() {
@BindView(R.id.user_center_header_mask) @BindView(R.id.user_center_header_mask)
lateinit var headerMaskView: View lateinit var headerMaskView: View
@BindView(R.id.user_info_chips)
lateinit var infoChips: View
private var profileBean: ProfileBean? = null private var profileBean: ProfileBean? = null
private var uid: String? = null private var uid: String? = null
private var tab = 0 private var tab = 0
@ -117,8 +123,8 @@ class UserActivity : BaseActivity() {
actionBtn.visibility = View.GONE actionBtn.visibility = View.GONE
if (!TextUtils.isEmpty(avatar)) { if (!TextUtils.isEmpty(avatar)) {
loadingView.visibility = View.GONE loadingView.visibility = View.GONE
ImageUtil.load(avatarView, ImageUtil.LOAD_TYPE_AVATAR, avatar) ImageUtil.load(avatarView, ImageUtil.LOAD_TYPE_AVATAR, StringUtil.getAvatarUrl(avatar))
ImageUtil.initImageView(avatarView, PhotoViewBean(avatar)) ImageUtil.initImageView(avatarView, PhotoViewBean(StringUtil.getAvatarUrl(avatar)))
} }
appbar.addOnOffsetChangedListener { appBarLayout: AppBarLayout, verticalOffset: Int -> appbar.addOnOffsetChangedListener { appBarLayout: AppBarLayout, verticalOffset: Int ->
val percent = abs(verticalOffset * 1.0f) / appBarLayout.totalScrollRange val percent = abs(verticalOffset * 1.0f) / appBarLayout.totalScrollRange
@ -202,6 +208,8 @@ class UserActivity : BaseActivity() {
} }
sexTv.text = sexTv.text =
if (profileBean!!.user!!.sex == "1") "" else if (profileBean!!.user!!.sex == "2") "" else "?" if (profileBean!!.user!!.sex == "1") "" else if (profileBean!!.user!!.sex == "2") "" else "?"
tbAgeTv.text = getString(R.string.tb_age, profileBean!!.user!!.tbAge)
infoChips.visibility = View.VISIBLE
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {

View File

@ -16,6 +16,11 @@ data class Account(
var fansNum: String? = null, var fansNum: String? = null,
var postNum: String? = null, var postNum: String? = null,
var concernNum: String? = null, var concernNum: String? = null,
var tbAge: String? = null,
var age: String? = null,
var birthdayShowStatus: String? = null,
var birthdayTime: String? = null,
var constellation: String? = null,
) : LitePalSupport() { ) : LitePalSupport() {
internal constructor() : this("", "", "", "", "", "", "") internal constructor() : this("", "", "", "", "", "", "")

View File

@ -97,26 +97,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textSize="16sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
app:tint="@color/color_text_translucent_light" app:tint="@color/color_text_translucent_light"
tools:text="USER" /> tools:text="USER" />
<TextView
android:id="@+id/user_sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:background="@drawable/bg_radius_50dp"
android:backgroundTint="@color/user_center_action_btn_color"
android:paddingStart="12dp"
android:paddingTop="1dp"
android:paddingEnd="12dp"
android:paddingBottom="1dp"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="♂" />
</LinearLayout> </LinearLayout>
<com.huanchengfly.tieba.post.widgets.theme.TintTextView <com.huanchengfly.tieba.post.widgets.theme.TintTextView
@ -124,15 +109,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:textSize="12sp" android:textSize="14sp"
app:tint="@color/color_text_secondary_translucent_light" /> app:tint="@color/color_text_secondary_translucent_light"
tools:text="介绍" />
<LinearLayout <LinearLayout
android:id="@+id/user_center_stat" android:id="@+id/user_center_stat"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginBottom="34dp"
android:gravity="bottom" android:gravity="bottom"
android:orientation="horizontal"> android:orientation="horizontal">
@ -175,6 +160,48 @@
android:textStyle="bold" android:textStyle="bold"
app:tint="@color/color_text_translucent_light" /> app:tint="@color/color_text_translucent_light" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/user_info_chips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="34dp"
android:orientation="horizontal"
android:visibility="invisible"
tools:visibility="visible">
<TextView
android:id="@+id/user_sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/bg_radius_50dp"
android:backgroundTint="@color/user_center_action_btn_color"
android:paddingStart="8dp"
android:paddingTop="2dp"
android:paddingEnd="8dp"
android:paddingBottom="2dp"
android:textColor="@color/white"
android:textSize="13sp"
tools:text="♂" />
<TextView
android:id="@+id/user_tb_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:background="@drawable/bg_radius_50dp"
android:backgroundTint="@color/user_center_action_btn_color"
android:paddingStart="8dp"
android:paddingTop="2dp"
android:paddingEnd="8dp"
android:paddingBottom="2dp"
android:textColor="@color/white"
android:textSize="13sp"
tools:text="吧龄 10.7 年" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<View <View

View File

@ -191,7 +191,7 @@
<color name="icon_blue">#FF3373EE</color> <color name="icon_blue">#FF3373EE</color>
<color name="icon_purple">#FF8E6DCA</color> <color name="icon_purple">#FF8E6DCA</color>
<color name="black_trans">#50000000</color> <color name="black_trans">#50000000</color>
<color name="user_center_action_btn_color">#50FFFFFF</color> <color name="user_center_action_btn_color">#40FFFFFF</color>
<color name="user_center_header_mask">#90000000</color> <color name="user_center_header_mask">#90000000</color>
<color name="default_color_on_accent">#FFFFFFFF</color> <color name="default_color_on_accent">#FFFFFFFF</color>
</resources> </resources>

View File

@ -4,6 +4,7 @@ android.useAndroidX=true
kapt.verbose=true kapt.verbose=true
kotlin.code.style=official kotlin.code.style=official
kotlin.parallel.tasks.in.project=true kotlin.parallel.tasks.in.project=true
kotlin.incremental.useClasspathSnapshot=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx2g -XX:+UseParallelGC -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2g -XX:+UseParallelGC -Dfile.encoding=UTF-8