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
742055c4
Commit
742055c4
authored
Jan 10, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various small changes
parent
fa73b41f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
53 deletions
+36
-53
AboutActivity.java
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
+5
-13
InstallFragment.java
app/src/main/java/com/topjohnwu/magisk/InstallFragment.java
+1
-1
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+1
-11
SettingsActivity.java
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
+4
-3
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+5
-1
StatusFragment.java
app/src/main/java/com/topjohnwu/magisk/StatusFragment.java
+7
-6
ReposAdapter.java
...main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
+1
-2
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+1
-2
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+8
-2
WebWindow.java
app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java
+2
-11
install_fragment.xml
app/src/main/res/layout/install_fragment.xml
+1
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
View file @
742055c4
package
com
.
topjohnwu
.
magisk
;
import
android.app.AlertDialog
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.text.Html
;
...
...
@@ -39,14 +39,13 @@ public class AboutActivity extends AppCompatActivity {
@BindView
(
R
.
id
.
app_source_code
)
AboutCardRow
appSourceCode
;
@BindView
(
R
.
id
.
support_thread
)
AboutCardRow
supportThread
;
@BindView
(
R
.
id
.
donation
)
AboutCardRow
donation
;
private
AlertDialog
.
Builder
builder
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
if
(
Utils
.
isDarkTheme
(
theme
,
this
)
)
{
if
(
Utils
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
}
setContentView
(
R
.
layout
.
activity_about
);
...
...
@@ -77,11 +76,6 @@ public class AboutActivity extends AppCompatActivity {
}
appChangelog
.
removeSummary
();
if
(
Utils
.
isDarkTheme
(
theme
,
this
))
{
builder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialog_dh
);
}
else
{
builder
=
new
AlertDialog
.
Builder
(
this
);
}
if
(
changes
==
null
)
{
appChangelog
.
setVisibility
(
View
.
GONE
);
}
else
{
...
...
@@ -92,13 +86,11 @@ public class AboutActivity extends AppCompatActivity {
result
=
Html
.
fromHtml
(
changes
);
}
appChangelog
.
setOnClickListener
(
v
->
{
AlertDialog
d
=
builder
AlertDialog
d
=
Utils
.
getAlertDialogBuilder
(
this
)
.
setTitle
(
R
.
string
.
app_changelog
)
.
setMessage
(
result
)
.
setPositiveButton
(
android
.
R
.
string
.
ok
,
null
)
.
create
();
d
.
show
();
.
show
();
//noinspection ConstantConditions
((
TextView
)
d
.
findViewById
(
android
.
R
.
id
.
message
)).
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
...
...
@@ -113,7 +105,7 @@ public class AboutActivity extends AppCompatActivity {
}
else
{
result
=
Html
.
fromHtml
(
getString
(
R
.
string
.
app_developers_
));
}
AlertDialog
d
=
builder
AlertDialog
d
=
Utils
.
getAlertDialogBuilder
(
this
)
.
setTitle
(
R
.
string
.
app_developers
)
.
setMessage
(
result
)
.
setPositiveButton
(
android
.
R
.
string
.
ok
,
null
)
...
...
app/src/main/java/com/topjohnwu/magisk/InstallFragment.java
View file @
742055c4
...
...
@@ -53,7 +53,7 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
}
String
filename
=
"Magisk-v"
+
StatusFragment
.
remoteMagiskVersion
+
".zip"
;
String
finalBootImage
=
bootImage
;
MainActivity
.
alertBuilder
Utils
.
getAlertDialogBuilder
(
getActivity
())
.
setTitle
(
getString
(
R
.
string
.
repo_install_title
,
getString
(
R
.
string
.
magisk
)))
.
setMessage
(
getString
(
R
.
string
.
repo_install_msg
,
filename
))
.
setCancelable
(
true
)
...
...
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
742055c4
package
com
.
topjohnwu
.
magisk
;
import
android.Manifest
;
import
android.app.AlertDialog
;
import
android.app.Fragment
;
import
android.app.FragmentTransaction
;
import
android.content.Intent
;
...
...
@@ -25,7 +24,6 @@ import android.view.MenuItem;
import
android.view.View
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
...
...
@@ -35,8 +33,6 @@ import butterknife.ButterKnife;
public
class
MainActivity
extends
AppCompatActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
,
CallbackHandler
.
EventListener
{
public
static
AlertDialog
.
Builder
alertBuilder
=
null
;
private
static
final
String
SELECTED_ITEM_ID
=
"SELECTED_ITEM_ID"
;
private
final
Handler
mDrawerHandler
=
new
Handler
();
...
...
@@ -54,13 +50,8 @@ public class MainActivity extends AppCompatActivity
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
String
theme
=
prefs
.
getString
(
"theme"
,
""
);
Logger
.
dev
(
"MainActivity: Theme is "
+
theme
);
if
(
Utils
.
isDarkTheme
(
theme
,
this
))
{
if
(
Utils
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
alertBuilder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialog_dh
);
}
else
{
alertBuilder
=
new
AlertDialog
.
Builder
(
this
);
}
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
...
...
@@ -116,7 +107,6 @@ public class MainActivity extends AppCompatActivity
protected
void
onDestroy
()
{
super
.
onDestroy
();
CallbackHandler
.
unRegister
(
StatusFragment
.
updateCheckDone
,
this
);
alertBuilder
=
null
;
}
@Override
...
...
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
742055c4
...
...
@@ -30,7 +30,7 @@ public class SettingsActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
if
(
Utils
.
isDarkTheme
(
theme
,
this
)
)
{
if
(
Utils
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
}
...
...
@@ -120,10 +120,11 @@ public class SettingsActivity extends AppCompatActivity {
switch
(
key
)
{
case
"theme"
:
String
theme
=
prefs
.
getString
(
key
,
""
);
String
theme
=
prefs
.
getString
(
"theme"
,
getString
(
R
.
string
.
theme_default_value
));
Utils
.
isDarkTheme
=
theme
.
equalsIgnoreCase
(
getString
(
R
.
string
.
theme_dark_value
));
themePreference
.
setSummary
(
theme
);
if
(
Utils
.
isDarkTheme
(
theme
,
getActivity
())
)
{
if
(
Utils
.
isDarkTheme
)
{
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme_dh
);
}
else
{
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme
);
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
742055c4
...
...
@@ -17,7 +17,11 @@ public class SplashActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplication
());
if
(
Utils
.
isDarkTheme
(
prefs
.
getString
(
"theme"
,
null
),
this
))
{
String
theme
=
prefs
.
getString
(
"theme"
,
getString
(
R
.
string
.
theme_default_value
));
Utils
.
isDarkTheme
=
theme
.
equalsIgnoreCase
(
getString
(
R
.
string
.
theme_dark_value
));
if
(
Utils
.
isDarkTheme
)
{
setTheme
(
R
.
style
.
AppTheme_dh
);
}
...
...
app/src/main/java/com/topjohnwu/magisk/StatusFragment.java
View file @
742055c4
...
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk;
import
android.app.AlertDialog
;
import
android.app.Fragment
;
import
android.app.FragmentTransaction
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
...
...
@@ -21,6 +19,7 @@ import com.topjohnwu.magisk.utils.Async;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.List
;
...
...
@@ -108,7 +107,8 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
});
if
(
magiskVersion
<
0
&&
Shell
.
rootAccess
()
&&
!
noDialog
)
{
MainActivity
.
alertBuilder
noDialog
=
true
;
Utils
.
getAlertDialogBuilder
(
getActivity
())
.
setTitle
(
R
.
string
.
no_magisk_title
)
.
setMessage
(
R
.
string
.
no_magisk_msg
)
.
setCancelable
(
true
)
...
...
@@ -120,7 +120,7 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
transaction
.
replace
(
R
.
id
.
content_frame
,
new
InstallFragment
(),
"install"
).
commit
();
}
catch
(
IllegalStateException
ignored
)
{}
})
.
setNegativeButton
(
R
.
string
.
no_thanks
,
(
dialogInterface
,
i
)
->
noDialog
=
true
)
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
();
}
...
...
@@ -240,7 +240,7 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
magiskCheckUpdatesProgress
.
setVisibility
(
View
.
GONE
);
mSwipeRefreshLayout
.
setRefreshing
(
false
);
updateMagisk
=
MainActivity
.
alertBuilder
updateMagisk
=
Utils
.
getAlertDialogBuilder
(
getActivity
())
.
setTitle
(
R
.
string
.
magisk_update_title
)
.
setMessage
(
getString
(
R
.
string
.
magisk_update_message
,
remoteMagiskVersion
))
.
setCancelable
(
true
)
...
...
@@ -255,12 +255,13 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
.
setNeutralButton
(
R
.
string
.
check_release_notes
,
(
dialog
,
which
)
->
{
getActivity
().
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
releaseNoteLink
)));
})
.
setNegativeButton
(
R
.
string
.
no_thanks
,
(
dialogInterface
,
i
)
->
noDialog
=
true
)
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
create
();
if
(
magiskVersion
<
remoteMagiskVersion
&&
Shell
.
rootAccess
())
{
magiskStatusContainer
.
setOnClickListener
(
view
->
updateMagisk
.
show
());
if
(!
noDialog
)
{
noDialog
=
true
;
updateMagisk
.
show
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
View file @
742055c4
...
...
@@ -17,7 +17,6 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.MainActivity
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.receivers.RepoDlReceiver
;
...
...
@@ -99,7 +98,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
});
holder
.
updateImage
.
setOnClickListener
(
view
->
{
String
filename
=
repo
.
getName
()
+
"-"
+
repo
.
getVersion
()
+
".zip"
;
MainActivity
.
alertBuilder
Utils
.
getAlertDialogBuilder
(
mContext
)
.
setTitle
(
mContext
.
getString
(
R
.
string
.
repo_install_title
,
repo
.
getName
()))
.
setMessage
(
mContext
.
getString
(
R
.
string
.
repo_install_msg
,
filename
))
.
setCancelable
(
true
)
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
742055c4
...
...
@@ -13,7 +13,6 @@ import android.widget.Toast;
import
com.topjohnwu.magisk.InstallFragment
;
import
com.topjohnwu.magisk.MagiskHideFragment
;
import
com.topjohnwu.magisk.MainActivity
;
import
com.topjohnwu.magisk.ModulesFragment
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ReposFragment
;
...
...
@@ -292,7 +291,7 @@ public class Async {
StatusFragment
.
updateCheckDone
.
trigger
();
new
LoadModules
().
exec
();
MainActivity
.
alertBuilder
Utils
.
getAlertDialogBuilder
(
mContext
)
.
setTitle
(
R
.
string
.
reboot_title
)
.
setMessage
(
R
.
string
.
reboot_msg
)
.
setPositiveButton
(
R
.
string
.
reboot
,
(
dialogInterface1
,
i
)
->
Shell
.
sh
(
"su -c reboot"
))
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
742055c4
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.Manifest
;
import
android.app.AlertDialog
;
import
android.app.DownloadManager
;
import
android.content.Context
;
import
android.content.IntentFilter
;
...
...
@@ -34,6 +35,7 @@ import javax.crypto.spec.DESKeySpec;
public
class
Utils
{
public
static
boolean
isDownloading
=
false
;
public
static
boolean
isDarkTheme
;
private
static
final
String
cryptoPass
=
"MagiskRox666"
;
private
static
final
String
secret
=
"GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus"
;
...
...
@@ -164,8 +166,12 @@ public class Utils {
return
null
;
}
public
static
boolean
isDarkTheme
(
String
theme
,
Context
resources
)
{
return
theme
!=
null
&&
theme
.
equalsIgnoreCase
(
resources
.
getString
(
R
.
string
.
theme_dark_value
));
public
static
AlertDialog
.
Builder
getAlertDialogBuilder
(
Context
context
)
{
if
(
isDarkTheme
)
{
return
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
}
else
{
return
new
AlertDialog
.
Builder
(
context
);
}
}
public
static
class
ByteArrayInOutStream
extends
ByteArrayOutputStream
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java
View file @
742055c4
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.preference.PreferenceManager
;
import
android.support.v7.app.AlertDialog
;
import
android.webkit.WebResourceRequest
;
import
android.webkit.WebView
;
import
android.webkit.WebViewClient
;
import
com.topjohnwu.magisk.R
;
public
class
WebWindow
{
public
WebWindow
(
String
title
,
String
url
,
Context
context
)
{
AlertDialog
.
Builder
alert
;
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getString
(
"theme"
,
""
);
if
(
Utils
.
isDarkTheme
(
theme
,
context
))
{
alert
=
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
}
else
{
alert
=
new
AlertDialog
.
Builder
(
context
);
}
AlertDialog
.
Builder
alert
=
Utils
.
getAlertDialogBuilder
(
context
);
alert
.
setTitle
(
title
);
Logger
.
dev
(
"WebView: URL = "
+
url
);
...
...
app/src/main/res/layout/install_fragment.xml
View file @
742055c4
...
...
@@ -21,7 +21,7 @@
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:padding=
"
1
5dp"
>
android:padding=
"5dp"
>
<TextView
android:id=
"@+id/install_title"
...
...
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