删除个人资料-标签
This commit is contained in:
@@ -10,7 +10,6 @@ import com.chwl.app.audio.SoundSignatureActivity;
|
|||||||
import com.chwl.app.ui.login.AddUserInfoActivity;
|
import com.chwl.app.ui.login.AddUserInfoActivity;
|
||||||
import com.chwl.app.ui.login.ModifyInfoActivity;
|
import com.chwl.app.ui.login.ModifyInfoActivity;
|
||||||
import com.chwl.app.ui.setting.SettingActivity;
|
import com.chwl.app.ui.setting.SettingActivity;
|
||||||
import com.chwl.app.ui.user.activity.EditUserLabelActivity;
|
|
||||||
import com.chwl.app.ui.user.activity.UserInfoActivity;
|
import com.chwl.app.ui.user.activity.UserInfoActivity;
|
||||||
import com.chwl.app.ui.user.activity.UserInfoModifyActivity;
|
import com.chwl.app.ui.user.activity.UserInfoModifyActivity;
|
||||||
import com.chwl.app.ui.user.activity.UserModifyPhotosActivity;
|
import com.chwl.app.ui.user.activity.UserModifyPhotosActivity;
|
||||||
@@ -111,11 +110,6 @@ public class UIHelper {
|
|||||||
"/hiyoo/modules/monster/index.html?monsterId=" + monsterId);
|
"/hiyoo/modules/monster/index.html?monsterId=" + monsterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showLabelInfoAct(Activity mActivity, int requestCode) {
|
|
||||||
Intent intent = new Intent(mActivity, EditUserLabelActivity.class);
|
|
||||||
mActivity.startActivityForResult(intent, requestCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到举报页
|
* 跳转到举报页
|
||||||
*
|
*
|
||||||
|
@@ -1,249 +0,0 @@
|
|||||||
package com.chwl.app.ui.user.activity
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
|
||||||
import com.google.android.flexbox.FlexDirection
|
|
||||||
import com.google.android.flexbox.FlexWrap
|
|
||||||
import com.google.android.flexbox.FlexboxLayoutManager
|
|
||||||
import com.google.android.flexbox.JustifyContent
|
|
||||||
import com.netease.nim.uikit.StatusBarUtil
|
|
||||||
import com.chwl.app.R
|
|
||||||
import com.chwl.app.base.BaseViewBindingActivity
|
|
||||||
import com.chwl.app.base.TitleBar
|
|
||||||
import com.chwl.app.databinding.ActivityEditUserLabelBinding
|
|
||||||
import com.chwl.app.ui.user.adapter.CommonWrapIndicatorAdapter
|
|
||||||
import com.chwl.app.ui.user.adapter.MyUserLabelAdapter
|
|
||||||
import com.chwl.app.ui.user.event.LabelEvent
|
|
||||||
import com.chwl.app.ui.user.event.UserLabelEvent
|
|
||||||
import com.chwl.app.ui.user.fragment.LabelFragment
|
|
||||||
import com.chwl.app.ui.widget.magicindicator.ViewPagerHelper
|
|
||||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
|
||||||
import com.chwl.core.user.UserModel
|
|
||||||
import com.chwl.core.user.bean.UserLabelInfo
|
|
||||||
import com.chwl.library.common.entity.CommonTabEntity
|
|
||||||
import com.chwl.library.utils.ResUtil
|
|
||||||
import io.reactivex.SingleObserver
|
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
/**
|
|
||||||
* author: wushaocheng
|
|
||||||
* time: 2022/2/16
|
|
||||||
* desc: 编辑用户标签
|
|
||||||
*/
|
|
||||||
class EditUserLabelActivity : BaseViewBindingActivity<ActivityEditUserLabelBinding>(),
|
|
||||||
CommonWrapIndicatorAdapter.OnItemSelectListener {
|
|
||||||
|
|
||||||
private var userLabelInfo: UserLabelInfo? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val KEY_LABEL = "key_label"
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun start(context: Context) {
|
|
||||||
val starter = Intent(context, EditUserLabelActivity::class.java)
|
|
||||||
context.startActivity(starter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val mTitles = ArrayList<CommonTabEntity>()
|
|
||||||
|
|
||||||
private val mMyLabelAdapter by lazy { MyUserLabelAdapter() }
|
|
||||||
|
|
||||||
override fun init() {
|
|
||||||
EventBus.getDefault().register(this)
|
|
||||||
|
|
||||||
initTitleBar(
|
|
||||||
getString(R.string.my_label),
|
|
||||||
object : TitleBar.TextAction(
|
|
||||||
getString(R.string.done),
|
|
||||||
ContextCompat.getColor(this, R.color.color_white)
|
|
||||||
) {
|
|
||||||
override fun performAction(view: View) {
|
|
||||||
val list = mMyLabelAdapter.data.joinToString(",")
|
|
||||||
dialogManager.showProgressDialog(
|
|
||||||
this@EditUserLabelActivity,
|
|
||||||
ResUtil.getString(R.string.ui_user_userinfomodifyactivity_02)
|
|
||||||
)
|
|
||||||
UserModel.get().saveLabel(list).subscribe(object : SingleObserver<String> {
|
|
||||||
override fun onSubscribe(d: Disposable) {
|
|
||||||
mCompositeDisposable.add(d)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(s: String) {
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
val usersBean = UserModel.get().cacheLoginUserInfo
|
|
||||||
usersBean?.labels = mMyLabelAdapter.data
|
|
||||||
toast(getString(R.string.update_success))
|
|
||||||
val intent = Intent()
|
|
||||||
intent.putExtra(KEY_LABEL, list)
|
|
||||||
setResult(RESULT_OK, intent)
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
toast(e.message)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
initTop()
|
|
||||||
initData()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initData() {
|
|
||||||
dialogManager.showProgressDialog(
|
|
||||||
this@EditUserLabelActivity,
|
|
||||||
ResUtil.getString(R.string.ui_user_userinfomodifyactivity_02)
|
|
||||||
)
|
|
||||||
UserModel.get().userLabelInfo.subscribe(object : SingleObserver<UserLabelInfo> {
|
|
||||||
override fun onSubscribe(d: Disposable) {
|
|
||||||
mCompositeDisposable.add(d)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(data: UserLabelInfo) {
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
userLabelInfo = data
|
|
||||||
userLabelInfo?.meLabels?.let {
|
|
||||||
mMyLabelAdapter.setNewData(it)
|
|
||||||
if (it.isNotEmpty()) {
|
|
||||||
binding.group.visibility = View.GONE
|
|
||||||
} else {
|
|
||||||
binding.group.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
initTabTitle()
|
|
||||||
initViewPager()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
toast(e.message)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initTop() {
|
|
||||||
val flexBoxLayoutManager = FlexboxLayoutManager(context)
|
|
||||||
flexBoxLayoutManager.flexDirection = FlexDirection.ROW//主轴为水平方向,起点在左端
|
|
||||||
flexBoxLayoutManager.flexWrap = FlexWrap.WRAP//按正常方向换行
|
|
||||||
flexBoxLayoutManager.justifyContent = JustifyContent.FLEX_START//交叉轴的起点对齐
|
|
||||||
binding.mRecyclerView.layoutManager = flexBoxLayoutManager
|
|
||||||
binding.mRecyclerView.adapter = mMyLabelAdapter
|
|
||||||
|
|
||||||
mMyLabelAdapter.setOnItemChildClickListener { _, _, position ->
|
|
||||||
EventBus.getDefault().post(LabelEvent(mMyLabelAdapter.data[position]))
|
|
||||||
mMyLabelAdapter.remove(position)
|
|
||||||
if (mMyLabelAdapter.data.size == 0) {
|
|
||||||
binding.group.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val labelList = UserModel.get().cacheLoginUserInfo?.labels
|
|
||||||
|
|
||||||
labelList?.let {
|
|
||||||
if (it.isNotEmpty()) {
|
|
||||||
binding.group.visibility = View.GONE
|
|
||||||
mMyLabelAdapter.setNewData(it)
|
|
||||||
} else {
|
|
||||||
binding.group.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initTabTitle() {
|
|
||||||
val tabList = userLabelInfo?.groups
|
|
||||||
tabList?.let {
|
|
||||||
it.forEach { tab ->
|
|
||||||
mTitles.add(CommonTabEntity(LabelFragment::class.java, tab))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initViewPager() {
|
|
||||||
if (mTitles.size == 0) return
|
|
||||||
val commonNavigator = CommonNavigator(context)
|
|
||||||
commonNavigator.setTitleWrapContent(true)
|
|
||||||
val magicIndicatorAdapter = CommonWrapIndicatorAdapter(this, mTitles.map { it.title })
|
|
||||||
magicIndicatorAdapter.textSize = 15
|
|
||||||
magicIndicatorAdapter.setOnItemSelectListener(this)
|
|
||||||
commonNavigator.adapter = magicIndicatorAdapter
|
|
||||||
binding.magicIndicator.navigator = commonNavigator
|
|
||||||
commonNavigator.titleContainer.showDividers = LinearLayout.SHOW_DIVIDER_MIDDLE
|
|
||||||
binding.mViewPager.adapter =
|
|
||||||
object : FragmentStateAdapter(supportFragmentManager, lifecycle) {
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
|
||||||
val tabEntity = mTitles[position]
|
|
||||||
val newInstance = tabEntity.frgClazz.newInstance()
|
|
||||||
val bundle = Bundle()
|
|
||||||
val labelList =
|
|
||||||
userLabelInfo?.labels?.let { label -> label.filter { it.group == mTitles[position].title } }
|
|
||||||
bundle.putSerializable(LabelFragment.USER_TAG, labelList as Serializable?)
|
|
||||||
newInstance.arguments = bundle
|
|
||||||
return newInstance
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
|
||||||
return mTitles.size
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ViewPagerHelper.bind(binding.magicIndicator, binding.mViewPager)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemSelect(position: Int, view: TextView?) {
|
|
||||||
binding.mViewPager.currentItem = position
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
fun onUserLabelEvent(event: UserLabelEvent) {
|
|
||||||
val data = mMyLabelAdapter.data
|
|
||||||
if (data.contains(event.label)) {
|
|
||||||
val pos = data.indexOf(event.label)
|
|
||||||
mMyLabelAdapter.remove(pos)
|
|
||||||
if (mMyLabelAdapter.data.size == 0) {
|
|
||||||
binding.group.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (data.size == 20) {
|
|
||||||
toast(getString(R.string.max_to_add_label))
|
|
||||||
} else {
|
|
||||||
if (mMyLabelAdapter.data.size == 0) {
|
|
||||||
binding.group.visibility = View.GONE
|
|
||||||
}
|
|
||||||
mMyLabelAdapter.addData(event.label)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun needSteepStateBar(): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setStatusBar() {
|
|
||||||
super.setStatusBar()
|
|
||||||
StatusBarUtil.transparencyBar(this)
|
|
||||||
StatusBarUtil.StatusBarLightMode(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
EventBus.getDefault().unregister(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -167,8 +167,6 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
|||||||
binding.llAudioRecord.setOnClickListener(this)
|
binding.llAudioRecord.setOnClickListener(this)
|
||||||
binding.llDesc.setOnClickListener(this)
|
binding.llDesc.setOnClickListener(this)
|
||||||
binding.layoutArea.setOnClickListener(this)
|
binding.layoutArea.setOnClickListener(this)
|
||||||
binding.layoutTag.setOnClickListener(this)
|
|
||||||
binding.tvTag.setOnClickListener(this)
|
|
||||||
val mLayoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true)
|
val mLayoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true)
|
||||||
binding.rvPhotos.layoutManager = mLayoutManager
|
binding.rvPhotos.layoutManager = mLayoutManager
|
||||||
}
|
}
|
||||||
@@ -184,40 +182,6 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
|||||||
this, calendar[Calendar.YEAR],
|
this, calendar[Calendar.YEAR],
|
||||||
calendar[Calendar.MONTH], calendar[Calendar.DAY_OF_MONTH], true
|
calendar[Calendar.MONTH], calendar[Calendar.DAY_OF_MONTH], true
|
||||||
)
|
)
|
||||||
|
|
||||||
val labelList = UserModel.get().cacheLoginUserInfo?.labels
|
|
||||||
if ((labelList?.size ?: 0) > 0) {
|
|
||||||
binding.tvTag.visibility = View.INVISIBLE
|
|
||||||
binding.mLabelRecyclerView.visibility = View.VISIBLE
|
|
||||||
val userInfoLabelAdapter = UserInfoLabelAdapter()
|
|
||||||
|
|
||||||
val labelLayoutManager = LinesFlexBoxLayoutManager(this)
|
|
||||||
labelLayoutManager.flexDirection = FlexDirection.ROW
|
|
||||||
labelLayoutManager.alignItems = AlignItems.FLEX_START
|
|
||||||
labelLayoutManager.setMaxLines(1)
|
|
||||||
binding.mLabelRecyclerView.layoutManager = labelLayoutManager
|
|
||||||
binding.mLabelRecyclerView.adapter = userInfoLabelAdapter
|
|
||||||
|
|
||||||
userInfoLabelAdapter.setNewData(labelList)
|
|
||||||
} else {
|
|
||||||
binding.tvTag.visibility = View.VISIBLE
|
|
||||||
binding.mLabelRecyclerView.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.mLabelRecyclerView.addOnItemTouchListener(object : OnItemTouchListener {
|
|
||||||
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
|
|
||||||
UIHelper.showLabelInfoAct(this@UserInfoModifyActivity, Method.LABEL)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDateSet(datePickerDialog: DatePickerDialog, year: Int, month: Int, day: Int) {
|
override fun onDateSet(datePickerDialog: DatePickerDialog, year: Int, month: Int, day: Int) {
|
||||||
@@ -356,12 +320,8 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
|||||||
dialogManager.dismissDialog()
|
dialogManager.dismissDialog()
|
||||||
toast(e.message)
|
toast(e.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
R.id.layout_tag, R.id.tv_tag -> {
|
|
||||||
UIHelper.showLabelInfoAct(this, Method.LABEL)
|
|
||||||
}
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,39 +457,6 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
|||||||
.subscribe(userInfoUpdateObserver)
|
.subscribe(userInfoUpdateObserver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Method.LABEL -> {
|
|
||||||
data?.let {
|
|
||||||
val label = it.getStringExtra(EditUserLabelActivity.KEY_LABEL)
|
|
||||||
if (label?.isNotEmpty() == true) {
|
|
||||||
val labelList = label.split(",")
|
|
||||||
binding.tvTag.visibility = View.INVISIBLE
|
|
||||||
binding.mLabelRecyclerView.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
binding.mLabelRecyclerView.addItemDecoration(
|
|
||||||
ColorDecoration(
|
|
||||||
Color.TRANSPARENT,
|
|
||||||
Utils.dip2px(this, 5f),
|
|
||||||
0,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
val userModifyLabelAdapter = UserModifyLabelAdapter()
|
|
||||||
|
|
||||||
val labelLayoutManager = LinesFlexBoxLayoutManager(this)
|
|
||||||
labelLayoutManager.flexDirection = FlexDirection.ROW
|
|
||||||
labelLayoutManager.alignItems = AlignItems.FLEX_START
|
|
||||||
labelLayoutManager.setMaxLines(1)
|
|
||||||
binding.mLabelRecyclerView.layoutManager = labelLayoutManager
|
|
||||||
binding.mLabelRecyclerView.adapter = userModifyLabelAdapter
|
|
||||||
|
|
||||||
userModifyLabelAdapter.setNewData(labelList)
|
|
||||||
} else {
|
|
||||||
binding.tvTag.visibility = View.VISIBLE
|
|
||||||
binding.mLabelRecyclerView.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Method.AUDIO -> {// 刷新声音资源
|
Method.AUDIO -> {// 刷新声音资源
|
||||||
data?.let {
|
data?.let {
|
||||||
// 获取数据并刷新显示
|
// 获取数据并刷新显示
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
package com.chwl.app.ui.user.adapter
|
|
||||||
|
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
||||||
import com.chad.library.adapter.base.BaseViewHolder
|
|
||||||
import com.chwl.app.R
|
|
||||||
import com.chwl.core.user.bean.UserLabelItemInfo
|
|
||||||
|
|
||||||
/**
|
|
||||||
* author: wushaocheng
|
|
||||||
* Created by wushaocheng on 2023/2/16.
|
|
||||||
* desc: 用户标签
|
|
||||||
*/
|
|
||||||
class MyUserLabelAdapter :
|
|
||||||
BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_my_user_label) {
|
|
||||||
|
|
||||||
override fun convert(helper: BaseViewHolder, item: String) {
|
|
||||||
helper.setText(R.id.tv_label, item)
|
|
||||||
helper.addOnClickListener(R.id.iv_close)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,79 +0,0 @@
|
|||||||
package com.chwl.app.ui.user.dialog
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
|
||||||
import com.google.android.flexbox.FlexDirection
|
|
||||||
import com.google.android.flexbox.FlexWrap
|
|
||||||
import com.google.android.flexbox.FlexboxLayoutManager
|
|
||||||
import com.google.android.flexbox.JustifyContent
|
|
||||||
import com.chwl.app.R
|
|
||||||
import com.chwl.app.base.BaseDialog
|
|
||||||
import com.chwl.app.databinding.DialogUserTagBinding
|
|
||||||
import com.chwl.app.ui.user.activity.EditUserLabelActivity
|
|
||||||
import com.chwl.app.ui.user.adapter.UserLabelDialogAdapter
|
|
||||||
import com.chwl.core.auth.AuthModel
|
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户标签
|
|
||||||
* Created by wushaocheng on 2023/2/16.
|
|
||||||
*/
|
|
||||||
class UserLabelDialog :
|
|
||||||
BaseDialog<DialogUserTagBinding>() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
const val KEY_USER_ID = "key_user_id"
|
|
||||||
const val KEY_LABEL = "key_label"
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun newInstance(label: MutableList<String>, userId: Long): UserLabelDialog {
|
|
||||||
val userLabelDialog = UserLabelDialog()
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putLong(KEY_USER_ID, userId)
|
|
||||||
bundle.putSerializable(KEY_LABEL, label as Serializable?)
|
|
||||||
userLabelDialog.arguments = bundle
|
|
||||||
return userLabelDialog
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val mTagAdapter by lazy { UserLabelDialogAdapter() }
|
|
||||||
|
|
||||||
override fun init() {
|
|
||||||
initListener()
|
|
||||||
initAdapter()
|
|
||||||
initLabel()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initListener() {
|
|
||||||
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
|
|
||||||
|
|
||||||
binding?.tvEdit?.setOnClickListener {
|
|
||||||
dismissAllowingStateLoss()
|
|
||||||
context?.let { it1 -> EditUserLabelActivity.start(it1) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initAdapter() {
|
|
||||||
val flexBoxLayoutManager = FlexboxLayoutManager(context)
|
|
||||||
flexBoxLayoutManager.flexDirection = FlexDirection.ROW//主轴为水平方向,起点在左端
|
|
||||||
flexBoxLayoutManager.flexWrap = FlexWrap.WRAP//按正常方向换行
|
|
||||||
flexBoxLayoutManager.justifyContent = JustifyContent.FLEX_START//交叉轴的起点对齐
|
|
||||||
binding?.mRecyclerView?.layoutManager = flexBoxLayoutManager
|
|
||||||
binding?.mRecyclerView?.adapter = mTagAdapter
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initLabel() {
|
|
||||||
val userId = arguments?.getLong(KEY_USER_ID) ?: 0L
|
|
||||||
if (AuthModel.get().currentUid != userId) {
|
|
||||||
binding?.tvTitle?.text = getString(R.string.other_label)
|
|
||||||
binding?.tvEdit?.visibility = View.GONE
|
|
||||||
} else {
|
|
||||||
binding?.tvTitle?.text = getString(R.string.my_label)
|
|
||||||
binding?.tvEdit?.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
val labelList = arguments?.getSerializable(KEY_LABEL) as List<String?>?
|
|
||||||
mTagAdapter.setNewData(labelList)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,79 +0,0 @@
|
|||||||
<?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:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_white"
|
|
||||||
tools:context=".ui.user.activity.EditUserLabelActivity">
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/view_bg"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:background="@drawable/bg_edit_user_tag"
|
|
||||||
app:layout_constraintDimensionRatio="1.24:1"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<com.chwl.app.base.TitleBar
|
|
||||||
android:id="@+id/title_bar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_44"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/iv_tag_empty"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_18"
|
|
||||||
android:src="@drawable/ic_edit_tag_empty"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title_bar" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/tv_tip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:text="@string/edit_your_tags_tip"
|
|
||||||
android:textColor="@color/color_white"
|
|
||||||
android:textSize="@dimen/sp_14"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_tag_empty" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Group
|
|
||||||
android:id="@+id/group"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:constraint_referenced_ids="iv_tag_empty,tv_tip" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/mRecyclerView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_0"
|
|
||||||
android:layout_marginTop="@dimen/dp_15"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/view_bg"/>
|
|
||||||
|
|
||||||
<com.chwl.app.ui.widget.magicindicator.MagicIndicator
|
|
||||||
android:id="@+id/magic_indicator"
|
|
||||||
android:layout_marginTop="@dimen/dp_14"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_26"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/view_bg"/>
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
|
||||||
android:id="@+id/mViewPager"
|
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_0"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/magic_indicator"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -243,71 +243,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:background="@color/line_353548" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/layout_tag"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/layout_item_user_03"
|
|
||||||
android:textColor="@color/text_title_color"
|
|
||||||
android:textSize="14sp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"/>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="220dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/iv_label_arrow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_tag"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center_vertical|end"
|
|
||||||
android:textColor="@color/color_6D6B89"
|
|
||||||
android:textSize="@dimen/font_normal"
|
|
||||||
android:text="@string/setting_personal_tags_will_be_more_popular"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/mLabelRecyclerView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:overScrollMode="never"
|
|
||||||
android:scrollbars="none"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/tv_tag"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_label_arrow"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:padding="15dp"
|
|
||||||
android:src="@drawable/arrow_right"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="@dimen/dp_30"
|
|
||||||
android:layout_marginEnd="@dimen/dp_30"
|
|
||||||
android:paddingBottom="@dimen/dp_20"
|
|
||||||
android:background="@drawable/bg_ffffff_14">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/ivClose"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
|
||||||
android:layout_marginEnd="@dimen/dp_15"
|
|
||||||
android:src="@drawable/ic_tag_close"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/tvTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="@color/color_1F1A4E"
|
|
||||||
android:textSize="@dimen/sp_17"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:layout_marginTop="@dimen/dp_18"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
tools:text="@string/other_label"/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/mRecyclerView"
|
|
||||||
android:layout_marginTop="@dimen/dp_7"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="120dp"
|
|
||||||
android:layout_marginStart="@dimen/dp_15"
|
|
||||||
android:layout_marginEnd="@dimen/dp_15"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
|
|
||||||
android:overScrollMode="never"
|
|
||||||
android:scrollbars="none"/>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/tvEdit"
|
|
||||||
android:text="@string/edit_tag"
|
|
||||||
android:textSize="@dimen/sp_14"
|
|
||||||
android:textColor="@color/base_color_theme_text"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_width="130dp"
|
|
||||||
android:layout_height="34dp"
|
|
||||||
android:background="@drawable/base_shape_theme_30dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/mRecyclerView"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/bg_ffffff_18"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_marginStart="@dimen/dp_15"
|
|
||||||
android:layout_marginBottom="@dimen/dp_15"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/tv_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="@dimen/dp_16"
|
|
||||||
android:paddingTop="@dimen/dp_8"
|
|
||||||
android:paddingEnd="@dimen/dp_0"
|
|
||||||
android:paddingBottom="@dimen/dp_8"
|
|
||||||
android:textColor="@color/color_1F1A4E"
|
|
||||||
android:textSize="@dimen/sp_13"
|
|
||||||
tools:text="自由人" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/iv_close"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingStart="@dimen/dp_2"
|
|
||||||
android:paddingEnd="@dimen/dp_12"
|
|
||||||
android:src="@drawable/ic_tag_close_my" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
Reference in New Issue
Block a user