1. 修复场景地图界面选择场景点时可能由于列表下标越界导致崩溃问题;
2. 修复自定义PagerAdapter时,没有重写destroyItem可能会导致的崩溃问题;
3. 修改数据库实体类MediaTypeAlias的主键id类型从龙变更为Long,否则无法自增;
4. 新增部分列表相关的工具函数;
已修改8个文件
已添加15个文件
1193 ■■■■■ 文件已修改
app/build.gradle 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/activity/ScenseMapActivity.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/adapter/IconsPageAdapter.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/bean/entity/MediaTypeAlias.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkRecordActivity.kt 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkViewModel.kt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseCustomViewHolder.kt 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseRecyclerAdapter.kt 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/DataLoadInterface.kt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/LoadState.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewPanel.kt 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewSetInterface.kt 279 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/SwipeRefreshLayoutSetInterface.kt 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/drawable/bg_layerlist_1.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_night_work.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/item_night_work.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/item_night_work_2.xml 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/layout_toolbar_2.xml 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/mipmap-xhdpi/ic_file.png 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/values/styles.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
build.gradle 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/build.gradle
@@ -13,8 +13,8 @@
        applicationId "cn.flightfeather.thirdapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 24
        versionName "1.1.14.07"
        versionCode 25
        versionName "1.1.14.08"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        renderscriptTargetApi 25
        renderscriptSupportModeEnabled true
@@ -91,6 +91,9 @@
    implementation 'com.amap.api:location:4.6.0'
    implementation 'com.amap.api:search:6.5.0.1'
    //recyclerViewAdapter
    implementation "com.github.CymChad:BaseRecyclerViewAdapterHelper:${adaper_version}"
    //lifecycle
    implementation "android.arch.lifecycle:extensions:${lifecycle_version}"
app/src/main/java/cn/flightfeather/thirdapp/activity/ScenseMapActivity.java
@@ -415,7 +415,7 @@
    private void selectScense(Marker marker) {
        mSelectedScense = mShownScenseList.get(curPos);
        if (mLastPos != -1) {
        if (mLastPos != -1 && mLastPos < markerList.size()) {
            markerList.get(mLastPos).setIcon(mLastBitmapDesc);
        }
        mLastBitmapDesc = marker.getIcons().get(0);
app/src/main/java/cn/flightfeather/thirdapp/adapter/IconsPageAdapter.java
@@ -1,5 +1,6 @@
package cn.flightfeather.thirdapp.adapter;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
@@ -33,4 +34,10 @@
        return viewList.get(position);
    }
    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
//        super.destroyItem(container, position, object);
        container.removeView(viewList.get(position));
    }
}
app/src/main/java/cn/flightfeather/thirdapp/bean/entity/MediaTypeAlias.java
@@ -13,7 +13,7 @@
@Entity
public class MediaTypeAlias {
    @Id(autoincrement = true)
    private long id;
    private Long id;
    @Property
    private int sceneTypeId;
    @Property
@@ -22,8 +22,8 @@
    private String typeName;
    @Property
    private String alias;
    @Generated(hash = 1531076614)
    public MediaTypeAlias(long id, int sceneTypeId, int typeId, String typeName,
    @Generated(hash = 626593863)
    public MediaTypeAlias(Long id, int sceneTypeId, int typeId, String typeName,
            String alias) {
        this.id = id;
        this.sceneTypeId = sceneTypeId;
@@ -34,7 +34,7 @@
    @Generated(hash = 849869520)
    public MediaTypeAlias() {
    }
    public long getId() {
    public Long getId() {
        return this.id;
    }
    public void setId(long id) {
@@ -64,4 +64,7 @@
    public void setAlias(String alias) {
        this.alias = alias;
    }
    public void setId(Long id) {
        this.id = id;
    }
}
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
@@ -56,6 +56,8 @@
    private val viewList = mutableListOf<View>()
    private val listMap = mutableMapOf<MediaFileType, RecyclerView>()
    var subTask: Subtask? = null
    var inspection: Inspection? = null
    var scene: Scense? = null
@@ -181,6 +183,10 @@
                }
            }))
            if (!listMap.containsKey(type)) {
                listMap[type] = this
            }
        }
        viewList.add(view)
@@ -230,22 +236,38 @@
    }
    private fun addPhoto(mediaFile: Mediafile) {
        getDataSet(currentType).run {
            first.value?.add(mediaFile)
            second.adapter?.run {
                notifyDataSetChanged()
        if (listMap.containsKey(currentType)) {
            viewModel.fileList.value?.forEach {
                if (it.type == currentType) {
                    it.dataList.add(mediaFile)//第一个数据为拍照按钮
                    listMap[currentType]?.adapter?.notifyDataSetChanged()
            }
        }
        }
//        getDataSet(currentType).run {
//            first.value?.add(mediaFile)
//            second.adapter?.run {
//                notifyDataSetChanged()
//            }
//        }
    }
    private fun deletePhoto(pos: Int) {
        getDataSet(currentType).run {
            first.value?.removeAt(pos + 1)//第一个数据为拍照按钮
            second.adapter?.run {
                notifyDataSetChanged()
        if (listMap.containsKey(currentType)) {
            viewModel.fileList.value?.forEach {
                if (it.type == currentType) {
                    it.dataList.removeAt(pos + 1)//第一个数据为拍照按钮
                    listMap[currentType]?.adapter?.notifyDataSetChanged()
            }
        }
    }
//        getDataSet(currentType).run {
//            first.value?.removeAt(pos + 1)//第一个数据为拍照按钮
//            second.adapter?.run {
//                notifyDataSetChanged()
//            }
//        }
    }
    private fun getDataSet(type: MediaFileType) = when (type) {
        MediaFileType.RoutineRecord -> Pair(viewModel.routineRecordList, rv_photo_list_1)
app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkRecordActivity.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
package cn.flightfeather.thirdapp.module.nightwork
import android.arch.lifecycle.ViewModelProviders
import android.os.Bundle
import android.view.View
import cn.flightfeather.thirdapp.R
import cn.flightfeather.thirdapp.module.base.BaseActivity
import kotlinx.android.synthetic.main.activity_night_work.*
import kotlinx.android.synthetic.main.layout_toolbar_2.*
/**
 * @author riku
 * Date: 2020/12/24
 */
class NightWorkRecordActivity : BaseActivity(), View.OnClickListener {
    override fun getLayoutId(): Int = R.layout.activity_night_work
    lateinit var viewModel: NightWorkViewModel
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewModel = ViewModelProviders.of(this).get(NightWorkViewModel::class.java)
        initToolbar()
        initRecyclerView1()
        initRecyclerView2()
        initObserver()
    }
    private fun initToolbar() {
        img_back.setOnClickListener(this)
        tv_main_title.text = "夜间施工许可"
    }
    private fun initRecyclerView1() {
        recycler_view
    }
    private fun initRecyclerView2() {
    }
    private fun initObserver() {
    }
    override fun onClick(v: View?) {
        TODO("Not yet implemented")
    }
}
app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkViewModel.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package cn.flightfeather.thirdapp.module.nightwork
import cn.flightfeather.thirdapp.module.base.BaseViewModel
/**
 * @author riku
 * Date: 2020/12/24
 */
class NightWorkViewModel : BaseViewModel() {
}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseCustomViewHolder.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,53 @@
package cn.flightfeather.thirdapp.view.recyclerview
import android.content.res.ColorStateList
import android.os.Build
import android.support.annotation.DrawableRes
import android.support.annotation.IdRes
import android.support.annotation.RequiresApi
import android.support.design.widget.FloatingActionButton
import android.support.v4.content.ContextCompat
import android.view.View
import com.chad.library.adapter.base.BaseViewHolder
/**
 * @author riku
 * Date: 2019/4/19
 * æ‰©å±•viewHolder,之后可能添加databinding,以及扩展view的属性设置方法
 */
class BaseCustomViewHolder(view: View?) : BaseViewHolder(view) {
//    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
//    fun setBackgroundTint(@IdRes viewId: Int, colorStateList: ColorStateList?): BaseCustomViewHolder {
//        val view = getView<View>(viewId)
//        view.backgroundTintList = colorStateList
//        return this
//    }
    fun setSelected(@IdRes viewId: Int, selected: Boolean): BaseCustomViewHolder {
        val view = getView<View>(viewId)
        view.isSelected = selected
        return this
    }
    fun setClickable(@IdRes viewId: Int, clickable: Boolean): BaseCustomViewHolder {
        val view = getView<View>(viewId)
        view.isClickable = clickable
        return this
    }
//    fun setMyProgress(@IdRes viewId: Int, progress: Long, max: Long): BaseCustomViewHolder {
//        val view = getView<CircularProgressBar>(viewId)
//        view.apply {
//            this.progress = progress.toFloat()
//            this.progressMax = max.toFloat()
//        }
//        return this
//    }
    fun setMyVisible(@IdRes viewId: Int, visible: Int): BaseCustomViewHolder {
        val view = getView<View>(viewId)
        view.visibility = visible
        return this
    }
}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseRecyclerAdapter.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,115 @@
package cn.flightfeather.thirdapp.view.recyclerview
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.entity.AbstractExpandableItem
import com.chad.library.adapter.base.entity.MultiItemEntity
/**
 * @author riku
 * Date: 2019/4/18
 * recyclerView的基类adapter
 */
abstract class BaseRecyclerAdapter<T> constructor(
    layoutIdMap: Map<Int, Int>,
    sectionLayoutId: Int?,
    mData: List<MySection<T>>
) : BaseMultiItemQuickAdapter<MySection<T>, BaseCustomViewHolder>(mData) {
    companion object {
        const val SECTION_HEADER_VIEW = 0x00000444
    }
    init {
        sectionLayoutId?.let { addItemType(SECTION_HEADER_VIEW, it) }
        layoutIdMap.forEach {
            addItemType(it.key, it.value)
        }
    }
    override fun onBindViewHolder(holder: BaseCustomViewHolder, position: Int) {
        when (holder.itemViewType) {
            SECTION_HEADER_VIEW -> {
                setFullSpan(holder)
                convertHead(holder, getItem(position - headerLayoutCount))
            }
            else -> super.onBindViewHolder(holder, position)
        }
    }
    override fun onBindViewHolder(
        holder: BaseCustomViewHolder,
        position: Int,
        payloads: MutableList<Any>
    ) {
        if (payloads.isEmpty()) {
            super.onBindViewHolder(holder, position, payloads)
        } else {
            convertPartView(holder, getItem(position - headerLayoutCount), payloads)
        }
    }
    protected abstract fun convertHead(holder: BaseCustomViewHolder, item: MySection<T>?)
    //局部刷新
    protected abstract fun convertPartView(holder: BaseCustomViewHolder, item: MySection<T>?, payloads: MutableList<Any>)
//    override fun convertHead(helper: BaseCustomViewHolder?, item: MySection<T>?) {
//        convertListener?.onConvertHead(helper, item)
//    }
//
//    override fun convert(helper: BaseCustomViewHolder, item: MySection<T>?) {
//        convertListener?.onConvert(helper, item)
//    }
}
class MySection<T> : AbstractExpandableItem<MySection<T>>, MultiItemEntity {
    var mItemType: Int = DEFAULT_ITEM_TYPE
    var isHeader: Boolean = false
    var t: T
    var header: String? = null
    var myLevel = 1
    constructor (isHeader: Boolean, header: String?, t: T) {
        this.isHeader = isHeader
        this.header = header
        this.myLevel = 1
        this.mItemType = BaseRecyclerAdapter.SECTION_HEADER_VIEW
        this.t = t
    }
    constructor(t: T, mItemType: Int = DEFAULT_ITEM_TYPE, level: Int = 1) {
        this.mItemType = mItemType
        this.t = t
        this.myLevel = level
    }
    companion object {
        const val DEFAULT_ITEM_TYPE = -1
        /**
         * å°†æ™®é€šçš„list转化为SectionEntity列表
         */
        fun <T> convert2Section(list: List<T>?): ArrayList<MySection<T>> {
            val resultList = ArrayList<MySection<T>>()
            list?.forEach {
                resultList.add(MySection(it))
            }
            return resultList
        }
        /**
         * å°†SectionEntity列表转化为普通的list
         */
        fun <T> convert2List(list: List<MySection<T>>?): List<T> {
            val resultList = mutableListOf<T>()
            list?.forEach {
                resultList.add(it.t)
            }
            return resultList
        }
    }
    override fun getItemType(): Int = mItemType
    override fun getLevel(): Int = myLevel
}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/DataLoadInterface.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package cn.flightfeather.thirdapp.view.recyclerview
import cn.flightfeather.thirdapp.common.net.ResultCallBack
/**
 * @author riku
 * Date: 2020/12/24
 * åˆ—表数据加载逻辑接口
 */
interface DataLoadInterface<T> : ResultCallBack<List<T>> {
}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/LoadState.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package cn.flightfeather.thirdapp.view.recyclerview
/**
 * @author riku
 * Date: 2019/4/10
 * ä¸Šä¸‹æ‹‰åŠ è½½çŠ¶æ€
 */
enum class LoadState {
    Refresh,
    LoadMore,
    RefreshDone,
    LoadMoreEnd,
    LoadMoreComplete,
    NONE,
    RefreshFail,
    LoadMoreFail
}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewPanel.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,173 @@
//package cn.flightfeather.thirdapp.view.recyclerview
//
//import android.annotation.SuppressLint
//import android.arch.lifecycle.LifecycleOwner
//import android.arch.lifecycle.Observer
//import android.content.Context
//import android.support.v4.content.ContextCompat
//import android.support.v4.widget.SwipeRefreshLayout
//import android.support.v7.widget.LinearLayoutManager
//import android.support.v7.widget.RecyclerView
//import android.view.LayoutInflater
//import android.view.View
//import com.chad.library.adapter.base.BaseQuickAdapter
//import com.chad.library.adapter.base.BaseViewHolder
//
///**
// * RecyclerView模块
// * @author riku
// * Date: 2019/11/22
// * reference layout is [R.layout.layout_recycler_view_refresh]
// */
//abstract class RecyclerViewPanel<T>(
//        private val viewModel: BaseViewModel<T>,
//        private val lifecycleObserver: LifecycleOwner,
//        private val rootView: View? = null
//) : RecyclerViewSetInterface<T>, SwipeRefreshLayoutSetInterface {
//
//    constructor(
//            viewModel: BaseViewModel<T>,
//            lifecycleObserver: LifecycleOwner,
//            recyclerView: RecyclerView,
//            context: Context?,
//            refreshLayout: SwipeRefreshLayout? = null
//    ) : this(viewModel, lifecycleObserver) {
//        context?.let { this.context = it }
//        tempRecyclerView = recyclerView
//        this.tempRefreshLayout = refreshLayout
//    }
//
//    private lateinit var context: Context
//    private var tempRecyclerView: RecyclerView? = null
//    private var tempRefreshLayout: SwipeRefreshLayout? = null
//
//    override var adapter: BaseRecyclerAdapter<T>? = null
//
//    private var mRecyclerView: RecyclerView? = null
//
//    private var refreshLayout: SwipeRefreshLayout? = null
//
//    init {
//        if (rootView != null) {
//            this@RecyclerViewPanel.context = rootView.context
//        }
//    }
//
//    open fun init() {
//        initViews()
//        initList()
//        initSwipeRefreshLayout()
//        initObserver()
//    }
//
//    private fun initViews() {
//        mRecyclerView = rootView?.findViewById(R.id.recycler_view) ?: tempRecyclerView
//        refreshLayout = rootView?.findViewById(R.id.refresh_layout) ?: tempRefreshLayout
//    }
//
//    open fun initObserver() {
//        viewModel.loading.observe(lifecycleObserver, Observer {
//            refreshLoadingStatus(it)
//        })
//
//        viewModel.dataList.observe(lifecycleObserver, Observer { dataList ->
//            dataList?.let {
//                if (viewModel.isFirstData()) {
//                    setNewData(it)
//                } else {
//                    addData(it)
//                }
//            }
//        })
//
//        viewModel.dataChanged.observe(lifecycleObserver, Observer {
//            if (it == true) {
//                adapter?.notifyDataSetChanged()
//            }
//        })
//    }
//
//    override fun getRecyclerView(): RecyclerView? =
//            mRecyclerView ?: rootView?.findViewById(R.id.recycler_view) ?: tempRecyclerView
//
//    override fun onRefreshDone() = stopRefresh()
//    override fun onRefreshFail() = stopRefresh()
//    override fun onLoadMoreEnd() = Unit
//    override fun onLoadMoreComplete() = Unit
//    override fun onLoadMoreFail() = Unit
//    override fun onRefreshNone() = stopRefresh()
//
//    override fun getMyLayoutManager(): RecyclerView.LayoutManager =
//            LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
//
//    override fun getItemLayoutIdMap(): Map<Int, Int> = emptyMap()
//
//    override fun getSectionLayoutId(): Int = R.layout.recycler_item_section_head
//
//    override fun getSectionDataList(): List<MySection<T>> =
//            MySection.convert2Section(viewModel.dataList.value)
//
//    override fun onItemClick(
//            adapter: BaseQuickAdapter<Any?, BaseViewHolder>,
//            view: View,
//            position: Int,
//            dataList: List<T>
//    ) = Unit
//
//    override fun onItemChildClick(
//            adapter: BaseQuickAdapter<Any?, BaseViewHolder>,
//            view: View,
//            position: Int,
//            dataList: List<T>
//    ) = Unit
//
//    override fun enableLoadMore(): Boolean = true
//
//    override fun onLoadMoreStart() {
//        if (getSwipeRefreshLayout()?.isRefreshing == true) {
//            adapter?.loadMoreComplete()
//            return
//        }
//    }
//
//    override fun onLoadMoreRequested() = viewModel.loadMore()
//
//    override fun enableUpFetch(): Boolean = false
//
//    @SuppressLint("InflateParams")
//    override fun getMyEmptyView(): View? =
//            LayoutInflater.from(context).inflate(R.layout.layout_empty_view, null)
//
//    @SuppressLint("InflateParams")
//    override fun getMyLoadingView(): View? = LayoutInflater.from(context).inflate(R.layout.layout_loading_view, null)
//
//    @SuppressLint("InflateParams")
//    override fun getMyLoadFailView(): View? = LayoutInflater.from(context).inflate(R.layout.layout_load_fail_view, null)
//
//    //******************************SwipeRefreshLayout************************************************************
//
//    override fun getSwipeRefreshLayout(): SwipeRefreshLayout? =
//            refreshLayout ?: rootView?.findViewById(R.id.refresh_layout) ?: tempRefreshLayout
//
//    override fun enableRefresh(): Boolean = true
//
//    override fun needSwipeRefresh(): Boolean = true
//
//    override fun onRefreshRequested() {
//        //第三方recyclerView的上拉加载结束后,如果下拉刷新执行,则应该重新打开监听
//        try {
//            if (!adapter?.isLoadMoreEnable!!) {
//                setLoadMore()
//            }
//        } catch (e: Exception) {
//            e.printStackTrace()
//        }
//        viewModel.refresh()
//    }
//
//    override fun getColorList(): Array<Int> = arrayOf(
//            ContextCompat.getColor(context, R.color.colorPrimary),
//            ContextCompat.getColor(context, R.color.colorPrimaryDark),
//            ContextCompat.getColor(context, R.color.colorAccent)
//    )
//}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewSetInterface.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,279 @@
package cn.flightfeather.thirdapp.view.recyclerview
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
/**
 * @author riku
 * Date: 2019/5/17
 * recyclerView设置接口
 */
interface RecyclerViewSetInterface<T> {
    var adapter: BaseRecyclerAdapter<T>?
    fun getRecyclerView(): RecyclerView?
    fun initList() {
        val layoutIdMap = if (getItemLayoutId() == null) {
            getItemLayoutIdMap()
        } else {
            mapOf(Pair(MySection.DEFAULT_ITEM_TYPE, getItemLayoutId()!!))
        }
        adapter = object :
            BaseRecyclerAdapter<T>(layoutIdMap, getSectionLayoutId(), getSectionDataList()) {
            override fun convertHead(holder: BaseCustomViewHolder, item: MySection<T>?) {
                onBindSectionView(holder, item)
            }
            override fun convert(helper: BaseCustomViewHolder, item: MySection<T>?) {
                onBindView(helper, item)
            }
            override fun convertPartView(holder: BaseCustomViewHolder, item: MySection<T>?, payloads: MutableList<Any>) {
                onBindPartView(holder, item, payloads)
            }
        }.apply {
            getRecyclerView()?.let { bindToRecyclerView(it) }
            //添加header
            getHeadViews().iterator().forEach {
                addHeaderView(it)
            }
            //添加footer
            getFootViews(getRecyclerView()?.parent as ViewGroup).iterator().forEach {
                addFooterView(it, 0)
            }
            //添加item点击事件
            onItemClickListener = BaseQuickAdapter.OnItemClickListener { adapter, view, position ->
                onItemClick(adapter, view, position, getAllDataList())
            }
            onItemLongClickListener = BaseQuickAdapter.OnItemLongClickListener { adapter, view, position ->
                onItemLongClick(adapter, view, position, getAllDataList())
            }
            //添加childItem点击事件
            onItemChildClickListener = BaseQuickAdapter.OnItemChildClickListener { adapter, view, position ->
                onItemChildClick(adapter, view, position, getAllDataList())
            }
            onItemChildLongClickListener = BaseQuickAdapter.OnItemChildLongClickListener { adapter, view, position ->
                onItemChildLongClick(adapter, view, position, getAllDataList())
            }
            //添加动画
            openLoadAnimation(getLoadAnimationByDefault())
            //设置空布局
            getMyLoadingView()?.let { emptyView = it }
//            setLoadMoreView(SimpleLoadMoreView())
        }
        //加载更多
        setLoadMore()
        //下拉获取
        setUpFetch()
        getRecyclerView()?.apply {
            layoutManager = getMyLayoutManager()
            getDivider()?.let { addItemDecoration(it) }
        }?.adapter = adapter
    }
    fun setLoadMore() {
        if (enableLoadMore()) {
            adapter?.apply {
                setOnLoadMoreListener((BaseQuickAdapter.RequestLoadMoreListener {
                    onLoadMoreStart()
                    onLoadMoreRequested()
                }), getRecyclerView())
            }
        }
    }
    fun setUpFetch() {
        if (enableUpFetch()) {
            adapter?.apply {
                isUpFetchEnable = true
                setStartUpFetchPosition(0)
                setUpFetchListener {
                    isUpFetching = true
                    onUpFetchRequested(this, getRecyclerView())
                    if (!isLoadMoreEnable) {
                        setLoadMore()
                    }
                }
            }
        }
    }
    fun getAllDataList(): List<T> {
        val list = adapter?.data as List<MySection<T>>
        val datas = mutableListOf<T>()
        list.forEach {
            datas.add(it.t)
        }
        return datas
    }
    /**
     * å°†åˆ—表数据替换成新的数据
     */
    fun setNewData(dataList: ArrayList<T>) {
        val resultList = convertToSection(dataList)
        addSection(resultList)
        adapter?.setNewData(resultList)
        onDataUpdated(adapter)
    }
    /**
     * åœ¨åŽŸæ•°æ®åŸºç¡€ä¸Šæ·»åŠ æ–°æ•°æ®
     */
    fun addData(dataList: ArrayList<T>) {
        val resultList = convertToSection(dataList)
        addSection(resultList)
        adapter?.addData(resultList)
        onDataUpdated(adapter)
    }
    fun addData(pos: Int, dataList: ArrayList<T>){
        val resultList = convertToSection(dataList)
        addSection(resultList)
        adapter?.addData(pos, resultList)
        onDataUpdated(adapter, pos)
    }
    /**
     * æŒ‰ç…§æ•°æ®çŠ¶æ€åˆ·æ–°ç•Œé¢
     */
    fun refreshLoadingStatus(state: LoadState?) {
        when (state) {
            LoadState.RefreshDone -> {
                onRefreshDone()
                getMyEmptyView()?.let { adapter?.emptyView = it }
            }
            LoadState.LoadMoreEnd -> {
                onLoadMoreEnd()
                adapter?.loadMoreEnd(getLoadMoreEndGone())
                getMyEmptyView()?.let { adapter?.emptyView = it }
            }
            LoadState.LoadMoreComplete -> {
                onLoadMoreComplete()
                adapter?.loadMoreComplete()
                getMyEmptyView()?.let { adapter?.emptyView = it }
            }
            LoadState.NONE -> {
                onRefreshNone()
                adapter?.loadMoreEnd(getLoadMoreEndGone())
                getMyLoadingView()?.let { adapter?.emptyView = it }
            }
            LoadState.RefreshFail -> {
                onRefreshFail()
                getMyLoadFailView()?.let { adapter?.emptyView = it }
            }
            LoadState.LoadMoreFail -> {
                onLoadMoreFail()
                adapter?.loadMoreFail()
                getMyLoadFailView()?.let { adapter?.emptyView = it }
            }
            else -> onRefreshNone()
        }
    }
    fun onRefreshDone()
    fun onRefreshFail()
    fun onLoadMoreEnd()
    fun onLoadMoreComplete()
    fun onLoadMoreFail()
    fun onRefreshNone()
    fun getMyLayoutManager(): RecyclerView.LayoutManager
    //获取列表的itemView的ID
    fun getItemLayoutId(): Int?
    //获取列表的itemView的ID, æ ¹æ®è‡ªå®šä¹‰çš„itemType分类,实现同时展示多种item样式
    fun getItemLayoutIdMap(): Map<Int, Int>
    //获取分组头部view的ID
    fun getSectionLayoutId(): Int
    //自定义是否需要添加列表分组
    fun addSection(dataList: ArrayList<MySection<T>>) = Unit
    //将数据转换为列表能接受的固定结构
    fun convertToSection(list: ArrayList<T>): ArrayList<MySection<T>> = MySection.convert2Section(list)
    //数据更新结束
    fun onDataUpdated(adapter: BaseRecyclerAdapter<T>?, pos: Int? = null) = Unit
    //获取适配器数据结构列表
    fun getSectionDataList(): List<MySection<T>>
    //获取header的view绑定方法
    fun onBindSectionView(holder: BaseCustomViewHolder?, item: MySection<T>?) = Unit
    //获取列表item中的view绑定方法
    fun onBindView(holder: BaseCustomViewHolder, item: MySection<T>?)
    fun onBindPartView(holder: BaseCustomViewHolder, item: MySection<T>?, payloads: MutableList<Any>)= Unit
    //获取headView
    fun getHeadViews(): Array<View> = emptyArray()
    //获取footView
    fun getFootViews(viewGroup: ViewGroup): Array<View> = emptyArray()
    //item点击事件
    fun onItemClick(adapter: BaseQuickAdapter<Any?, BaseViewHolder>, view: View, position: Int, dataList: List<T>)
    //item长点击事件
    fun onItemLongClick(adapter: BaseQuickAdapter<Any?, BaseViewHolder>, view: View, position: Int, dataList: List<T>) =
        true
    //childItem点击事件
    fun onItemChildClick(adapter: BaseQuickAdapter<Any?, BaseViewHolder>, view: View, position: Int, dataList: List<T>)
    //childItem长点击事件
    fun onItemChildLongClick(adapter: BaseQuickAdapter<Any?, BaseViewHolder>, view: View, position: Int, dataList: List<T>):Boolean = true
    //入场动画
    fun getLoadAnimationByDefault(): Int = BaseQuickAdapter.ALPHAIN
    //<editor-fold desc="加载更多">
    fun enableLoadMore(): Boolean
    fun onLoadMoreStart()
    fun onLoadMoreRequested()
    //</editor-fold>
    //<editor-fold desc="下拉获取">
    fun enableUpFetch(): Boolean
    fun onUpFetchRequested(adapter: BaseRecyclerAdapter<T>, recyclerView: RecyclerView?) = Unit
    //</editor-fold>
    fun getMyLoadingView(): View? = null
    //获取空布局
    fun getMyEmptyView(): View?
    //获取空布局
    fun getMyLoadFailView(): View? = null
    //分割线
    fun getDivider(): RecyclerView.ItemDecoration? = null
    //加载完成后, åŠ è½½ç•Œé¢æ˜¯å¦æ¶ˆå¤±
    fun getLoadMoreEndGone(): Boolean = false
}
/**
 * æ‰©å±•remove æ–¹æ³•, å¯ä»¥æ ¹æ®ä¼ å…¥çš„编号列表逐个完成删除动画
 */
fun <T> BaseRecyclerAdapter<T>.remove(posList: List<Int>) {
    val tempPosList = posList.sortedBy { it }
    for (i in tempPosList.indices) {
        this.remove((tempPosList[i] - i))
    }
}
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/SwipeRefreshLayoutSetInterface.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
package cn.flightfeather.thirdapp.view.recyclerview
import android.support.v4.widget.SwipeRefreshLayout
/**
 * @author riku
 * Date: 2019/5/17
 */
interface SwipeRefreshLayoutSetInterface {
    fun initSwipeRefreshLayout(){
        //下拉刷新
        getSwipeRefreshLayout()?.let {
            it.isEnabled = needSwipeRefresh()
            if (getColorList().size == 3) {
                it.setColorSchemeColors(getColorList()[0], getColorList()[1], getColorList()[2])
            }
            it.setOnRefreshListener {
                onRefreshRequested()
                it.postDelayed({
                    it.isRefreshing = false
                }, 10000)
            }
        }
    }
    fun startRefresh(){
        if (enableRefresh()) {
            onRefreshRequested()
            if (needSwipeRefresh()) {
                getSwipeRefreshLayout()?.let {
                    it.isRefreshing = true
                    it.postDelayed({
                        it.isRefreshing = false
                    }, 10000)
                }
            }
        }
    }
    fun stopRefresh(){
        if (enableRefresh()) {
            if (getSwipeRefreshLayout()?.isRefreshing == true) {
                getSwipeRefreshLayout()?.isRefreshing = false
            }
        }
    }
    fun getSwipeRefreshLayout(): SwipeRefreshLayout?
    //是否允许默认第一次自动刷新
    fun enableRefresh(): Boolean
    //启用layout动画效果的下拉刷新,能够手动刷新
    fun needSwipeRefresh():Boolean
    fun onRefreshRequested()
    fun getColorList(): Array<Int>
}
app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java
@@ -24,7 +24,7 @@
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, long.class, "id", true, "_id");
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property SceneTypeId = new Property(1, int.class, "sceneTypeId", false, "SCENE_TYPE_ID");
        public final static Property TypeId = new Property(2, int.class, "typeId", false, "TYPE_ID");
        public final static Property TypeName = new Property(3, String.class, "typeName", false, "TYPE_NAME");
@@ -44,7 +44,7 @@
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"MEDIA_TYPE_ALIAS\" (" + //
                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ," + // 0: id
                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
                "\"SCENE_TYPE_ID\" INTEGER NOT NULL ," + // 1: sceneTypeId
                "\"TYPE_ID\" INTEGER NOT NULL ," + // 2: typeId
                "\"TYPE_NAME\" TEXT," + // 3: typeName
@@ -60,7 +60,11 @@
    @Override
    protected final void bindValues(DatabaseStatement stmt, MediaTypeAlias entity) {
        stmt.clearBindings();
        stmt.bindLong(1, entity.getId());
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
        stmt.bindLong(2, entity.getSceneTypeId());
        stmt.bindLong(3, entity.getTypeId());
 
@@ -78,7 +82,11 @@
    @Override
    protected final void bindValues(SQLiteStatement stmt, MediaTypeAlias entity) {
        stmt.clearBindings();
        stmt.bindLong(1, entity.getId());
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
        stmt.bindLong(2, entity.getSceneTypeId());
        stmt.bindLong(3, entity.getTypeId());
 
@@ -95,13 +103,13 @@
    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.getLong(offset + 0);
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    
    @Override
    public MediaTypeAlias readEntity(Cursor cursor, int offset) {
        MediaTypeAlias entity = new MediaTypeAlias( //
            cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.getInt(offset + 1), // sceneTypeId
            cursor.getInt(offset + 2), // typeId
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // typeName
@@ -112,7 +120,7 @@
     
    @Override
    public void readEntity(Cursor cursor, MediaTypeAlias entity, int offset) {
        entity.setId(cursor.getLong(offset + 0));
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setSceneTypeId(cursor.getInt(offset + 1));
        entity.setTypeId(cursor.getInt(offset + 2));
        entity.setTypeName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
@@ -136,7 +144,7 @@
    @Override
    public boolean hasKey(MediaTypeAlias entity) {
        throw new UnsupportedOperationException("Unsupported for entities with a non-null key");
        return entity.getId() != null;
    }
    @Override
app/src/main/res/drawable/bg_layerlist_1.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:tools="http://schemas.android.com/tools"
            xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <gradient
                android:angle="-90"
                android:startColor="#FDAC43"
                android:centerColor="#FECD8B"
                android:endColor="@color/white"/>
        </shape>
    </item>
    <item android:bottom="46dp"
        android:end="46dp">
        <shape android:shape="oval"
            android:tint="#FECD8B">
        </shape>
    </item>
</layer-list>
app/src/main/res/layout/activity_night_work.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,90 @@
<?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:orientation="vertical"
    android:background="@color/white">
    <include layout="@layout/layout_toolbar_2" />
    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <TextView
                android:id="@+id/txt_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dimen16"
                android:layout_marginStart="@dimen/dimen16"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                android:textColor="@color/main_color_1"
                android:textStyle="bold"
                android:textSize="@dimen/textSize_18"
                android:text="最新文件"/>
            <TextView
                android:id="@+id/txt_more"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/dimen16"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintBottom_toBottomOf="@id/txt_title"
                android:text="更多"/>
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                tools:listitem="@layout/item_night_work"
                tools:itemCount="2"
                app:layoutManager="android.support.v7.widget.LinearLayoutManager"
                android:orientation="horizontal"
                android:layout_marginStart="@dimen/dimen16"
                android:layout_marginTop="@dimen/dimen16"
                app:layout_constraintTop_toBottomOf="@id/txt_title"/>
            <TextView
                android:id="@+id/txt_history"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/dimen16"
                android:layout_marginTop="@dimen/dimen16"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/recycler_view"
                android:textColor="@color/main_color_1"
                android:textStyle="bold"
                android:textSize="@dimen/textSize_18"
                android:text="历史文件"/>
            <TextView
                android:id="@+id/txt_more_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/dimen16"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintBottom_toBottomOf="@id/txt_history"
                android:text="更多"/>
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view_2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dimen16"
                android:layout_marginStart="@dimen/dimen16"
                android:layout_marginEnd="@dimen/dimen16"
                app:layout_constraintTop_toBottomOf="@id/txt_history"
                tools:listitem="@layout/item_night_work_2"
                tools:itemCount="6"
                app:layoutManager="android.support.v7.widget.LinearLayoutManager"
                android:orientation="vertical"/>
        </android.support.constraint.ConstraintLayout>
    </android.support.v4.widget.NestedScrollView>
</LinearLayout>
app/src/main/res/layout/item_night_work.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.card.MaterialCardView
    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:orientation="horizontal"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    app:cardCornerRadius="@dimen/dimen16"
    app:cardBackgroundColor="@color/white"
    android:layout_marginEnd="@dimen/dimen16"
    android:layout_marginBottom="@dimen/dimen4">
    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/transparent"
        android:padding="@dimen/dimen16"
        android:elevation="@dimen/dimen2"
        tools:ignore="UnusedAttribute">
        <TextView
            android:id="@+id/txt_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextStyle.Category"
            android:text="文件编号"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"/>
        <TextView
            android:id="@+id/txt_night_work_num"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            tools:text="夜间许可证编号"
            style="@style/TextStyle.Category.Item"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/txt_1"/>
        <TextView
            android:id="@+id/txt_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextStyle.Category"
            android:text="施工内容"
            android:layout_marginTop="@dimen/dimen16"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/txt_night_work_num"/>
        <TextView
            android:id="@+id/txt_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextStyle.Category.Item"
            tools:text="施工内容"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/txt_2"/>
        <TextView
            android:id="@+id/txt_3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextStyle.Category"
            android:text="施工时间"
            android:layout_marginTop="@dimen/dimen16"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/txt_content"/>
        <TextView
            android:id="@+id/txt_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextStyle.Category.Item"
            tools:text="2020.12.01-12.03"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/txt_3"/>
    </android.support.constraint.ConstraintLayout>
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="160dp"
        android:src="@mipmap/ic_file"
        android:layout_gravity="bottom|end"
        android:layout_marginTop="150dp"
        app:layout_constraintTop_toBottomOf="@id/txt_time"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"/>
</android.support.design.card.MaterialCardView>
app/src/main/res/layout/item_night_work_2.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="@dimen/dimen8"
    android:paddingBottom="@dimen/dimen8">
    <ImageView
        android:id="@+id/img_icon"
        android:layout_width="46dp"
        android:layout_height="46dp"
        android:src="@drawable/button_bg_enable_2"
        android:tint="#1C1E33"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>
    <TextView
        android:id="@+id/txt_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/TextStyle.Category"
        android:textColor="@color/main_color_1"
        android:text="施工内容"
        android:visibility="gone"
        android:layout_marginStart="@dimen/dimen16"
        app:layout_constraintStart_toEndOf="@id/img_icon"
        app:layout_constraintTop_toTopOf="parent"/>
    <TextView
        android:id="@+id/txt_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/TextStyle.Category.Item"
        android:textColor="@color/main_color_1"
        tools:text="施工内容"
        android:layout_marginStart="@dimen/dimen16"
        app:layout_constraintStart_toEndOf="@id/img_icon"
        app:layout_constraintTop_toBottomOf="@id/txt_1"/>
    <TextView
        android:id="@+id/txt_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/TextStyle.Category"
        android:textColor="@color/main_color_1"
        android:text="施工时间"
        android:visibility="gone"
        android:layout_marginTop="@dimen/dimen16"
        app:layout_constraintStart_toStartOf="@id/txt_time"
        app:layout_constraintTop_toBottomOf="@id/txt_time"/>
    <TextView
        android:id="@+id/txt_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/TextStyle.Category"
        android:textColor="@color/main_color_1"
        tools:text="2020.12.01-12.03"
        app:layout_constraintStart_toStartOf="@id/txt_time"
        app:layout_constraintTop_toBottomOf="@id/txt_2"
        app:layout_constraintBottom_toBottomOf="@id/img_icon"
        app:layout_constraintVertical_bias="1"/>
</android.support.constraint.ConstraintLayout>
app/src/main/res/layout/layout_toolbar_2.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/actionbarHeight"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/toolbar"
    app:contentInsetStart="0dp"
    android:background="@color/transparent">
    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="visible">
        <ImageView
            android:id="@+id/img_back"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:padding="@dimen/dimen8"
            android:src="@drawable/ic_menu_back"
            android:tint="#1C1E33"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"/>
        <TextView
            android:id="@+id/tv_main_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            android:textColor="#1C1E33"
            style="@style/ToolbarTitleStyle"
            tools:text="标题"/>
    </android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>
app/src/main/res/mipmap-xhdpi/ic_file.png
app/src/main/res/values/styles.xml
@@ -23,6 +23,17 @@
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
    <!--标题栏标题文字样式-->
    <style name="ToolbarTitleStyle">
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">16sp</item>
        <item name="android:maxLines">1</item>
        <item name="android:ellipsize">end</item>
        <item name="layout_constrainedWidth">true</item>
        <item name="layout_constraintWidth_percent">0.8</item>
        <item name="android:gravity">center</item>
    </style>
    <!--设置-->
    <style name="settingItemStyle">
        <item name="item_text_size">5sp</item>
@@ -224,4 +235,15 @@
        <item name="android:windowEnterAnimation">@anim/bottom_menu_enter</item>
        <item name="android:windowExitAnimation">@anim/bottom_menu_exit</item>
    </style>
    <style name="TextStyle.Category">
        <item name="android:textSize">@dimen/textSize_notes</item>
        <item name="android:textColor">@color/main_color_3</item>
    </style>
    <style name="TextStyle.Category.Item">
        <item name="android:textSize">@dimen/textSize_16</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/main_color_1</item>
    </style>
</resources>
build.gradle
@@ -7,6 +7,7 @@
    ext.event_bus = '3.1.1'
    ext.image_picker_version = '2.2.7'
    ext.glide_version = '4.9.0'
    ext.adaper_version = '2.9.46'
    repositories {
        jcenter()