Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
786372615 committed Aug 30, 2019
1 parent 712f4b4 commit 2a46548
Show file tree
Hide file tree
Showing 29 changed files with 508 additions and 45 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
repositories {
google()
jcenter()

maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
Expand All @@ -20,7 +20,7 @@ allprojects {
repositories {
google()
jcenter()

maven { url "https://jitpack.io" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion config/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ext {
junit4 : "4.12",
mockito : "2.5.5",
//BaseRecyclerAdapter
cymchad_baseadapter : "2.9.40",
cymchad_baseadapter : "2.9.47",
]

dependencies = [
Expand Down
8 changes: 4 additions & 4 deletions platform/src/main/java/com/oo/platform/util/StatusBarUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import android.graphics.Color
import android.graphics.Rect
import android.os.Build
import android.os.Environment
import androidx.annotation.ColorInt
import androidx.core.view.ViewCompat
import android.view.*
import android.widget.FrameLayout
import androidx.annotation.ColorInt
import androidx.core.view.ViewCompat
import java.io.File
import java.io.FileInputStream
import java.io.IOException
Expand Down Expand Up @@ -191,7 +191,7 @@ object StatusBarUtils {
val contentView = window.findViewById<View>(Window.ID_ANDROID_CONTENT) as ViewGroup
val firstChild = contentView.getChildAt(0)
if (firstChild != null) {
ViewCompat.setFitsSystemWindows(firstChild, false)
firstChild.fitsSystemWindows = false
ViewCompat.requestApplyInsets(firstChild)
}
}
Expand Down Expand Up @@ -232,8 +232,8 @@ object StatusBarUtils {
firstChild.layoutParams = lp
firstChild.tag = TAG_MARGIN_ADDED
}
firstChild.fitsSystemWindows = false

ViewCompat.setFitsSystemWindows(firstChild, false)
}

companion object {
Expand Down
5 changes: 3 additions & 2 deletions resume/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ android {
productFlavors {
PRO {
dimension = 'API_ENV'
buildConfigField('String','API_HOST','"http://134.175.147.149"')
buildConfigField('String', 'API_HOST', '"http://134.175.147.149"')
}
DEV {
dimension = 'API_ENV'
buildConfigField('String','API_HOST','"http://172.25.165.242"')
buildConfigField('String', 'API_HOST', '"http://172.25.165.242"')
}
}
compileOptions {
Expand Down Expand Up @@ -69,6 +69,7 @@ dependencies {
implementation dep.recyclerview
implementation dep.fresco
implementation dep.design
implementation dep.cymchad_baseadapter
implementation project(path: ':platform')
implementation project(path: ':data')
implementation project(path: ':widget')
Expand Down
3 changes: 2 additions & 1 deletion resume/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:targetApi="n">
<activity android:name=".activity.ResumeDetailActivity"/>
<activity android:name=".activity.EditBasicProfileActivity"/>
<activity android:name=".activity.ResumeDetailActivity" />
<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.oo.resume.activity

import android.os.Bundle
import com.chenenyu.router.annotation.Route
import com.oo.platform.view.BaseActivity
import com.oo.resume.R
import com.oo.resume.activity.router.RouteUrl
import kotlinx.android.synthetic.main.activity_edit_basic_profile.*
import kotlinx.android.synthetic.main.layout_edit_profile.view.*
import kotlinx.android.synthetic.main.layout_normal_title_bar.*

@Route(RouteUrl.EDIT_RESUME_BASE_INFO)
class EditBasicProfileActivity : BaseActivity() {

companion object {
const val KEY_BASE_INFO = "KEY_BASE_INFO"
}

override fun getContentViewResId(): Int {
return R.layout.activity_edit_basic_profile
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initData()
initViewState()
bindListener()
observeState()
}


private fun initData() {

}

private fun initViewState() {
ll_name.tv_title.text = "姓名"
ll_sex.tv_title.text = "性别"
ll_phone.tv_title.text = "电话"
ll_age.tv_title.text = "年龄"
ll_email.tv_title.text = "邮箱"
tv_title.text = "编辑个人信息"
}

private fun bindListener() {

}

private fun observeState() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import com.chenenyu.router.annotation.Route
import com.oo.platform.view.BaseActivity
import com.oo.platform.viewmodel.ViewModelBinder
import com.oo.resume.R
import com.oo.resume.activity.adapter.ResumeDetailAdapter
import com.oo.resume.activity.router.RouteUrl
import com.oo.resume.data.response.ResumeDTO
import com.oo.resume.viewmodel.ResumeListViewModel
import kotlinx.android.synthetic.main.activity_resume_detail.*
import kotlinx.android.synthetic.main.layout_normal_title_bar.*

@Route(RouteUrl.RESUME_DETAIL_PAGE)
Expand All @@ -22,41 +25,68 @@ class ResumeDetailActivity : BaseActivity() {

private lateinit var resumeViewModel: ResumeListViewModel

private var mAdapter = ResumeDetailAdapter()

@InjectParam(key = KEY_RESUME_ID)
lateinit var resumeId: String
var resumeId: Long? = null

override fun getContentViewResId(): Int {
return R.layout.activity_resume_detail
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initData()
bindViewModel()
initData()
initViewState()
observeState()
bindListener()
}

private fun initData() {
Router.injectParams(this)
}
private fun bindListener() {
mAdapter.setOnItemChildClickListener { _, view, position ->
when(view.id){
R.id.cl_basic_wrapper ->
Router.build(RouteUrl.EDIT_RESUME_BASE_INFO)
.go(this){ status,_,_->
if (status.isSuccessful){

}
}
}
}
}

private fun bindViewModel() {
resumeViewModel = ViewModelBinder.bind(this, ResumeListViewModel::class.java)
}

private fun initData() {
Router.injectParams(this)
resumeViewModel.resumeDetail(resumeId)
}


private fun initViewState() {
iv_back.setOnClickListener { onBackPressed() }
tv_title.text = "简历详情"
tv_control.visibility = View.VISIBLE
tv_control.text = "预览"
rv_resume_detail_list.adapter = mAdapter
}

private fun observeState(){
resumeViewModel.getResumeDetail().observe(this, Observer {
private fun observeState() {
resumeViewModel.getResumeDetail()
.observe(this, Observer { resumeResult ->
if (resumeResult == null) return@Observer
if (resumeResult.isSuccess){
refreshResumeList(resumeResult.data)
}
})
}

})
private fun refreshResumeList(data: ResumeDTO?) {
mAdapter.addBasic(data?.baseInfo)
}

}
32 changes: 28 additions & 4 deletions resume/src/main/java/com/oo/resume/activity/ResumeListFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.chenenyu.router.Router
import com.oo.platform.view.BaseFragment
Expand Down Expand Up @@ -42,6 +44,7 @@ class ResumeListFragment : BaseFragment() {
private fun initView() {
adapter = ResumeAdapter()
rv_resume.adapter = adapter
rv_resume.itemAnimator = DefaultItemAnimator()
}

private fun observe() {
Expand Down Expand Up @@ -82,8 +85,29 @@ class ResumeListFragment : BaseFragment() {
}

fun setData(resumes: List<ResumeDTO>?) {
val diffUtil = DiffUtil.calculateDiff(object : DiffUtil.Callback() {
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
val oldItem = this@ResumeAdapter.reusmes?.get(oldItemPosition)
val newItem = reusmes?.get(newItemPosition)
return oldItem?.id?.equals(newItem?.id) ?: false
}

override fun getOldListSize(): Int {
return this@ResumeAdapter.reusmes?.size ?: 0
}

override fun getNewListSize(): Int {
return resumes?.size ?: 0
}

override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
val oldItem = this@ResumeAdapter.reusmes?.get(oldItemPosition)
val newItem = reusmes?.get(newItemPosition)
return oldItem?.equals(newItem) ?: false
}
})
diffUtil.dispatchUpdatesTo(this)
this.reusmes = resumes
notifyDataSetChanged()
}

override fun getItemCount(): Int {
Expand All @@ -105,17 +129,17 @@ class ResumeListFragment : BaseFragment() {
if ((resume.exeprience ?: 0) > 0) {
baseProfile.append(resume.exeprience).append("年经验")
}
if ((resume.account?.age ?:0) > 0){
if ((resume.account?.age ?: 0) > 0) {
baseProfile.append(" · ").append(resume.account?.age).append("")
}
if (!resume.education.isNullOrEmpty()) {
baseProfile.append(" · ").append(resume.education?.get(0)?.record)
}
itemView.tv_base_profile.text = baseProfile.toString()
itemView.sdv_avatar?.setImageURI(resume.account?.avatar)
itemView.sdv_avatar?.setImageURI(resume.baseInfo?.avatar)
itemView.setOnClickListener {
Router.build(RESUME_DETAIL_PAGE)
.with(KEY_RESUME_ID,resume.id)
.with(KEY_RESUME_ID, resume.id)
.go(this@ResumeListFragment)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class SignInActivity : BaseActivity() {
loading.show()
return@Observer
}

loading.dismiss()
if (result.isSuccess) {
showToast("登录成功")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.oo.resume.activity.adapter

import com.chad.library.adapter.base.BaseViewHolder
import com.chad.library.adapter.base.MultipleItemRvAdapter
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.facebook.drawee.view.SimpleDraweeView
import com.oo.resume.R
import com.oo.resume.data.response.BaseInfoDTO


class ResumeDetailAdapter : MultipleItemRvAdapter<Any, BaseViewHolder>(null) {


init {
finishInitialize()
}

override fun registerItemProvider() {
mProviderDelegate.registerProvider(BasicInfoProvider())
}

override fun getViewType(t: Any?): Int {
return when (t) {
t is BaseInfoDTO -> TYPE_BASIC_INFO

else -> TYPE_BASIC_INFO
}
}

companion object {
const val TYPE_BASIC_INFO = 0X001
}



fun addBasic(basic: BaseInfoDTO?) {
if (basic != null) {
getData().add(basic)
}
notifyDataSetChanged()
}



inner class BasicInfoProvider : BaseItemProvider<BaseInfoDTO, BaseViewHolder>() {
override fun convert(helper: BaseViewHolder?, data: BaseInfoDTO?, position: Int) {
if (helper == null || data == null) return
helper.setText(R.id.tv_name, data.name ?: "")
helper.getView<SimpleDraweeView>(R.id.sdv_avatar)?.setImageURI(data.avatar)
helper.addOnClickListener(R.id.cl_basic_wrapper)
}

override fun viewType(): Int {
return TYPE_BASIC_INFO
}

override fun layout(): Int {
return R.layout.item_resume_detail_basic
}

}

}
Loading

0 comments on commit 2a46548

Please sign in to comment.