Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
juliao
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
胡尚
juliao
Commits
b8abd43f
提交
b8abd43f
authored
11月 27, 2023
作者:
enjoy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化INIT
上级
5fd99792
隐藏空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
612 行增加
和
13 行删除
+612
-13
GeneralPagingAdapter.kt
...va/com/work/provide_origin/origin/GeneralPagingAdapter.kt
+1
-1
GeneralVMActivity.kt
.../java/com/work/provide_origin/origin/GeneralVMActivity.kt
+8
-0
IApp.kt
provide_tool/src/main/java/com/work/provide_tool/app/IApp.kt
+1
-0
TalkDb.kt
...c/main/java/com/work/provide_tool/apppri/dataro/TalkDb.kt
+4
-2
InterflowDao.kt
...a/com/work/provide_tool/apppri/dataro/dao/InterflowDao.kt
+33
-0
FriendEntity.kt
...om/work/provide_tool/apppri/dataro/entity/FriendEntity.kt
+31
-1
InterflowEntity.kt
...work/provide_tool/apppri/dataro/entity/InterflowEntity.kt
+39
-0
general.kt
...rc/main/java/com/work/provide_tool/apppri/util/general.kt
+3
-2
Util.kt
...ide_tool/src/main/java/com/work/provide_tool/util/Util.kt
+36
-0
colors.xml
provide_tool/src/main/res/values/colors.xml
+3
-0
AndroidManifest.xml
widget_onepage/src/main/AndroidManifest.xml
+4
-0
FriendAdapter.kt
...ain/java/com/juling/work_onepage/adapter/FriendAdapter.kt
+1
-1
InterflowAdapter.kt
.../java/com/juling/work_onepage/adapter/InterflowAdapter.kt
+96
-0
InterflowDataSou.kt
...n/java/com/juling/work_onepage/paging/InterflowDataSou.kt
+21
-0
InterflowRepository.kt
...ava/com/juling/work_onepage/paging/InterflowRepository.kt
+23
-0
FriendFragment.kt
...rc/main/java/com/juling/work_onepage/ui/FriendFragment.kt
+4
-4
InterflowActivity.kt
...main/java/com/juling/work_onepage/ui/InterflowActivity.kt
+84
-0
general.kt
...age/src/main/java/com/juling/work_onepage/util/general.kt
+4
-0
FriendModel.kt
...src/main/java/com/juling/work_onepage/work/FriendModel.kt
+1
-1
FriendViewModel.kt
...main/java/com/juling/work_onepage/work/FriendViewModel.kt
+1
-1
InterflowModel.kt
.../main/java/com/juling/work_onepage/work/InterflowModel.kt
+10
-0
InterflowViewModel.kt
...n/java/com/juling/work_onepage/work/InterflowViewModel.kt
+10
-0
interflow_word.xml
widget_onepage/src/main/res/drawable/interflow_word.xml
+8
-0
activity_interflow.xml
widget_onepage/src/main/res/layout/activity_interflow.xml
+37
-0
widget_interflow.xml
widget_onepage/src/main/res/layout/widget_interflow.xml
+16
-0
widget_interflow_at.xml
widget_onepage/src/main/res/layout/widget_interflow_at.xml
+11
-0
widget_interflow_draw.xml
widget_onepage/src/main/res/layout/widget_interflow_draw.xml
+11
-0
widget_interflow_draw_with_u.xml
...page/src/main/res/layout/widget_interflow_draw_with_u.xml
+11
-0
widget_interflow_word.xml
widget_onepage/src/main/res/layout/widget_interflow_word.xml
+50
-0
widget_interflow_word_with_u.xml
...page/src/main/res/layout/widget_interflow_word_with_u.xml
+50
-0
没有找到文件。
provide_origin/src/main/java/com/work/provide_origin/origin/GeneralPagingAdapter.kt
浏览文件 @
b8abd43f
...
@@ -13,7 +13,7 @@ import kotlinx.coroutines.CoroutineDispatcher
...
@@ -13,7 +13,7 @@ import kotlinx.coroutines.CoroutineDispatcher
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
abstract
class
GeneralPagingAdapter
<
T
:
Any
,
V
:
ViewBinding
>(
abstract
class
GeneralPagingAdapter
<
T
:
Any
,
V
:
ViewBinding
>(
pr
ivate
val
context
:
Context
,
pr
otected
val
context
:
Context
,
diffCallback
:
DiffUtil
.
ItemCallback
<
T
>,
diffCallback
:
DiffUtil
.
ItemCallback
<
T
>,
mainDispatcher
:
CoroutineDispatcher
=
Dispatchers
.
Main
,
mainDispatcher
:
CoroutineDispatcher
=
Dispatchers
.
Main
,
workerDispatcher
:
CoroutineDispatcher
=
Dispatchers
.
Default
):
PagingDataAdapter
<
T
,
GeneralPagingAdapter
.
Holder
<
V
>>(
workerDispatcher
:
CoroutineDispatcher
=
Dispatchers
.
Default
):
PagingDataAdapter
<
T
,
GeneralPagingAdapter
.
Holder
<
V
>>(
...
...
provide_origin/src/main/java/com/work/provide_origin/origin/GeneralVMActivity.kt
浏览文件 @
b8abd43f
...
@@ -48,6 +48,14 @@ abstract class GeneralVMActivity<VM : GeneralViewModel>:AppCompatActivity() {
...
@@ -48,6 +48,14 @@ abstract class GeneralVMActivity<VM : GeneralViewModel>:AppCompatActivity() {
}
}
}
}
protected
fun
getLeftView
():
View
{
return
activityGeneralBinding
.
includeGeneralTitle
.
findViewById
(
R
.
id
.
free_iv
)
}
protected
fun
getTitleView
():
TextView
{
return
activityGeneralBinding
.
includeGeneralTitle
.
findViewById
(
R
.
id
.
title
)
}
protected
fun
setTitleNa
(
value
:
String
){
protected
fun
setTitleNa
(
value
:
String
){
activityGeneralBinding
.
includeGeneralTitle
.
findViewById
<
TextView
>(
R
.
id
.
title
).
run
{
activityGeneralBinding
.
includeGeneralTitle
.
findViewById
<
TextView
>(
R
.
id
.
title
).
run
{
text
=
value
text
=
value
...
...
provide_tool/src/main/java/com/work/provide_tool/app/IApp.kt
浏览文件 @
b8abd43f
...
@@ -11,6 +11,7 @@ import com.work.provide_tool.util.AppActivityLeader
...
@@ -11,6 +11,7 @@ import com.work.provide_tool.util.AppActivityLeader
abstract
class
IApp
:
Application
()
{
abstract
class
IApp
:
Application
()
{
companion
object
{
companion
object
{
lateinit
var
app
:
Application
lateinit
var
app
:
Application
val
widthAppDesgin
=
375
}
}
override
fun
onCreate
()
{
override
fun
onCreate
()
{
...
...
provide_tool/src/main/java/com/work/provide_tool/apppri/dataro/TalkDb.kt
浏览文件 @
b8abd43f
...
@@ -5,17 +5,19 @@ import androidx.room.Room
...
@@ -5,17 +5,19 @@ import androidx.room.Room
import
androidx.room.RoomDatabase
import
androidx.room.RoomDatabase
import
com.work.provide_tool.app.IApp.Companion.app
import
com.work.provide_tool.app.IApp.Companion.app
import
com.work.provide_tool.apppri.dataro.dao.FriendDao
import
com.work.provide_tool.apppri.dataro.dao.FriendDao
import
com.work.provide_tool.apppri.dataro.dao.InterflowDao
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
import
com.work.provide_tool.apppri.dataro.entity.InterflowEntity
@Database
(
@Database
(
entities
=
[
FriendEntity
::
class
],
entities
=
[
FriendEntity
::
class
,
InterflowEntity
::
class
],
version
=
1
,
version
=
1
,
exportSchema
=
false
exportSchema
=
false
)
)
//@TypeConverters(value = [TypeConverterData::class])
//@TypeConverters(value = [TypeConverterData::class])
abstract
class
TalkDb
:
RoomDatabase
(){
abstract
class
TalkDb
:
RoomDatabase
(){
abstract
fun
getFriendDao
():
FriendDao
abstract
fun
getFriendDao
():
FriendDao
// abstract fun getPlayDataDao():PlayerData
Dao
abstract
fun
getInterflowDao
():
Interflow
Dao
// abstract fun getNotePVPDao():NotePVPDao
// abstract fun getNotePVPDao():NotePVPDao
companion
object
{
companion
object
{
...
...
provide_tool/src/main/java/com/work/provide_tool/apppri/dataro/dao/InterflowDao.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.work.provide_tool.apppri.dataro.dao
import
androidx.paging.PagingSource
import
androidx.room.Dao
import
androidx.room.Delete
import
androidx.room.Insert
import
androidx.room.Query
import
androidx.room.Update
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
import
com.work.provide_tool.apppri.dataro.entity.InterflowEntity
@Dao
interface
InterflowDao
{
@Insert
fun
insertInterflowData
(
notePVPDataEntity
:
InterflowEntity
)
@Update
fun
updateInterflowData
(
vararg
notePVPDataEntity
:
InterflowEntity
)
@Query
(
"SELECT * FROM interflow order by interId"
)
fun
queryInterflowData
():
PagingSource
<
Int
,
InterflowEntity
>
@Query
(
"SELECT * FROM interflow where id=:rId order by interId"
)
fun
queryInterflowDataWithLt
(
rId
:
Long
):
List
<
InterflowEntity
>?
@Delete
fun
delInterflowData
(
notePVPDataEntity
:
InterflowEntity
)
@Insert
fun
insertAll
(
vararg
notePVPDataEntity
:
InterflowEntity
)
}
\ No newline at end of file
provide_tool/src/main/java/com/work/provide_tool/apppri/dataro/entity/FriendEntity.kt
浏览文件 @
b8abd43f
package
com.work.provide_tool.apppri.dataro.entity
package
com.work.provide_tool.apppri.dataro.entity
import
android.os.Parcel
import
android.os.Parcelable
import
androidx.room.Entity
import
androidx.room.Entity
import
androidx.room.PrimaryKey
import
androidx.room.PrimaryKey
@Entity
(
tableName
=
"friend"
)
@Entity
(
tableName
=
"friend"
)
data class
FriendEntity
(
var
id
:
Int
,
var
na
:
String
){
data class
FriendEntity
(
var
id
:
Int
,
var
na
:
String
)
:
Parcelable
{
@PrimaryKey
var
fId
:
Long
?
=
null
@PrimaryKey
var
fId
:
Long
?
=
null
constructor
(
parcel
:
Parcel
)
:
this
(
parcel
.
readInt
(),
parcel
.
readString
()
!!
)
{
fId
=
parcel
.
readValue
(
Long
::
class
.
java
.
classLoader
)
as
?
Long
}
override
fun
writeToParcel
(
parcel
:
Parcel
,
flags
:
Int
)
{
parcel
.
writeInt
(
id
)
parcel
.
writeString
(
na
)
parcel
.
writeValue
(
fId
)
}
override
fun
describeContents
():
Int
{
return
0
}
companion
object
CREATOR
:
Parcelable
.
Creator
<
FriendEntity
>
{
override
fun
createFromParcel
(
parcel
:
Parcel
):
FriendEntity
{
return
FriendEntity
(
parcel
)
}
override
fun
newArray
(
size
:
Int
):
Array
<
FriendEntity
?>
{
return
arrayOfNulls
(
size
)
}
}
}
}
\ No newline at end of file
provide_tool/src/main/java/com/work/provide_tool/apppri/dataro/entity/InterflowEntity.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.work.provide_tool.apppri.dataro.entity
import
android.os.Parcel
import
android.os.Parcelable
import
androidx.room.Entity
import
androidx.room.PrimaryKey
@Entity
(
tableName
=
"interflow"
)
data class
InterflowEntity
(
var
id
:
Int
,
var
what
:
String
):
Parcelable
{
@PrimaryKey
var
interId
:
Long
?
=
null
constructor
(
parcel
:
Parcel
)
:
this
(
parcel
.
readInt
(),
parcel
.
readString
()
!!
)
{
interId
=
parcel
.
readValue
(
Long
::
class
.
java
.
classLoader
)
as
?
Long
}
override
fun
writeToParcel
(
parcel
:
Parcel
,
flags
:
Int
)
{
parcel
.
writeInt
(
id
)
parcel
.
writeString
(
what
)
parcel
.
writeValue
(
interId
)
}
override
fun
describeContents
():
Int
{
return
0
}
companion
object
CREATOR
:
Parcelable
.
Creator
<
InterflowEntity
>
{
override
fun
createFromParcel
(
parcel
:
Parcel
):
InterflowEntity
{
return
InterflowEntity
(
parcel
)
}
override
fun
newArray
(
size
:
Int
):
Array
<
InterflowEntity
?>
{
return
arrayOfNulls
(
size
)
}
}
}
\ No newline at end of file
provide_tool/src/main/java/com/work/provide_tool/apppri/util/general.kt
浏览文件 @
b8abd43f
package
com.work.provide_tool.apppri.util
package
com.work.provide_tool.apppri.util
var
REF_KEY_TALK
=
"com.juling.work_onepage.ui.FriendModel"
var
REF_KEY_TALK
=
"com.juling.work_onepage.work.FriendModel"
\ No newline at end of file
var
REF_KEY_INTERFLOW
=
"com.juling.work_onepage.work.InterflowModel"
\ No newline at end of file
provide_tool/src/main/java/com/work/provide_tool/util/Util.kt
浏览文件 @
b8abd43f
package
com.work.provide_tool.util
package
com.work.provide_tool.util
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.content.Context
import
android.util.DisplayMetrics
import
android.widget.ImageView
import
android.widget.ImageView
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.lifecycle.LifecycleOwner
import
androidx.lifecycle.LifecycleOwner
...
@@ -12,6 +14,8 @@ import com.work.provide_tool.app.IApp.Companion.app
...
@@ -12,6 +14,8 @@ import com.work.provide_tool.app.IApp.Companion.app
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.async
import
kotlinx.coroutines.async
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
//import kotlinx.coroutines.withContext
//import kotlinx.coroutines.withContext
...
@@ -113,3 +117,35 @@ private fun glideGeneralOption(url:Any?,iv:ImageView?,requestOptions:RequestOpti
...
@@ -113,3 +117,35 @@ private fun glideGeneralOption(url:Any?,iv:ImageView?,requestOptions:RequestOpti
}
}
//-----------------------------------------/Glide----------------------------------------------
//-----------------------------------------/Glide----------------------------------------------
//-----------------------------------------屏宽高-----------------------------------------
/**
*
* @param tag 1:宽 2:高
*/
fun
getTotalPhoneWithHW
(
tag
:
Int
):
Int
{
val
displayMetrics
:
DisplayMetrics
=
app
.
resources
.
displayMetrics
val
widthPixels
=
displayMetrics
.
widthPixels
//当前屏幕宽
val
heightPixels
=
displayMetrics
.
heightPixels
//当前屏幕高
return
if
(
tag
==
1
)
widthPixels
else
heightPixels
}
fun
dp2Px
(
context
:
Context
,
dp
:
Float
):
Int
{
val
scale
=
context
.
resources
.
displayMetrics
.
density
return
(
dp
*
scale
+
0.5f
).
toInt
()
}
fun
px2Dp
(
context
:
Context
,
px
:
Float
):
Int
{
val
scale
=
context
.
resources
.
displayMetrics
.
density
return
(
px
/
scale
+
0.5f
).
toInt
()
}
fun
px2sp
(
context
:
Context
,
pxValue
:
Float
):
Int
{
val
fontScale
=
context
.
resources
.
displayMetrics
.
scaledDensity
return
(
pxValue
/
fontScale
+
0.5f
).
toInt
()
}
fun
sp2Px
(
context
:
Context
,
spValue
:
Float
):
Int
{
val
fontScale
=
context
.
resources
.
displayMetrics
.
scaledDensity
return
(
spValue
*
fontScale
+
0.5f
).
toInt
()
}
//-----------------------------------------/屏宽高-----------------------------------------
provide_tool/src/main/res/values/colors.xml
浏览文件 @
b8abd43f
...
@@ -13,4 +13,6 @@
...
@@ -13,4 +13,6 @@
<color
name=
"color_101010"
>
#101010
</color>
<color
name=
"color_101010"
>
#101010
</color>
<color
name=
"color_B7B6B6"
>
#B7B6B6
</color>
<color
name=
"color_B7B6B6"
>
#B7B6B6
</color>
<color
name=
"color_ff5959"
>
#ff5959
</color>
<color
name=
"color_ff5959"
>
#ff5959
</color>
<color
name=
"color_AAAAAA"
>
#AAAAAA
</color>
<color
name=
"color_ECECEC"
>
#ECECEC
</color>
</resources>
</resources>
\ No newline at end of file
widget_onepage/src/main/AndroidManifest.xml
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<application>
<activity
android:name=
"com.juling.work_onepage.ui.InterflowActivity"
/>
</application>
</manifest>
</manifest>
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/
ui
/FriendAdapter.kt
→
widget_onepage/src/main/java/com/juling/work_onepage/
adapter
/FriendAdapter.kt
浏览文件 @
b8abd43f
package
com.juling.work_onepage.
ui
package
com.juling.work_onepage.
adapter
import
android.content.Context
import
android.content.Context
import
androidx.recyclerview.widget.DiffUtil
import
androidx.recyclerview.widget.DiffUtil
...
...
widget_onepage/src/main/java/com/juling/work_onepage/adapter/InterflowAdapter.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.adapter
import
android.content.Context
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.databinding.DataBindingUtil
import
androidx.recyclerview.widget.DiffUtil
import
com.juling.work_onepage.R
import
com.juling.work_onepage.databinding.WidgetInterflowAtBinding
import
com.juling.work_onepage.databinding.WidgetInterflowBinding
import
com.juling.work_onepage.databinding.WidgetInterflowDrawBinding
import
com.juling.work_onepage.databinding.WidgetInterflowDrawWithUBinding
import
com.juling.work_onepage.databinding.WidgetInterflowWordBinding
import
com.juling.work_onepage.databinding.WidgetInterflowWordWithUBinding
import
com.work.provide_origin.origin.GeneralPagingAdapter
import
com.work.provide_tool.app.IApp.Companion.app
import
com.work.provide_tool.app.IApp.Companion.widthAppDesgin
import
com.work.provide_tool.apppri.dataro.entity.InterflowEntity
import
com.work.provide_tool.util.dp2Px
import
com.work.provide_tool.util.glideLoadRound
class
InterflowAdapter
(
context
:
Context
)
:
GeneralPagingAdapter
<
InterflowEntity
,
WidgetInterflowBinding
>(
context
,
object
:
DiffUtil
.
ItemCallback
<
InterflowEntity
>(){
override
fun
areItemsTheSame
(
oldItem
:
InterflowEntity
,
newItem
:
InterflowEntity
):
Boolean
{
return
false
}
override
fun
areContentsTheSame
(
oldItem
:
InterflowEntity
,
newItem
:
InterflowEntity
):
Boolean
{
return
false
}
}){
private
var
type2Layout
=
HashMap
<
Int
,
Int
>().
apply
{
put
(
0
,
R
.
layout
.
widget_interflow_word
)
put
(
1
,
R
.
layout
.
widget_interflow_draw
)
put
(
2
,
R
.
layout
.
widget_interflow_at
)
put
(
3
,
R
.
layout
.
widget_interflow_word_with_u
)
put
(
3
+
1
,
R
.
layout
.
widget_interflow_draw_with_u
)
}
override
var
layout
:
Int
get
()
=
R
.
layout
.
widget_interflow
set
(
value
)
{}
override
fun
onBindViewHolderWork
(
holder
:
Holder
<
WidgetInterflowBinding
>,
t
:
InterflowEntity
?,
position
:
Int
)
{
holder
.
rootViewType
?.
run
{
valueLayout
.
addView
(
provideView
(
position
%
type2Layout
.
size
).
apply
{
layoutParams
=
ViewGroup
.
LayoutParams
(
dp2Px
(
app
,
widthAppDesgin
-
30f
),
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
})
}
}
private
fun
provideView
(
type
:
Int
):
View
{
return
LayoutInflater
.
from
(
context
).
inflate
(
type2Layout
[
type
]
!!
,
null
).
also
{
view
->
when
(
type
){
0
->
initInterFlowWord
(
DataBindingUtil
.
bind
(
view
))
1
->
initInterFlowDraw
(
DataBindingUtil
.
bind
(
view
))
2
->
initInterFlowAt
(
DataBindingUtil
.
bind
(
view
))
3
->
initInterFlowWordWithU
(
DataBindingUtil
.
bind
(
view
))
3
+
1
->
initInterFlowDrawWithU
(
DataBindingUtil
.
bind
(
view
))
}
}
}
private
fun
initInterFlowWord
(
widgetInterflowBinding
:
WidgetInterflowWordBinding
?){
widgetInterflowBinding
?.
run
{
wordTv
.
text
=
"hello啊hello啊hello啊hello啊hello啊hello啊"
glideLoadRound
(
R
.
mipmap
.
t1
,
friIg
)
}
}
private
fun
initInterFlowDraw
(
widgetInterflowDrawBinding
:
WidgetInterflowDrawBinding
?){
}
private
fun
initInterFlowAt
(
widgetInterflowDrawBinding
:
WidgetInterflowAtBinding
?){
}
private
fun
initInterFlowWordWithU
(
widgetInterflowBinding
:
WidgetInterflowWordWithUBinding
?){
widgetInterflowBinding
?.
run
{
wordTv
.
text
=
"hello啊hello啊hello啊hello啊hello啊hello啊"
glideLoadRound
(
R
.
mipmap
.
t1
,
friIg
)
}
}
private
fun
initInterFlowDrawWithU
(
widgetInterflowDrawBinding
:
WidgetInterflowDrawWithUBinding
?){
}
}
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/paging/InterflowDataSou.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.paging
import
androidx.paging.PagingSource
import
androidx.paging.PagingState
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
class
InterflowDataSou
:
PagingSource
<
Int
,
FriendEntity
>(){
override
fun
getRefreshKey
(
state
:
PagingState
<
Int
,
FriendEntity
>):
Int
?
{
return
null
}
override
suspend
fun
load
(
params
:
LoadParams
<
Int
>):
LoadResult
<
Int
,
FriendEntity
>
{
return
LoadResult
.
Page
(
data
=
arrayListOf
(),
//TODO1
nextKey
=
null
,
prevKey
=
null
)
}
}
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/paging/InterflowRepository.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.paging
import
androidx.paging.Pager
import
androidx.paging.PagingConfig
import
androidx.paging.PagingSource
import
com.work.provide_tool.apppri.dataro.TalkDb
object
InterflowRepository
{
private
val
pageSz
=
5
private
var
pagingConfig
=
PagingConfig
(
pageSize
=
pageSz
,
// 每页显示的数据的大小
prefetchDistance
=
pageSz
,
// 预刷新的距离,距离最后一个 item 多远时加载数据
enablePlaceholders
=
true
,
//定义如果PagingSource提供了空占位符,则PagingData是否可以显示空占位符。
initialLoadSize
=
pageSz
+
pageSz
+
pageSz
// 初始化加载数
,
jumpThreshold
=
PagingSource
.
LoadResult
.
Page
.
COUNT_UNDEFINED
//预取距离,定义访问必须离已加载内容的边缘多远才能触发进一步加载。
)
fun
getInterflowList
()
=
Pager
(
pagingConfig
){
TalkDb
.
get
().
getInterflowDao
().
queryInterflowData
()
}.
flow
}
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/ui/FriendFragment.kt
浏览文件 @
b8abd43f
...
@@ -7,7 +7,9 @@ import androidx.recyclerview.widget.DividerItemDecoration
...
@@ -7,7 +7,9 @@ import androidx.recyclerview.widget.DividerItemDecoration
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.SimpleItemAnimator
import
androidx.recyclerview.widget.SimpleItemAnimator
import
com.juling.work_onepage.R
import
com.juling.work_onepage.R
import
com.juling.work_onepage.adapter.FriendAdapter
import
com.juling.work_onepage.databinding.FragmentTalkBinding
import
com.juling.work_onepage.databinding.FragmentTalkBinding
import
com.juling.work_onepage.work.FriendViewModel
import
com.work.provide_origin.origin.GeneralAgentFragment
import
com.work.provide_origin.origin.GeneralAgentFragment
import
com.work.provide_tool.apppri.dataro.TalkDb
import
com.work.provide_tool.apppri.dataro.TalkDb
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
...
@@ -15,7 +17,7 @@ import com.work.provide_tool.util.ToastUtil
...
@@ -15,7 +17,7 @@ import com.work.provide_tool.util.ToastUtil
import
com.work.provide_tool.util.keepDataUpdateWithUi
import
com.work.provide_tool.util.keepDataUpdateWithUi
class
FriendFragment
:
GeneralAgentFragment
<
FriendViewModel
,
FragmentTalkBinding
>()
{
class
FriendFragment
:
GeneralAgentFragment
<
FriendViewModel
,
FragmentTalkBinding
>()
{
private
lateinit
var
adapter
:
FriendAdapter
private
lateinit
var
adapter
:
FriendAdapter
private
val
iViewModel
by
lazy
{
private
val
iViewModel
by
lazy
{
ViewModelProvider
(
this
)[
FriendViewModel
::
class
.
java
]
ViewModelProvider
(
this
)[
FriendViewModel
::
class
.
java
]
}
}
...
@@ -68,9 +70,7 @@ class FriendFragment : GeneralAgentFragment<FriendViewModel, FragmentTalkBinding
...
@@ -68,9 +70,7 @@ class FriendFragment : GeneralAgentFragment<FriendViewModel, FragmentTalkBinding
override
fun
initEvent
()
{
override
fun
initEvent
()
{
adapter
.
onClick
=
{
view
,
t
,
p
->
adapter
.
onClick
=
{
view
,
t
,
p
->
InterflowActivity
.
start
(
t
)
ToastUtil
.
show
(
"eee"
)
}
}
}
}
...
...
widget_onepage/src/main/java/com/juling/work_onepage/ui/InterflowActivity.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.ui
import
android.content.Intent
import
android.view.View
import
androidx.lifecycle.ViewModelProvider
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.juling.work_onepage.R
import
com.juling.work_onepage.adapter.InterflowAdapter
import
com.juling.work_onepage.databinding.ActivityInterflowBinding
import
com.juling.work_onepage.util.TURN_UI_INFO_WITH_FRIEND_ENTITY
import
com.juling.work_onepage.work.FriendViewModel
import
com.juling.work_onepage.work.InterflowViewModel
import
com.work.provide_origin.origin.GeneralAgentActivity
import
com.work.provide_tool.apppri.dataro.TalkDb
import
com.work.provide_tool.apppri.dataro.entity.FriendEntity
import
com.work.provide_tool.apppri.dataro.entity.InterflowEntity
import
com.work.provide_tool.util.AppActivityLeader
import
com.work.provide_tool.util.keepDataUpdateWithUi
class
InterflowActivity
:
GeneralAgentActivity
<
InterflowViewModel
,
ActivityInterflowBinding
>()
{
private
var
friendEntity
:
FriendEntity
?
=
null
private
lateinit
var
interflowAdapter
:
InterflowAdapter
private
val
iViewModel
by
lazy
{
ViewModelProvider
(
this
)[
InterflowViewModel
::
class
.
java
]
}
companion
object
{
fun
start
(
friendEntity
:
FriendEntity
?){
AppActivityLeader
.
getActivity
()
?.
run
{
startActivity
(
Intent
(
this
,
InterflowActivity
::
class
.
java
)
.
putExtra
(
TURN_UI_INFO_WITH_FRIEND_ENTITY
,
friendEntity
))
}
}
}
override
var
layout
:
Int
get
()
=
R
.
layout
.
activity_interflow
set
(
value
)
{}
protected
override
fun
initDo
(){
friendEntity
=
intent
.
getParcelableExtra
(
TURN_UI_INFO_WITH_FRIEND_ENTITY
)
}
override
fun
createLooker
()
{
iViewModel
.
getInterflowList
().
observe
(
this
){
dt
->
keepDataUpdateWithUi
(
this
,{
interflowAdapter
.
submitData
(
dt
)
})
}
}
override
fun
initTitle
(
titleView
:
View
)
{
super
.
initTitle
(
titleView
)
getLeftView
().
visibility
=
View
.
GONE
setTitleNa
(
"好友!"
)
getTitleView
().
setOnClickListener
{
keepDataUpdateWithUi
(
this
,{
TalkDb
.
get
().
getInterflowDao
().
insertInterflowData
(
InterflowEntity
(
1
,
"hello"
))
})
}
}
override
fun
initUi
()
{
initRv
()
}
private
fun
initRv
(){
iDataBinding
.
recyclerView
.
run
{
adapter
=
InterflowAdapter
(
activity
).
apply
{
interflowAdapter
=
this
}
layoutManager
=
LinearLayoutManager
(
activity
)
}
}
override
fun
initData
()
{
}
override
fun
initEvent
()
{
}
}
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/util/general.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.util
val
TURN_UI_INFO_WITH_FRIEND_ENTITY
=
"turn_ui_info_with_friend_entity"
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/
ui
/FriendModel.kt
→
widget_onepage/src/main/java/com/juling/work_onepage/
work
/FriendModel.kt
浏览文件 @
b8abd43f
package
com.juling.work_onepage.
ui
package
com.juling.work_onepage.
work
import
androidx.lifecycle.asLiveData
import
androidx.lifecycle.asLiveData
import
com.juling.work_onepage.paging.FriendRepository
import
com.juling.work_onepage.paging.FriendRepository
...
...
widget_onepage/src/main/java/com/juling/work_onepage/
ui
/FriendViewModel.kt
→
widget_onepage/src/main/java/com/juling/work_onepage/
work
/FriendViewModel.kt
浏览文件 @
b8abd43f
package
com.juling.work_onepage.
ui
package
com.juling.work_onepage.
work
import
com.work.provide_origin.origin.GeneralViewModel
import
com.work.provide_origin.origin.GeneralViewModel
import
com.work.provide_origin.util.ProviderModelEngine
import
com.work.provide_origin.util.ProviderModelEngine
...
...
widget_onepage/src/main/java/com/juling/work_onepage/work/InterflowModel.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.work
import
androidx.lifecycle.asLiveData
import
com.juling.work_onepage.paging.InterflowRepository
import
com.work.provide_origin.inf.IModel
class
InterflowModel
:
IModel
{
fun
getInterflowList
()
=
InterflowRepository
.
getInterflowList
().
asLiveData
()
}
\ No newline at end of file
widget_onepage/src/main/java/com/juling/work_onepage/work/InterflowViewModel.kt
0 → 100644
浏览文件 @
b8abd43f
package
com.juling.work_onepage.work
import
com.work.provide_origin.origin.GeneralViewModel
import
com.work.provide_origin.util.ProviderModelEngine
import
com.work.provide_tool.apppri.util.REF_KEY_INTERFLOW
class
InterflowViewModel
:
GeneralViewModel
(){
fun
getInterflowList
()
=
ProviderModelEngine
.
provider
<
InterflowModel
>(
REF_KEY_INTERFLOW
).
getInterflowList
()
}
\ No newline at end of file
widget_onepage/src/main/res/drawable/interflow_word.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/color_ECECEC"
></solid>
<corners
android:radius=
"5dp"
></corners>
</shape>
\ No newline at end of file
widget_onepage/src/main/res/layout/activity_interflow.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerView"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@+id/constraintLayout2"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/constraintLayout2"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:background=
"@color/color_AAAAAA"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"1.0"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
widget_onepage/src/main/res/layout/widget_interflow.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/value_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingLeft=
"15dp"
android:paddingTop=
"3dp"
android:paddingRight=
"15dp"
android:paddingBottom=
"3dp"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
widget_onepage/src/main/res/layout/widget_interflow_at.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
widget_onepage/src/main/res/layout/widget_interflow_draw.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
widget_onepage/src/main/res/layout/widget_interflow_draw_with_u.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
widget_onepage/src/main/res/layout/widget_interflow_word.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/fri_ig"
android:layout_width=
"39dp"
android:layout_height=
"39dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
app:srcCompat=
"@mipmap/t1"
/>
<TextView
android:id=
"@+id/word_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"9dp"
android:background=
"@drawable/interflow_word"
android:maxWidth=
"270dp"
android:padding=
"9dp"
android:textColor=
"@color/color_101010"
android:textSize=
"19sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toEndOf=
"@+id/fri_ig"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
widget_onepage/src/main/res/layout/widget_interflow_word_with_u.xml
0 → 100644
浏览文件 @
b8abd43f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/fri_ig"
android:layout_width=
"39dp"
android:layout_height=
"39dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"1.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
app:srcCompat=
"@mipmap/t1"
/>
<TextView
android:id=
"@+id/word_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"9dp"
android:background=
"@drawable/interflow_word"
android:maxWidth=
"270dp"
android:padding=
"9dp"
android:textColor=
"@color/color_101010"
android:textSize=
"19sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/fri_ig"
app:layout_constraintHorizontal_bias=
"1.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论