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
e4cba700
Commit
e4cba700
authored
Sep 29, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ready for release
parent
692b993e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
538 additions
and
402 deletions
+538
-402
build.gradle
app/build.gradle
+5
-5
AboutActivity.java
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
+7
-1
LogFragment.java
app/src/main/java/com/topjohnwu/magisk/LogFragment.java
+70
-40
MagiskFragment.java
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
+18
-1
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+3
-6
ModulesAdapter.java
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
+0
-1
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+1
-1
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+49
-30
RootFragment.java
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
+143
-142
SettingsFragment.java
app/src/main/java/com/topjohnwu/magisk/SettingsFragment.java
+45
-21
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+3
-4
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+30
-4
AutoStartReceiver.java
...ava/com/topjohnwu/magisk/receivers/AutoStartReceiver.java
+1
-1
PrivateBroadcastReceiver.java
.../topjohnwu/magisk/receivers/PrivateBroadcastReceiver.java
+1
-1
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+43
-12
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+12
-18
fade_in.xml
app/src/main/res/anim/fade_in.xml
+0
-8
fade_out.xml
app/src/main/res/anim/fade_out.xml
+0
-8
ic_attach_money.xml
app/src/main/res/drawable/ic_attach_money.xml
+9
-0
ic_done_black.xml
app/src/main/res/drawable/ic_done_black.xml
+0
-9
activity_about.xml
app/src/main/res/layout/activity_about.xml
+20
-5
list_item_app.xml
app/src/main/res/layout/list_item_app.xml
+23
-23
drawer.xml
app/src/main/res/menu/drawer.xml
+25
-18
menu_module.xml
app/src/main/res/menu/menu_module.xml
+0
-11
colors.xml
app/src/main/res/values/colors.xml
+0
-6
dimens.xml
app/src/main/res/values/dimens.xml
+0
-1
strings.xml
app/src/main/res/values/strings.xml
+16
-14
styles.xml
app/src/main/res/values/styles.xml
+0
-8
uisettings.xml
app/src/main/res/xml/uisettings.xml
+14
-3
No files found.
app/build.gradle
View file @
e4cba700
...
...
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
android
{
compileSdkVersion
24
buildToolsVersion
"24.0.
2
"
buildToolsVersion
"24.0.
3
"
defaultConfig
{
applicationId
"com.topjohnwu.magisk"
minSdkVersion
21
targetSdkVersion
24
versionCode
4
versionCode
5
versionName
"2.0"
jackOptions
{
enabled
true
...
...
@@ -32,9 +32,9 @@ repositories {
dependencies
{
compile
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
compile
'com.android.support:recyclerview-v7:24.2.
0
'
compile
'com.android.support:cardview-v7:24.2.
0
'
compile
'com.android.support:design:24.2.
0
'
compile
'com.android.support:recyclerview-v7:24.2.
1
'
compile
'com.android.support:cardview-v7:24.2.
1
'
compile
'com.android.support:design:24.2.
1
'
compile
'com.github.d8ahazard:BroadcastTileSupportUpdate:master'
compile
'com.getkeepsafe.taptargetview:taptargetview:1.2.0'
compile
'com.jakewharton:butterknife:8.4.0'
...
...
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
View file @
e4cba700
...
...
@@ -29,7 +29,9 @@ import butterknife.ButterKnife;
public
class
AboutActivity
extends
AppCompatActivity
{
private
static
final
String
SOURCE_CODE_URL
=
"https://github.com/topjohnwu/MagiskManager"
;
private
static
final
String
XDA_THREAD
=
"http://forum.xda-developers.com/android/software/mod-magisk-v1-universal-systemless-t3432382"
;
private
static
final
String
XDA_THREAD
=
"http://forum.xda-developers.com/showthread.php?t=3432382"
;
private
static
final
String
DONATION_URL
=
"http://topjohnwu.github.io/donate"
;
private
AlertDialog
.
Builder
builder
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
...
...
@@ -39,6 +41,7 @@ public class AboutActivity extends AppCompatActivity {
@BindView
(
R
.
id
.
app_translators
)
RowItem
appTranslators
;
@BindView
(
R
.
id
.
app_source_code
)
RowItem
appSourceCode
;
@BindView
(
R
.
id
.
support_thread
)
RowItem
supportThread
;
@BindView
(
R
.
id
.
donation
)
RowItem
donation
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -139,6 +142,9 @@ public class AboutActivity extends AppCompatActivity {
supportThread
.
removeSummary
();
supportThread
.
setOnClickListener
(
view
->
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
XDA_THREAD
))));
donation
.
removeSummary
();
donation
.
setOnClickListener
(
view
->
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
DONATION_URL
))));
setFloating
();
}
...
...
app/src/main/java/com/topjohnwu/magisk/LogFragment.java
View file @
e4cba700
...
...
@@ -90,10 +90,7 @@ public class LogFragment extends Fragment {
reloadErrorLog
();
return
true
;
case
R
.
id
.
menu_send
:
try
{
send
();
}
catch
(
NullPointerException
ignored
)
{
}
send
();
return
true
;
case
R
.
id
.
menu_save
:
save
();
...
...
@@ -117,11 +114,23 @@ public class LogFragment extends Fragment {
}
private
void
send
()
{
Intent
sendIntent
=
new
Intent
();
sendIntent
.
setAction
(
Intent
.
ACTION_SEND
);
sendIntent
.
putExtra
(
Intent
.
EXTRA_STREAM
,
Uri
.
fromFile
(
save
()));
sendIntent
.
setType
(
"application/html"
);
startActivity
(
Intent
.
createChooser
(
sendIntent
,
getResources
().
getString
(
R
.
string
.
menuSend
)));
new
SaveLog
()
{
@Override
protected
void
onPostExecute
(
Boolean
bool
)
{
super
.
onPostExecute
(
bool
);
if
(
bool
)
{
Intent
sendIntent
=
new
Intent
();
sendIntent
.
setAction
(
Intent
.
ACTION_SEND
);
sendIntent
.
putExtra
(
Intent
.
EXTRA_STREAM
,
Uri
.
fromFile
(
targetFile
));
sendIntent
.
setType
(
"application/html"
);
startActivity
(
Intent
.
createChooser
(
sendIntent
,
getResources
().
getString
(
R
.
string
.
menuSend
)));
}
else
{
Toast
.
makeText
(
getActivity
(),
getString
(
R
.
string
.
logs_save_failed
),
Toast
.
LENGTH_LONG
).
show
();
}
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
@Override
...
...
@@ -138,45 +147,66 @@ public class LogFragment extends Fragment {
}
}
@SuppressLint
(
"DefaultLocale"
)
private
File
save
()
{
if
(
ActivityCompat
.
checkSelfPermission
(
getActivity
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
0
);
private
void
save
()
{
new
SaveLog
(){
@Override
protected
void
onPostExecute
(
Boolean
bool
)
{
super
.
onPostExecute
(
bool
);
if
(
bool
)
{
Toast
.
makeText
(
getActivity
(),
targetFile
.
toString
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
Toast
.
makeText
(
getActivity
(),
getString
(
R
.
string
.
logs_save_failed
),
Toast
.
LENGTH_LONG
).
show
();
}
}
return
null
;
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
)
;
}
if
(!
Environment
.
getExternalStorageState
().
equals
(
Environment
.
MEDIA_MOUNTED
))
{
Snackbar
.
make
(
txtLog
,
R
.
string
.
sdcard_not_writable
,
Snackbar
.
LENGTH_LONG
).
show
();
return
null
;
}
private
class
SaveLog
extends
AsyncTask
<
Void
,
Void
,
Boolean
>
{
Calendar
now
=
Calendar
.
getInstance
();
String
filename
=
String
.
format
(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log"
,
"error"
,
now
.
get
(
Calendar
.
YEAR
),
now
.
get
(
Calendar
.
MONTH
)
+
1
,
now
.
get
(
Calendar
.
DAY_OF_MONTH
),
now
.
get
(
Calendar
.
HOUR_OF_DAY
),
now
.
get
(
Calendar
.
MINUTE
),
now
.
get
(
Calendar
.
SECOND
));
File
targetFile
;
File
dir
=
new
File
(
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
()
+
"/Magisk/"
);
dir
.
mkdir
();
@SuppressLint
(
"DefaultLocale"
)
@Override
protected
Boolean
doInBackground
(
Void
...
voids
)
{
if
(
ActivityCompat
.
checkSelfPermission
(
getActivity
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
0
);
}
return
false
;
}
if
(!
Environment
.
getExternalStorageState
().
equals
(
Environment
.
MEDIA_MOUNTED
))
{
return
false
;
}
Calendar
now
=
Calendar
.
getInstance
();
String
filename
=
String
.
format
(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log"
,
"error"
,
now
.
get
(
Calendar
.
YEAR
),
now
.
get
(
Calendar
.
MONTH
)
+
1
,
now
.
get
(
Calendar
.
DAY_OF_MONTH
),
now
.
get
(
Calendar
.
HOUR_OF_DAY
),
now
.
get
(
Calendar
.
MINUTE
),
now
.
get
(
Calendar
.
SECOND
));
File
targetFile
=
new
File
(
dir
,
filename
);
List
<
String
>
in
=
Utils
.
readFile
(
MAGISK_LOG
);
targetFile
=
new
File
(
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
()
+
"/MagiskManager/"
+
filename
);
try
{
FileWriter
out
=
new
FileWriter
(
targetFile
);
for
(
String
line
:
in
)
{
out
.
write
(
line
+
"\n"
);
if
((!
targetFile
.
getParentFile
().
exists
()
&&
!
targetFile
.
getParentFile
().
mkdirs
())
||
(
targetFile
.
exists
()
&&
!
targetFile
.
delete
()))
{
return
false
;
}
out
.
close
();
Toast
.
makeText
(
getActivity
(),
targetFile
.
toString
(),
Toast
.
LENGTH_LONG
).
show
();
return
targetFile
;
}
catch
(
IOException
e
)
{
Toast
.
makeText
(
getActivity
(),
getResources
().
getString
(
R
.
string
.
logs_save_failed
)
+
"\n"
+
e
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
return
null
;
List
<
String
>
in
=
Utils
.
readFile
(
MAGISK_LOG
);
try
{
FileWriter
out
=
new
FileWriter
(
targetFile
);
for
(
String
line
:
in
)
{
out
.
write
(
line
+
"\n"
);
}
out
.
close
();
return
true
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
e4cba700
...
...
@@ -152,7 +152,7 @@ public class MagiskFragment extends Fragment {
private
void
updateUI
()
{
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
()).
getString
(
"theme"
,
""
);
if
(
theme
.
equals
(
"Dark"
))
{
builder
=
new
AlertDialog
.
Builder
(
getActivity
(),
R
.
style
.
AlertDialog_dh
);
builder
=
new
AlertDialog
.
Builder
(
getActivity
(),
R
.
style
.
AlertDialog_dh
);
}
else
{
builder
=
new
AlertDialog
.
Builder
(
getActivity
());
}
...
...
@@ -190,11 +190,28 @@ public class MagiskFragment extends Fragment {
"Magisk-v"
+
String
.
valueOf
(
remoteMagiskVersion
)
+
".zip"
))
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
());
}
else
{
magiskCheckUpdatesContainer
.
setBackgroundColor
(
colorOK
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_check_circle
);
magiskCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
up_to_date
,
getString
(
R
.
string
.
magisk
)));
magiskCheckUpdatesStatus
.
setTextColor
(
colorOK
);
magiskUpdateView
.
setOnClickListener
(
view
->
builder
.
setTitle
(
getString
(
R
.
string
.
repo_install_title
,
getString
(
R
.
string
.
magisk
)))
.
setMessage
(
getString
(
R
.
string
.
repo_install_msg
,
"Magisk-v"
+
String
.
valueOf
(
remoteMagiskVersion
)))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
Utils
.
downloadAndReceive
(
getActivity
(),
new
DownloadReceiver
()
{
@Override
public
void
task
(
Uri
uri
)
{
new
Async
.
FlashZIP
(
mContext
,
uri
).
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
},
magiskLink
,
"Magisk-v"
+
String
.
valueOf
(
remoteMagiskVersion
)
+
".zip"
))
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
());
}
if
(
remoteAppVersionCode
>
BuildConfig
.
VERSION_CODE
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
e4cba700
...
...
@@ -35,12 +35,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private
final
Handler
mDrawerHandler
=
new
Handler
();
private
String
currentTitle
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
@BindView
(
R
.
id
.
drawer_layout
)
DrawerLayout
drawer
;
@BindView
(
R
.
id
.
nav_view
)
NavigationView
navigationView
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
@BindView
(
R
.
id
.
drawer_layout
)
DrawerLayout
drawer
;
@BindView
(
R
.
id
.
nav_view
)
NavigationView
navigationView
;
@IdRes
private
int
mSelectedId
=
R
.
id
.
magisk
;
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
View file @
e4cba700
...
...
@@ -67,7 +67,6 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
public
void
onBindViewHolder
(
final
ViewHolder
holder
,
int
position
)
{
final
Module
module
=
mList
.
get
(
position
);
Log
.
d
(
"Magisk"
,
"ModulesAdapter: Trying set up bindview from list pos "
+
position
+
" and "
+
module
.
getName
());
if
(
module
.
isCache
())
{
holder
.
title
.
setText
(
"[Cache] "
+
module
.
getName
());
}
else
{
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
e4cba700
...
...
@@ -61,7 +61,7 @@ public class ModulesFragment extends Fragment {
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
recyclerView
.
setVisibility
(
View
.
GONE
);
prefs
.
edit
().
putBoolean
(
"module_done"
,
false
).
apply
();
new
Async
.
LoadModules
(
getActivity
()).
executeOnExecutor
(
AsyncTask
.
THREAD_POO
L_EXECUTOR
);
new
Async
.
LoadModules
(
getActivity
()).
executeOnExecutor
(
AsyncTask
.
SERIA
L_EXECUTOR
);
});
if
(
prefs
.
getBoolean
(
"module_done"
,
false
))
{
...
...
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
View file @
e4cba700
...
...
@@ -4,9 +4,12 @@ import android.animation.Animator;
import
android.animation.ObjectAnimator
;
import
android.animation.ValueAnimator
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.preference.PreferenceManager
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
...
...
@@ -39,6 +42,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
private
final
List
<
Repo
>
mList
;
private
View
mView
;
private
Context
context
;
private
AlertDialog
.
Builder
builder
;
public
ReposAdapter
(
List
<
Repo
>
list
)
{
mList
=
list
;
...
...
@@ -49,6 +53,14 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
mView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_repo
,
parent
,
false
);
ButterKnife
.
bind
(
this
,
mView
);
context
=
parent
.
getContext
();
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getString
(
"theme"
,
""
);
if
(
theme
.
equals
(
"Dark"
))
{
builder
=
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
}
else
{
builder
=
new
AlertDialog
.
Builder
(
context
);
}
return
new
ViewHolder
(
mView
);
}
...
...
@@ -75,44 +87,51 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
View
.
OnClickListener
listener
=
view
->
{
if
(
view
.
getId
()
==
holder
.
updateImage
.
getId
())
{
Utils
.
downloadAndReceive
(
context
,
new
DownloadReceiver
(
repo
.
getName
()
+
"-"
+
repo
.
getVersion
())
{
@Override
public
void
task
(
Uri
uri
)
{
new
Async
.
FlashZIP
(
context
,
uri
,
mName
)
{
String
fullname
=
repo
.
getName
()
+
"-"
+
repo
.
getVersion
();
builder
.
setTitle
(
context
.
getString
(
R
.
string
.
repo_install_title
,
repo
.
getName
()))
.
setMessage
(
context
.
getString
(
R
.
string
.
repo_install_msg
,
fullname
))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
Utils
.
downloadAndReceive
(
context
,
new
DownloadReceiver
(
fullname
)
{
@Override
protected
void
preProcessing
()
throws
Throwable
{
super
.
preProcessing
();
new
File
(
mUri
.
getPath
()).
delete
();
Shell
.
su
(
"cd "
+
mFile
.
getParent
(),
"mkdir git"
,
"unzip -o install.zip -d git"
,
"mv git/* install"
,
"cd install"
,
"rm -rf system/placeholder"
,
"chmod 644 $(find . -type f)"
,
"chmod 755 $(find . -type d)"
,
"rm -rf ../install.zip ../git"
,
"zip -r ../install.zip *"
,
"rm -rf ../install"
);
public
void
task
(
Uri
uri
)
{
new
Async
.
FlashZIP
(
context
,
uri
,
mName
)
{
@Override
protected
void
preProcessing
()
throws
Throwable
{
super
.
preProcessing
();
new
File
(
mUri
.
getPath
()).
delete
();
Shell
.
su
(
"cd "
+
mFile
.
getParent
(),
"mkdir git"
,
"unzip -o install.zip -d git"
,
"mv git/* install"
,
"cd install"
,
"rm -rf system/placeholder"
,
"chmod 644 $(find . -type f)"
,
"chmod 755 $(find . -type d)"
,
"rm -rf ../install.zip ../git"
,
"zip -r ../install.zip *"
,
"rm -rf ../install"
);
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
}
.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
},
repo
.
getZipUrl
(),
repo
.
getId
().
replace
(
" "
,
""
)
+
".zip"
);
}
,
repo
.
getZipUrl
(),
repo
.
getId
().
replace
(
" "
,
""
)
+
".zip"
))
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
(
);
}
if
((
view
.
getId
()
==
holder
.
changeLog
.
getId
())
&&
(!
repo
.
getLogUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Changelog"
,
repo
.
getLogUrl
(),
context
);
new
WebWindow
(
context
.
getString
(
R
.
string
.
changelog
)
,
repo
.
getLogUrl
(),
context
);
}
if
((
view
.
getId
()
==
holder
.
authorLink
.
getId
())
&&
(!
repo
.
getSupportUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Donate"
,
repo
.
getDonateUrl
(),
context
);
context
.
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
repo
.
getDonateUrl
()))
);
}
if
((
view
.
getId
()
==
holder
.
supportLink
.
getId
())
&&
(!
repo
.
getSupportUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Support"
,
repo
.
getSupportUrl
(),
context
);
context
.
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
repo
.
getSupportUrl
()))
);
}
};
...
...
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
View file @
e4cba700
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/SettingsFragment.java
View file @
e4cba700
...
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.preference.CheckBoxPreference
;
import
android.preference.ListPreference
;
...
...
@@ -12,19 +13,18 @@ import android.util.TypedValue;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
butterknife.ButterKnife
;
public
class
SettingsFragment
extends
PreferenceFragment
implements
SharedPreferences
.
OnSharedPreferenceChangeListener
{
private
CheckBoxPreference
quickTilePreference
;
private
CheckBoxPreference
quickTilePreference
,
busyboxPreference
;
private
ListPreference
themePreference
;
public
SettingsFragment
()
{
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -50,9 +50,10 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
ButterKnife
.
bind
(
this
,
view
);
quickTilePreference
=
(
CheckBoxPreference
)
findPreference
(
"enable_quicktile"
);
themePreference
=
(
ListPreference
)
findPreference
(
"theme"
);
busyboxPreference
=
(
CheckBoxPreference
)
findPreference
(
"busybox"
);
quickTilePreference
=
(
CheckBoxPreference
)
findPreference
(
"enable_quicktile"
)
;
busyboxPreference
.
setChecked
(
Utils
.
commandExists
(
"unzip"
));
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
()).
registerOnSharedPreferenceChangeListener
(
this
);
CheckBoxPreference
keepRootOffPreference
=
(
CheckBoxPreference
)
findPreference
(
"keep_root_off"
);
CheckBoxPreference
hideRootNotificationPreference
=
(
CheckBoxPreference
)
findPreference
(
"hide_root_notification"
);
...
...
@@ -67,21 +68,6 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
hideRootNotificationPreference
.
setEnabled
(
true
);
}
Preference
.
OnPreferenceClickListener
preferenceClickListener
=
preference
->
{
if
(
preference
==
quickTilePreference
)
{
boolean
isChecked
=
quickTilePreference
.
isChecked
();
if
(
isChecked
)
{
Utils
.
installTile
(
getActivity
());
}
else
{
Utils
.
uninstallTile
(
getActivity
());
}
}
return
false
;
};
quickTilePreference
.
setOnPreferenceClickListener
(
preferenceClickListener
);
// calculate margins
int
horizontalMargin
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
2
,
getResources
().
getDisplayMetrics
());
int
verticalMargin
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
2
,
getResources
().
getDisplayMetrics
());
...
...
@@ -118,6 +104,44 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
Logger
.
dev
(
"SettingsFragment: theme is "
+
pref
);
}
else
if
(
key
.
equals
(
"enable_quicktile"
))
{
boolean
checked
=
sharedPreferences
.
getBoolean
(
"enable_quicktile"
,
false
);
if
(
checked
)
{
new
AsyncTask
<
Void
,
Void
,
Boolean
>
()
{
@Override
protected
Boolean
doInBackground
(
Void
...
voids
)
{
return
Utils
.
installTile
(
getActivity
());
}
@Override
protected
void
onPostExecute
(
Boolean
result
)
{
super
.
onPostExecute
(
result
);
if
(
result
)
{
Toast
.
makeText
(
getActivity
(),
"Tile installed"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
getActivity
(),
"Tile installation error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
else
{
new
AsyncTask
<
Void
,
Void
,
Boolean
>
()
{
@Override
protected
Boolean
doInBackground
(
Void
...
voids
)
{
return
Utils
.
uninstallTile
(
getActivity
());
}
@Override
protected
void
onPostExecute
(
Boolean
result
)
{
super
.
onPostExecute
(
result
);
if
(
result
)
{
Toast
.
makeText
(
getActivity
(),
"Tile uninstalled"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
getActivity
(),
"Tile uninstallation error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
}
else
if
(
key
.
equals
(
"busybox"
))
{
boolean
checked
=
sharedPreferences
.
getBoolean
(
"busybox"
,
false
);
new
Async
.
LinkBusyBox
(
checked
).
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
e4cba700
...
...
@@ -19,7 +19,6 @@ public class SplashActivity extends AppCompatActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
SharedPreferences
defaultPrefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplication
());
if
(
defaultPrefs
.
getString
(
"theme"
,
""
).
equals
(
"Dark"
))
{
...
...
@@ -35,8 +34,8 @@ public class SplashActivity extends AppCompatActivity {
set
.
add
(
"com.google.android.gms"
);
set
.
add
(
"com.google.commerce.tapandpay"
);
editor
.
putStringSet
(
"auto_blacklist"
,
set
);
editor
.
putBoolean
(
"autoRootEnable"
,
false
);
editor
.
putBoolean
(
"root"
,
Utils
.
rootEnabled
());
editor
.
putBoolean
(
"autoRootEnable"
,
false
);
editor
.
putBoolean
(
"root"
,
Utils
.
rootEnabled
());
editor
.
apply
();
}
...
...
@@ -56,7 +55,7 @@ public class SplashActivity extends AppCompatActivity {
}
// Set up quick settings tile
Utils
.
S
etupQuickSettingsTile
(
getApplicationContext
());
Utils
.
s
etupQuickSettingsTile
(
getApplicationContext
());
// Initialize
Utils
.
init
(
this
);
...
...
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
e4cba700
package
com
.
topjohnwu
.
magisk
.
module
;
import
android.os.AsyncTask
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.ModuleHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
...
...
@@ -34,11 +36,23 @@ public class Module extends BaseModule {
}
public
void
createDisableFile
()
{
mEnable
=
!
Utils
.
createFile
(
mDisableFile
);
new
AsyncTask
<
Void
,
Void
,
Void
>()
{
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
mEnable
=
!
Utils
.
createFile
(
mDisableFile
);
return
null
;
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
public
void
removeDisableFile
()
{
mEnable
=
Utils
.
removeFile
(
mDisableFile
);
new
AsyncTask
<
Void
,
Void
,
Void
>()
{
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
mEnable
=
Utils
.
removeFile
(
mDisableFile
);
return
null
;
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
public
boolean
isEnabled
()
{
...
...
@@ -46,11 +60,23 @@ public class Module extends BaseModule {
}
public
void
createRemoveFile
()
{
mRemove
=
Utils
.
createFile
(
mRemoveFile
);
new
AsyncTask
<
Void
,
Void
,
Void
>()
{
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
mRemove
=
Utils
.
createFile
(
mRemoveFile
);
return
null
;
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
public
void
deleteRemoveFile
()
{
mRemove
=
!
Utils
.
removeFile
(
mRemoveFile
);
new
AsyncTask
<
Void
,
Void
,
Void
>()
{
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
mRemove
=
!
Utils
.
removeFile
(
mRemoveFile
);
return
null
;
}
}.
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
public
boolean
willBeRemoved
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/receivers/AutoStartReceiver.java
View file @
e4cba700
...
...
@@ -19,7 +19,7 @@ public class AutoStartReceiver extends BroadcastReceiver {
Utils
.
toggleRoot
(
false
,
context
);
}
if
(
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
Utils
.
S
etupQuickSettingsTile
(
context
);
Utils
.
s
etupQuickSettingsTile
(
context
);
}
...
...
app/src/main/java/com/topjohnwu/magisk/receivers/PrivateBroadcastReceiver.java
View file @
e4cba700
...
...
@@ -32,6 +32,6 @@ public final class PrivateBroadcastReceiver extends BroadcastReceiver {
Utils
.
toggleRoot
(
false
,
context
);
}
Utils
.
S
etupQuickSettingsTile
(
context
);
Utils
.
s
etupQuickSettingsTile
(
context
);
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
e4cba700
...
...
@@ -46,16 +46,18 @@ public class Async {
String
busybox
=
mContext
.
getApplicationInfo
().
dataDir
+
"/lib/libbusybox.so"
;
String
zip
=
mContext
.
getApplicationInfo
().
dataDir
+
"/lib/libzip.so"
;
if
(
Shell
.
rootAccess
())
{
if
(!
Utils
.
commandExists
(
"unzip"
)
||
!
Utils
.
commandExists
(
"zip"
)
||
!
Utils
.
itemExist
(
toolPath
))
{
if
(!
Utils
.
itemExist
(
toolPath
))
{
Shell
.
sh
(
"rm -rf "
+
toolPath
,
"mkdir "
+
toolPath
,
"chmod 755 "
+
toolPath
,
"ln -s "
+
busybox
+
" "
+
toolPath
+
"/busybox"
,
"for tool in $("
+
toolPath
+
"/busybox --list); do"
,
"ln -s "
+
busybox
+
" "
+
toolPath
+
"/$tool"
,
"cd "
+
toolPath
,
"ln -s "
+
busybox
+
" busybox"
,
"for tool in $(./busybox --list); do"
,
"ln -s "
+
busybox
+
" $tool"
,
"done"
,
"ln -s "
+
zip
+
" "
+
toolPath
+
"/zip"
"rm -f su sh"
,
"ln -s "
+
zip
+
" zip"
);
}
}
...
...
@@ -165,15 +167,18 @@ public class Async {
mContext
=
context
;
mUri
=
uri
;
Cursor
c
=
mContext
.
getContentResolver
().
query
(
uri
,
null
,
null
,
null
,
null
);
int
nameIndex
=
c
.
getColumnIndex
(
OpenableColumns
.
DISPLAY_NAME
);
c
.
moveToFirst
();
if
(
nameIndex
!=
-
1
)
{
mName
=
c
.
getString
(
nameIndex
);
}
else
{
if
(
c
!=
null
)
{
int
nameIndex
=
c
.
getColumnIndex
(
OpenableColumns
.
DISPLAY_NAME
);
c
.
moveToFirst
();
if
(
nameIndex
!=
-
1
)
{
mName
=
c
.
getString
(
nameIndex
);
}
c
.
close
();
}
if
(
mName
==
null
)
{
int
idx
=
uri
.
getPath
().
lastIndexOf
(
'/'
);
mName
=
uri
.
getPath
().
substring
(
idx
+
1
);
}
c
.
close
();
copyToSD
=
false
;
}
...
...
@@ -296,6 +301,10 @@ public class Async {
}
protected
void
done
()
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
mContext
);
prefs
.
edit
().
putBoolean
(
"module_done"
,
false
).
apply
();
new
LoadModules
(
mContext
).
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
AlertDialog
.
Builder
builder
;
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
mContext
).
getString
(
"theme"
,
""
);
if
(
theme
.
equals
(
"Dark"
))
{
...
...
@@ -306,9 +315,31 @@ public class Async {
builder
.
setTitle
(
R
.
string
.
reboot_title
)
.
setMessage
(
R
.
string
.
reboot_msg
)
.
setPositiveButton
(
R
.
string
.
reboot
,
(
dialogInterface1
,
i
)
->
Shell
.
s
u
(
"sh
-c reboot"
))
.
setPositiveButton
(
R
.
string
.
reboot
,
(
dialogInterface1
,
i
)
->
Shell
.
s
h
(
"su
-c reboot"
))
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
();
}
}
public
static
class
LinkBusyBox
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
private
boolean
link
;
public
LinkBusyBox
(
boolean
b
)
{
link
=
b
;
}
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
if
(
link
)
{
Shell
.
su
(
"rm -rf /magisk/.core/busybox"
,
"ln -s /data/busybox /magisk/.core/busybox"
);
}
else
{
Shell
.
su
(
"rm -rf /magisk/.core/busybox"
);
}
return
null
;
}
}
}
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
e4cba700
...
...
@@ -23,7 +23,6 @@ import android.widget.Toast;
import
com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder
;
import
com.topjohnwu.magisk.MagiskFragment
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.module.BaseModule
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
import
com.topjohnwu.magisk.receivers.PrivateBroadcastReceiver
;
import
com.topjohnwu.magisk.services.MonitorService
;
...
...
@@ -36,7 +35,6 @@ import java.security.InvalidKeyException;
import
java.security.NoSuchAlgorithmException
;
import
java.security.spec.InvalidKeySpecException
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -63,7 +61,7 @@ public class Utils {
MagiskFragment
.
magiskVersion
=
Integer
.
parseInt
(
ret
.
get
(
0
));
}
String
toolPath
=
context
.
getApplicationInfo
().
dataDir
+
"/tools"
;
Shell
.
su
(
"PATH=
$PATH:"
+
toolPath
);
Shell
.
su
(
"PATH=
"
+
toolPath
+
":$PATH"
);
}
public
static
boolean
itemExist
(
String
path
)
{
...
...
@@ -113,7 +111,7 @@ public class Utils {
Shell
.
su
(
"rm -rf /magisk/.core/bin"
,
"setprop magisk.root 0"
);
}
if
(
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
S
etupQuickSettingsTile
(
context
);
s
etupQuickSettingsTile
(
context
);
}
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
"root"
,
b
).
apply
();
}
...
...
@@ -140,7 +138,7 @@ public class Utils {
}
}
if
(
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
S
etupQuickSettingsTile
(
context
);
s
etupQuickSettingsTile
(
context
);
}
}
...
...
@@ -174,7 +172,7 @@ public class Utils {
}
if
((!
file
.
getParentFile
().
exists
()
&&
!
file
.
getParentFile
().
mkdirs
())
||
(
file
.
exists
()
&&
!
file
.
delete
()))
{
Toast
.
makeText
(
context
,
R
.
string
.
toast_error_makedir
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
context
,
R
.
string
.
permissionNotGranted
,
Toast
.
LENGTH_LONG
).
show
();
}
DownloadManager
downloadManager
=
(
DownloadManager
)
context
.
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
...
...
@@ -208,7 +206,7 @@ public class Utils {
return
secret
;
}
public
static
void
S
etupQuickSettingsTile
(
Context
mContext
)
{
public
static
void
s
etupQuickSettingsTile
(
Context
mContext
)
{
Logger
.
dev
(
"Utils: SetupQuickSettings called"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
Logger
.
dev
(
"Utils: Starting N quick settings service"
);
...
...
@@ -266,7 +264,7 @@ public class Utils {
}
}
public
static
void
installTile
(
Context
context
)
{
public
static
boolean
installTile
(
Context
context
)
{
String
qsTileId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
qsTileId
=
"custom(com.topjohnwu.magisk/.services.TileServiceNewApi)"
;
...
...
@@ -281,8 +279,7 @@ public class Utils {
if
(
tiles
.
size
()
>
1
)
{
for
(
String
tile
:
tiles
)
{
if
(
tile
.
equals
(
qsTileId
))
{
Toast
.
makeText
(
context
,
"Tile already installed"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
return
true
;
}
}
...
...
@@ -290,17 +287,16 @@ public class Utils {
String
newTiles
=
TextUtils
.
join
(
","
,
tiles
);
Logger
.
dev
(
"Utils: NewtilesString is "
+
newTiles
);
Shell
.
su
(
"settings put secure sysui_qs_tiles \""
+
newTiles
+
"\""
);
Toast
.
makeText
(
context
,
"Tile installed"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
Utils
.
refreshService
(
context
);
}
return
;
return
true
;
}
}
Toast
.
makeText
(
context
,
"Tile installation error"
,
Toast
.
LENGTH_SHORT
).
show
()
;
return
false
;
}
public
static
void
uninstallTile
(
Context
context
)
{
public
static
boolean
uninstallTile
(
Context
context
)
{
String
qsTileId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
...
...
@@ -323,17 +319,15 @@ public class Utils {
if
(
isPresent
)
{
String
newTiles
=
TextUtils
.
join
(
","
,
tiles
);
Shell
.
su
(
"settings put secure sysui_qs_tiles \""
+
newTiles
+
"\""
);
Toast
.
makeText
(
context
,
"Tile uninstalled"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
Utils
.
refreshService
(
context
);
}
return
;
}
Toast
.
makeText
(
context
,
"Tile already uninstalled"
,
Toast
.
LENGTH_SHORT
).
show
()
;
return
true
;
}
}
Toast
.
makeText
(
context
,
"Tile uninstallation error"
,
Toast
.
LENGTH_SHORT
).
show
()
;
return
false
;
}
private
static
void
refreshService
(
Context
context
)
{
...
...
app/src/main/res/anim/fade_in.xml
deleted
100644 → 0
View file @
692b993e
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:interpolator=
"@android:anim/linear_interpolator"
>
<alpha
android:duration=
"250"
android:fromAlpha=
"0.1"
android:toAlpha=
"1.0"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/fade_out.xml
deleted
100644 → 0
View file @
692b993e
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:interpolator=
"@android:anim/linear_interpolator"
>
<alpha
android:duration=
"250"
android:fromAlpha=
"1.0"
android:toAlpha=
"0.1"
/>
</set>
\ No newline at end of file
app/src/main/res/drawable/ic_
system_update_alt_black
.xml
→
app/src/main/res/drawable/ic_
attach_money
.xml
View file @
e4cba700
...
...
@@ -5,5 +5,5 @@
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#757575"
android:pathData=
"M1
2,16.5l4,-4h-3v-9h-2v9L8,12.5l4,4zM21,3.5h-6v1.99h6v14.03L3,19.52L3,5.49h6L9,3.5L3,3.5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2v-14c0,-1.1 -0.9,-2 -2,-2
z"
/>
android:pathData=
"M1
1.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4
z"
/>
</vector>
app/src/main/res/drawable/ic_done_black.xml
deleted
100644 → 0
View file @
692b993e
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"
/>
</vector>
app/src/main/res/layout/activity_about.xml
View file @
e4cba700
...
...
@@ -104,12 +104,27 @@
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
<com.topjohnwu.magisk.RowItem
android:id=
"@+id/support_thread"
android:layout_width=
"match_parent"
<LinearLayout
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
app:icon=
"@drawable/ic_xda"
app:text=
"@string/support_thread"
/>
android:layout_marginBottom=
"8dp"
android:orientation=
"vertical"
>
<com.topjohnwu.magisk.RowItem
android:id=
"@+id/support_thread"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:icon=
"@drawable/ic_xda"
app:text=
"@string/support_thread"
/>
<com.topjohnwu.magisk.RowItem
android:id=
"@+id/donation"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:icon=
"@drawable/ic_attach_money"
app:text=
"@string/donation"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
...
...
app/src/main/res/layout/list_item_app.xml
View file @
e4cba700
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto
"
android:layout_width=
"fill_parent
"
android:layout_height=
"wrap_cont
ent"
android:layout_gravity=
"center
"
android:layout_marginBottom=
"@dimen/card_vertical_margin
"
android:layout_marginEnd=
"@dimen/card_horizont
al_margin"
android:layout_marginStart
=
"@dimen/card_horizontal_margin"
android:layout_marginTop=
"@dimen/card_vertic
al_margin"
style=
"?attr/cardStyle"
android:minHeight=
"?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardElevation=
"@dimen/card_elevation"
>
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android
"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto
"
android:layout_width=
"fill_par
ent"
android:layout_height=
"wrap_content
"
android:layout_gravity=
"center
"
android:layout_marginBottom=
"@dimen/card_vertic
al_margin"
android:layout_marginEnd
=
"@dimen/card_horizontal_margin"
android:layout_marginStart=
"@dimen/card_horizont
al_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
style=
"?attr/cardStyle"
android:minHeight=
"?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardElevation=
"@dimen/card_elevation"
>
<RelativeLayout
android:layout_width=
"match_parent"
...
...
@@ -21,13 +21,13 @@
android:layout_gravity=
"center_vertical"
android:padding=
"@dimen/card_layout_padding"
>
<ImageView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/app_icon
"
android:layout_width=
"@dimen/card_appicon_size
"
android:layout_height
=
"@dimen/card_appicon_size"
android:layout_centerVertical=
"tru
e"
android:scaleType=
"centerCrop"
/>
<ImageView
xmlns:android=
"http://schemas.android.com/apk/res/android
"
android:id=
"@+id/app_icon
"
android:layout_width
=
"@dimen/card_appicon_size"
android:layout_height=
"@dimen/card_appicon_siz
e"
android:layout_centerVertical=
"true"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:id=
"@+id/textLayout"
...
...
@@ -77,8 +77,8 @@
android:clickable=
"false"
android:focusable=
"false"
android:gravity=
"center"
android:src=
"@drawable/ic_menu_overflow_material"
/>
android:src=
"@drawable/ic_menu_overflow_material"
/>
</LinearLayout>
</RelativeLayout>
...
...
app/src/main/res/menu/drawer.xml
View file @
e4cba700
...
...
@@ -10,15 +10,7 @@
android:icon=
"@drawable/magisk"
android:title=
"@string/magisk"
/>
<item
android:id=
"@+id/root"
android:icon=
"@drawable/root"
android:title=
"@string/root"
/>
<item
android:id=
"@+id/autoroot"
android:icon=
"@drawable/ic_autoroot"
android:title=
"@string/auto_toggle"
/>
<item
android:id=
"@+id/modules"
...
...
@@ -30,27 +22,42 @@
android:icon=
"@drawable/ic_cloud_download"
android:title=
"@string/downloads"
/>
</group>
<group
android:checkableBehavior=
"single"
>
<item
android:id=
"@+id/
log
"
android:icon=
"@drawable/
ic_bug_repor
t"
android:title=
"@string/
log
"
/>
android:id=
"@+id/
root
"
android:icon=
"@drawable/
roo
t"
android:title=
"@string/
root
"
/>
<item
android:id=
"@+id/
settings
"
android:icon=
"@drawable/ic_
settings
"
android:title=
"@string/
settings
"
/>
android:id=
"@+id/
autoroot
"
android:icon=
"@drawable/ic_
autoroot
"
android:title=
"@string/
auto_toggle
"
/>
</group>
<group
android:id=
"@+id/option_items"
android:checkableBehavior=
"
non
e"
>
android:checkableBehavior=
"
singl
e"
>
<item
android:id=
"@+id/app_about"
android:icon=
"@drawable/ic_info_outline"
android:title=
"@string/about"
/>
android:id=
"@+id/log"
android:icon=
"@drawable/ic_bug_report"
android:title=
"@string/log"
/>
<item
android:id=
"@+id/settings"
android:icon=
"@drawable/ic_settings"
android:title=
"@string/settings"
/>
</group>
<item
android:id=
"@+id/app_about"
android:icon=
"@drawable/ic_info_outline"
android:title=
"@string/about"
/>
</menu>
\ No newline at end of file
app/src/main/res/menu/menu_module.xml
deleted
100644 → 0
View file @
692b993e
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/force_reload"
android:icon=
"@drawable/ic_refresh"
android:title=
"@string/menuReload"
app:showAsAction=
"always"
/>
</menu>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
e4cba700
...
...
@@ -4,27 +4,21 @@
<color
name=
"primary"
>
#009688
</color>
<color
name=
"primary_dark"
>
#00796B
</color>
<color
name=
"accent"
>
#FFC107
</color>
<color
name=
"primary_text"
>
#212121
</color>
<color
name=
"icons"
>
#FFFFFF
</color>
<color
name=
"icon_grey"
>
#757575
</color>
<color
name=
"red500"
>
#F44336
</color>
<color
name=
"green500"
>
#4CAF50
</color>
<color
name=
"blue500"
>
#2196F3
</color>
<color
name=
"grey500"
>
#9E9E9E
</color>
<color
name=
"yellow500"
>
#FFC107
</color>
<color
name=
"dh_primary"
>
#3F51B5
</color>
<color
name=
"dh_primary_dark"
>
#303F9F
</color>
<color
name=
"dh_primary_light"
>
#C5CAE9
</color>
<color
name=
"dh_accent"
>
#448AFF
</color>
<color
name=
"dh_primary_text"
>
#dedede
</color>
<color
name=
"dh_secondary_text"
>
#8A8A8A
</color>
<color
name=
"dh_icons"
>
#dedede
</color>
<color
name=
"dh_divider"
>
#313131
</color>
<color
name=
"dh_alertWarn"
>
#FF9800
</color>
<color
name=
"dh_alertOk"
>
@color/dh_accent
</color>
<color
name=
"dh_alertNeutral"
>
@color/dh_primary_light
</color>
<color
name=
"dh_alertFail"
>
@color/red500
</color>
...
...
app/src/main/res/values/dimens.xml
View file @
e4cba700
...
...
@@ -2,7 +2,6 @@
<resources>
<dimen
name=
"floating_height"
>
650dp
</dimen>
<dimen
name=
"floating_width"
>
500dp
</dimen>
<dimen
name=
"min_rowheight"
>
100dp
</dimen>
<dimen
name=
"card_divider_space"
>
5sp
</dimen>
<dimen
name=
"card_horizontal_margin"
>
8dip
</dimen>
<dimen
name=
"card_vertical_margin"
>
3dip
</dimen>
...
...
app/src/main/res/values/strings.xml
View file @
e4cba700
...
...
@@ -24,7 +24,6 @@
<!--Root Fragment-->
<string
name=
"root_toggle"
>
Root Toggle
</string>
<string
name=
"auto_root"
>
Auto Root
</string>
<string
name=
"selinux_toggle"
>
SELinux Toggle
</string>
<string
name=
"root_error"
>
Root Error
</string>
...
...
@@ -48,7 +47,6 @@
<!--Module Fragment-->
<string
name=
"no_info_provided"
>
(No info provided)
</string>
<string
name=
"no_modules_found"
>
No modules found
</string>
<string
name=
"module_not_installed"
>
Module is not installed
</string>
<string
name=
"update_file_created"
>
Module will be updated at next reboot
</string>
<string
name=
"remove_file_created"
>
Module will be removed at next reboot
</string>
<string
name=
"remove_file_deleted"
>
Module will not be removed at next reboot
</string>
...
...
@@ -60,6 +58,7 @@
<string
name=
"update_available"
>
Update Available
</string>
<string
name=
"installed"
>
Installed
</string>
<string
name=
"not_installed"
>
Not Installed
</string>
<string
name=
"changelog"
>
Changelog
</string>
<!--Log Fragment-->
<string
name=
"menuSaveToSd"
>
Save to SD
</string>
...
...
@@ -80,6 +79,7 @@
<string
name=
"translators"
/>
<string
name=
"app_version"
>
App\'s version
</string>
<string
name=
"app_source_code"
>
Source code
</string>
<string
name=
"donation"
>
Donation
</string>
<string
name=
"app_translators"
>
App\'s translators
</string>
<string
name=
"support_thread"
>
Support thread
</string>
...
...
@@ -90,6 +90,8 @@
<string
name=
"accessibility_service_description"
>
Accessibility service required for Magisk auto-unroot feature
</string>
<string
name=
"update_title"
>
%1$s Update!
</string>
<string
name=
"update_msg"
>
New version v%2$s of %1$s is available!\nChangelog:\n%3$s
</string>
<string
name=
"repo_install_title"
>
Install %1$s
</string>
<string
name=
"repo_install_msg"
>
Do you want to install %1$s ?
</string>
<string
name=
"download_install"
>
Download and install
</string>
<string
name=
"download_file_error"
>
Error downloading file
</string>
<string
name=
"install_error"
>
Installation error!
</string>
...
...
@@ -102,10 +104,6 @@
<string
name=
"zip_install_progress_msg"
>
"Installing %1$s …"
</string>
<string
name=
"no_magisk_title"
>
No Magisk Installed!
</string>
<string
name=
"no_magisk_msg"
>
Do you want to download and install Magisk?
</string>
<string
name=
"root_method_title"
>
Choose a root method
</string>
<string
name=
"phh"
>
phh\'s superuser
</string>
<string
name=
"supersu"
>
SuperSU
</string>
<string
name=
"root_system_msg"
>
It seems that you have incompatible root installed\nDo you want to install Magisk compatible root now?
</string>
<!--URL Templates-->
<string
name=
"url_main"
>
https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=
</string>
...
...
@@ -113,20 +111,24 @@
<string
name=
"zip_url"
>
https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip
</string>
<!--Settings Fragment -->
<string
name=
"settings_general_category"
>
General
</string>
<string
name=
"settings_theme_title"
>
Theme
</string>
<string
name=
"settings_theme_summary"
>
Select a theme
</string>
<string
name=
"settings_busybox_title"
>
Enable BusyBox
</string>
<string
name=
"settings_busybox_summary"
>
Make Magisk\'s built-in BusyBox be visible in PATH
</string>
<string
name=
"settings_quicksettings_category"
>
Quick Settings
</string>
<string
name=
"settings_enable_quicktile_title"
>
Enable Quicksettings Tile
</string>
<string
name=
"settings_enable_quicktile_summary"
>
Click here to enable or disable the quick settings tile.
</string>
<string
name=
"settings_root_category"
>
Root
</string>
<string
name=
"settings_keep_root_off_summary"
>
Disable root unless otherwise enabled by auto-toggle or toggle.
</string>
<string
name=
"settings_keep_root_off_title"
>
Keep root turned off
</string>
<string
name=
"settings_developer_logging_title"
>
Enable advanced debug logging
</string>
<string
name=
"settings_developer_logging_summary"
>
Check this to enable more verbose logging.
</string>
<string
name=
"settings_root_category"
>
Root
</string>
<string
name=
"settings_development_category"
>
Development
</string>
<string
name=
"settings_hide_root_notification_summary"
>
When checked, auto-toggle notifications will not be displayed.
</string>
<string
name=
"settings_hide_root_notification_title"
>
Hide auto-toggle notifications
</string>
<
!--General Use --
>
<string
name=
"
toast_error_makedir"
>
Error creating directory, could not download file.
</string>
<string
name=
"
toast_error_removing_files"
>
Error removing old files, cancelled
.
</string>
<string
name=
"settings_general_title"
>
General
</string>
<
string
name=
"settings_development_category"
>
Development
</string
>
<string
name=
"
settings_developer_logging_title"
>
Enable advanced debug logging
</string>
<string
name=
"
settings_developer_logging_summary"
>
Check this to enable more verbose logging
.
</string>
</resources>
app/src/main/res/values/styles.xml
View file @
e4cba700
...
...
@@ -17,14 +17,6 @@
<item
name=
"ColorNeutral"
>
@color/grey500
</item>
</style>
<style
name=
"AppTheme.Toolbar"
parent=
"ThemeOverlay.AppCompat.Light"
>
<item
name=
"colorPrimary"
>
@color/primary
</item>
<item
name=
"android:elevation"
>
4dp
</item>
<item
name=
"android:textColorPrimary"
>
@color/primary_text
</item>
<item
name=
"android:textColorSecondary"
>
@color/primary_text
</item>
<!-- force -->
<item
name=
"actionMenuTextColor"
>
@color/icons
</item>
</style>
<style
name=
"AppTheme.dh"
parent=
"ThemeOverlay.AppCompat.Dark"
>
<item
name=
"colorPrimary"
>
@color/dh_primary
</item>
<item
name=
"colorPrimaryDark"
>
@color/dh_primary_dark
</item>
...
...
app/src/main/res/xml/uisettings.xml
View file @
e4cba700
...
...
@@ -2,16 +2,24 @@
android:layout_marginTop=
"?attr/actionBarSize"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<PreferenceCategory
android:title=
"@string/settings_general_
title
"
>
android:title=
"@string/settings_general_
category
"
>
<ListPreference
android:key=
"theme"
android:title=
"
Them
e"
android:summary=
"
Select a theme
"
android:title=
"
@string/settings_theme_titl
e"
android:summary=
"
@string/settings_theme_summary
"
android:defaultValue=
"Default"
android:entries=
"@array/themes"
android:entryValues=
"@array/themes"
/>
<CheckBoxPreference
android:key=
"busybox"
android:defaultValue=
"false"
android:title=
"@string/settings_busybox_title"
android:summary=
"@string/settings_busybox_summary"
/>
</PreferenceCategory>
<PreferenceCategory
android:title=
"@string/settings_quicksettings_category"
>
...
...
@@ -22,8 +30,10 @@
android:summary=
"@string/settings_enable_quicktile_summary"
/>
</PreferenceCategory>
<PreferenceCategory
android:title=
"@string/settings_root_category"
>
<CheckBoxPreference
android:key=
"keep_root_off"
android:defaultValue=
"false"
...
...
@@ -37,6 +47,7 @@
android:summary=
"@string/settings_hide_root_notification_summary"
/>
</PreferenceCategory>
<PreferenceCategory
android:title=
"@string/settings_development_category"
>
...
...
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