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
bcc69523
Commit
bcc69523
authored
Jan 25, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Seperate Configs
parent
ad16a6fc
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
40 additions
and
30 deletions
+40
-30
AboutActivity.java
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
+1
-1
Global.java
app/src/main/java/com/topjohnwu/magisk/Global.java
+18
-1
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+1
-2
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+1
-1
ReposFragment.java
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
+1
-1
SettingsActivity.java
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
+6
-6
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+3
-8
ModuleHelper.java
...c/main/java/com/topjohnwu/magisk/module/ModuleHelper.java
+1
-1
MagiskDlReceiver.java
...java/com/topjohnwu/magisk/receivers/MagiskDlReceiver.java
+1
-1
SuReceiver.java
.../main/java/com/topjohnwu/magisk/superuser/SuReceiver.java
+0
-1
Logger.java
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
+5
-5
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+2
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
View file @
bcc69523
...
@@ -46,7 +46,7 @@ public class AboutActivity extends AppCompatActivity {
...
@@ -46,7 +46,7 @@ public class AboutActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
if
(
Util
s
.
isDarkTheme
)
{
if
(
Global
.
Config
s
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
setContentView
(
R
.
layout
.
activity_about
);
setContentView
(
R
.
layout
.
activity_about
);
...
...
app/src/main/java/com/topjohnwu/magisk/Global.java
View file @
bcc69523
package
com
.
topjohnwu
.
magisk
;
package
com
.
topjohnwu
.
magisk
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.ValueSortedMap
;
import
com.topjohnwu.magisk.utils.ValueSortedMap
;
...
@@ -21,7 +26,7 @@ public class Global {
...
@@ -21,7 +26,7 @@ public class Global {
}
}
public
static
class
Data
{
public
static
class
Data
{
public
static
ValueSortedMap
<
String
,
Repo
>
repoMap
=
new
ValueSortedMap
<>();
public
static
ValueSortedMap
<
String
,
Repo
>
repoMap
=
new
ValueSortedMap
<>();
public
static
ValueSortedMap
<
String
,
com
.
topjohnwu
.
magisk
.
module
.
Module
>
moduleMap
=
new
ValueSortedMap
<>();
public
static
ValueSortedMap
<
String
,
Module
>
moduleMap
=
new
ValueSortedMap
<>();
public
static
List
<
String
>
blockList
;
public
static
List
<
String
>
blockList
;
}
}
public
static
class
Events
{
public
static
class
Events
{
...
@@ -33,5 +38,17 @@ public class Global {
...
@@ -33,5 +38,17 @@ public class Global {
public
static
final
CallbackHandler
.
Event
updateCheckDone
=
new
CallbackHandler
.
Event
();
public
static
final
CallbackHandler
.
Event
updateCheckDone
=
new
CallbackHandler
.
Event
();
public
static
final
CallbackHandler
.
Event
safetyNetDone
=
new
CallbackHandler
.
Event
();
public
static
final
CallbackHandler
.
Event
safetyNetDone
=
new
CallbackHandler
.
Event
();
}
}
public
static
class
Configs
{
public
static
boolean
isDarkTheme
;
public
static
boolean
shellLogging
;
public
static
boolean
devLogging
;
public
static
void
init
(
Context
context
)
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
isDarkTheme
=
prefs
.
getString
(
"theme"
,
context
.
getString
(
R
.
string
.
theme_default_value
)).
equalsIgnoreCase
(
context
.
getString
(
R
.
string
.
theme_dark_value
));
devLogging
=
prefs
.
getBoolean
(
"developer_logging"
,
false
);
shellLogging
=
prefs
.
getBoolean
(
"shell_logging"
,
false
);
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
bcc69523
...
@@ -24,7 +24,6 @@ import android.view.View;
...
@@ -24,7 +24,6 @@ import android.view.View;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
...
@@ -48,7 +47,7 @@ public class MainActivity extends AppCompatActivity
...
@@ -48,7 +47,7 @@ public class MainActivity extends AppCompatActivity
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
if
(
Util
s
.
isDarkTheme
)
{
if
(
Global
.
Config
s
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
bcc69523
...
@@ -16,10 +16,10 @@ import android.widget.TextView;
...
@@ -16,10 +16,10 @@ import android.widget.TextView;
import
com.github.clans.fab.FloatingActionButton
;
import
com.github.clans.fab.FloatingActionButton
;
import
com.topjohnwu.magisk.adapters.ModulesAdapter
;
import
com.topjohnwu.magisk.adapters.ModulesAdapter
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.ModuleHelper
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.module.ModuleHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
...
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
View file @
bcc69523
...
@@ -16,11 +16,11 @@ import android.widget.TextView;
...
@@ -16,11 +16,11 @@ import android.widget.TextView;
import
com.topjohnwu.magisk.adapters.ReposAdapter
;
import
com.topjohnwu.magisk.adapters.ReposAdapter
;
import
com.topjohnwu.magisk.adapters.SimpleSectionedRecyclerViewAdapter
;
import
com.topjohnwu.magisk.adapters.SimpleSectionedRecyclerViewAdapter
;
import
com.topjohnwu.magisk.module.ModuleHelper
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.module.ModuleHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
...
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
bcc69523
...
@@ -32,7 +32,7 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -32,7 +32,7 @@ public class SettingsActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
if
(
Util
s
.
isDarkTheme
)
{
if
(
Global
.
Config
s
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
...
@@ -101,7 +101,7 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -101,7 +101,7 @@ public class SettingsActivity extends AppCompatActivity {
return
true
;
return
true
;
});
});
if
(
Util
s
.
isDarkTheme
)
{
if
(
Global
.
Config
s
.
isDarkTheme
)
{
themePreference
.
setSummary
(
R
.
string
.
theme_dark
);
themePreference
.
setSummary
(
R
.
string
.
theme_dark
);
}
else
{
}
else
{
themePreference
.
setSummary
(
R
.
string
.
theme_default
);
themePreference
.
setSummary
(
R
.
string
.
theme_default
);
...
@@ -143,8 +143,8 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -143,8 +143,8 @@ public class SettingsActivity extends AppCompatActivity {
switch
(
key
)
{
switch
(
key
)
{
case
"theme"
:
case
"theme"
:
String
theme
=
prefs
.
getString
(
"theme"
,
getString
(
R
.
string
.
theme_default_value
));
String
theme
=
prefs
.
getString
(
"theme"
,
getString
(
R
.
string
.
theme_default_value
));
if
(
Util
s
.
isDarkTheme
!=
theme
.
equalsIgnoreCase
(
getString
(
R
.
string
.
theme_dark_value
)))
{
if
(
Global
.
Config
s
.
isDarkTheme
!=
theme
.
equalsIgnoreCase
(
getString
(
R
.
string
.
theme_dark_value
)))
{
Utils
.
isDarkTheme
=
!
Util
s
.
isDarkTheme
;
Global
.
Configs
.
isDarkTheme
=
!
Global
.
Config
s
.
isDarkTheme
;
getActivity
().
recreate
();
getActivity
().
recreate
();
Global
.
Events
.
reloadMainActivity
.
trigger
();
Global
.
Events
.
reloadMainActivity
.
trigger
();
}
}
...
@@ -200,10 +200,10 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -200,10 +200,10 @@ public class SettingsActivity extends AppCompatActivity {
}.
exec
();
}.
exec
();
break
;
break
;
case
"developer_logging"
:
case
"developer_logging"
:
Logger
.
devLo
g
=
prefs
.
getBoolean
(
"developer_logging"
,
false
);
Global
.
Configs
.
devLoggin
g
=
prefs
.
getBoolean
(
"developer_logging"
,
false
);
break
;
break
;
case
"shell_logging"
:
case
"shell_logging"
:
Logger
.
logShell
=
prefs
.
getBoolean
(
"shell_logging"
,
false
);
Global
.
Configs
.
shellLogging
=
prefs
.
getBoolean
(
"shell_logging"
,
false
);
break
;
break
;
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
bcc69523
...
@@ -7,7 +7,6 @@ import android.preference.PreferenceManager;
...
@@ -7,7 +7,6 @@ import android.preference.PreferenceManager;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
public
class
SplashActivity
extends
AppCompatActivity
{
public
class
SplashActivity
extends
AppCompatActivity
{
...
@@ -16,18 +15,14 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -16,18 +15,14 @@ public class SplashActivity extends AppCompatActivity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplication
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplication
Context
());
String
theme
=
prefs
.
getString
(
"theme"
,
getString
(
R
.
string
.
theme_default_value
));
Global
.
Configs
.
init
(
getApplicationContext
());
Utils
.
isDarkTheme
=
theme
.
equalsIgnoreCase
(
getString
(
R
.
string
.
theme_dark_value
));
if
(
Util
s
.
isDarkTheme
)
{
if
(
Global
.
Config
s
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
Logger
.
devLog
=
prefs
.
getBoolean
(
"developer_logging"
,
false
);
Logger
.
logShell
=
prefs
.
getBoolean
(
"shell_logging"
,
false
);
// Initialize prefs
// Initialize prefs
prefs
.
edit
()
prefs
.
edit
()
.
putBoolean
(
"magiskhide"
,
Utils
.
itemExist
(
false
,
"/magisk/.core/magiskhide/enable"
))
.
putBoolean
(
"magiskhide"
,
Utils
.
itemExist
(
false
,
"/magisk/.core/magiskhide/enable"
))
...
...
app/src/main/java/com/topjohnwu/magisk/module/ModuleHelper.java
View file @
bcc69523
...
@@ -5,8 +5,8 @@ import android.content.SharedPreferences;
...
@@ -5,8 +5,8 @@ import android.content.SharedPreferences;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
com.google.gson.reflect.TypeToken
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.ValueSortedMap
;
import
com.topjohnwu.magisk.utils.ValueSortedMap
;
...
...
app/src/main/java/com/topjohnwu/magisk/receivers/MagiskDlReceiver.java
View file @
bcc69523
...
@@ -2,8 +2,8 @@ package com.topjohnwu.magisk.receivers;
...
@@ -2,8 +2,8 @@ package com.topjohnwu.magisk.receivers;
import
android.net.Uri
;
import
android.net.Uri
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.ZipUtils
;
import
com.topjohnwu.magisk.utils.ZipUtils
;
...
...
app/src/main/java/com/topjohnwu/magisk/superuser/SuReceiver.java
View file @
bcc69523
...
@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.superuser;
...
@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.superuser;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Process
;
import
android.os.Process
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
View file @
bcc69523
...
@@ -2,20 +2,20 @@ package com.topjohnwu.magisk.utils;
...
@@ -2,20 +2,20 @@ package com.topjohnwu.magisk.utils;
import
android.util.Log
;
import
android.util.Log
;
import
com.topjohnwu.magisk.Global
;
public
class
Logger
{
public
class
Logger
{
public
static
final
String
TAG
=
"Magisk"
;
public
static
final
String
TAG
=
"Magisk"
;
public
static
final
String
DEV_TAG
=
"Magisk: DEV"
;
public
static
final
String
DEV_TAG
=
"Magisk: DEV"
;
public
static
final
String
DEBUG_TAG
=
"Magisk: DEBUG"
;
public
static
final
String
DEBUG_TAG
=
"Magisk: DEBUG"
;
public
static
boolean
logShell
,
devLog
;
public
static
void
debug
(
String
msg
)
{
public
static
void
debug
(
String
msg
)
{
Log
.
d
(
DEBUG_TAG
,
msg
);
Log
.
d
(
DEBUG_TAG
,
msg
);
}
}
public
static
void
dev
(
String
msg
,
Object
...
args
)
{
public
static
void
dev
(
String
msg
,
Object
...
args
)
{
if
(
devLo
g
)
{
if
(
Global
.
Configs
.
devLoggin
g
)
{
if
(
args
.
length
==
1
&&
args
[
0
]
instanceof
Throwable
)
{
if
(
args
.
length
==
1
&&
args
[
0
]
instanceof
Throwable
)
{
Log
.
d
(
DEV_TAG
,
msg
,
(
Throwable
)
args
[
0
]);
Log
.
d
(
DEV_TAG
,
msg
,
(
Throwable
)
args
[
0
]);
}
else
{
}
else
{
...
@@ -25,13 +25,13 @@ public class Logger {
...
@@ -25,13 +25,13 @@ public class Logger {
}
}
public
static
void
dev
(
String
msg
)
{
public
static
void
dev
(
String
msg
)
{
if
(
devLo
g
)
{
if
(
Global
.
Configs
.
devLoggin
g
)
{
Log
.
d
(
DEV_TAG
,
msg
);
Log
.
d
(
DEV_TAG
,
msg
);
}
}
}
}
public
static
void
shell
(
boolean
root
,
String
msg
)
{
public
static
void
shell
(
boolean
root
,
String
msg
)
{
if
(
logShell
)
{
if
(
Global
.
Configs
.
shellLogging
)
{
Log
.
d
(
root
?
"SU"
:
"SH"
,
msg
);
Log
.
d
(
root
?
"SU"
:
"SH"
,
msg
);
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
bcc69523
...
@@ -12,6 +12,7 @@ import android.support.v4.app.ActivityCompat;
...
@@ -12,6 +12,7 @@ import android.support.v4.app.ActivityCompat;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
...
@@ -23,7 +24,6 @@ import java.util.List;
...
@@ -23,7 +24,6 @@ import java.util.List;
public
class
Utils
{
public
class
Utils
{
public
static
boolean
isDownloading
=
false
;
public
static
boolean
isDownloading
=
false
;
public
static
boolean
isDarkTheme
;
public
static
boolean
itemExist
(
String
path
)
{
public
static
boolean
itemExist
(
String
path
)
{
return
itemExist
(
true
,
path
);
return
itemExist
(
true
,
path
);
...
@@ -125,7 +125,7 @@ public class Utils {
...
@@ -125,7 +125,7 @@ public class Utils {
}
}
public
static
AlertDialog
.
Builder
getAlertDialogBuilder
(
Context
context
)
{
public
static
AlertDialog
.
Builder
getAlertDialogBuilder
(
Context
context
)
{
if
(
isDarkTheme
)
{
if
(
Global
.
Configs
.
isDarkTheme
)
{
return
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
return
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
}
else
{
}
else
{
return
new
AlertDialog
.
Builder
(
context
);
return
new
AlertDialog
.
Builder
(
context
);
...
...
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