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
c56dd417
Commit
c56dd417
authored
Sep 25, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apparently, I thought a theme was a good idea...
parent
d2335485
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
614 additions
and
426 deletions
+614
-426
MagiskFragment.java
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
+23
-12
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+19
-3
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+29
-7
RootFragment.java
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
+56
-52
SettingsFragment.java
app/src/main/java/com/topjohnwu/magisk/SettingsFragment.java
+57
-2
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+5
-2
AutoStartReceiver.java
...ava/com/topjohnwu/magisk/receivers/AutoStartReceiver.java
+4
-5
MonitorService.java
...in/java/com/topjohnwu/magisk/services/MonitorService.java
+1
-2
TileServiceCompat.java
...java/com/topjohnwu/magisk/services/TileServiceCompat.java
+13
-2
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+102
-106
Logger.java
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
+2
-1
PrefHelper.java
app/src/main/java/com/topjohnwu/magisk/utils/PrefHelper.java
+0
-23
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+6
-5
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-0
list_item_app.xml
app/src/main/res/layout/list_item_app.xml
+16
-16
list_item_module.xml
app/src/main/res/layout/list_item_module.xml
+142
-144
list_item_repo.xml
app/src/main/res/layout/list_item_repo.xml
+42
-40
magisk_fragment.xml
app/src/main/res/layout/magisk_fragment.xml
+4
-0
root_fragment.xml
app/src/main/res/layout/root_fragment.xml
+7
-0
toolbar.xml
app/src/main/res/layout/toolbar.xml
+2
-2
arrays.xml
app/src/main/res/values/arrays.xml
+7
-0
attrs.xml
app/src/main/res/values/attrs.xml
+6
-0
colors.xml
app/src/main/res/values/colors.xml
+15
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
styles.xml
app/src/main/res/values/styles.xml
+44
-1
uisettings.xml
app/src/main/res/xml/uisettings.xml
+10
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
c56dd417
...
@@ -2,6 +2,8 @@ package com.topjohnwu.magisk;
...
@@ -2,6 +2,8 @@ package com.topjohnwu.magisk;
import
android.app.Fragment
;
import
android.app.Fragment
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
...
@@ -45,11 +47,9 @@ public class MagiskFragment extends Fragment {
...
@@ -45,11 +47,9 @@ public class MagiskFragment extends Fragment {
@BindView
(
R
.
id
.
magisk_check_updates_status
)
TextView
magiskCheckUpdatesStatus
;
@BindView
(
R
.
id
.
magisk_check_updates_status
)
TextView
magiskCheckUpdatesStatus
;
@BindView
(
R
.
id
.
magisk_check_updates_progress
)
ProgressBar
magiskCheckUpdatesProgress
;
@BindView
(
R
.
id
.
magisk_check_updates_progress
)
ProgressBar
magiskCheckUpdatesProgress
;
@BindColor
(
R
.
color
.
green500
)
int
green500
;
@BindColor
(
R
.
color
.
accent
)
int
accent
;
@BindColor
(
R
.
color
.
blue500
)
int
blue500
;
@BindColor
(
R
.
color
.
grey500
)
int
grey500
;
@BindColor
(
R
.
color
.
grey500
)
int
grey500
;
private
int
colorOK
,
colorWarn
,
colorNeutral
;
int
statusOK
=
R
.
drawable
.
ic_check_circle
;
int
statusOK
=
R
.
drawable
.
ic_check_circle
;
int
statusUnknown
=
R
.
drawable
.
ic_help
;
int
statusUnknown
=
R
.
drawable
.
ic_help
;
...
@@ -58,7 +58,18 @@ public class MagiskFragment extends Fragment {
...
@@ -58,7 +58,18 @@ public class MagiskFragment extends Fragment {
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
v
=
inflater
.
inflate
(
R
.
layout
.
magisk_fragment
,
container
,
false
);
View
v
=
inflater
.
inflate
(
R
.
layout
.
magisk_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
v
);
ButterKnife
.
bind
(
this
,
v
);
int
[]
attrs0
=
{
R
.
attr
.
ColorOK
};
int
[]
attrs1
=
{
R
.
attr
.
ColorWarn
};
int
[]
attrs2
=
{
R
.
attr
.
ColorNeutral
};
TypedArray
ta0
=
getActivity
().
obtainStyledAttributes
(
attrs0
);
TypedArray
ta1
=
getActivity
().
obtainStyledAttributes
(
attrs1
);
TypedArray
ta2
=
getActivity
().
obtainStyledAttributes
(
attrs2
);
colorOK
=
ta0
.
getColor
(
0
,
Color
.
GRAY
);
colorWarn
=
ta1
.
getColor
(
0
,
Color
.
GRAY
);
colorNeutral
=
ta2
.
getColor
(
0
,
Color
.
GRAY
);
ta0
.
recycle
();
ta1
.
recycle
();
ta2
.
recycle
();
new
updateUI
().
execute
();
new
updateUI
().
execute
();
return
v
;
return
v
;
...
@@ -88,16 +99,16 @@ public class MagiskFragment extends Fragment {
...
@@ -88,16 +99,16 @@ public class MagiskFragment extends Fragment {
magiskVersion
.
setTextColor
(
grey500
);
magiskVersion
.
setTextColor
(
grey500
);
magiskVersion
.
setText
(
R
.
string
.
magisk_version_error
);
magiskVersion
.
setText
(
R
.
string
.
magisk_version_error
);
}
else
{
}
else
{
magiskStatusContainer
.
setBackgroundColor
(
green500
);
magiskStatusContainer
.
setBackgroundColor
(
colorOK
);
magiskStatusIcon
.
setImageResource
(
statusOK
);
magiskStatusIcon
.
setImageResource
(
statusOK
);
magiskVersion
.
setTextColor
(
green500
);
magiskVersion
.
setTextColor
(
colorOK
);
magiskVersion
.
setText
(
getString
(
R
.
string
.
magisk_version
,
String
.
valueOf
(
Utils
.
magiskVersion
)));
magiskVersion
.
setText
(
getString
(
R
.
string
.
magisk_version
,
String
.
valueOf
(
Utils
.
magiskVersion
)));
}
}
if
(
Utils
.
remoteMagiskVersion
==
-
1
)
{
if
(
Utils
.
remoteMagiskVersion
==
-
1
)
{
appCheckUpdatesContainer
.
setBackgroundColor
(
accent
);
appCheckUpdatesContainer
.
setBackgroundColor
(
colorWarn
);
magiskCheckUpdatesContainer
.
setBackgroundColor
(
accent
);
magiskCheckUpdatesContainer
.
setBackgroundColor
(
colorWarn
);
appCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_warning
);
appCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_warning
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_warning
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_warning
);
...
@@ -106,7 +117,7 @@ public class MagiskFragment extends Fragment {
...
@@ -106,7 +117,7 @@ public class MagiskFragment extends Fragment {
magiskCheckUpdatesStatus
.
setText
(
R
.
string
.
cannot_check_updates
);
magiskCheckUpdatesStatus
.
setText
(
R
.
string
.
cannot_check_updates
);
}
else
{
}
else
{
if
(
Utils
.
remoteMagiskVersion
>
Utils
.
magiskVersion
)
{
if
(
Utils
.
remoteMagiskVersion
>
Utils
.
magiskVersion
)
{
magiskCheckUpdatesContainer
.
setBackgroundColor
(
blue500
);
magiskCheckUpdatesContainer
.
setBackgroundColor
(
colorNeutral
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_file_download
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_file_download
);
magiskCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
magisk_update_available
,
String
.
valueOf
(
Utils
.
remoteMagiskVersion
)));
magiskCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
magisk_update_available
,
String
.
valueOf
(
Utils
.
remoteMagiskVersion
)));
magiskUpdateView
.
setOnClickListener
(
view
->
new
AlertDialog
.
Builder
(
getActivity
())
magiskUpdateView
.
setOnClickListener
(
view
->
new
AlertDialog
.
Builder
(
getActivity
())
...
@@ -127,13 +138,13 @@ public class MagiskFragment extends Fragment {
...
@@ -127,13 +138,13 @@ public class MagiskFragment extends Fragment {
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
());
.
show
());
}
else
{
}
else
{
magiskCheckUpdatesContainer
.
setBackgroundColor
(
green500
);
magiskCheckUpdatesContainer
.
setBackgroundColor
(
colorOK
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_check_circle
);
magiskCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_check_circle
);
magiskCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
up_to_date
,
getString
(
R
.
string
.
magisk
)));
magiskCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
up_to_date
,
getString
(
R
.
string
.
magisk
)));
}
}
if
(
Utils
.
remoteAppVersion
>
BuildConfig
.
VERSION_CODE
)
{
if
(
Utils
.
remoteAppVersion
>
BuildConfig
.
VERSION_CODE
)
{
appCheckUpdatesContainer
.
setBackgroundColor
(
blue500
);
appCheckUpdatesContainer
.
setBackgroundColor
(
colorNeutral
);
appCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_file_download
);
appCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_file_download
);
appCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
app_update_available
,
String
.
valueOf
(
Utils
.
remoteAppVersion
)));
appCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
app_update_available
,
String
.
valueOf
(
Utils
.
remoteAppVersion
)));
appUpdateView
.
setOnClickListener
(
view
->
new
AlertDialog
.
Builder
(
getActivity
())
appUpdateView
.
setOnClickListener
(
view
->
new
AlertDialog
.
Builder
(
getActivity
())
...
@@ -157,7 +168,7 @@ public class MagiskFragment extends Fragment {
...
@@ -157,7 +168,7 @@ public class MagiskFragment extends Fragment {
.
show
()
.
show
()
);
);
}
else
{
}
else
{
appCheckUpdatesContainer
.
setBackgroundColor
(
green500
);
appCheckUpdatesContainer
.
setBackgroundColor
(
colorOK
);
appCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_check_circle
);
appCheckUpdatesIcon
.
setImageResource
(
R
.
drawable
.
ic_check_circle
);
appCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
up_to_date
,
getString
(
R
.
string
.
app_name
)));
appCheckUpdatesStatus
.
setText
(
getString
(
R
.
string
.
up_to_date
,
getString
(
R
.
string
.
app_name
)));
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
c56dd417
...
@@ -9,6 +9,7 @@ import android.graphics.Color;
...
@@ -9,6 +9,7 @@ import android.graphics.Color;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.IdRes
;
import
android.support.annotation.IdRes
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
android.support.design.widget.NavigationView
;
import
android.support.design.widget.NavigationView
;
...
@@ -49,6 +50,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -49,6 +50,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
@Override
@Override
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dh
(
"MainActivity: Theme is "
+
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
}
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
ButterKnife
.
bind
(
this
);
ButterKnife
.
bind
(
this
);
...
@@ -106,6 +113,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -106,6 +113,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
}
}
}
);
);
setSupportActionBar
(
toolbar
);
setSupportActionBar
(
toolbar
);
...
@@ -137,10 +146,17 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -137,10 +146,17 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
navigationView
.
setNavigationItemSelectedListener
(
this
);
navigationView
.
setNavigationItemSelectedListener
(
this
);
mView
=
getToolbarNavigationButton
();
mView
=
getToolbarNavigationButton
();
if
(
getIntent
().
hasExtra
(
"relaunch"
))
{
navigate
(
R
.
id
.
root
);
Bundle
extras
=
getIntent
().
getExtras
();
if
(
extras
!=
null
)
{
Logger
.
dh
(
"MainActivity: Intent has extras "
+
getIntent
().
getExtras
().
getString
(
"Relaunch"
));
String
data
=
extras
.
getString
(
"Relaunch"
);
// retrieve the data using keyName
if
(
data
.
contains
(
"Settings"
))
{
navigate
(
R
.
id
.
settings
);
}
}
startTour
();
}
}
}
public
ImageButton
getToolbarNavigationButton
()
{
public
ImageButton
getToolbarNavigationButton
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
c56dd417
...
@@ -3,21 +3,24 @@ package com.topjohnwu.magisk;
...
@@ -3,21 +3,24 @@ package com.topjohnwu.magisk;
import
android.app.Fragment
;
import
android.app.Fragment
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.CheckBox
;
import
android.widget.CheckBox
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.ipaulpro.afilechooser.FileInfo
;
import
com.ipaulpro.afilechooser.utils.FileUtils
;
import
com.ipaulpro.afilechooser.utils.FileUtils
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
...
@@ -29,10 +32,13 @@ import butterknife.BindView;
...
@@ -29,10 +32,13 @@ import butterknife.BindView;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
public
class
ModulesFragment
extends
Fragment
{
public
class
ModulesFragment
extends
Fragment
{
@BindView
(
R
.
id
.
swipeRefreshLayout
)
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
swipeRefreshLayout
)
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
@BindView
(
R
.
id
.
recyclerView
)
private
static
final
int
FETCH_ZIP_CODE
=
2
;
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
private
static
final
int
FETCH_ZIP_CODE
=
2
;
private
SharedPreferences
prefs
;
private
SharedPreferences
prefs
;
public
static
List
<
Module
>
listModules
=
new
ArrayList
<>();
public
static
List
<
Module
>
listModules
=
new
ArrayList
<>();
@BindView
(
R
.
id
.
fab
)
@BindView
(
R
.
id
.
fab
)
...
@@ -43,7 +49,6 @@ private static final int FETCH_ZIP_CODE = 2;
...
@@ -43,7 +49,6 @@ private static final int FETCH_ZIP_CODE = 2;
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
viewMain
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
View
viewMain
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
viewMain
);
ButterKnife
.
bind
(
this
,
viewMain
);
fabio
.
setOnClickListener
(
v
->
{
fabio
.
setOnClickListener
(
v
->
{
Intent
getContentIntent
=
FileUtils
.
createGetContentIntent
(
null
);
Intent
getContentIntent
=
FileUtils
.
createGetContentIntent
(
null
);
...
@@ -76,6 +81,23 @@ private static final int FETCH_ZIP_CODE = 2;
...
@@ -76,6 +81,23 @@ private static final int FETCH_ZIP_CODE = 2;
return
viewMain
;
return
viewMain
;
}
}
@Override
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
data
!=
null
)
{
// Get the URI of the selected file
final
Uri
uri
=
data
.
getData
();
try
{
// Get the file path from the URI
new
Async
.
FlashZIP
(
getActivity
(),
uri
).
execute
();
FileInfo
fileInfo
=
FileUtils
.
getFileInfo
(
getActivity
(),
uri
);
}
catch
(
Exception
e
)
{
Log
.
e
(
"FileSelectorTestAc..."
,
"File select error"
,
e
);
}
}
}
@Override
@Override
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
...
...
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
View file @
c56dd417
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/SettingsFragment.java
View file @
c56dd417
package
com
.
topjohnwu
.
magisk
;
package
com
.
topjohnwu
.
magisk
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.CheckBoxPreference
;
import
android.preference.CheckBoxPreference
;
import
android.preference.ListPreference
;
import
android.preference.Preference
;
import
android.preference.Preference
;
import
android.preference.PreferenceFragment
;
import
android.preference.PreferenceFragment
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceScreen
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
public
class
SettingsFragment
extends
PreferenceFragment
{
public
class
SettingsFragment
extends
PreferenceFragment
implements
SharedPreferences
.
OnSharedPreferenceChangeListener
{
private
CheckBoxPreference
quickTilePreference
;
private
CheckBoxPreference
quickTilePreference
;
private
ListPreference
themePreference
;
private
SharedPreferences
.
OnSharedPreferenceChangeListener
listener
;
@Override
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -30,6 +38,15 @@ public class SettingsFragment extends PreferenceFragment {
...
@@ -30,6 +38,15 @@ public class SettingsFragment extends PreferenceFragment {
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
getActivity
().
setTitle
(
"Settings"
);
getActivity
().
setTitle
(
"Settings"
);
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
()).
registerOnSharedPreferenceChangeListener
(
this
);
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
()).
unregisterOnSharedPreferenceChangeListener
(
this
);
}
}
@Override
@Override
...
@@ -37,9 +54,11 @@ public class SettingsFragment extends PreferenceFragment {
...
@@ -37,9 +54,11 @@ public class SettingsFragment extends PreferenceFragment {
View
view
=
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
View
view
=
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
quickTilePreference
=
(
CheckBoxPreference
)
findPreference
(
"enable_quicktile"
);
quickTilePreference
=
(
CheckBoxPreference
)
findPreference
(
"enable_quicktile"
);
themePreference
=
(
ListPreference
)
findPreference
(
"theme"
);
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
()).
registerOnSharedPreferenceChangeListener
(
this
);
CheckBoxPreference
keepRootOffPreference
=
(
CheckBoxPreference
)
findPreference
(
"keep_root_off"
);
CheckBoxPreference
keepRootOffPreference
=
(
CheckBoxPreference
)
findPreference
(
"keep_root_off"
);
CheckBoxPreference
hideRootNotificationPreference
=
(
CheckBoxPreference
)
findPreference
(
"hide_root_notification"
);
CheckBoxPreference
hideRootNotificationPreference
=
(
CheckBoxPreference
)
findPreference
(
"hide_root_notification"
);
themePreference
.
setSummary
(
themePreference
.
getValue
());
if
(
Utils
.
magiskVersion
==
-
1
)
{
if
(
Utils
.
magiskVersion
==
-
1
)
{
quickTilePreference
.
setEnabled
(
false
);
quickTilePreference
.
setEnabled
(
false
);
keepRootOffPreference
.
setEnabled
(
false
);
keepRootOffPreference
.
setEnabled
(
false
);
...
@@ -50,6 +69,7 @@ public class SettingsFragment extends PreferenceFragment {
...
@@ -50,6 +69,7 @@ public class SettingsFragment extends PreferenceFragment {
hideRootNotificationPreference
.
setEnabled
(
true
);
hideRootNotificationPreference
.
setEnabled
(
true
);
}
}
Preference
.
OnPreferenceClickListener
preferenceClickListener
=
preference
->
{
Preference
.
OnPreferenceClickListener
preferenceClickListener
=
preference
->
{
if
(
preference
==
quickTilePreference
)
{
if
(
preference
==
quickTilePreference
)
{
boolean
isChecked
=
quickTilePreference
.
isChecked
();
boolean
isChecked
=
quickTilePreference
.
isChecked
();
...
@@ -64,6 +84,10 @@ public class SettingsFragment extends PreferenceFragment {
...
@@ -64,6 +84,10 @@ public class SettingsFragment extends PreferenceFragment {
return
false
;
return
false
;
};
};
quickTilePreference
.
setOnPreferenceClickListener
(
preferenceClickListener
);
quickTilePreference
.
setOnPreferenceClickListener
(
preferenceClickListener
);
// calculate margins
// calculate margins
int
horizontalMargin
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
2
,
getResources
().
getDisplayMetrics
());
int
horizontalMargin
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
2
,
getResources
().
getDisplayMetrics
());
...
@@ -78,5 +102,36 @@ public class SettingsFragment extends PreferenceFragment {
...
@@ -78,5 +102,36 @@ public class SettingsFragment extends PreferenceFragment {
return
view
;
return
view
;
}
@Override
public
void
onSharedPreferenceChanged
(
SharedPreferences
sharedPreferences
,
String
key
)
{
Logger
.
dh
(
"Settings: NewValue is "
+
key
);
if
(
key
.
equals
(
"theme"
))
{
String
pref
=
sharedPreferences
.
getString
(
key
,
""
);
themePreference
.
setSummary
(
pref
);
if
(
pref
.
equals
(
"Dark"
))
{
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme_dh
);
}
else
{
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme
);
}
Intent
intent
=
new
Intent
(
getActivity
(),
MainActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
putExtra
(
"Relaunch"
,
"Settings"
);
startActivity
(
intent
);
Logger
.
dh
(
"SettingsFragment: theme is "
+
pref
);
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
c56dd417
...
@@ -10,7 +10,6 @@ import android.support.v7.app.AppCompatActivity;
...
@@ -10,7 +10,6 @@ import android.support.v7.app.AppCompatActivity;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.PrefHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.HashSet
;
import
java.util.HashSet
;
...
@@ -19,6 +18,9 @@ import java.util.Set;
...
@@ -19,6 +18,9 @@ import java.util.Set;
public
class
SplashActivity
extends
AppCompatActivity
{
public
class
SplashActivity
extends
AppCompatActivity
{
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
if
(
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
).
equals
(
"Dark"
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
}
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
//setups go here
//setups go here
...
@@ -47,7 +49,7 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -47,7 +49,7 @@ public class SplashActivity extends AppCompatActivity {
getApplication
().
startService
(
myIntent
);
getApplication
().
startService
(
myIntent
);
}
}
}
else
{
}
else
{
if
(
Pref
Helper
.
CheckBool
(
"keep_root_off"
,
getApplication
()
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
getApplication
()).
getBoolean
(
"keep_root_off"
,
false
))
{
Utils
.
toggleRoot
(
false
,
getApplication
());
Utils
.
toggleRoot
(
false
,
getApplication
());
}
}
}
}
...
@@ -61,6 +63,7 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -61,6 +63,7 @@ public class SplashActivity extends AppCompatActivity {
new
Async
.
LoadModules
(
this
).
execute
();
new
Async
.
LoadModules
(
this
).
execute
();
new
Async
.
LoadRepos
(
this
).
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
);
new
Async
.
LoadRepos
(
this
).
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
);
// Start main activity
// Start main activity
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
...
...
app/src/main/java/com/topjohnwu/magisk/receivers/AutoStartReceiver.java
View file @
c56dd417
...
@@ -3,10 +3,10 @@ package com.topjohnwu.magisk.receivers;
...
@@ -3,10 +3,10 @@ package com.topjohnwu.magisk.receivers;
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.preference.PreferenceManager
;
import
android.util.Log
;
import
android.util.Log
;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.utils.PrefHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
public
class
AutoStartReceiver
extends
BroadcastReceiver
{
public
class
AutoStartReceiver
extends
BroadcastReceiver
{
...
@@ -15,14 +15,13 @@ public class AutoStartReceiver extends BroadcastReceiver {
...
@@ -15,14 +15,13 @@ public class AutoStartReceiver extends BroadcastReceiver {
Log
.
d
(
"Magisk"
,
"Received Boot call, attempting to start service"
);
Log
.
d
(
"Magisk"
,
"Received Boot call, attempting to start service"
);
Intent
myIntent
=
new
Intent
(
context
,
MonitorService
.
class
);
Intent
myIntent
=
new
Intent
(
context
,
MonitorService
.
class
);
context
.
startService
(
myIntent
);
context
.
startService
(
myIntent
);
if
(
Pref
Helper
.
CheckBool
(
"keep_root_off"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"keep_root_off"
,
false
))
{
Utils
.
toggleRoot
(
false
,
context
);
Utils
.
toggleRoot
(
false
,
context
);
}
}
if
(
Pref
Helper
.
CheckBool
(
"enable_quicktile"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
Utils
.
SetupQuickSettingsTile
(
context
);
Utils
.
SetupQuickSettingsTile
(
context
);
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/services/MonitorService.java
View file @
c56dd417
...
@@ -18,7 +18,6 @@ import android.view.accessibility.AccessibilityEvent;
...
@@ -18,7 +18,6 @@ import android.view.accessibility.AccessibilityEvent;
import
com.topjohnwu.magisk.MainActivity
;
import
com.topjohnwu.magisk.MainActivity
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.PrefHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -109,7 +108,7 @@ public class MonitorService extends AccessibilityService {
...
@@ -109,7 +108,7 @@ public class MonitorService extends AccessibilityService {
private
void
ShowNotification
(
boolean
rootAction
,
String
packageName
)
{
private
void
ShowNotification
(
boolean
rootAction
,
String
packageName
)
{
NotificationManager
mNotifyMgr
=
(
NotificationManager
)
getSystemService
(
NOTIFICATION_SERVICE
);
NotificationManager
mNotifyMgr
=
(
NotificationManager
)
getSystemService
(
NOTIFICATION_SERVICE
);
NotificationCompat
.
Builder
mBuilder
;
NotificationCompat
.
Builder
mBuilder
;
if
(!
Pref
Helper
.
CheckBool
(
"hide_root_notification"
,
getApplicationContext
()
))
{
if
(!
Pref
erenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getBoolean
(
"hide_root_notification"
,
false
))
{
if
(
rootAction
)
{
if
(
rootAction
)
{
Intent
intent
=
new
Intent
(
getApplication
(),
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
getApplication
(),
MainActivity
.
class
);
...
...
app/src/main/java/com/topjohnwu/magisk/services/TileServiceCompat.java
View file @
c56dd417
...
@@ -74,15 +74,26 @@ public class TileServiceCompat extends Service {
...
@@ -74,15 +74,26 @@ public class TileServiceCompat extends Service {
private
void
onSimpleClick
()
{
private
void
onSimpleClick
()
{
updateRoots
();
updateRoots
();
updateTile
();
updateTile
();
Utils
.
toggleAutoRoot
(
false
,
getApplicationContext
());
if
(
autoRoot
)
{
Utils
.
toggleRoot
(!
root
,
getApplicationContext
());
Utils
.
toggleAutoRoot
(
false
,
getApplicationContext
());
if
(!
Utils
.
hasServicePermission
(
getApplicationContext
()))
{
Intent
it
=
new
Intent
(
Intent
.
ACTION_CLOSE_SYSTEM_DIALOGS
);
sendBroadcast
(
it
);
}
}
else
{
Utils
.
toggleRoot
(!
root
,
getApplicationContext
());
}
}
}
private
void
onLongClick
()
{
private
void
onLongClick
()
{
updateRoots
();
updateRoots
();
updateTile
();
updateTile
();
Utils
.
toggleAutoRoot
(!
autoRoot
,
getApplicationContext
());
Utils
.
toggleAutoRoot
(!
autoRoot
,
getApplicationContext
());
if
(!
Utils
.
hasServicePermission
(
getApplicationContext
()))
{
Intent
it
=
new
Intent
(
Intent
.
ACTION_CLOSE_SYSTEM_DIALOGS
);
sendBroadcast
(
it
);
}
}
}
private
void
updateTile
()
{
private
void
updateTile
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
c56dd417
...
@@ -5,11 +5,12 @@ import android.content.ContentResolver;
...
@@ -5,11 +5,12 @@ import android.content.ContentResolver;
import
android.content.Context
;
import
android.content.Context
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.provider.DocumentsContract
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.ipaulpro.afilechooser.FileInfo
;
import
com.ipaulpro.afilechooser.utils.FileUtils
;
import
com.topjohnwu.magisk.ModulesFragment
;
import
com.topjohnwu.magisk.ModulesFragment
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ReposFragment
;
import
com.topjohnwu.magisk.ReposFragment
;
...
@@ -87,8 +88,7 @@ public class Async {
...
@@ -87,8 +88,7 @@ public class Async {
.
setTitle
(
R
.
string
.
no_magisk_title
)
.
setTitle
(
R
.
string
.
no_magisk_title
)
.
setMessage
(
R
.
string
.
no_magisk_msg
)
.
setMessage
(
R
.
string
.
no_magisk_msg
)
.
setCancelable
(
true
)
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
{
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
new
AlertDialog
.
Builder
(
mContext
)
new
AlertDialog
.
Builder
(
mContext
)
.
setTitle
(
R
.
string
.
root_method_title
)
.
setTitle
(
R
.
string
.
root_method_title
)
.
setItems
(
new
String
[]{
mContext
.
getString
(
R
.
string
.
phh
),
mContext
.
getString
(
R
.
string
.
supersu
)},
(
dialogInterface1
,
root
)
->
{
.
setItems
(
new
String
[]{
mContext
.
getString
(
R
.
string
.
phh
),
mContext
.
getString
(
R
.
string
.
supersu
)},
(
dialogInterface1
,
root
)
->
{
Utils
.
DownloadReceiver
rootReceiver
;
Utils
.
DownloadReceiver
rootReceiver
;
...
@@ -132,8 +132,7 @@ public class Async {
...
@@ -132,8 +132,7 @@ public class Async {
};
};
Utils
.
downloadAndReceive
(
mContext
,
magiskReceiver
,
Utils
.
magiskLink
,
"latest_magisk.zip"
);
Utils
.
downloadAndReceive
(
mContext
,
magiskReceiver
,
Utils
.
magiskLink
,
"latest_magisk.zip"
);
})
})
.
show
();
.
show
())
})
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
();
.
show
();
}
else
if
(
Shell
.
rootStatus
==
2
)
{
}
else
if
(
Shell
.
rootStatus
==
2
)
{
...
@@ -141,8 +140,7 @@ public class Async {
...
@@ -141,8 +140,7 @@ public class Async {
.
setTitle
(
R
.
string
.
root_system
)
.
setTitle
(
R
.
string
.
root_system
)
.
setMessage
(
R
.
string
.
root_system_msg
)
.
setMessage
(
R
.
string
.
root_system_msg
)
.
setCancelable
(
true
)
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
{
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
new
AlertDialog
.
Builder
(
mContext
)
new
AlertDialog
.
Builder
(
mContext
)
.
setTitle
(
R
.
string
.
root_method_title
)
.
setTitle
(
R
.
string
.
root_method_title
)
.
setItems
(
new
String
[]{
mContext
.
getString
(
R
.
string
.
phh
),
mContext
.
getString
(
R
.
string
.
supersu
)},
(
dialogInterface1
,
root
)
->
{
.
setItems
(
new
String
[]{
mContext
.
getString
(
R
.
string
.
phh
),
mContext
.
getString
(
R
.
string
.
supersu
)},
(
dialogInterface1
,
root
)
->
{
switch
(
root
)
{
switch
(
root
)
{
...
@@ -170,8 +168,7 @@ public class Async {
...
@@ -170,8 +168,7 @@ public class Async {
break
;
break
;
}
}
})
})
.
show
();
.
show
())
})
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
();
.
show
();
}
}
...
@@ -216,8 +213,6 @@ public class Async {
...
@@ -216,8 +213,6 @@ public class Async {
public
static
class
LoadRepos
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
public
static
class
LoadRepos
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
private
Context
mContext
;
private
Context
mContext
;
private
boolean
doReload
;
private
RepoHelper
.
TaskDelegate
mTaskDelegate
;
public
LoadRepos
(
Context
context
)
{
public
LoadRepos
(
Context
context
)
{
mContext
=
context
;
mContext
=
context
;
...
@@ -255,33 +250,31 @@ public class Async {
...
@@ -255,33 +250,31 @@ public class Async {
mContext
=
context
;
mContext
=
context
;
mUri
=
uRi
;
mUri
=
uRi
;
deleteFileAfter
=
true
;
deleteFileAfter
=
true
;
String
file
=
""
;
final
String
docId
=
DocumentsContract
.
getDocumentId
(
mUri
);
String
file
;
FileInfo
fileInfo
=
FileUtils
.
getFileInfo
(
context
,
mUri
);
Log
.
d
(
"Magisk"
,
"Utils: FlashZip Running, "
+
docId
+
" and "
+
mUri
.
toString
());
if
(
docId
.
contains
(
":"
))
Logger
.
dh
(
"Utils: FlashZip Running, "
+
fileInfo
.
getPath
());
mName
=
docId
.
split
(
":"
)[
1
];
String
filename
=
fileInfo
.
getPath
();
else
mName
=
docId
;
String
idStr
=
filename
.
substring
(
filename
.
lastIndexOf
(
'/'
)
+
1
);
if
(
mName
.
contains
(
"/"
))
if
(!
idStr
.
contains
(
".zip"
))
{
mName
=
mName
.
substring
(
mName
.
lastIndexOf
(
'/'
)
+
1
);
Logger
.
dh
(
"Async: Improper name, cancelling "
+
idStr
);
if
(
mName
.
contains
(
".zip"
))
{
file
=
mContext
.
getFilesDir
()
+
"/"
+
mName
;
Log
.
d
(
"Magisk"
,
"Utils: FlashZip running for uRI "
+
mUri
.
toString
());
}
else
{
Log
.
e
(
"Magisk"
,
"Utils: error parsing Zipfile "
+
mUri
.
getPath
());
this
.
cancel
(
true
);
this
.
cancel
(
true
);
progress
.
cancel
();
}
}
file
=
mContext
.
getFilesDir
()
+
"/"
+
idStr
;
ContentResolver
contentResolver
=
mContext
.
getContentResolver
();
ContentResolver
contentResolver
=
mContext
.
getContentResolver
();
//contentResolver.takePersistableUriPermission(mUri, flags);
//contentResolver.takePersistableUriPermission(mUri, flags);
try
{
try
{
InputStream
in
=
contentResolver
.
openInputStream
(
mUri
);
InputStream
in
=
contentResolver
.
openInputStream
(
mUri
);
Log
.
d
(
"Magisk"
,
"Firing inputStream"
);
Log
.
d
(
"Magisk"
,
"Firing inputStream"
);
mFile
=
createFileFromInputStream
(
in
,
file
,
mContext
);
mFile
=
createFileFromInputStream
(
in
,
file
);
if
(
mFile
!=
null
)
{
if
(
mFile
!=
null
)
{
mPath
=
mFile
.
getPath
();
mPath
=
mFile
.
getPath
();
Log
.
d
(
"Magisk"
,
"Utils
: Mpath is "
+
mPath
);
Log
ger
.
dh
(
"Async
: Mpath is "
+
mPath
);
}
else
{
}
else
{
Log
.
e
(
"Magisk"
,
"
Utils
: error creating file "
+
mUri
.
getPath
());
Log
.
e
(
"Magisk"
,
"
Async
: error creating file "
+
mUri
.
getPath
());
this
.
cancel
(
true
);
this
.
cancel
(
true
);
}
}
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
...
@@ -292,7 +285,7 @@ public class Async {
...
@@ -292,7 +285,7 @@ public class Async {
}
}
private
static
File
createFileFromInputStream
(
InputStream
inputStream
,
String
fileName
,
Context
context
)
{
private
static
File
createFileFromInputStream
(
InputStream
inputStream
,
String
fileName
)
{
try
{
try
{
File
f
=
new
File
(
fileName
);
File
f
=
new
File
(
fileName
);
...
@@ -307,12 +300,13 @@ public class Async {
...
@@ -307,12 +300,13 @@ public class Async {
outputStream
.
close
();
outputStream
.
close
();
inputStream
.
close
();
inputStream
.
close
();
Log
.
d
(
"Magisk"
,
"Holy balls, I think it worked. File is
"
+
f
.
getPath
());
Log
ger
.
dh
(
"Async: File created successfully -
"
+
f
.
getPath
());
return
f
;
return
f
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"error in creating a file"
);
System
.
out
.
println
(
"error in creating a file"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
null
;
return
null
;
...
@@ -327,23 +321,24 @@ public class Async {
...
@@ -327,23 +321,24 @@ public class Async {
@Override
@Override
protected
Boolean
doInBackground
(
Void
...
voids
)
{
protected
Boolean
doInBackground
(
Void
...
voids
)
{
if
(
mPath
!
=
null
)
{
if
(
mPath
=
=
null
)
{
Log
.
e
(
"Magisk"
,
"Utils: Error, flashZIP called without a valid zip file to flash."
);
Log
.
e
(
"Magisk"
,
"Utils: Error, flashZIP called without a valid zip file to flash."
);
progress
.
dismiss
();
this
.
cancel
(
true
);
this
.
cancel
(
true
);
progress
.
cancel
();
return
false
;
return
false
;
}
}
if
(!
Shell
.
rootAccess
())
{
if
(!
Shell
.
rootAccess
())
{
return
false
;
return
false
;
}
else
{
}
else
{
ret
=
Shell
.
su
(
ret
=
Shell
.
su
(
"rm -rf /d
ev
/tmp"
,
"rm -rf /d
ata
/tmp"
,
"mkdir -p /d
ev
/tmp"
,
"mkdir -p /d
ata
/tmp"
,
"cp -af "
+
mPath
+
" /d
ev
/tmp/install.zip"
,
"cp -af "
+
mPath
+
" /d
ata
/tmp/install.zip"
,
"unzip -o /d
ev/tmp/install.zip META-INF/com/google/android/* -d /dev
/tmp"
,
"unzip -o /d
ata/tmp/install.zip META-INF/com/google/android/* -d /data
/tmp"
,
"BOOTMODE=true sh /d
ev/tmp/META-INF/com/google/android/update-binary dummy 1 /dev
/tmp/install.zip"
,
"BOOTMODE=true sh /d
ata/tmp/META-INF/com/google/android/update-binary dummy 1 /data
/tmp/install.zip"
,
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
);
);
Logger
.
dh
(
"Async: ret is "
+
ret
);
return
ret
!=
null
&&
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
));
return
ret
!=
null
&&
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
));
}
}
}
}
...
@@ -351,6 +346,7 @@ public class Async {
...
@@ -351,6 +346,7 @@ public class Async {
@Override
@Override
protected
void
onPostExecute
(
Boolean
result
)
{
protected
void
onPostExecute
(
Boolean
result
)
{
super
.
onPostExecute
(
result
);
super
.
onPostExecute
(
result
);
//Shell.su("rm -rf /data/tmp");
if
(
deleteFileAfter
)
{
if
(
deleteFileAfter
)
{
Shell
.
su
(
"rm -rf "
+
mPath
);
Shell
.
su
(
"rm -rf "
+
mPath
);
Log
.
d
(
"Magisk"
,
"Utils: Deleting file "
+
mPath
);
Log
.
d
(
"Magisk"
,
"Utils: Deleting file "
+
mPath
);
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
View file @
c56dd417
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.utils;
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.utils;
import
android.app.Application
;
import
android.app.Application
;
import
android.content.Context
;
import
android.content.Context
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
android.util.Log
;
public
class
Logger
{
public
class
Logger
{
...
@@ -15,7 +16,7 @@ public class Logger {
...
@@ -15,7 +16,7 @@ public class Logger {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
(
Pref
Helper
.
CheckBool
(
"developer_logging"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"developer_logging"
,
false
))
{
if
(
args
.
length
==
1
&&
args
[
0
]
instanceof
Throwable
)
{
if
(
args
.
length
==
1
&&
args
[
0
]
instanceof
Throwable
)
{
Log
.
d
(
LOG_TAG
,
msg
,
(
Throwable
)
args
[
0
]);
Log
.
d
(
LOG_TAG
,
msg
,
(
Throwable
)
args
[
0
]);
}
else
{
}
else
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/PrefHelper.java
deleted
100644 → 0
View file @
d2335485
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.content.Context
;
import
android.preference.PreferenceManager
;
public
class
PrefHelper
{
public
PrefHelper
()
{
}
public
static
boolean
CheckBool
(
String
key
,
Context
context
)
{
return
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
key
,
false
);
}
public
static
void
SetBool
(
String
key
,
Boolean
value
,
Context
context
)
{
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
key
,
value
).
apply
();
}
}
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
c56dd417
...
@@ -72,10 +72,10 @@ public class Utils {
...
@@ -72,10 +72,10 @@ public class Utils {
if
(!
Shell
.
rootAccess
())
{
if
(!
Shell
.
rootAccess
())
{
Snackbar
.
make
(((
Activity
)
context
).
findViewById
(
android
.
R
.
id
.
content
),
R
.
string
.
no_root_access
,
Snackbar
.
LENGTH_LONG
).
show
();
Snackbar
.
make
(((
Activity
)
context
).
findViewById
(
android
.
R
.
id
.
content
),
R
.
string
.
no_root_access
,
Snackbar
.
LENGTH_LONG
).
show
();
}
}
if
(
Pref
Helper
.
CheckBool
(
"keep_root_off"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"keep_root_off"
,
false
))
{
Utils
.
toggleRoot
(
false
,
context
);
Utils
.
toggleRoot
(
false
,
context
);
}
}
if
(
Pref
Helper
.
CheckBool
(
"enable_quicktile"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
Utils
.
SetupQuickSettingsTile
(
context
);
Utils
.
SetupQuickSettingsTile
(
context
);
}
}
}
}
...
@@ -137,10 +137,10 @@ public class Utils {
...
@@ -137,10 +137,10 @@ public class Utils {
}
else
{
}
else
{
Shell
.
su
(
"rm -rf /magisk/.core/bin"
,
"setprop magisk.root 0"
);
Shell
.
su
(
"rm -rf /magisk/.core/bin"
,
"setprop magisk.root 0"
);
}
}
if
(
Pref
Helper
.
CheckBool
(
"enable_quicktile"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
SetupQuickSettingsTile
(
context
);
SetupQuickSettingsTile
(
context
);
}
}
Pref
Helper
.
SetBool
(
"root"
,
b
,
context
);
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
"root"
,
b
).
apply
(
);
}
}
}
}
...
@@ -156,6 +156,7 @@ public class Utils {
...
@@ -156,6 +156,7 @@ public class Utils {
Logger
.
dh
(
"Utils: toggleAuto checks passed, setting"
+
b
);
Logger
.
dh
(
"Utils: toggleAuto checks passed, setting"
+
b
);
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
"autoRootEnable"
,
b
).
apply
();
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
"autoRootEnable"
,
b
).
apply
();
Intent
myServiceIntent
=
new
Intent
(
context
,
MonitorService
.
class
);
Intent
myServiceIntent
=
new
Intent
(
context
,
MonitorService
.
class
);
myServiceIntent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
b
)
{
if
(
b
)
{
context
.
startService
(
myServiceIntent
);
context
.
startService
(
myServiceIntent
);
}
else
{
}
else
{
...
@@ -163,7 +164,7 @@ public class Utils {
...
@@ -163,7 +164,7 @@ public class Utils {
}
}
}
}
}
}
if
(
Pref
Helper
.
CheckBool
(
"enable_quicktile"
,
context
))
{
if
(
Pref
erenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"enable_quicktile"
,
false
))
{
SetupQuickSettingsTile
(
context
);
SetupQuickSettingsTile
(
context
);
}
}
UpdateRootFragmentUI
(
context
);
UpdateRootFragmentUI
(
context
);
...
...
app/src/main/res/layout/activity_main.xml
View file @
c56dd417
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"start"
android:layout_gravity=
"start"
android:fitsSystemWindows=
"true"
android:fitsSystemWindows=
"true"
style=
"?attr/navStyle"
app:menu=
"@menu/drawer"
/>
app:menu=
"@menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
</android.support.v4.widget.DrawerLayout>
app/src/main/res/layout/list_item_app.xml
View file @
c56dd417
...
@@ -6,11 +6,11 @@
...
@@ -6,11 +6,11 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:layout_marginBottom=
"@dimen/card_vertical_margin"
android:layout_marginBottom=
"@dimen/card_vertical_margin"
android:layout_marginStart=
"@dimen/card_horizontal_margin"
android:layout_marginEnd=
"@dimen/card_horizontal_margin"
android:layout_marginEnd=
"@dimen/card_horizontal_margin"
android:layout_marginStart=
"@dimen/card_horizontal_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
android:background=
"?android:attr/selectableItemBackground
"
style=
"?attr/cardStyle
"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:minHeight=
"?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardElevation=
"@dimen/card_elevation"
>
card_view:cardElevation=
"@dimen/card_elevation"
>
...
@@ -33,11 +33,11 @@
...
@@ -33,11 +33,11 @@
android:id=
"@+id/textLayout"
android:id=
"@+id/textLayout"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:layout_height=
"fill_parent"
android:layout_alignBottom=
"@+id/app_icon"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:paddingEnd=
"@dimen/card_appicon_size"
android:paddingEnd=
"@dimen/card_appicon_size"
android:paddingStart=
"65dp"
android:paddingStart=
"65dp"
android:gravity=
"center_horizontal"
android:layout_alignBottom=
"@+id/app_icon"
android:weightSum=
"1"
>
android:weightSum=
"1"
>
...
@@ -46,21 +46,21 @@
...
@@ -46,21 +46,21 @@
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"false"
android:layout_alignParentEnd=
"false"
android:layout_weight=
"1"
android:paddingEnd=
"3dp"
android:paddingEnd=
"3dp"
android:paddingStart=
"3dp"
android:paddingStart=
"3dp"
android:textStyle=
"bold"
android:textStyle=
"bold"
/>
android:layout_weight=
"1"
/>
<TextView
<TextView
android:id=
"@+id/app_paackage"
android:id=
"@+id/app_paackage"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"25dp"
android:layout_height=
"25dp"
android:ellipsize=
"marquee"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:paddingEnd=
"3dp"
android:marqueeRepeatLimit=
"marquee_forever"
android:paddingStart=
"3dp"
android:maxLines=
"1"
android:maxLines=
"1"
android:
marqueeRepeatLimit =
"marquee_forever
"
android:
paddingEnd=
"3dp
"
android:
ellipsize=
"marquee
"
/>
android:
paddingStart=
"3dp
"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
...
...
app/src/main/res/layout/list_item_module.xml
View file @
c56dd417
...
@@ -6,20 +6,20 @@
...
@@ -6,20 +6,20 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:layout_marginBottom=
"@dimen/card_vertical_margin"
android:layout_marginBottom=
"@dimen/card_vertical_margin"
android:layout_marginStart=
"@dimen/card_horizontal_margin"
android:layout_marginEnd=
"@dimen/card_horizontal_margin"
android:layout_marginEnd=
"@dimen/card_horizontal_margin"
android:layout_marginStart=
"@dimen/card_horizontal_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
android:background=
"?android:attr/selectableItemBackground"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:minHeight=
"?android:attr/listPreferredItemHeight"
style=
"?attr/cardStyle"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardElevation=
"@dimen/card_elevation"
>
card_view:cardElevation=
"@dimen/card_elevation"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:padding=
"@dimen/card_layout_padding"
android:padding=
"@dimen/card_layout_padding"
>
android:layout_gravity=
"center_vertical"
>
<TextView
<TextView
android:id=
"@+id/title"
android:id=
"@+id/title"
...
@@ -30,26 +30,26 @@
...
@@ -30,26 +30,26 @@
android:layout_marginTop=
"0dp"
android:layout_marginTop=
"0dp"
android:maxLines=
"1"
android:maxLines=
"1"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textIsSelectable=
"false"
/>
android:textIsSelectable=
"false"
/>
<TextView
<TextView
android:id=
"@+id/version_name"
android:id=
"@+id/version_name"
android:layout_width=
"@dimen/card_textview_width"
android:layout_width=
"@dimen/card_textview_width"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/title"
android:layout_below=
"@id/title"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
android:textStyle=
"bold|italic"
/>
android:layout_alignParentStart=
"true"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_above=
"@+id/expand_layout"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:orientation=
"horizontal"
android:layout_alignParentTop=
"true"
android:layout_alignParentTop=
"true"
android:layout_above=
"@+id/expand_layout
"
android:orientation=
"horizontal
"
android:paddingTop=
"15dp"
>
android:paddingTop=
"15dp"
>
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
android:gravity=
"center"
android:gravity=
"center"
android:padding=
"@dimen/checkbox_padding"
android:padding=
"@dimen/checkbox_padding"
android:src=
"@drawable/ic_menu_overflow_material"
android:src=
"@drawable/ic_menu_overflow_material"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
<ImageView
<ImageView
android:id=
"@+id/delete"
android:id=
"@+id/delete"
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
android:gravity=
"center"
android:gravity=
"center"
android:padding=
"@dimen/checkbox_padding"
android:padding=
"@dimen/checkbox_padding"
android:src=
"@drawable/ic_delete"
android:src=
"@drawable/ic_delete"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
</LinearLayout>
<!--TODO - Work in an auto-update notifier, make this fly around like magic -->
<!--TODO - Work in an auto-update notifier, make this fly around like magic -->
...
@@ -96,7 +96,7 @@
...
@@ -96,7 +96,7 @@
android:layout_below=
"@id/version_name"
android:layout_below=
"@id/version_name"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
android:textIsSelectable=
"false"
/>
<TextView
<TextView
android:id=
"@+id/warning"
android:id=
"@+id/warning"
...
@@ -107,7 +107,7 @@
...
@@ -107,7 +107,7 @@
android:text=
"@string/remove_file_created"
android:text=
"@string/remove_file_created"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@color/red500"
android:textColor=
"@color/red500"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
<LinearLayout
<LinearLayout
android:id=
"@+id/expand_layout"
android:id=
"@+id/expand_layout"
...
@@ -127,17 +127,17 @@
...
@@ -127,17 +127,17 @@
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
android:textStyle=
"bold|italic"
/>
<TextView
<TextView
android:id=
"@+id/updateStatus"
android:id=
"@+id/updateStatus"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginBottom=
"20dip"
android:layout_marginBottom=
"20dip"
android:gravity=
"center_horizontal"
android:gravity=
"center_horizontal"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
/>
android:layout_gravity=
"center_horizontal"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -152,8 +152,8 @@
...
@@ -152,8 +152,8 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:backgroundTint=
"@color/icon_grey
"
android:background=
"@drawable/ic_changelog
"
android:background=
"@drawable/ic_changelog"
/>
android:backgroundTint=
"@color/icon_grey"
/>
<ImageView
<ImageView
android:id=
"@+id/authorLink"
android:id=
"@+id/authorLink"
...
@@ -161,8 +161,8 @@
...
@@ -161,8 +161,8 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:backgroundTint=
"@color/icon_grey
"
android:background=
"@drawable/ic_author
"
android:background=
"@drawable/ic_author"
/>
android:backgroundTint=
"@color/icon_grey"
/>
<ImageView
<ImageView
android:id=
"@+id/supportLink"
android:id=
"@+id/supportLink"
...
@@ -170,8 +170,8 @@
...
@@ -170,8 +170,8 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:backgroundTint=
"@color/icon_grey
"
android:background=
"@drawable/ic_support
"
android:background=
"@drawable/ic_support"
/>
android:backgroundTint=
"@color/icon_grey"
/>
</LinearLayout>
</LinearLayout>
...
@@ -181,6 +181,4 @@
...
@@ -181,6 +181,4 @@
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
\ No newline at end of file
app/src/main/res/layout/list_item_repo.xml
View file @
c56dd417
...
@@ -6,11 +6,11 @@
...
@@ -6,11 +6,11 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:layout_marginBottom=
"@dimen/card_vertical_margin"
android:layout_marginBottom=
"@dimen/card_vertical_margin"
android:layout_marginStart=
"@dimen/card_horizontal_margin"
android:layout_marginEnd=
"@dimen/card_horizontal_margin"
android:layout_marginEnd=
"@dimen/card_horizontal_margin"
android:layout_marginStart=
"@dimen/card_horizontal_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
android:layout_marginTop=
"@dimen/card_vertical_margin"
android:background=
"?android:attr/selectableItemBackground"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:minHeight=
"?android:attr/listPreferredItemHeight"
style=
"?attr/cardStyle"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardCornerRadius=
"@dimen/card_corner_radius"
card_view:cardElevation=
"@dimen/card_elevation"
>
card_view:cardElevation=
"@dimen/card_elevation"
>
...
@@ -31,47 +31,47 @@
...
@@ -31,47 +31,47 @@
android:id=
"@+id/title"
android:id=
"@+id/title"
android:layout_width=
"@dimen/card_textview_width"
android:layout_width=
"@dimen/card_textview_width"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:singleLine=
"false"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textIsSelectable=
"false"
android:layout_alignParentStart=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignParentTop=
"true"
android:layout_alignParentTop=
"true"
android:layout_marginTop=
"0dp"
/>
android:layout_marginTop=
"0dp"
android:maxLines=
"1"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textIsSelectable=
"false"
/>
<TextView
<TextView
android:id=
"@+id/version_name"
android:id=
"@+id/version_name"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/title"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
android:textStyle=
"bold|italic"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/title"
/>
/>
<ImageView
<ImageView
android:id=
"@+id/update"
android:id=
"@+id/update"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:focusable=
"false"
android:gravity=
"end"
android:background=
"@drawable/ic_file_download_black"
android:backgroundTint=
"@color/icon_grey"
android:layout_gravity=
"end"
android:layout_alignBaseline=
"@id/title"
android:layout_alignBaseline=
"@id/title"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:layout_gravity=
"end"
android:background=
"@drawable/ic_file_download_black"
android:backgroundTint=
"@color/icon_grey"
android:focusable=
"false"
android:gravity=
"end"
/>
/>
<TextView
<TextView
android:id=
"@+id/description"
android:id=
"@+id/description"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/update"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/update"
/>
/>
...
@@ -79,10 +79,10 @@
...
@@ -79,10 +79,10 @@
android:id=
"@+id/expand_layout"
android:id=
"@+id/expand_layout"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/description"
android:minHeight=
"100dp"
android:minHeight=
"100dp"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:layout_below=
"@id/description"
android:layout_alignParentStart=
"true"
>
>
...
@@ -108,40 +108,43 @@
...
@@ -108,40 +108,43 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:layout_marginBottom=
"20dip"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
/>
android:layout_marginBottom=
"20dip"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"50dip"
android:layout_height=
"50dip"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:orientation=
"horizontal"
android:layout_marginBottom=
"0dip"
android:layout_marginBottom=
"0dip"
>
android:orientation=
"horizontal"
>
<ImageView
<ImageView
android:id=
"@+id/changeLog"
android:id=
"@+id/changeLog"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:backgroundTint=
"@color/icon_grey"
android:background=
"@drawable/ic_changelog"
android:background=
"@drawable/ic_changelog"
/>
android:backgroundTint=
"@color/icon_grey"
/>
<ImageView
<ImageView
android:id=
"@+id/authorLink"
android:id=
"@+id/authorLink"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:backgroundTint=
"@color/icon_grey"
android:background=
"@drawable/ic_author"
android:background=
"@drawable/ic_author"
/>
android:backgroundTint=
"@color/icon_grey"
/>
<ImageView
<ImageView
android:id=
"@+id/supportLink"
android:id=
"@+id/supportLink"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:background
Tint=
"@color/icon_grey
"
android:background
=
"@drawable/ic_support
"
android:background
=
"@drawable/ic_support
"
/>
android:background
Tint=
"@color/icon_grey
"
/>
</LinearLayout>
</LinearLayout>
...
@@ -149,18 +152,17 @@
...
@@ -149,18 +152,17 @@
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<ImageView
<ImageView
android:id=
"@+id/installed"
android:id=
"@+id/installed"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:focusable=
"false"
android:visibility=
"gone"
android:gravity=
"end"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:focusable=
"false"
android:gravity=
"end"
android:visibility=
"gone"
/>
/>
</RelativeLayout>
</RelativeLayout>
...
...
app/src/main/res/layout/magisk_fragment.xml
View file @
c56dd417
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
xmlns:card_view=
"http://schemas.android.com/tools"
android:layout_marginBottom=
"8dp"
android:layout_marginBottom=
"8dp"
android:layout_marginTop=
"?attr/actionBarSize"
android:layout_marginTop=
"?attr/actionBarSize"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
...
@@ -20,6 +21,7 @@
...
@@ -20,6 +21,7 @@
android:layout_marginLeft=
"5dip"
android:layout_marginLeft=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
android:layout_marginTop=
"6dp"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
app:cardUseCompatPadding=
"true"
>
<LinearLayout
<LinearLayout
...
@@ -70,6 +72,7 @@
...
@@ -70,6 +72,7 @@
android:layout_marginLeft=
"5dip"
android:layout_marginLeft=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
android:layout_marginTop=
"6dp"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
app:cardUseCompatPadding=
"true"
>
<LinearLayout
<LinearLayout
...
@@ -121,6 +124,7 @@
...
@@ -121,6 +124,7 @@
android:layout_marginLeft=
"5dip"
android:layout_marginLeft=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
android:layout_marginTop=
"6dp"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
app:cardUseCompatPadding=
"true"
>
<LinearLayout
<LinearLayout
...
...
app/src/main/res/layout/root_fragment.xml
View file @
c56dd417
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
xmlns:card_view=
"http://schemas.android.com/tools"
android:layout_marginBottom=
"8dp"
android:layout_marginBottom=
"8dp"
android:layout_marginTop=
"?attr/actionBarSize"
>
android:layout_marginTop=
"?attr/actionBarSize"
>
...
@@ -23,6 +24,7 @@
...
@@ -23,6 +24,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:elevation=
"2dp"
android:elevation=
"2dp"
android:visibility=
"gone"
android:visibility=
"gone"
style=
"?attr/cardStyle"
app:cardCornerRadius=
"0dp"
>
app:cardCornerRadius=
"0dp"
>
<Switch
<Switch
...
@@ -41,6 +43,7 @@
...
@@ -41,6 +43,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:elevation=
"2dp"
android:elevation=
"2dp"
android:visibility=
"gone"
android:visibility=
"gone"
style=
"?attr/cardStyle"
app:cardCornerRadius=
"0dp"
>
app:cardCornerRadius=
"0dp"
>
<Switch
<Switch
...
@@ -60,6 +63,7 @@
...
@@ -60,6 +63,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:elevation=
"2dp"
android:elevation=
"2dp"
android:visibility=
"gone"
android:visibility=
"gone"
style=
"?attr/cardStyle"
app:cardCornerRadius=
"0dp"
>
app:cardCornerRadius=
"0dp"
>
<Switch
<Switch
...
@@ -82,6 +86,7 @@
...
@@ -82,6 +86,7 @@
android:layout_marginRight=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
android:layout_marginTop=
"6dp"
android:visibility=
"gone"
android:visibility=
"gone"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
app:cardUseCompatPadding=
"true"
>
<LinearLayout
<LinearLayout
...
@@ -126,6 +131,7 @@
...
@@ -126,6 +131,7 @@
android:layout_marginRight=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
android:layout_marginTop=
"6dp"
android:visibility=
"gone"
android:visibility=
"gone"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
app:cardUseCompatPadding=
"true"
>
<LinearLayout
<LinearLayout
...
@@ -162,6 +168,7 @@
...
@@ -162,6 +168,7 @@
android:layout_marginRight=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
android:layout_marginTop=
"6dp"
android:visibility=
"gone"
android:visibility=
"gone"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
app:cardUseCompatPadding=
"true"
>
<LinearLayout
<LinearLayout
...
...
app/src/main/res/layout/toolbar.xml
View file @
c56dd417
...
@@ -5,5 +5,5 @@
...
@@ -5,5 +5,5 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
android:layout_height=
"?attr/actionBarSize"
android:background=
"?attr/colorPrimary"
android:background=
"?attr/colorPrimary"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:theme=
"@style/AppTheme.Toolbar"
/>
/>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values/arrays.xml
0 → 100644
View file @
c56dd417
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array
name=
"themes"
>
<item>
"Default"
</item>
<item>
"Dark"
</item>
</string-array>
</resources>
\ No newline at end of file
app/src/main/res/values/attrs.xml
View file @
c56dd417
...
@@ -20,6 +20,12 @@
...
@@ -20,6 +20,12 @@
<declare-styleable
name=
"RowItem"
>
<declare-styleable
name=
"RowItem"
>
<attr
name=
"icon"
format=
"reference"
/>
<attr
name=
"icon"
format=
"reference"
/>
<attr
name=
"text"
format=
"string"
/>
<attr
name=
"text"
format=
"string"
/>
<attr
name=
"cardStyle"
format=
"reference"
/>
<attr
name=
"navStyle"
format=
"reference"
/>
<attr
name=
"ColorOK"
format=
"reference"
/>
<attr
name=
"ColorWarn"
format=
"reference"
/>
<attr
name=
"ColorFail"
format=
"reference"
/>
<attr
name=
"ColorNeutral"
format=
"reference"
/>
</declare-styleable>
</declare-styleable>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
c56dd417
...
@@ -11,5 +11,20 @@
...
@@ -11,5 +11,20 @@
<color
name=
"green500"
>
#4CAF50
</color>
<color
name=
"green500"
>
#4CAF50
</color>
<color
name=
"blue500"
>
#2196F3
</color>
<color
name=
"blue500"
>
#2196F3
</color>
<color
name=
"grey500"
>
#9E9E9E
</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"
>
#03A9F4
</color>
<color
name=
"dh_primary_text"
>
#dedede
</color>
<color
name=
"dh_secondary_text"
>
#8A8A8A
</color>
<color
name=
"dh_icons"
>
#000000
</color>
<color
name=
"dh_divider"
>
#424242
</color>
<color
name=
"dh_alertWarn"
>
#FF9800
</color>
<color
name=
"dh_alertOk"
>
#2196F3
</color>
<color
name=
"dh_alertNeutral"
>
#2196F3
</color>
<color
name=
"dh_alertFail"
>
#FF5722
</color>
</resources>
</resources>
app/src/main/res/values/strings.xml
View file @
c56dd417
...
@@ -127,4 +127,5 @@
...
@@ -127,4 +127,5 @@
<string
name=
"auto_toggle_apps"
>
Auto-toggle List
</string>
<string
name=
"auto_toggle_apps"
>
Auto-toggle List
</string>
<string
name=
"toast_error_makedir"
>
Error creating directory, could not download file.
</string>
<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=
"toast_error_removing_files"
>
Error removing old files, cancelled.
</string>
<string
name=
"settings_general_title"
>
General
</string>
</resources>
</resources>
app/src/main/res/values/styles.xml
View file @
c56dd417
...
@@ -7,10 +7,14 @@
...
@@ -7,10 +7,14 @@
<item
name=
"colorAccent"
>
@color/accent
</item>
<item
name=
"colorAccent"
>
@color/accent
</item>
<item
name=
"windowActionModeOverlay"
>
true
</item>
<item
name=
"windowActionModeOverlay"
>
true
</item>
<item
name=
"android:windowDrawsSystemBarBackgrounds"
>
true
</item>
<item
name=
"android:windowDrawsSystemBarBackgrounds"
>
true
</item>
<item
name=
"cardStyle"
>
@style/CardViewStyle.Light
</item>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"android:statusBarColor"
>
@android:color/transparent
</item>
<item
name=
"android:statusBarColor"
>
@android:color/transparent
</item>
<item
name=
"ColorOK"
>
@color/green500
</item>
<item
name=
"ColorWarn"
>
@color/yellow500
</item>
<item
name=
"ColorFail"
>
@color/red500
</item>
<item
name=
"ColorNeutral"
>
@color/grey500
</item>
</style>
</style>
<style
name=
"AppTheme.Toolbar"
parent=
"ThemeOverlay.AppCompat.Light"
>
<style
name=
"AppTheme.Toolbar"
parent=
"ThemeOverlay.AppCompat.Light"
>
...
@@ -20,6 +24,45 @@
...
@@ -20,6 +24,45 @@
<item
name=
"android:textColorSecondary"
>
@color/primary_text
</item>
<!-- force -->
<item
name=
"android:textColorSecondary"
>
@color/primary_text
</item>
<!-- force -->
<item
name=
"actionMenuTextColor"
>
@color/icons
</item>
<item
name=
"actionMenuTextColor"
>
@color/icons
</item>
</style>
</style>
<style
name=
"AppTheme.dh"
parent=
"ThemeOverlay.AppCompat.Dark"
>
<item
name=
"colorPrimary"
>
@color/dh_primary
</item>
<item
name=
"colorPrimaryDark"
>
@color/dh_primary_dark
</item>
<item
name=
"colorAccent"
>
@color/dh_accent
</item>
<item
name=
"windowActionModeOverlay"
>
true
</item>
<item
name=
"android:windowDrawsSystemBarBackgrounds"
>
true
</item>
<item
name=
"cardBackgroundColor"
>
@color/dh_accent
</item>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"cardStyle"
>
@style/CardViewStyle.Dark
</item>
<item
name=
"android:statusBarColor"
>
@android:color/transparent
</item>
<item
name=
"android:textColorPrimary"
>
@color/dh_primary_text
</item>
<item
name=
"android:textColorSecondary"
>
@color/dh_primary_text
</item>
<item
name=
"ColorOK"
>
@color/dh_alertOk
</item>
<item
name=
"ColorWarn"
>
@color/dh_alertWarn
</item>
<item
name=
"ColorFail"
>
@color/dh_alertFail
</item>
<item
name=
"ColorNeutral"
>
@color/grey500
</item>
</style>
<style
name=
"AppTheme.Toolbar.dh"
parent=
"ThemeOverlay.AppCompat.Dark"
>
<item
name=
"colorPrimary"
>
@color/dh_primary
</item>
<item
name=
"android:elevation"
>
4dp
</item>
<item
name=
"android:textColorPrimary"
>
@color/dh_primary_text
</item>
<item
name=
"android:textColorSecondary"
>
@color/dh_primary_text
</item>
<!-- force -->
<item
name=
"actionMenuTextColor"
>
@color/dh_icons
</item>
</style>
<style
name=
"CardViewStyle.Dark"
parent=
"CardView"
>
<item
name=
"cardBackgroundColor"
>
@android:color/background_dark
</item>
</style>
<style
name=
"CardViewStyle.Light"
parent=
"CardView"
>
<item
name=
"cardBackgroundColor"
>
@android:color/background_light
</item>
</style>
<style
name=
"AppTheme.Transparent"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
<style
name=
"AppTheme.Transparent"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
</style>
</style>
...
...
app/src/main/res/xml/uisettings.xml
View file @
c56dd417
<PreferenceScreen
<PreferenceScreen
android:layout_marginTop=
"?attr/actionBarSize"
android:layout_marginTop=
"?attr/actionBarSize"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<PreferenceCategory
android:title=
"@string/settings_general_title"
>
<ListPreference
android:key=
"theme"
android:title=
"Theme"
android:summary=
"Select a theme"
android:entries=
"@array/themes"
android:entryValues=
"@array/themes"
/>
</PreferenceCategory>
<PreferenceCategory
<PreferenceCategory
android:title=
"@string/settings_quicksettings_category"
>
android:title=
"@string/settings_quicksettings_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