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
d9cf33d1
Commit
d9cf33d1
authored
Apr 11, 2020
by
Viktor De Pasquale
Committed by
John Wu
Apr 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed shortcuts
This has been broken due to recent transition to navigation components
parent
ee3028e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
MainActivity.kt
app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt
+17
-2
main.xml
app/src/main/res/navigation/main.xml
+10
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt
View file @
d9cf33d1
...
...
@@ -10,6 +10,7 @@ import androidx.core.graphics.Insets
import
androidx.core.view.forEach
import
androidx.core.view.setPadding
import
androidx.core.view.updateLayoutParams
import
androidx.navigation.NavDirections
import
com.google.android.material.card.MaterialCardView
import
com.topjohnwu.magisk.MainDirections
import
com.topjohnwu.magisk.R
...
...
@@ -100,10 +101,14 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
binding
.
mainNavigation
.
viewTreeObserver
.
addOnGlobalLayoutListener
(
navObserver
)
if
(
intent
.
getBooleanExtra
(
Const
.
Key
.
OPEN_SETTINGS
,
false
))
{
when
{
intent
.
hasExtra
(
Const
.
Key
.
OPEN_SECTION
)
->
getScreen
(
intent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
?.
navigate
()
intent
.
getBooleanExtra
(
Const
.
Key
.
OPEN_SETTINGS
,
false
)
->
HomeFragmentDirections
.
actionHomeFragmentToSettingsFragment
().
navigate
()
}
if
(
savedInstanceState
!=
null
)
{
if
(!
isRoot
)
{
requestNavigationHidden
()
...
...
@@ -165,4 +170,14 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
binding
.
mainToolbar
.
invalidate
()
}
private
fun
getScreen
(
name
:
String
?):
NavDirections
?
{
return
when
(
name
)
{
"superuser"
->
HomeFragmentDirections
.
actionSuperuserFragment
()
"magiskhide"
->
HomeFragmentDirections
.
actionHideFragment
()
"modules"
->
HomeFragmentDirections
.
actionModuleFragment
()
null
->
null
else
->
TODO
(
"Implement screen shortcut \"$name\""
)
}
}
}
app/src/main/res/navigation/main.xml
View file @
d9cf33d1
...
...
@@ -182,4 +182,14 @@
app:popUpTo=
"@id/installFragment"
app:popUpToInclusive=
"true"
/>
<action
android:id=
"@+id/action_hideFragment"
app:destination=
"@id/hideFragment"
app:enterAnim=
"@anim/fragment_enter"
app:exitAnim=
"@anim/fragment_exit"
app:popEnterAnim=
"@anim/fragment_enter_pop"
app:popExitAnim=
"@anim/fragment_exit_pop"
app:popUpTo=
"@id/superuserFragment"
app:popUpToInclusive=
"false"
/>
</navigation>
\ 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