From 7be66bc9663c1106ebc78748dc22f394680ac86b Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 29 十二月 2020 09:57:09 +0800
Subject: [PATCH] 1. 修复场景地图界面选择场景点时可能由于列表下标越界导致崩溃问题; 2. 修复自定义PagerAdapter时,没有重写destroyItem可能会导致的崩溃问题; 3. 修改数据库实体类MediaTypeAlias的主键id类型从龙变更为Long,否则无法自增; 4. 新增部分列表相关的工具函数;
---
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt | 38 +
app/src/main/res/layout/activity_night_work.xml | 90 ++++
app/src/main/res/layout/layout_toolbar_2.xml | 41 ++
app/src/main/res/values/styles.xml | 22 +
app/src/main/res/layout/item_night_work_2.xml | 69 +++
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseRecyclerAdapter.kt | 115 +++++
app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkRecordActivity.kt | 50 ++
app/src/main/res/mipmap-xhdpi/ic_file.png | 0
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewPanel.kt | 173 ++++++++
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewSetInterface.kt | 279 +++++++++++++
app/src/main/res/layout/item_night_work.xml | 90 ++++
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseCustomViewHolder.kt | 53 ++
app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java | 24
app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkViewModel.kt | 11
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/SwipeRefreshLayoutSetInterface.kt | 61 +++
build.gradle | 1
app/src/main/java/cn/flightfeather/thirdapp/activity/ScenseMapActivity.java | 2
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/LoadState.kt | 17
app/src/main/java/cn/flightfeather/thirdapp/adapter/IconsPageAdapter.java | 7
app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/DataLoadInterface.kt | 12
app/src/main/res/drawable/bg_layerlist_1.xml | 20 +
app/src/main/java/cn/flightfeather/thirdapp/bean/entity/MediaTypeAlias.java | 11
app/build.gradle | 7
23 files changed, 1,170 insertions(+), 23 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index fdba244..eeda49f 100644
--- a/app/build.gradle
+++ b/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}"
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/activity/ScenseMapActivity.java b/app/src/main/java/cn/flightfeather/thirdapp/activity/ScenseMapActivity.java
index c7a3198..abc30b9 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/activity/ScenseMapActivity.java
+++ b/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);
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/adapter/IconsPageAdapter.java b/app/src/main/java/cn/flightfeather/thirdapp/adapter/IconsPageAdapter.java
index 58292bb..6c13d30 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/adapter/IconsPageAdapter.java
+++ b/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));
+ }
}
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/bean/entity/MediaTypeAlias.java b/app/src/main/java/cn/flightfeather/thirdapp/bean/entity/MediaTypeAlias.java
index dcd8706..c671f5b 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/bean/entity/MediaTypeAlias.java
+++ b/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;
+ }
}
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
index f6e86cb..59f991a 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
+++ b/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,21 +236,37 @@
}
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) {
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkRecordActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkRecordActivity.kt
new file mode 100644
index 0000000..3872ef9
--- /dev/null
+++ b/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")
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/nightwork/NightWorkViewModel.kt
new file mode 100644
index 0000000..fc21fcc
--- /dev/null
+++ b/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() {
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseCustomViewHolder.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseCustomViewHolder.kt
new file mode 100644
index 0000000..0eaa4ae
--- /dev/null
+++ b/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锛屼互鍙婃墿灞晇iew鐨勫睘鎬ц缃柟娉�
+ */
+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
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseRecyclerAdapter.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/BaseRecyclerAdapter.kt
new file mode 100644
index 0000000..7c68f60
--- /dev/null
+++ b/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鐨勫熀绫籥dapter
+ */
+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杞寲涓篠ectionEntity鍒楄〃
+ */
+ fun <T> convert2Section(list: List<T>?): ArrayList<MySection<T>> {
+ val resultList = ArrayList<MySection<T>>()
+ list?.forEach {
+ resultList.add(MySection(it))
+ }
+ return resultList
+ }
+
+ /**
+ * 灏哠ectionEntity鍒楄〃杞寲涓烘櫘閫氱殑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
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/DataLoadInterface.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/DataLoadInterface.kt
new file mode 100644
index 0000000..4a0972b
--- /dev/null
+++ b/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>> {
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/LoadState.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/LoadState.kt
new file mode 100644
index 0000000..d1c11ec
--- /dev/null
+++ b/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
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewPanel.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewPanel.kt
new file mode 100644
index 0000000..4ae13fb
--- /dev/null
+++ b/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() {
+// //绗笁鏂箁ecyclerView鐨勪笂鎷夊姞杞界粨鏉熷悗锛屽鏋滀笅鎷夊埛鏂版墽琛岋紝鍒欏簲璇ラ噸鏂版墦寮�鐩戝惉
+// 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)
+// )
+//}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewSetInterface.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/RecyclerViewSetInterface.kt
new file mode 100644
index 0000000..6025ae3
--- /dev/null
+++ b/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
+
+ //鑾峰彇鍒楄〃鐨刬temView鐨処D
+ fun getItemLayoutId(): Int?
+
+ //鑾峰彇鍒楄〃鐨刬temView鐨処D, 鏍规嵁鑷畾涔夌殑itemType鍒嗙被锛屽疄鐜板悓鏃跺睍绀哄绉峣tem鏍峰紡
+ fun getItemLayoutIdMap(): Map<Int, Int>
+
+ //鑾峰彇鍒嗙粍澶撮儴view鐨処D
+ 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鐨剉iew缁戝畾鏂规硶
+ 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))
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/SwipeRefreshLayoutSetInterface.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/recyclerview/SwipeRefreshLayoutSetInterface.kt
new file mode 100644
index 0000000..387811e
--- /dev/null
+++ b/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>
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java b/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java
index ed9b1ce..19a66bb 100644
--- a/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java
+++ b/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
diff --git a/app/src/main/res/drawable/bg_layerlist_1.xml b/app/src/main/res/drawable/bg_layerlist_1.xml
new file mode 100644
index 0000000..cb0261b
--- /dev/null
+++ b/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>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_night_work.xml b/app/src/main/res/layout/activity_night_work.xml
new file mode 100644
index 0000000..7f63f68
--- /dev/null
+++ b/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>
diff --git a/app/src/main/res/layout/item_night_work.xml b/app/src/main/res/layout/item_night_work.xml
new file mode 100644
index 0000000..661068b
--- /dev/null
+++ b/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>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_night_work_2.xml b/app/src/main/res/layout/item_night_work_2.xml
new file mode 100644
index 0000000..8f32848
--- /dev/null
+++ b/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>
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_toolbar_2.xml b/app/src/main/res/layout/layout_toolbar_2.xml
new file mode 100644
index 0000000..0323d3d
--- /dev/null
+++ b/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>
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-xhdpi/ic_file.png b/app/src/main/res/mipmap-xhdpi/ic_file.png
new file mode 100644
index 0000000..213ed9d
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/ic_file.png
Binary files differ
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 39d7c7d..bb60abd 100644
--- a/app/src/main/res/values/styles.xml
+++ b/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>
diff --git a/build.gradle b/build.gradle
index adde915..1ad50e8 100644
--- a/build.gradle
+++ b/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()
--
Gitblit v1.9.3