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
70174e09
Unverified
Commit
70174e09
authored
Aug 30, 2020
by
vvb2060
Committed by
GitHub
Aug 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize network status display
parent
0333e82e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
6 deletions
+16
-6
MagiskRepository.kt
.../com/topjohnwu/magisk/data/repository/MagiskRepository.kt
+4
-0
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+7
-1
LollipopNetworkObserver.kt
...com/topjohnwu/magisk/utils/net/LollipopNetworkObserver.kt
+1
-1
fragment_home_md2.xml
app/src/main/res/layout/fragment_home_md2.xml
+2
-2
include_home_magisk.xml
app/src/main/res/layout/include_home_magisk.xml
+1
-1
include_home_manager.xml
app/src/main/res/layout/include_home_manager.xml
+1
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt
View file @
70174e09
...
...
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk.data.repository
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.data.network.GithubRawServices
import
retrofit2.HttpException
import
timber.log.Timber
import
java.io.IOException
...
...
@@ -28,6 +29,9 @@ class MagiskRepository(
}
catch
(
e
:
IOException
)
{
Timber
.
e
(
e
)
null
}
catch
(
e
:
HttpException
)
{
Timber
.
e
(
e
)
null
}
}
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
70174e09
...
...
@@ -70,6 +70,9 @@ class HomeViewModel(
val
showUninstall
get
()
=
Info
.
env
.
magiskVersionCode
>
0
&&
stateMagisk
!=
MagiskState
.
LOADING
&&
isConnected
.
get
()
@get
:
Bindable
val
showSafetyNet
get
()
=
Info
.
hasGMS
&&
isConnected
.
get
()
val
itemBinding
=
itemBindingOf
<
IconLink
>
{
it
.
bindExtra
(
BR
.
viewModel
,
this
)
}
...
...
@@ -77,8 +80,11 @@ class HomeViewModel(
private
var
shownDialog
=
false
override
fun
refresh
()
=
viewModelScope
.
launch
{
state
=
State
.
LOADING
notifyPropertyChanged
(
BR
.
showUninstall
)
notifyPropertyChanged
(
BR
.
showSafetyNet
)
repoMagisk
.
fetchUpdate
()
?.
apply
{
state
=
State
.
LOADED
stateMagisk
=
when
{
!
Info
.
env
.
isActive
->
MagiskState
.
NOT_INSTALLED
magisk
.
isObsolete
->
MagiskState
.
OBSOLETE
...
...
@@ -99,7 +105,7 @@ class HomeViewModel(
launch
{
ensureEnv
()
}
}
}
?:
apply
{
state
=
State
.
LOADING_FAILED
}
}
val
showTest
=
false
...
...
app/src/main/java/com/topjohnwu/magisk/utils/net/LollipopNetworkObserver.kt
View file @
70174e09
...
...
@@ -32,7 +32,7 @@ open class LollipopNetworkObserver(
}
override
fun
onLost
(
network
:
Network
)
{
emit
(
Connectivity
.
create
(
manager
,
network
))
emit
(
Connectivity
(
))
}
}
}
app/src/main/res/layout/fragment_home_md2.xml
View file @
70174e09
...
...
@@ -108,7 +108,7 @@
<Space
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/l1"
gone=
"@{!
Info.hasGMS
&& !viewModel.showUninstall}"
/>
gone=
"@{!
viewModel.showSafetyNet
&& !viewModel.showUninstall}"
/>
<Button
style=
"@style/WidgetFoundation.Button.Outlined"
...
...
@@ -120,7 +120,7 @@
android:textAllCaps=
"false"
android:textSize=
"12sp"
android:onClick=
"@{() -> viewModel.onSafetyNetPressed()}"
gone=
"@{!
Info.hasGMS
}"
gone=
"@{!
viewModel.showSafetyNet
}"
app:cornerRadius=
"@dimen/r1"
app:icon=
"@drawable/ic_safetynet_md2"
/>
...
...
app/src/main/res/layout/include_home_magisk.xml
View file @
70174e09
...
...
@@ -118,7 +118,7 @@
<TextView
style=
"@style/W.Home.ItemContent.Right"
android:text=
"@{viewModel.
isConnected ? viewModel.magiskRemoteVersion : @string/not_available
}"
android:text=
"@{viewModel.
loadFailed ? @string/not_available : viewModel.magiskRemoteVersion
}"
tools:text=
"20.1 (12345)"
/>
</LinearLayout>
...
...
app/src/main/res/layout/include_home_manager.xml
View file @
70174e09
...
...
@@ -121,7 +121,7 @@
<TextView
style=
"@style/W.Home.ItemContent.Right"
android:text=
"@{viewModel.
isConnected ? viewModel.managerRemoteVersion : @string/not_available
}"
android:text=
"@{viewModel.
loadFailed ? @string/not_available : viewModel.managerRemoteVersion
}"
tools:text=
"8.0.0 (123) (10)"
/>
</LinearLayout>
...
...
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