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
e0d5d902
Commit
e0d5d902
authored
Jun 08, 2022
by
nikk gitanes
Committed by
John Wu
Jun 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix restart button focus on flash result
parent
482a5b99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
FlashFragment.kt
.../main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt
+11
-1
FlashViewModel.kt
...main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
+7
-1
fragment_flash_md2.xml
app/src/main/res/layout/fragment_flash_md2.xml
+9
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt
View file @
e0d5d902
...
...
@@ -6,6 +6,7 @@ import android.content.pm.ActivityInfo
import
android.net.Uri
import
android.os.Bundle
import
android.view.*
import
androidx.core.view.isVisible
import
androidx.navigation.NavDeepLinkBuilder
import
com.topjohnwu.magisk.MainDirections
import
com.topjohnwu.magisk.R
...
...
@@ -37,6 +38,15 @@ class FlashFragment : BaseFragment<FragmentFlashMd2Binding>() {
viewModel
.
subtitle
.
observe
(
this
)
{
activity
?.
supportActionBar
?.
setSubtitle
(
it
)
}
viewModel
.
flashResult
.
observe
(
this
)
{
success
->
binding
.
restartBtn
.
apply
{
if
(
success
&&
viewModel
.
showReboot
)
{
if
(!
this
.
isVisible
)
this
.
show
()
if
(!
this
.
isFocused
)
this
.
requestFocus
()
}
}
}
}
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
...
...
@@ -66,7 +76,7 @@ class FlashFragment : BaseFragment<FragmentFlashMd2Binding>() {
}
override
fun
onKeyEvent
(
event
:
KeyEvent
):
Boolean
{
return
when
(
event
.
keyCode
)
{
return
when
(
event
.
keyCode
)
{
KeyEvent
.
KEYCODE_VOLUME_UP
,
KeyEvent
.
KEYCODE_VOLUME_DOWN
->
true
else
->
false
...
...
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
View file @
e0d5d902
...
...
@@ -34,6 +34,10 @@ class FlashViewModel : BaseViewModel() {
private
val
_subtitle
=
MutableLiveData
(
R
.
string
.
flashing
)
val
subtitle
get
()
=
_subtitle
as
LiveData
<
Int
>
private
val
_flashResult
=
MutableLiveData
<
Boolean
>()
val
flashResult
:
LiveData
<
Boolean
>
get
()
=
_flashResult
val
items
=
diffListOf
<
ConsoleItem
>()
lateinit
var
args
:
FlashFragmentArgs
...
...
@@ -88,6 +92,7 @@ class FlashViewModel : BaseViewModel() {
success
->
_subtitle
.
postValue
(
R
.
string
.
done
)
else
->
_subtitle
.
postValue
(
R
.
string
.
failure
)
}
_flashResult
.
value
=
success
}
fun
onMenuItemClicked
(
item
:
MenuItem
):
Boolean
{
...
...
@@ -100,7 +105,8 @@ class FlashViewModel : BaseViewModel() {
private
fun
savePressed
()
=
withExternalRW
{
viewModelScope
.
launch
(
Dispatchers
.
IO
)
{
val
name
=
"magisk_install_log_%s.log"
.
format
(
System
.
currentTimeMillis
().
toTime
(
timeFormatStandard
))
System
.
currentTimeMillis
().
toTime
(
timeFormatStandard
)
)
val
file
=
MediaStoreUtils
.
getFile
(
name
,
true
)
file
.
uri
.
outputStream
().
bufferedWriter
().
use
{
writer
->
synchronized
(
logItems
)
{
...
...
app/src/main/res/layout/fragment_flash_md2.xml
View file @
e0d5d902
...
...
@@ -24,13 +24,13 @@
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/flash_content"
app:items=
"@{viewModel.items}"
scrollToLast=
"@{true}"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:clipToPadding=
"false"
android:orientation=
"vertical"
app:fitsSystemWindowsInsets=
"start|end|bottom"
app:items=
"@{viewModel.items}"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
tools:listitem=
"@layout/item_console_md2"
/>
...
...
@@ -38,27 +38,31 @@
</HorizontalScrollView>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id=
"@+id/restart_btn"
gone=
"@{!viewModel.loaded || !viewModel.showReboot}"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|end"
android:layout_margin=
"@dimen/l1"
android:layout_marginBottom=
"@dimen/l1"
android:clickable=
"@{!viewModel.loaded}"
android:enabled=
"@{viewModel.loaded}"
android:focusable=
"true"
android:onClick=
"@{() -> viewModel.restartPressed()}"
android:text=
"@string/reboot"
android:textAllCaps=
"false"
android:textColor=
"?colorOnPrimary"
android:textStyle=
"bold"
app:layout_fitsSystemWindowsInsets=
"bottom"
app:backgroundTint=
"?colorPrimary"
app:icon=
"@drawable/ic_restart"
app:iconTint=
"?colorOnPrimary"
/>
app:iconTint=
"?colorOnPrimary"
app:layout_fitsSystemWindowsInsets=
"bottom"
/>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id=
"@+id/snackbar_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:id=
"@+id/snackbar_container"
app:fitsSystemWindowsInsets=
"top|bottom"
/>
app:fitsSystemWindowsInsets=
"top|bottom"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
...
...
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