1.修改RelationCpCardView布局文件加入DataBing数据绑定 2.增加CP主页 3.调整CpTaskActivity包结构

This commit is contained in:
yitao_hello
2022-02-16 11:49:16 +08:00
parent 87b980ce35
commit 641097374f
7 changed files with 124 additions and 5 deletions

View File

@@ -1263,10 +1263,18 @@
android:name=".home.activity.VisitorListActivity"
android:screenOrientation="portrait" />
<activity android:name=".skill.activity.SkillDetailActivity"
android:screenOrientation="portrait"
/>
<activity
android:name=".skill.activity.SkillDetailActivity"
android:screenOrientation="portrait" />
<!--CP-->
<activity
android:name=".relation.cp.activity.CpTaskActivity"
android:screenOrientation="portrait" />
<activity
android:name=".relation.cp.activity.CpHomeActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@@ -0,0 +1,24 @@
package com.yizhuan.erban.relation.cp.activity
import android.view.View
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseBindingActivity
import com.yizhuan.erban.databinding.ActivityCpHomeBinding
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
@ActLayoutRes(R.layout.activity_cp_home)
class CpHomeActivity : BaseBindingActivity<ActivityCpHomeBinding>() {
override fun init() {
initTitleBar("亲密关系")
mBinding.click = this
}
//获取用户信息CP信息
override fun onClick(v: View) {
when (v.id) {
}
}
}

View File

@@ -1,4 +1,4 @@
package com.yizhuan.erban.relation.cp
package com.yizhuan.erban.relation.cp.activity
import android.widget.TextView
import com.yizhuan.erban.R

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<variable
name="cpEntity"
type="com.yizhuan.xchat_android_core.relation.cp.CpHomeEntity" />
<variable
name="click"
type="android.view.View.OnClickListener" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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_25"
app:layout_constraintTop_toTopOf="parent" />
<com.yizhuan.erban.relation.cp.widget.RelationCpCardView
android:id="@+id/cp_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_15"
bind:cpEntity="@{cpEntity}"
bind:click="@{click}"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -1,6 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="cpEntity"
type="com.yizhuan.xchat_android_core.relation.cp.CpHomeEntity" />
<variable
name="click"
type="android.view.View.OnClickListener" />
<import type="android.view.View" />
</data>
<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"
@@ -15,9 +28,11 @@
<com.yizhuan.erban.common.widget.CircleImageView
android:id="@+id/mine_avatar"
avatarUrl="@{cpEntity.inviteAvatar}"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginLeft="@dimen/dp_32"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:civ_border_color="@color/white"
app:civ_border_width="1dp"
app:layout_constraintBottom_toTopOf="@id/tv_mine_name"
@@ -36,8 +51,10 @@
android:paddingLeft="@dimen/dp_16"
android:paddingRight="@dimen/dp_16"
android:singleLine="true"
android:text="@{cpEntity.inviteNick}"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
@@ -50,6 +67,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cp_heart"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:layout_constraintBottom_toTopOf="@id/tv_cp_time"
app:layout_constraintLeft_toRightOf="@id/mine_avatar"
app:layout_constraintRight_toLeftOf="@id/other_avatar"
@@ -62,8 +80,10 @@
android:layout_marginBottom="@dimen/dp_8"
android:background="@drawable/bg_cp_level"
android:gravity="center"
android:text="@{@string/cp_level(String.valueOf(cpEntity.cpLevel))}"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:layout_constraintBottom_toTopOf="@id/iv_cp_heart"
app:layout_constraintLeft_toLeftOf="@id/iv_cp_heart"
app:layout_constraintRight_toRightOf="@id/iv_cp_heart"
@@ -78,8 +98,10 @@
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_9"
android:gravity="center"
android:text="@{@string/cp_duration(String.valueOf(cpEntity.duration))}"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:layout_constraintLeft_toLeftOf="@id/iv_cp_heart"
app:layout_constraintRight_toRightOf="@id/iv_cp_heart"
app:layout_constraintTop_toBottomOf="@id/iv_cp_heart"
@@ -87,9 +109,11 @@
<com.yizhuan.erban.common.widget.CircleImageView
android:id="@+id/other_avatar"
avatarUrl="@{cpEntity.acceptAvatar}"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginRight="@dimen/dp_32"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:civ_border_color="@color/white"
app:civ_border_width="1dp"
app:layout_constraintBottom_toTopOf="@id/tv_other_name"
@@ -108,8 +132,10 @@
android:paddingLeft="@dimen/dp_16"
android:paddingRight="@dimen/dp_16"
android:singleLine="true"
android:text="@{cpEntity.acceptNick}"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/iv_cp_heart"
@@ -118,14 +144,17 @@
tools:text="我的cp战友名" />
<Button
android:id="@+id/tv_recovery_unbind"
android:layout_width="wrap_content"
android:layout_height="26dp"
android:layout_marginTop="@dimen/dp_15"
android:background="@drawable/bg_cp_pink_selector"
android:onClick="@{click}"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_8"
android:text="撤销解除关系"
android:textSize="@dimen/sp_12"
android:visibility="@{cpEntity.hasCp?View.VISIBLE:View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/iv_cp_heart"
app:layout_constraintRight_toRightOf="@id/iv_cp_heart"
@@ -135,6 +164,7 @@
android:id="@+id/iv_invite"
android:layout_width="56dp"
android:layout_height="56dp"
android:onClick="@{click}"
android:src="@drawable/ic_cp_invite"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
@@ -170,7 +200,7 @@
android:id="@+id/group_bind"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
android:visibility="@{(!cpEntity.hasCp)?View.VISIBLE:View.GONE}"
app:constraint_referenced_ids="tv_cp_empty_tip,iv_invite,btn_bind" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -911,7 +911,12 @@
<string name="home_like_hint">关注的人和收藏的房间都会出现在这里\n暂无关注的人和收藏的房间哦</string>
<string name="avatar_auditing">头像已送审,审核成功后自动应用头像</string>
<string name="vip_time_desc">剩余时间以30天为周期以获得新的贵族等级次日起算30日后的中午12:00为截止时间周期内贵族等级出现变化则剩余时间自动重置为30天。</string>
<!--技能卡-->
<string name="delete_skill">删除技能卡</string>
<string name="tip_save_skill">您填写的技能卡未保存,是否直接返\n回上一页</string>
<string name="tip_delete_skill">确定要删除该技能卡?</string>
<!--CP-->
<string name="cp_level">CP Lv.%s</string>>
<string name="cp_duration">已陪伴%s小时</string>>
</resources>

View File

@@ -0,0 +1,15 @@
package com.yizhuan.xchat_android_core.relation.cp
/**
* CP信息
*/
data class CpHomeEntity(
val hasCp: Boolean,
val inviteAvatar: String?,
val acceptAvatar: String?,
val inviteNick: String,
val acceptNick: String,
val duration: Int,//陪伴时长
val cpLevel: Int,//CP等级
)