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
95a5b572
Unverified
Commit
95a5b572
authored
Jan 16, 2021
by
Rikka
Committed by
GitHub
Jan 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove "Flashing" overlay
Fix #3579, fix #3250
parent
13fbf397
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
33 deletions
+18
-33
BaseUIFragment.kt
...src/main/java/com/topjohnwu/magisk/arch/BaseUIFragment.kt
+5
-0
ViewModelsModule.kt
...src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt
+1
-1
FlashFragment.kt
.../main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt
+4
-0
FlashViewModel.kt
...main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
+8
-9
fragment_flash_md2.xml
app/src/main/res/layout/fragment_flash_md2.xml
+0
-23
No files found.
app/src/main/java/com/topjohnwu/magisk/arch/BaseUIFragment.kt
View file @
95a5b572
...
@@ -41,6 +41,11 @@ abstract class BaseUIFragment<VM : BaseViewModel, Binding : ViewDataBinding> :
...
@@ -41,6 +41,11 @@ abstract class BaseUIFragment<VM : BaseViewModel, Binding : ViewDataBinding> :
return
binding
.
root
return
binding
.
root
}
}
override
fun
onStart
()
{
super
.
onStart
()
activity
.
supportActionBar
?.
subtitle
=
null
}
override
fun
onEventDispatched
(
event
:
ViewEvent
)
=
when
(
event
)
{
override
fun
onEventDispatched
(
event
:
ViewEvent
)
=
when
(
event
)
{
is
ContextExecutor
->
event
(
requireContext
())
is
ContextExecutor
->
event
(
requireContext
())
is
ActivityExecutor
->
event
(
activity
)
is
ActivityExecutor
->
event
(
activity
)
...
...
app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt
View file @
95a5b572
...
@@ -29,6 +29,6 @@ val viewModelModules = module {
...
@@ -29,6 +29,6 @@ val viewModelModules = module {
viewModel
{
MainViewModel
()
}
viewModel
{
MainViewModel
()
}
// Legacy
// Legacy
viewModel
{
(
args
:
FlashFragmentArgs
)
->
FlashViewModel
(
args
,
get
()
)
}
viewModel
{
(
args
:
FlashFragmentArgs
)
->
FlashViewModel
(
args
)
}
viewModel
{
SuRequestViewModel
(
get
(),
get
(),
get
(
SUTimeout
),
get
())
}
viewModel
{
SuRequestViewModel
(
get
(),
get
(),
get
(
SUTimeout
),
get
())
}
}
}
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt
View file @
95a5b572
...
@@ -32,6 +32,10 @@ class FlashFragment : BaseUIFragment<FlashViewModel, FragmentFlashMd2Binding>()
...
@@ -32,6 +32,10 @@ class FlashFragment : BaseUIFragment<FlashViewModel, FragmentFlashMd2Binding>()
super
.
onStart
()
super
.
onStart
()
setHasOptionsMenu
(
true
)
setHasOptionsMenu
(
true
)
activity
.
setTitle
(
R
.
string
.
flash_screen_title
)
activity
.
setTitle
(
R
.
string
.
flash_screen_title
)
viewModel
.
subtitle
.
observe
(
this
)
{
activity
.
supportActionBar
?.
setSubtitle
(
it
)
}
}
}
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
View file @
95a5b572
package
com.topjohnwu.magisk.ui.flash
package
com.topjohnwu.magisk.ui.flash
import
android.content.res.Resources
import
android.net.Uri
import
android.net.Uri
import
android.view.MenuItem
import
android.view.MenuItem
import
androidx.databinding.Bindable
import
androidx.databinding.Bindable
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.viewModelScope
import
androidx.lifecycle.viewModelScope
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
...
@@ -26,17 +27,15 @@ import kotlinx.coroutines.Dispatchers
...
@@ -26,17 +27,15 @@ import kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
class
FlashViewModel
(
class
FlashViewModel
(
args
:
FlashFragmentArgs
,
args
:
FlashFragmentArgs
private
val
resources
:
Resources
)
:
BaseViewModel
()
{
)
:
BaseViewModel
()
{
@get
:
Bindable
@get
:
Bindable
var
showReboot
=
Shell
.
rootAccess
()
var
showReboot
=
Shell
.
rootAccess
()
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
showReboot
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
showReboot
)
@get
:
Bindable
private
val
_subtitle
=
MutableLiveData
(
R
.
string
.
flashing
)
var
behaviorText
=
resources
.
getString
(
R
.
string
.
flashing
)
val
subtitle
get
()
=
_subtitle
as
LiveData
<
Int
>
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
behaviorText
)
val
adapter
=
RvBindingAdapter
<
ConsoleItem
>()
val
adapter
=
RvBindingAdapter
<
ConsoleItem
>()
val
items
=
diffListOf
<
ConsoleItem
>()
val
items
=
diffListOf
<
ConsoleItem
>()
...
@@ -91,9 +90,9 @@ class FlashViewModel(
...
@@ -91,9 +90,9 @@ class FlashViewModel(
private
fun
onResult
(
success
:
Boolean
)
{
private
fun
onResult
(
success
:
Boolean
)
{
state
=
if
(
success
)
State
.
LOADED
else
State
.
LOADING_FAILED
state
=
if
(
success
)
State
.
LOADED
else
State
.
LOADING_FAILED
behaviorText
=
when
{
when
{
success
->
resources
.
getString
(
R
.
string
.
done
)
success
->
_subtitle
.
postValue
(
R
.
string
.
done
)
else
->
resources
.
getString
(
R
.
string
.
failure
)
else
->
_subtitle
.
postValue
(
R
.
string
.
failure
)
}
}
}
}
...
...
app/src/main/res/layout/fragment_flash_md2.xml
View file @
95a5b572
...
@@ -56,29 +56,6 @@
...
@@ -56,29 +56,6 @@
app:icon=
"@drawable/ic_restart"
app:icon=
"@drawable/ic_restart"
app:iconTint=
"?colorOnPrimary"
/>
app:iconTint=
"?colorOnPrimary"
/>
<com.google.android.material.card.MaterialCardView
style=
"@style/WidgetFoundation.Card.Elevated"
goneUnless=
"@{viewModel.loading}"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
app:contentPadding=
"@dimen/l1"
>
<TextView
movieBehavior=
"@{viewModel.loading}"
movieBehaviorText=
"@{viewModel.behaviorText}"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:fontFamily=
"monospace"
android:gravity=
"center"
android:textAppearance=
"@style/AppearanceFoundation.Body"
android:textColor=
"?colorOnSurface"
android:textStyle=
"bold"
tools:text=
"Flashing..."
/>
</com.google.android.material.card.MaterialCardView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</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