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
8999a57f
Commit
8999a57f
authored
Oct 06, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added in-app settings shortcut from system settings
parent
8024089b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
4 deletions
+34
-4
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+10
-0
Const.kt
app/src/main/java/com/topjohnwu/magisk/Const.kt
+1
-0
Navigation.kt
.../java/com/topjohnwu/magisk/model/navigation/Navigation.kt
+15
-3
MainActivity.kt
...c/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt
+6
-1
CompatActivity.kt
...va/com/topjohnwu/magisk/redesign/compat/CompatActivity.kt
+2
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
8999a57f
...
...
@@ -36,6 +36,16 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity-alias
android:name=
"a.s"
android:targetActivity=
"a.c"
>
<intent-filter>
<action
android:name=
"android.intent.action.APPLICATION_PREFERENCES"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</activity-alias>
<activity
android:name=
"a.f"
android:configChanges=
"keyboardHidden|orientation|screenSize"
...
...
app/src/main/java/com/topjohnwu/magisk/Const.kt
View file @
8999a57f
...
...
@@ -59,6 +59,7 @@ object Const {
const
val
ETAG_KEY
=
"ETag"
// intents
const
val
OPEN_SECTION
=
"section"
const
val
OPEN_SETTINGS
=
"settings"
const
val
INTENT_SET_APP
=
"app_json"
const
val
FLASH_ACTION
=
"action"
const
val
FLASH_DATA
=
"additional_data"
...
...
app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt
View file @
8999a57f
...
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.model.navigation
import
android.content.Context
import
android.content.Intent
import
android.os.Build
import
com.topjohnwu.magisk.ClassMap
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.Const
...
...
@@ -74,12 +75,23 @@ object Navigation {
Config
.
redesign
->
RedesignActivity
::
class
.
java
else
->
MainActivity
::
class
.
java
}
val
intent
=
Intent
(
context
,
ClassMap
[
destination
])
intent
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
launchIntent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
context
.
startActivity
(
intent
)
Intent
(
context
,
ClassMap
[
destination
])
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
launchIntent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
.
putExtra
(
Const
.
Key
.
OPEN_SETTINGS
,
launchIntent
.
action
==
ACTION_APPLICATION_PREFERENCES
)
.
also
{
context
.
startActivity
(
it
)
}
}
object
Main
{
const
val
OPEN_NAV
=
1
}
private
val
ACTION_APPLICATION_PREFERENCES
get
()
=
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
Intent
.
ACTION_APPLICATION_PREFERENCES
}
else
{
"cannot be null, cannot be empty"
}
}
app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt
View file @
8999a57f
...
...
@@ -4,6 +4,7 @@ import android.graphics.Insets
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
com.ncapdevi.fragnav.FragNavController
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
import
com.topjohnwu.magisk.model.navigation.Navigation
...
...
@@ -44,9 +45,13 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
R
.
id
.
logFragment
->
Navigation
.
log
()
R
.
id
.
settingsFragment
->
Navigation
.
settings
()
else
->
throw
NotImplementedError
(
"Id ${it.itemId} is not defined as selectable"
)
}.
also
{
onEventDispatched
(
it
)
}
}.
dispatchOnSelf
()
true
}
if
(
intent
.
getBooleanExtra
(
Const
.
Key
.
OPEN_SETTINGS
,
false
))
{
binding
.
mainNavigation
.
selectedItemId
=
R
.
id
.
settingsFragment
}
}
override
fun
onTabTransaction
(
fragment
:
Fragment
?,
index
:
Int
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatActivity.kt
View file @
8999a57f
...
...
@@ -31,4 +31,6 @@ abstract class CompatActivity<ViewModel : CompatViewModel, Binding : ViewDataBin
delegate
.
onEventExecute
(
event
,
this
)
}
protected
fun
ViewEvent
.
dispatchOnSelf
()
=
onEventDispatched
(
this
)
}
\ 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