Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
6c845743
Commit
6c845743
authored
Nov 11, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added loading item to modules
parent
bc5cbe9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
1 deletion
+59
-1
ModuleRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
+13
-0
ModuleViewModel.kt
...a/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
+8
-1
item_loading.xml
app/src/main/res/layout/item_loading.xml
+38
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
View file @
6c845743
...
...
@@ -146,6 +146,19 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
}
object
LoadingItem
:
ComparableRvItem
<
LoadingItem
>()
{
override
val
layoutRes
=
R
.
layout
.
item_loading
override
fun
onBindingBound
(
binding
:
ViewDataBinding
)
{
super
.
onBindingBound
(
binding
)
val
params
=
binding
.
root
.
layoutParams
as
?
StaggeredGridLayoutManager
.
LayoutParams
?:
return
params
.
isFullSpan
=
true
}
override
fun
contentSameAs
(
other
:
LoadingItem
)
=
this
==
other
override
fun
itemSameAs
(
other
:
LoadingItem
)
=
this
===
other
}
abstract
class
ObservableItem
<
T
>
:
ComparableRvItem
<
T
>(),
Observable
{
private
val
list
=
PropertyChangeRegistry
()
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
View file @
6c845743
...
...
@@ -12,6 +12,7 @@ import com.topjohnwu.magisk.databinding.ComparableRvItem
import
com.topjohnwu.magisk.extensions.subscribeK
import
com.topjohnwu.magisk.model.entity.module.Module
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.model.entity.recycler.LoadingItem
import
com.topjohnwu.magisk.model.entity.recycler.ModuleItem
import
com.topjohnwu.magisk.model.entity.recycler.RepoItem
import
com.topjohnwu.magisk.model.entity.recycler.SectionTitle
...
...
@@ -25,6 +26,7 @@ import io.reactivex.Single
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.Disposable
import
me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter
import
timber.log.Timber
class
ModuleViewModel
(
private
val
repoName
:
RepoByNameDao
,
...
...
@@ -96,12 +98,17 @@ class ModuleViewModel(
remoteJob
=
loadRepos
(
offset
=
size
)
.
map
{
it
.
map
{
RepoItem
(
it
)
}
}
.
applyViewModel
(
this
)
.
subscribeK
{
.
subscribeK
(
onError
=
{
Timber
.
e
(
it
)
items
.
remove
(
LoadingItem
)
})
{
items
.
remove
(
LoadingItem
)
if
(!
items
.
contains
(
sectionRemote
))
{
items
.
add
(
sectionRemote
)
}
items
.
addAll
(
it
)
}
items
.
add
(
LoadingItem
)
}
private
fun
loadRepos
(
...
...
app/src/main/res/layout/item_loading.xml
0 → 100644
View file @
6c845743
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"item"
type=
"com.topjohnwu.magisk.model.entity.recycler.LoadingItem"
/>
<variable
name=
"viewModel"
type=
"com.topjohnwu.magisk.base.viewmodel.LoadingViewModel"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"?listPreferredItemHeightSmall"
android:orientation=
"vertical"
android:padding=
"@dimen/l1"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"@string/safetynet_attest_loading"
android:textAppearance=
"?appearanceTextTitleNormal"
/>
<ProgressBar
style=
"?styleProgressIndeterminate"
android:layout_gravity=
"center"
android:layout_marginTop=
"@dimen/l1"
/>
</LinearLayout>
</layout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment