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
df0a5b59
Commit
df0a5b59
authored
Jan 12, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace old design with redesign (p1)
parent
0827044c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
103 deletions
+33
-103
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-5
b.java
app/src/main/java/a/b.java
+0
-7
b.kt
app/src/main/java/a/b.kt
+1
-3
Config.kt
app/src/main/java/com/topjohnwu/magisk/Config.kt
+0
-3
Hacks.kt
app/src/main/java/com/topjohnwu/magisk/Hacks.kt
+1
-1
BaseActivity.kt
app/src/main/java/com/topjohnwu/magisk/base/BaseActivity.kt
+1
-8
Navigation.kt
.../java/com/topjohnwu/magisk/model/navigation/Navigation.kt
+15
-46
MainActivity.kt
...c/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt
+3
-0
SettingsItems.kt
...a/com/topjohnwu/magisk/redesign/settings/SettingsItems.kt
+1
-8
SettingsViewModel.kt
...m/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt
+2
-4
MarkDownWindow.kt
...src/main/java/com/topjohnwu/magisk/view/MarkDownWindow.kt
+9
-18
No files found.
app/src/main/AndroidManifest.xml
View file @
df0a5b59
...
@@ -29,11 +29,6 @@
...
@@ -29,11 +29,6 @@
<!-- Main -->
<!-- Main -->
<activity
android:name=
"a.b"
/>
<activity
android:name=
"a.b"
/>
<activity
android:name=
"a.i"
android:windowSoftInputMode=
"adjustResize"
android:exported=
"true"
/>
<!-- Flashing -->
<!-- Flashing -->
<activity
android:name=
"a.f"
/>
<activity
android:name=
"a.f"
/>
...
...
app/src/main/java/a/b.java
deleted
100644 → 0
View file @
0827044c
package
a
;
import
com.topjohnwu.magisk.ui.MainActivity
;
public
class
b
extends
MainActivity
{
/* stub */
}
app/src/main/java/a/
i
.kt
→
app/src/main/java/a/
b
.kt
View file @
df0a5b59
...
@@ -2,6 +2,4 @@ package a
...
@@ -2,6 +2,4 @@ package a
import
com.topjohnwu.magisk.redesign.MainActivity
import
com.topjohnwu.magisk.redesign.MainActivity
class
i
:
MainActivity
()
{
class
b
:
MainActivity
()
/* stub */
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/Config.kt
View file @
df0a5b59
...
@@ -123,9 +123,6 @@ object Config : PreferenceModel, DBConfig {
...
@@ -123,9 +123,6 @@ object Config : PreferenceModel, DBConfig {
var
updateChannel
by
preferenceStrInt
(
Key
.
UPDATE_CHANNEL
,
defaultChannel
)
var
updateChannel
by
preferenceStrInt
(
Key
.
UPDATE_CHANNEL
,
defaultChannel
)
var
safetyNotice
by
preference
(
Key
.
SAFETY
,
true
)
var
safetyNotice
by
preference
(
Key
.
SAFETY
,
true
)
var
redesign
by
preference
(
Key
.
REDESIGN
,
false
)
@Deprecated
(
"Use extended dark theme"
)
var
darkTheme
by
preference
(
Key
.
DARK_THEME
,
true
)
var
darkThemeExtended
by
preference
(
var
darkThemeExtended
by
preference
(
Key
.
DARK_THEME_EXTENDED
,
Key
.
DARK_THEME_EXTENDED
,
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
...
...
app/src/main/java/com/topjohnwu/magisk/Hacks.kt
View file @
df0a5b59
...
@@ -151,7 +151,7 @@ object ClassMap {
...
@@ -151,7 +151,7 @@ object ClassMap {
DownloadService
::
class
.
java
to
a
.
j
::
class
.
java
,
DownloadService
::
class
.
java
to
a
.
j
::
class
.
java
,
SuRequestActivity
::
class
.
java
to
a
.
m
::
class
.
java
,
SuRequestActivity
::
class
.
java
to
a
.
m
::
class
.
java
,
ProcessPhoenix
::
class
.
java
to
a
.
r
::
class
.
java
,
ProcessPhoenix
::
class
.
java
to
a
.
r
::
class
.
java
,
RedesignActivity
::
class
.
java
to
a
.
i
::
class
.
java
RedesignActivity
::
class
.
java
to
a
.
b
::
class
.
java
)
)
operator
fun
get
(
c
:
Class
<
*
>)
=
map
.
getOrElse
(
c
)
{
c
}
operator
fun
get
(
c
:
Class
<
*
>)
=
map
.
getOrElse
(
c
)
{
c
}
...
...
app/src/main/java/com/topjohnwu/magisk/base/BaseActivity.kt
View file @
df0a5b59
...
@@ -39,14 +39,7 @@ abstract class BaseActivity<ViewModel : BaseViewModel, Binding : ViewDataBinding
...
@@ -39,14 +39,7 @@ abstract class BaseActivity<ViewModel : BaseViewModel, Binding : ViewDataBinding
private
val
resultCallbacks
by
lazy
{
SparseArrayCompat
<
RequestCallback
>()
}
private
val
resultCallbacks
by
lazy
{
SparseArrayCompat
<
RequestCallback
>()
}
init
{
init
{
val
theme
=
if
(
Config
.
redesign
)
{
val
theme
=
Config
.
darkThemeExtended
Config
.
darkThemeExtended
}
else
{
when
{
Config
.
darkTheme
->
AppCompatDelegate
.
MODE_NIGHT_YES
else
->
AppCompatDelegate
.
MODE_NIGHT_NO
}
}
AppCompatDelegate
.
setDefaultNightMode
(
theme
)
AppCompatDelegate
.
setDefaultNightMode
(
theme
)
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt
View file @
df0a5b59
...
@@ -3,60 +3,40 @@ package com.topjohnwu.magisk.model.navigation
...
@@ -3,60 +3,40 @@ package com.topjohnwu.magisk.model.navigation
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.os.Build
import
android.os.Build
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.intent
import
com.topjohnwu.magisk.intent
import
com.topjohnwu.magisk.redesign.MainActivity
import
com.topjohnwu.magisk.redesign.hide.HideFragment
import
com.topjohnwu.magisk.redesign.home.HomeFragment
import
com.topjohnwu.magisk.redesign.install.InstallFragment
import
com.topjohnwu.magisk.redesign.install.InstallFragment
import
com.topjohnwu.magisk.redesign.log.LogFragment
import
com.topjohnwu.magisk.redesign.safetynet.SafetynetFragment
import
com.topjohnwu.magisk.redesign.safetynet.SafetynetFragment
import
com.topjohnwu.magisk.redesign.settings.SettingsFragment
import
com.topjohnwu.magisk.redesign.superuser.SuperuserFragment
import
com.topjohnwu.magisk.redesign.theme.ThemeFragment
import
com.topjohnwu.magisk.redesign.theme.ThemeFragment
import
com.topjohnwu.magisk.ui.MainActivity
import
com.topjohnwu.magisk.ui.hide.MagiskHideFragment
import
com.topjohnwu.magisk.ui.home.HomeFragment
import
com.topjohnwu.magisk.ui.log.LogFragment
import
com.topjohnwu.magisk.ui.module.ModulesFragment
import
com.topjohnwu.magisk.ui.module.ModulesFragment
import
com.topjohnwu.magisk.ui.module.ReposFragment
import
com.topjohnwu.magisk.ui.module.ReposFragment
import
com.topjohnwu.magisk.ui.settings.SettingsFragment
import
com.topjohnwu.magisk.ui.superuser.SuperuserFragment
import
com.topjohnwu.magisk.redesign.MainActivity
as
RedesignActivity
import
com.topjohnwu.magisk.redesign.hide.HideFragment
as
RedesignHideFragment
import
com.topjohnwu.magisk.redesign.home.HomeFragment
as
RedesignHomeFragment
import
com.topjohnwu.magisk.redesign.log.LogFragment
as
RedesignLogFragment
import
com.topjohnwu.magisk.redesign.module.ModuleFragment
as
RedesignModulesFragment
import
com.topjohnwu.magisk.redesign.settings.SettingsFragment
as
RedesignSettingsFragment
import
com.topjohnwu.magisk.redesign.superuser.SuperuserFragment
as
RedesignSuperuserFragment
object
Navigation
{
object
Navigation
{
fun
home
()
=
MagiskNavigationEvent
{
fun
home
()
=
MagiskNavigationEvent
{
navDirections
{
navDirections
{
destination
=
when
{
destination
=
HomeFragment
::
class
Config
.
redesign
->
RedesignHomeFragment
::
class
else
->
HomeFragment
::
class
}
}
}
navOptions
{
navOptions
{
popUpTo
=
when
{
popUpTo
=
HomeFragment
::
class
Config
.
redesign
->
RedesignHomeFragment
::
class
else
->
HomeFragment
::
class
}
}
}
}
}
fun
superuser
()
=
MagiskNavigationEvent
{
fun
superuser
()
=
MagiskNavigationEvent
{
navDirections
{
navDirections
{
destination
=
when
{
destination
=
SuperuserFragment
::
class
Config
.
redesign
->
RedesignSuperuserFragment
::
class
else
->
SuperuserFragment
::
class
}
}
}
}
}
fun
modules
()
=
MagiskNavigationEvent
{
fun
modules
()
=
MagiskNavigationEvent
{
navDirections
{
navDirections
{
destination
=
when
{
destination
=
ModulesFragment
::
class
Config
.
redesign
->
RedesignModulesFragment
::
class
else
->
ModulesFragment
::
class
}
}
}
}
}
...
@@ -66,10 +46,7 @@ object Navigation {
...
@@ -66,10 +46,7 @@ object Navigation {
fun
hide
()
=
MagiskNavigationEvent
{
fun
hide
()
=
MagiskNavigationEvent
{
navDirections
{
navDirections
{
destination
=
when
{
destination
=
HideFragment
::
class
Config
.
redesign
->
RedesignHideFragment
::
class
else
->
MagiskHideFragment
::
class
}
}
}
}
}
...
@@ -79,19 +56,13 @@ object Navigation {
...
@@ -79,19 +56,13 @@ object Navigation {
fun
log
()
=
MagiskNavigationEvent
{
fun
log
()
=
MagiskNavigationEvent
{
navDirections
{
navDirections
{
destination
=
when
{
destination
=
LogFragment
::
class
Config
.
redesign
->
RedesignLogFragment
::
class
else
->
LogFragment
::
class
}
}
}
}
}
fun
settings
()
=
MagiskNavigationEvent
{
fun
settings
()
=
MagiskNavigationEvent
{
navDirections
{
navDirections
{
destination
=
when
{
destination
=
SettingsFragment
::
class
Config
.
redesign
->
RedesignSettingsFragment
::
class
else
->
SettingsFragment
::
class
}
}
}
}
}
...
@@ -116,10 +87,8 @@ object Navigation {
...
@@ -116,10 +87,8 @@ object Navigation {
// redesign starts here
// redesign starts here
fun
start
(
launchIntent
:
Intent
,
context
:
Context
)
{
fun
start
(
launchIntent
:
Intent
,
context
:
Context
)
{
when
{
context
.
intent
<
MainActivity
>()
Config
.
redesign
->
context
.
intent
<
RedesignActivity
>()
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
launchIntent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
else
->
context
.
intent
<
MainActivity
>()
}.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
launchIntent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
.
putExtra
(
.
putExtra
(
Const
.
Key
.
OPEN_SETTINGS
,
Const
.
Key
.
OPEN_SETTINGS
,
launchIntent
.
action
==
ACTION_APPLICATION_PREFERENCES
launchIntent
.
action
==
ACTION_APPLICATION_PREFERENCES
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt
View file @
df0a5b59
...
@@ -4,6 +4,7 @@ import android.os.Bundle
...
@@ -4,6 +4,7 @@ import android.os.Bundle
import
android.view.MenuItem
import
android.view.MenuItem
import
android.view.View
import
android.view.View
import
android.view.ViewTreeObserver
import
android.view.ViewTreeObserver
import
android.view.WindowManager
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.core.graphics.Insets
import
androidx.core.graphics.Insets
import
androidx.core.view.setPadding
import
androidx.core.view.setPadding
...
@@ -54,6 +55,8 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
...
@@ -54,6 +55,8 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
window
.
setSoftInputMode
(
WindowManager
.
LayoutParams
.
SOFT_INPUT_ADJUST_RESIZE
)
setSupportActionBar
(
binding
.
mainToolbar
)
setSupportActionBar
(
binding
.
mainToolbar
)
binding
.
mainToolbarWrapper
.
updateLayoutParams
<
CoordinatorLayout
.
LayoutParams
>
{
binding
.
mainToolbarWrapper
.
updateLayoutParams
<
CoordinatorLayout
.
LayoutParams
>
{
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsItems.kt
View file @
df0a5b59
...
@@ -42,13 +42,6 @@ object Language : SettingsItem.Selector() {
...
@@ -42,13 +42,6 @@ object Language : SettingsItem.Selector() {
}
}
}
}
object
Redesign
:
SettingsItem
.
Toggle
()
{
override
val
title
=
"Redesign"
.
asTransitive
()
override
val
description
=
"Select this to disable redesign. App will automatically shut down"
.
asTransitive
()
override
var
value
:
Boolean
by
dataObservable
(
Config
.
redesign
)
{
Config
.
redesign
=
it
}
}
object
Theme
:
SettingsItem
.
Blank
()
{
object
Theme
:
SettingsItem
.
Blank
()
{
override
val
icon
=
R
.
drawable
.
ic_paint
override
val
icon
=
R
.
drawable
.
ic_paint
override
val
title
=
R
.
string
.
section_theme
.
asTransitive
()
override
val
title
=
R
.
string
.
section_theme
.
asTransitive
()
...
@@ -386,4 +379,4 @@ object SUNotification : SettingsItem.Selector() {
...
@@ -386,4 +379,4 @@ object SUNotification : SettingsItem.Selector() {
override
fun
refresh
()
{
override
fun
refresh
()
{
isEnabled
=
Utils
.
showSuperUser
()
isEnabled
=
Utils
.
showSuperUser
()
}
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt
View file @
df0a5b59
...
@@ -11,7 +11,6 @@ import com.topjohnwu.magisk.model.download.DownloadService
...
@@ -11,7 +11,6 @@ import com.topjohnwu.magisk.model.download.DownloadService
import
com.topjohnwu.magisk.model.entity.internal.Configuration
import
com.topjohnwu.magisk.model.entity.internal.Configuration
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import
com.topjohnwu.magisk.model.entity.recycler.SettingsItem
import
com.topjohnwu.magisk.model.entity.recycler.SettingsItem
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.events.PermissionEvent
import
com.topjohnwu.magisk.model.events.PermissionEvent
import
com.topjohnwu.magisk.model.events.RecreateEvent
import
com.topjohnwu.magisk.model.events.RecreateEvent
import
com.topjohnwu.magisk.model.events.dialog.BiometricDialog
import
com.topjohnwu.magisk.model.events.dialog.BiometricDialog
...
@@ -35,7 +34,7 @@ class SettingsViewModel(
...
@@ -35,7 +34,7 @@ class SettingsViewModel(
val
itemBinding
=
itemBindingOf
<
SettingsItem
>
{
it
.
bindExtra
(
BR
.
callback
,
this
)
}
val
itemBinding
=
itemBindingOf
<
SettingsItem
>
{
it
.
bindExtra
(
BR
.
callback
,
this
)
}
val
items
=
diffListOf
(
val
items
=
diffListOf
(
Customization
,
Customization
,
Theme
,
Language
,
Redesign
,
DownloadPath
,
GridSize
,
Theme
,
Language
,
DownloadPath
,
GridSize
,
Manager
,
Manager
,
UpdateChannel
,
UpdateChannelUrl
,
ClearRepoCache
,
HideOrRestore
(),
UpdateChecker
,
UpdateChannel
,
UpdateChannelUrl
,
ClearRepoCache
,
HideOrRestore
(),
UpdateChecker
,
...
@@ -57,7 +56,6 @@ class SettingsViewModel(
...
@@ -57,7 +56,6 @@ class SettingsViewModel(
override
fun
onItemChanged
(
view
:
View
,
item
:
SettingsItem
)
=
when
(
item
)
{
override
fun
onItemChanged
(
view
:
View
,
item
:
SettingsItem
)
=
when
(
item
)
{
// use only instances you want, don't declare everything
// use only instances you want, don't declare everything
is
Theme
->
Navigation
.
theme
().
publish
()
is
Theme
->
Navigation
.
theme
().
publish
()
is
Redesign
->
DieEvent
().
publish
()
is
Language
->
RecreateEvent
().
publish
()
is
Language
->
RecreateEvent
().
publish
()
is
UpdateChannel
->
openUrlIfNecessary
(
view
)
is
UpdateChannel
->
openUrlIfNecessary
(
view
)
...
@@ -118,4 +116,4 @@ class SettingsViewModel(
...
@@ -118,4 +116,4 @@ class SettingsViewModel(
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/view/MarkDownWindow.kt
View file @
df0a5b59
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk.view
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk.view
import
android.content.Context
import
android.content.Context
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.widget.TextView
import
android.widget.TextView
import
androidx.appcompat.app.AlertDialog
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.data.repository.StringRepository
import
com.topjohnwu.magisk.data.repository.StringRepository
import
com.topjohnwu.magisk.extensions.subscribeK
import
com.topjohnwu.magisk.extensions.subscribeK
...
@@ -35,7 +33,7 @@ object MarkDownWindow : KoinComponent {
...
@@ -35,7 +33,7 @@ object MarkDownWindow : KoinComponent {
}
}
fun
show
(
activity
:
Context
,
title
:
String
?,
content
:
Single
<
String
>)
{
fun
show
(
activity
:
Context
,
title
:
String
?,
content
:
Single
<
String
>)
{
val
mdRes
=
if
(
Config
.
redesign
)
R
.
layout
.
markdown_window_md2
else
R
.
layout
.
markdown_window
val
mdRes
=
R
.
layout
.
markdown_window_md2
val
mv
=
LayoutInflater
.
from
(
activity
).
inflate
(
mdRes
,
null
)
val
mv
=
LayoutInflater
.
from
(
activity
).
inflate
(
mdRes
,
null
)
val
tv
=
mv
.
findViewById
<
TextView
>(
R
.
id
.
md_txt
)
val
tv
=
mv
.
findViewById
<
TextView
>(
R
.
id
.
md_txt
)
...
@@ -47,21 +45,14 @@ object MarkDownWindow : KoinComponent {
...
@@ -47,21 +45,14 @@ object MarkDownWindow : KoinComponent {
tv
.
setText
(
R
.
string
.
download_file_error
)
tv
.
setText
(
R
.
string
.
download_file_error
)
Completable
.
complete
()
Completable
.
complete
()
}.
subscribeK
{
}.
subscribeK
{
if
(
Config
.
redesign
)
{
MagiskDialog
(
activity
)
MagiskDialog
(
activity
)
.
applyTitle
(
title
?:
""
)
.
applyTitle
(
title
?:
""
)
.
applyView
(
mv
)
.
applyView
(
mv
)
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
titleRes
=
android
.
R
.
string
.
cancel
titleRes
=
android
.
R
.
string
.
cancel
}
}
.
reveal
()
.
reveal
()
return
@subscribeK
return
@subscribeK
}
AlertDialog
.
Builder
(
activity
)
.
setTitle
(
title
)
.
setView
(
mv
)
.
setNegativeButton
(
android
.
R
.
string
.
cancel
)
{
dialog
,
_
->
dialog
.
dismiss
()
}
.
show
()
}
}
}
}
}
}
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