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
f5c98235
Commit
f5c98235
authored
Aug 31, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove online section in modules fragment
parent
f98c68a2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
254 deletions
+53
-254
build.gradle.kts
app/build.gradle.kts
+1
-1
ServiceLocator.kt
app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt
+0
-2
ModuleFragment.kt
...ain/java/com/topjohnwu/magisk/ui/module/ModuleFragment.kt
+2
-34
ModuleRvItem.kt
.../main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt
+9
-17
ModuleViewModel.kt
...in/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt
+35
-192
item_module_md2.xml
app/src/main/res/layout/item_module_md2.xml
+2
-2
item_repo_md2.xml
app/src/main/res/layout/item_repo_md2.xml
+4
-6
No files found.
app/build.gradle.kts
View file @
f5c98235
...
@@ -232,7 +232,7 @@ dependencies {
...
@@ -232,7 +232,7 @@ dependencies {
implementation
(
"androidx.navigation:navigation-ui-ktx:${vNav}"
)
implementation
(
"androidx.navigation:navigation-ui-ktx:${vNav}"
)
implementation
(
"androidx.biometric:biometric:1.1.0"
)
implementation
(
"androidx.biometric:biometric:1.1.0"
)
implementation
(
"androidx.constraintlayout:constraintlayout:2.
0.4
"
)
implementation
(
"androidx.constraintlayout:constraintlayout:2.
1.0
"
)
implementation
(
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
)
implementation
(
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
)
implementation
(
"androidx.browser:browser:1.3.0"
)
implementation
(
"androidx.browser:browser:1.3.0"
)
implementation
(
"androidx.preference:preference:1.1.1"
)
implementation
(
"androidx.preference:preference:1.1.1"
)
...
...
app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt
View file @
f5c98235
...
@@ -19,7 +19,6 @@ import com.topjohnwu.magisk.ktx.deviceProtectedContext
...
@@ -19,7 +19,6 @@ import com.topjohnwu.magisk.ktx.deviceProtectedContext
import
com.topjohnwu.magisk.ui.home.HomeViewModel
import
com.topjohnwu.magisk.ui.home.HomeViewModel
import
com.topjohnwu.magisk.ui.install.InstallViewModel
import
com.topjohnwu.magisk.ui.install.InstallViewModel
import
com.topjohnwu.magisk.ui.log.LogViewModel
import
com.topjohnwu.magisk.ui.log.LogViewModel
import
com.topjohnwu.magisk.ui.module.ModuleViewModel
import
com.topjohnwu.magisk.ui.settings.SettingsViewModel
import
com.topjohnwu.magisk.ui.settings.SettingsViewModel
import
com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
import
com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
import
com.topjohnwu.magisk.ui.surequest.SuRequestViewModel
import
com.topjohnwu.magisk.ui.surequest.SuRequestViewModel
...
@@ -61,7 +60,6 @@ object ServiceLocator {
...
@@ -61,7 +60,6 @@ object ServiceLocator {
return
when
(
clz
)
{
return
when
(
clz
)
{
HomeViewModel
::
class
.
java
->
HomeViewModel
(
networkService
)
HomeViewModel
::
class
.
java
->
HomeViewModel
(
networkService
)
LogViewModel
::
class
.
java
->
LogViewModel
(
logRepo
)
LogViewModel
::
class
.
java
->
LogViewModel
(
logRepo
)
ModuleViewModel
::
class
.
java
->
ModuleViewModel
(
repoDB
,
repoUpdater
)
SettingsViewModel
::
class
.
java
->
SettingsViewModel
(
repoDB
)
SettingsViewModel
::
class
.
java
->
SettingsViewModel
(
repoDB
)
SuperuserViewModel
::
class
.
java
->
SuperuserViewModel
(
policyDB
)
SuperuserViewModel
::
class
.
java
->
SuperuserViewModel
(
policyDB
)
InstallViewModel
::
class
.
java
->
InstallViewModel
(
networkService
)
InstallViewModel
::
class
.
java
->
InstallViewModel
(
networkService
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleFragment.kt
View file @
f5c98235
...
@@ -10,8 +10,6 @@ import androidx.recyclerview.widget.RecyclerView
...
@@ -10,8 +10,6 @@ import androidx.recyclerview.widget.RecyclerView
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.arch.BaseUIFragment
import
com.topjohnwu.magisk.arch.BaseUIFragment
import
com.topjohnwu.magisk.arch.ReselectionTarget
import
com.topjohnwu.magisk.arch.ReselectionTarget
import
com.topjohnwu.magisk.arch.ViewEvent
import
com.topjohnwu.magisk.core.download.BaseDownloader
import
com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
import
com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
import
com.topjohnwu.magisk.di.viewModel
import
com.topjohnwu.magisk.di.viewModel
import
com.topjohnwu.magisk.ktx.*
import
com.topjohnwu.magisk.ktx.*
...
@@ -42,13 +40,10 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
...
@@ -42,13 +40,10 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
super
.
onStart
()
super
.
onStart
()
setHasOptionsMenu
(
true
)
setHasOptionsMenu
(
true
)
activity
.
title
=
resources
.
getString
(
R
.
string
.
modules
)
activity
.
title
=
resources
.
getString
(
R
.
string
.
modules
)
BaseDownloader
.
observeProgress
(
this
,
viewModel
::
onProgressUpdate
)
}
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
super
.
onViewCreated
(
view
,
savedInstanceState
)
setEndlessScroller
()
setEndlessSearch
()
binding
.
moduleFilterToggle
.
setOnClickListener
{
binding
.
moduleFilterToggle
.
setOnClickListener
{
isFilterVisible
=
true
isFilterVisible
=
true
...
@@ -116,13 +111,6 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
...
@@ -116,13 +111,6 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
// ---
// ---
override
fun
onEventDispatched
(
event
:
ViewEvent
)
=
when
(
event
)
{
is
EndlessRecyclerScrollListener
.
ResetState
->
listeners
.
forEach
{
it
.
resetState
()
}
else
->
super
.
onEventDispatched
(
event
)
}
// ---
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
inflater
.
inflate
(
R
.
menu
.
menu_module_md2
,
menu
)
inflater
.
inflate
(
R
.
menu
.
menu_module_md2
,
menu
)
}
}
...
@@ -137,32 +125,12 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
...
@@ -137,32 +125,12 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
// ---
// ---
override
fun
onReselected
()
{
override
fun
onReselected
()
{
binding
.
moduleList
binding
.
moduleList
.
scrollToPosition
(
10
)
.
also
{
it
.
scrollToPosition
(
10
)
}
binding
.
moduleList
.
also
{
it
.
post
{
it
.
smoothScrollToPosition
(
0
)
}
}
.
let
{
binding
.
moduleList
}
.
also
{
it
.
post
{
it
.
smoothScrollToPosition
(
0
)
}
}
}
}
// ---
// ---
override
fun
onPreBind
(
binding
:
FragmentModuleMd2Binding
)
=
Unit
override
fun
onPreBind
(
binding
:
FragmentModuleMd2Binding
)
=
Unit
private
fun
setEndlessScroller
()
{
val
lama
=
binding
.
moduleList
.
layoutManager
?:
return
lama
.
isAutoMeasureEnabled
=
false
val
listener
=
EndlessRecyclerScrollListener
(
lama
,
viewModel
::
loadRemote
)
binding
.
moduleList
.
addOnScrollListener
(
listener
)
listeners
.
add
(
listener
)
}
private
fun
setEndlessSearch
()
{
val
lama
=
binding
.
moduleFilterInclude
.
moduleFilterList
.
layoutManager
?:
return
lama
.
isAutoMeasureEnabled
=
false
val
listener
=
EndlessRecyclerScrollListener
(
lama
,
viewModel
::
loadMoreQuery
)
binding
.
moduleFilterInclude
.
moduleFilterList
.
addOnScrollListener
(
listener
)
listeners
.
add
(
listener
)
}
}
}
app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt
View file @
f5c98235
...
@@ -39,34 +39,27 @@ class SectionTitle(
...
@@ -39,34 +39,27 @@ class SectionTitle(
override
fun
contentSameAs
(
other
:
SectionTitle
):
Boolean
=
this
===
other
override
fun
contentSameAs
(
other
:
SectionTitle
):
Boolean
=
this
===
other
}
}
sealed
class
RepoItem
(
val
item
:
OnlineModule
)
:
ObservableItem
<
Repo
Item
>()
{
class
OnlineModuleRvItem
(
val
item
:
OnlineModule
)
:
ObservableItem
<
OnlineModuleRv
Item
>()
{
override
val
layoutRes
:
Int
=
R
.
layout
.
item_repo_md2
override
val
layoutRes
:
Int
=
R
.
layout
.
item_repo_md2
@get
:
Bindable
@get
:
Bindable
var
progress
=
0
var
progress
=
0
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
progress
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
progress
)
abstract
val
isUpdate
:
Boolean
var
hasUpdate
=
false
override
fun
contentSameAs
(
other
:
Repo
Item
):
Boolean
=
item
==
other
.
item
override
fun
contentSameAs
(
other
:
OnlineModuleRv
Item
):
Boolean
=
item
==
other
.
item
override
fun
itemSameAs
(
other
:
Repo
Item
):
Boolean
=
item
.
id
==
other
.
item
.
id
override
fun
itemSameAs
(
other
:
OnlineModuleRv
Item
):
Boolean
=
item
.
id
==
other
.
item
.
id
class
Update
(
item
:
OnlineModule
)
:
RepoItem
(
item
)
{
override
val
isUpdate
get
()
=
true
}
class
Remote
(
item
:
OnlineModule
)
:
RepoItem
(
item
)
{
override
val
isUpdate
get
()
=
false
}
}
}
class
ModuleItem
(
val
item
:
LocalModule
)
:
ObservableItem
<
Module
Item
>()
{
class
LocalModuleRvItem
(
val
item
:
LocalModule
)
:
ObservableItem
<
LocalModuleRv
Item
>()
{
override
val
layoutRes
=
R
.
layout
.
item_module_md2
override
val
layoutRes
=
R
.
layout
.
item_module_md2
@get
:
Bindable
@get
:
Bindable
var
repo
:
OnlineModule
?
=
null
var
online
:
OnlineModule
?
=
null
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
repo
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
online
)
@get
:
Bindable
@get
:
Bindable
var
isEnabled
=
item
.
enable
var
isEnabled
=
item
.
enable
...
@@ -88,11 +81,10 @@ class ModuleItem(val item: LocalModule) : ObservableItem<ModuleItem>() {
...
@@ -88,11 +81,10 @@ class ModuleItem(val item: LocalModule) : ObservableItem<ModuleItem>() {
viewModel
.
updateActiveState
()
viewModel
.
updateActiveState
()
}
}
override
fun
contentSameAs
(
other
:
Module
Item
):
Boolean
=
item
.
version
==
other
.
item
.
version
override
fun
contentSameAs
(
other
:
LocalModuleRv
Item
):
Boolean
=
item
.
version
==
other
.
item
.
version
&&
item
.
versionCode
==
other
.
item
.
versionCode
&&
item
.
versionCode
==
other
.
item
.
versionCode
&&
item
.
description
==
other
.
item
.
description
&&
item
.
description
==
other
.
item
.
description
&&
item
.
name
==
other
.
item
.
name
&&
item
.
name
==
other
.
item
.
name
override
fun
itemSameAs
(
other
:
Module
Item
):
Boolean
=
item
.
id
==
other
.
item
.
id
override
fun
itemSameAs
(
other
:
LocalModuleRv
Item
):
Boolean
=
item
.
id
==
other
.
item
.
id
}
}
app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt
View file @
f5c98235
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/item_module_md2.xml
View file @
f5c98235
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<variable
<variable
name=
"item"
name=
"item"
type=
"com.topjohnwu.magisk.ui.module.
Module
Item"
/>
type=
"com.topjohnwu.magisk.ui.module.
LocalModuleRv
Item"
/>
<variable
<variable
name=
"viewModel"
name=
"viewModel"
...
@@ -120,7 +120,7 @@
...
@@ -120,7 +120,7 @@
<ImageView
<ImageView
android:id=
"@+id/module_info"
android:id=
"@+id/module_info"
style=
"@style/WidgetFoundation.Icon"
style=
"@style/WidgetFoundation.Icon"
gone=
"@{item.
repo
== null}"
gone=
"@{item.
online
== null}"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:alpha=
".5"
android:alpha=
".5"
android:clickable=
"true"
android:clickable=
"true"
...
...
app/src/main/res/layout/item_repo_md2.xml
View file @
f5c98235
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<variable
<variable
name=
"item"
name=
"item"
type=
"com.topjohnwu.magisk.ui.module.
Repo
Item"
/>
type=
"com.topjohnwu.magisk.ui.module.
OnlineModuleRv
Item"
/>
<variable
<variable
name=
"viewModel"
name=
"viewModel"
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
android:clickable=
"true"
android:clickable=
"true"
android:focusable=
"true"
android:focusable=
"true"
android:nextFocusRight=
"@id/module_info"
android:nextFocusRight=
"@id/module_info"
android:onClick=
"@{() -> viewModel.downloadPressed(item)}"
tools:layout_gravity=
"center"
tools:layout_gravity=
"center"
tools:layout_marginBottom=
"@dimen/l1"
tools:layout_marginBottom=
"@dimen/l1"
tools:layout_marginEnd=
"@dimen/l1"
>
tools:layout_marginEnd=
"@dimen/l1"
>
...
@@ -102,7 +101,7 @@
...
@@ -102,7 +101,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:alpha=
".5"
android:alpha=
".5"
android:nextFocusLeft=
"@id/module_card"
android:nextFocusLeft=
"@id/module_card"
android:onClick=
"@{() -> viewModel.infoPressed(item)}"
android:onClick=
"@{() -> viewModel.infoPressed(item
.item
)}"
android:paddingEnd=
"@dimen/l_50"
android:paddingEnd=
"@dimen/l_50"
app:layout_constraintBottom_toBottomOf=
"@+id/module_download"
app:layout_constraintBottom_toBottomOf=
"@+id/module_download"
app:layout_constraintEnd_toStartOf=
"@+id/module_download"
app:layout_constraintEnd_toStartOf=
"@+id/module_download"
...
@@ -113,11 +112,11 @@
...
@@ -113,11 +112,11 @@
android:id=
"@+id/module_download"
android:id=
"@+id/module_download"
style=
"@style/WidgetFoundation.Icon.Primary"
style=
"@style/WidgetFoundation.Icon.Primary"
isEnabled=
"@{!(item.progress == -100 || (item.progress > 0 && item.progress < 100))}"
isEnabled=
"@{!(item.progress == -100 || (item.progress > 0 && item.progress < 100))}"
srcCompat=
"@{item.
i
sUpdate ? R.drawable.ic_update_md2 : R.drawable.ic_download_md2}"
srcCompat=
"@{item.
ha
sUpdate ? R.drawable.ic_update_md2 : R.drawable.ic_download_md2}"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:contentDescription=
"@string/download"
android:contentDescription=
"@string/download"
android:nextFocusLeft=
"@id/module_info"
android:nextFocusLeft=
"@id/module_info"
android:onClick=
"@{() -> viewModel.downloadPressed(item)}"
android:onClick=
"@{() -> viewModel.downloadPressed(item
.item
)}"
android:paddingStart=
"@dimen/l_50"
android:paddingStart=
"@dimen/l_50"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
@@ -154,4 +153,3 @@
...
@@ -154,4 +153,3 @@
</com.google.android.material.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView>
</layout>
</layout>
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