Commit 2406e9bb authored by shiyuelong's avatar shiyuelong

add选择职业标签页面

parent 3aa39181
......@@ -25,6 +25,8 @@ class XRouterPathConstants {
const val LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE = "/lifeAccountEnterpriseAuthComplete"
const val LIFE_ACCOUNT_ENTERPRISE_AUTH = "/lifeAccountEnterpriseAuth"
const val LIFE_NUMBER = "/lifeNumberActivity"
// 选择职业标签
const val CHOOSE_CAREER = "/chooseCareerActivity"
// 人员管理 —— 我的员工
const val PERSONAL_MY_STAFF = "/personal/myStaffActivity"
......
......@@ -5,13 +5,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?attr/colorPrimary"
android:fitsSystemWindows="true"
android:minHeight="50dp"
......
......@@ -135,6 +135,9 @@
<activity
android:name=".ui.center.MerchantAuthInfoActivity"
android:theme="@style/Transparent" />
<activity
android:name=".ui.auth.ChooseCareerActivity"
android:theme="@style/Transparent" />
</application>
......
package com.yidian.shenghuoquan.newscontent.adapter
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yidian.shenghuoquan.newscontent.R
/**
* 选择职业数据适配器
*/
class FirstCareerListAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_career_first_list) {
//记录当前选中的条目索引
private var selectedIndex = 0
fun setSelectedIndex(position: Int) {
selectedIndex = position
notifyDataSetChanged()
}
override fun convert(holder: BaseViewHolder, item: String) {
val position = holder.adapterPosition
val firstCareer = holder.getView<TextView>(R.id.tv_first_career)
firstCareer.text = item
if (selectedIndex == position) {
holder.itemView.setBackgroundColor(ContextCompat.getColor(context, R.color.white))
firstCareer.setTextColor(ContextCompat.getColor(context, R.color.color_1852F1))
} else {
holder.itemView.setBackgroundColor(ContextCompat.getColor(context, R.color.color_FFF2F2F2))
firstCareer.setTextColor(ContextCompat.getColor(context, R.color.color_333333))
}
}
}
package com.yidian.shenghuoquan.newscontent.adapter
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yidian.shenghuoquan.newscontent.R
class SecondCareerListAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_career_second_list) {
//记录当前选中的条目索引
private var selectedIndex = 0
fun setSelectedIndex(position: Int) {
selectedIndex = position
notifyDataSetChanged()
}
override fun convert(holder: BaseViewHolder, item: String) {
val position = holder.adapterPosition
val secondCareer = holder.getView<TextView>(R.id.tv_second_career)
secondCareer.text = item
if (selectedIndex == position) {
secondCareer.setTextColor(ContextCompat.getColor(context, R.color.color_1852F1))
} else {
secondCareer.setTextColor(ContextCompat.getColor(context, R.color.color_333333))
}
}
}
......@@ -2,6 +2,7 @@ package com.yidian.shenghuoquan.newscontent.app
import android.content.Intent
import com.yidian.common.XRouterPathConstants
import com.yidian.common.XRouterPathConstants.Companion.CHOOSE_CAREER
import com.yidian.common.XRouterPathConstants.Companion.FLASH
import com.yidian.common.XRouterPathConstants.Companion.GALLERY
import com.yidian.common.XRouterPathConstants.Companion.ID_CARD_TEST
......@@ -255,6 +256,17 @@ class NewsContentApplication : YdBaseApplication() {
context.startActivity(intent)
}
}),
XPageNode(CHOOSE_CAREER, XPageNodePageType.NATIVE, object : XPageHandler {
override fun handler(params: Map<String, Any?>?) {
val intent = Intent()
if (params != null) {
intent.putExtra(XRouterPathConstants.ParamsKey, params as HashMap)
}
intent.setClass(context, ChooseCareerActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
context.startActivity(intent)
}
}),
// 人员管理 —— 我的员工
XPageNode(PERSONAL_MY_STAFF, XPageNodePageType.NATIVE, object : XPageHandler {
override fun handler(params: Map<String, Any?>?) {
......
package com.yidian.shenghuoquan.newscontent.ui.auth
import android.os.Bundle
import com.yidian.common.XRouterPathConstants.Companion.CHOOSE_CAREER
import com.yidian.common.base.BaseActivity
import com.yidian.common.extensions.initTitleBar
import com.yidian.shenghuoquan.newscontent.R
import com.yidian.shenghuoquan.newscontent.adapter.FirstCareerListAdapter
import com.yidian.shenghuoquan.newscontent.adapter.SecondCareerListAdapter
import com.yidian.shenghuoquan.newscontent.databinding.ActivityChooseCareerBinding
import com.yidian.utils.ToastUtil
/**
* 选择职业标签
*/
class ChooseCareerActivity : BaseActivity<ActivityChooseCareerBinding>() {
var secondCareer1 = arrayListOf("第一职业1", "第一职业2", "第一职业3", "第一职业4", "第一职业5")
var secondCareer2 = arrayListOf("第二职业1", "第二职业2", "第二职业3", "第二职业4", "第二职业5")
var secondCareer3 = arrayListOf("第三职业1", "第三职业2", "第三职业3", "第三职业4", "第三职业5")
var secondCareer4 = arrayListOf("第四职业1", "第四职业2", "第四职业3", "第四职业4", "第四职业5")
var firstCareer = arrayListOf("互联网", "金融类", "公务员", "自由职业")
private val firstListAdapter: FirstCareerListAdapter by lazy { FirstCareerListAdapter() }
private val secondListAdapter: SecondCareerListAdapter by lazy { SecondCareerListAdapter() }
override fun createViewBinding(): ActivityChooseCareerBinding {
return ActivityChooseCareerBinding.inflate(layoutInflater)
}
override fun getXPageName(): String {
return CHOOSE_CAREER
}
override fun init(savedInstanceState: Bundle?) {
super.init(savedInstanceState)
initView()
}
private fun initView() {
initTitleBar(viewBind.include.toolbar, viewBind.include.tvTitle, resources.getString(R.string.choose_career))
viewBind.rvListFirst.adapter = firstListAdapter
viewBind.rvListSecond.adapter = secondListAdapter
firstListAdapter.setList(firstCareer)
secondListAdapter.setList(secondCareer1)
firstListAdapter.setOnItemClickListener { _, _, position ->
when (position) {
0 -> {
secondListAdapter.setList(secondCareer1)
}
1 -> {
secondListAdapter.setList(secondCareer2)
}
2 -> {
secondListAdapter.setList(secondCareer3)
}
3 -> {
secondListAdapter.setList(secondCareer4)
}
}
firstListAdapter.setSelectedIndex(position)
}
secondListAdapter.setOnItemClickListener { adapter, _, position ->
secondListAdapter.setSelectedIndex(position)
val secondCareer = adapter.data[position] as String
// todo 回传选择的职业
ToastUtil.showToast(this, "选择的职业:$secondCareer")
}
}
}
......@@ -110,4 +110,4 @@ class LifeAccountAuthActivity : BaseActivity<ActivityLifeAccountAuthBinding>(),
"request auth merchant check failure, message: $message"
)
}
}
\ No newline at end of file
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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_F5F6F7"
android:orientation="vertical">
<include
android:id="@+id/include"
layout="@layout/layout_common_toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list_first"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/color_FFF2F2F2"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="6"
tools:listitem="@layout/item_career_first_list" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="6"
tools:listitem="@layout/item_career_second_list" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?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="@dimen/dp136"
android:layout_height="@dimen/dp60"
android:paddingStart="@dimen/dp15"
android:paddingEnd="@dimen/dp15">
<TextView
android:id="@+id/tv_first_career"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_333333"
android:textSize="@dimen/sp16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="职业一级列表" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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="@dimen/dp60"
android:paddingStart="@dimen/dp15"
android:paddingEnd="@dimen/dp15">
<TextView
android:id="@+id/tv_second_career"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_333333"
android:textSize="@dimen/sp16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="职业二级列表" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -144,6 +144,7 @@
<string name="apply_auth_merchant_description">通过即享更多曝光 · 权威认证 · 服务能力</string>
<string name="modify_auth">修改认证</string>
<string name="choose_career">选择职业标签</string>
<string name="my_staff">我的员工</string>
<string name="manager_account_change_tips">管理员账号替换后,原账户将无法操作生活号所有功能,同时将自动退出当前登录状态,新账号将继承原账号所有权益。</string>
<string name="manager_register_tips">未注册生活圈的手机号,登录时将自动注册,且代表你已经同意《用户协议》《隐私政策》。</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment