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
5124cd4b
Commit
5124cd4b
authored
Sep 21, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/digitalhigh_automount' into digitalhigh_automount
parents
0cbf6699
e922fdc5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
748 additions
and
445 deletions
+748
-445
build.gradle
app/build.gradle
+1
-4
MagiskFragment.java
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
+2
-2
ModulesAdapter.java
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
+6
-5
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+2
-2
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+15
-17
ReposFragment.java
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
+4
-10
WelcomeActivity.java
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
+5
-7
BaseModule.java
...src/main/java/com/topjohnwu/magisk/module/BaseModule.java
+5
-8
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+3
-2
Repo.java
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
+280
-232
RepoHelper.java
...src/main/java/com/topjohnwu/magisk/module/RepoHelper.java
+49
-156
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+374
-0
strings.xml
app/src/main/res/values/strings.xml
+2
-0
No files found.
app/build.gradle
View file @
5124cd4b
...
...
@@ -38,10 +38,7 @@ dependencies {
compile
'com.github.d8ahazard:BroadcastTileSupportUpdate:master'
compile
'com.jakewharton:butterknife:8.4.0'
compile
'com.github.michalis-vitos:aFileChooser:master'
compile
'com.google.code.gson:gson:2.7'
annotationProcessor
'com.jakewharton:butterknife-compiler:8.4.0'
}
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
5124cd4b
...
...
@@ -7,7 +7,6 @@ import android.support.annotation.Nullable;
import
android.support.v4.app.Fragment
;
import
android.support.v4.content.FileProvider
;
import
android.support.v7.app.AlertDialog
;
import
android.text.Html
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -15,6 +14,7 @@ import android.widget.ImageView;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
...
...
@@ -112,7 +112,7 @@ public class MagiskFragment extends Fragment {
new
Utils
.
DownloadReceiver
(
getString
(
R
.
string
.
magisk
))
{
@Override
public
void
task
(
File
file
)
{
new
Utils
.
FlashZIP
(
mContext
,
mName
,
file
.
getPath
()).
execute
();
new
Async
.
FlashZIP
(
mContext
,
mName
,
file
.
getPath
()).
execute
();
}
},
Utils
.
magiskLink
,
"latest_magisk.zip"
);
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
View file @
5124cd4b
...
...
@@ -21,6 +21,7 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.WebWindow
;
...
...
@@ -84,8 +85,8 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
holder
.
description
.
setText
(
module
.
getDescription
());
holder
.
author
.
setText
(
module
.
getAuthor
());
String
logUrl
=
module
.
getmLogUrl
();
String
supportUrl
=
module
.
get
m
SupportUrl
();
String
donateUrl
=
module
.
get
m
DonateUrl
();
String
supportUrl
=
module
.
getSupportUrl
();
String
donateUrl
=
module
.
getDonateUrl
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(
prefs
.
contains
(
"ignoreUpdateAlerts"
))
{
ignoreAlertUpdate
=
prefs
.
getBoolean
(
"ignoreUpdateAlerts"
,
false
);
...
...
@@ -109,7 +110,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
public
void
task
(
File
file
)
{
Log
.
d
(
"Magisk"
,
"Task firing"
);
new
Utils
.
FlashZIP
(
context
,
mModule
.
getId
(),
file
.
toString
()).
execute
();
new
Async
.
FlashZIP
(
context
,
mModule
.
getId
(),
file
.
toString
()).
execute
();
}
};
String
filename
=
mModule
.
getId
().
replace
(
" "
,
""
)
+
".zip"
;
...
...
@@ -139,10 +140,10 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
new
WebWindow
(
"Changelog"
,
module
.
getmLogUrl
(),
context
);
}
if
(
view
.
getId
()
==
holder
.
authorLink
.
getId
())
{
new
WebWindow
(
"Donate"
,
module
.
get
m
DonateUrl
(),
context
);
new
WebWindow
(
"Donate"
,
module
.
getDonateUrl
(),
context
);
}
if
(
view
.
getId
()
==
holder
.
supportLink
.
getId
())
{
new
WebWindow
(
"Support"
,
module
.
get
m
SupportUrl
(),
context
);
new
WebWindow
(
"Support"
,
module
.
getSupportUrl
(),
context
);
}
};
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
5124cd4b
...
...
@@ -16,7 +16,7 @@ import android.widget.CheckBox;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.
Utils
;
import
com.topjohnwu.magisk.utils.
Async
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -44,7 +44,7 @@ public class ModulesFragment extends Fragment {
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
recyclerView
.
setVisibility
(
View
.
GONE
);
new
Utils
.
LoadModules
(
getActivity
()).
execute
();
new
Async
.
LoadModules
(
getActivity
()).
execute
();
new
updateUI
().
execute
();
prefs
.
edit
().
putBoolean
(
"ignoreUpdateAlerts"
,
false
).
apply
();
...
...
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
View file @
5124cd4b
...
...
@@ -21,6 +21,7 @@ import android.widget.TextView;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.WebWindow
;
...
...
@@ -91,9 +92,9 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
repo
=
mList
.
get
(
position
);
mHolder
=
holder
;
mDonateUrl
=
repo
.
get
m
DonateUrl
();
mSupportUrl
=
repo
.
get
m
SupportUrl
();
mLogUrl
=
repo
.
get
m
LogUrl
();
mDonateUrl
=
repo
.
getDonateUrl
();
mSupportUrl
=
repo
.
getSupportUrl
();
mLogUrl
=
repo
.
getLogUrl
();
mExpandedList
=
new
ArrayList
<>(
mList
.
size
());
for
(
int
i
=
0
;
i
<
mList
.
size
();
i
++)
{
mExpandedList
.
add
(
false
);
...
...
@@ -113,13 +114,10 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
}
mHolder
.
title
.
setText
(
titleString
);
mHolder
.
versionName
.
setText
(
repo
.
get
m
Version
());
mHolder
.
versionName
.
setText
(
repo
.
getVersion
());
mHolder
.
description
.
setText
(
repo
.
getDescription
());
String
authorString
=
this
.
context
.
getResources
().
getString
(
R
.
string
.
author
)
+
" "
+
repo
.
get
m
Author
();
String
authorString
=
this
.
context
.
getResources
().
getString
(
R
.
string
.
author
)
+
" "
+
repo
.
getAuthor
();
mHolder
.
author
.
setText
(
authorString
);
String
logUrl
=
repo
.
getmLogUrl
();
String
supportUrl
=
repo
.
getmSupportUrl
();
String
donateUrl
=
repo
.
getmDonateUrl
();
if
(
prefs
.
contains
(
"ignoreUpdateAlerts"
))
{
ignoreAlertUpdate
=
prefs
.
getBoolean
(
"ignoreUpdateAlerts"
,
false
);
}
...
...
@@ -135,7 +133,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
mHolder
.
updateStatus
.
setText
(
repo
.
canUpdate
()
?
this
.
context
.
getResources
().
getString
(
R
.
string
.
module_update_available
)
:
this
.
context
.
getResources
().
getString
(
R
.
string
.
module_up_to_date
));
}
Log
.
d
(
"Magisk"
,
"ReposAdapter: Setting up info "
+
repo
.
getId
()
+
" and "
+
repo
.
getDescription
()
+
" and "
+
repo
.
get
m
Version
());
Log
.
d
(
"Magisk"
,
"ReposAdapter: Setting up info "
+
repo
.
getId
()
+
" and "
+
repo
.
getDescription
()
+
" and "
+
repo
.
getVersion
());
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
mCanUpdate
=
prefs
.
getBoolean
(
"repo-canUpdate_"
+
repo
.
getId
(),
false
);
...
...
@@ -150,23 +148,23 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
@Override
public
void
task
(
File
file
)
{
Log
.
d
(
"Magisk"
,
"Task firing"
);
new
Utils
.
FlashZIP
(
context
,
repo
.
getId
(),
file
.
toString
()).
execute
();
new
Async
.
FlashZIP
(
context
,
repo
.
getId
(),
file
.
toString
()).
execute
();
}
};
String
filename
=
repo
.
getId
().
replace
(
" "
,
""
)
+
".zip"
;
Utils
.
downloadAndReceive
(
context
,
receiver
,
repo
.
get
m
ZipUrl
(),
filename
);
Utils
.
downloadAndReceive
(
context
,
receiver
,
repo
.
getZipUrl
(),
filename
);
}
else
{
Toast
.
makeText
(
context
,
repo
.
getId
()
+
" is already installed."
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
if
((
view
.
getId
()
==
mHolder
.
changeLog
.
getId
())
&&
(!
repo
.
get
m
LogUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Changelog"
,
repo
.
get
m
LogUrl
(),
context
);
if
((
view
.
getId
()
==
mHolder
.
changeLog
.
getId
())
&&
(!
repo
.
getLogUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Changelog"
,
repo
.
getLogUrl
(),
context
);
}
if
((
view
.
getId
()
==
mHolder
.
authorLink
.
getId
())
&&
(!
repo
.
get
m
SupportUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Donate"
,
repo
.
get
m
DonateUrl
(),
context
);
if
((
view
.
getId
()
==
mHolder
.
authorLink
.
getId
())
&&
(!
repo
.
getSupportUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Donate"
,
repo
.
getDonateUrl
(),
context
);
}
if
((
view
.
getId
()
==
mHolder
.
supportLink
.
getId
())
&&
(!
repo
.
get
m
SupportUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Support"
,
repo
.
get
m
SupportUrl
(),
context
);
if
((
view
.
getId
()
==
mHolder
.
supportLink
.
getId
())
&&
(!
repo
.
getSupportUrl
().
equals
(
""
)))
{
new
WebWindow
(
"Support"
,
repo
.
getSupportUrl
(),
context
);
}
};
mHolder
.
changeLog
.
setOnClickListener
(
oCl
);
...
...
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
View file @
5124cd4b
...
...
@@ -17,6 +17,7 @@ import android.widget.TextView;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.RepoHelper
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
...
...
@@ -111,14 +112,7 @@ public class ReposFragment extends Fragment {
};
Log
.
d
(
"Magisk"
,
"ReposFragment, LoadRepo called"
);
mListRepos
.
clear
();
List
<
Repo
>
magiskRepos
=
RepoHelper
.
listRepos
(
getActivity
(),
doReload
,
taskDelegate
);
for
(
Repo
repo
:
magiskRepos
)
{
Log
.
d
(
"Magisk"
,
"ReposFragment: Adding repo from string "
+
repo
.
getId
());
mListRepos
.
add
(
repo
);
}
new
Async
.
LoadRepos
(
getActivity
());
}
private
void
NotifyOfAlerts
()
{
...
...
@@ -133,11 +127,11 @@ public class ReposFragment extends Fragment {
@Override
public
void
task
(
File
file
)
{
Log
.
d
(
"Magisk"
,
"Task firing"
);
new
Utils
.
FlashZIP
(
getActivity
(),
repo
.
getId
(),
file
.
toString
()).
execute
();
new
Async
.
FlashZIP
(
getActivity
(),
repo
.
getId
(),
file
.
toString
()).
execute
();
}
};
String
filename
=
repo
.
getId
().
replace
(
" "
,
""
)
+
".zip"
;
Utils
.
downloadAndReceive
(
getActivity
(),
receiver
,
repo
.
get
m
ZipUrl
(),
filename
);
Utils
.
downloadAndReceive
(
getActivity
(),
receiver
,
repo
.
getZipUrl
(),
filename
);
break
;
...
...
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
View file @
5124cd4b
...
...
@@ -24,6 +24,7 @@ import android.view.MenuItem;
import
android.view.View
;
import
com.topjohnwu.magisk.module.RepoHelper
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.utils.Utils
;
...
...
@@ -71,16 +72,13 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
}
new
Utils
.
Initialize
(
this
).
execute
(
);
new
Utils
.
CheckUpdates
(
this
).
execute
();
Utils
.
init
(
this
);
new
Async
.
CheckUpdates
(
this
).
execute
();
RepoHelper
.
TaskDelegate
delegate
=
result
->
{
//Do a thing here when we get a result we want
};
new
Utils
.
LoadModules
(
this
).
execute
();
new
Utils
.
LoadRepos
(
this
,
true
,
delegate
).
execute
();
new
Utils
.
LoadRepos
(
this
,
!
prefs
.
contains
(
"hasCachedRepos"
),
delegate
).
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
);
new
Utils
.
LoadModules
(
getApplication
()).
execute
();
new
Utils
.
LoadRepos
(
this
,
false
,
delegate
).
execute
();
new
Async
.
LoadModules
(
this
).
execute
();
new
Async
.
LoadRepos
(
this
).
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
);
setSupportActionBar
(
toolbar
);
...
...
app/src/main/java/com/topjohnwu/magisk/module/BaseModule.java
View file @
5124cd4b
...
...
@@ -7,16 +7,13 @@ import java.util.List;
public
abstract
class
BaseModule
{
protected
String
mId
,
mName
,
mVersion
,
m
Description
,
mSupportUrl
,
mDonateUrl
,
mAuthor
;
protected
String
mId
,
mName
,
mVersion
,
m
Author
,
mDescription
,
mSupportUrl
,
mDonateUrl
;
protected
boolean
mIsCacheModule
=
false
;
protected
int
mVersionCode
=
0
;
public
BaseModule
(
List
<
String
>
props
)
{
this
(
props
.
toArray
(
new
String
[
props
.
size
()]));
}
protected
void
parseProps
(
List
<
String
>
props
)
{
parseProps
(
props
.
toArray
(
new
String
[
props
.
size
()]));
}
p
ublic
BaseModule
(
String
[]
props
)
{
p
rotected
void
parseProps
(
String
[]
props
)
{
for
(
String
line
:
props
)
{
String
[]
prop
=
line
.
split
(
"="
,
2
);
if
(
prop
.
length
!=
2
)
{
...
...
@@ -93,11 +90,11 @@ public abstract class BaseModule {
return
mVersionCode
;
}
public
String
get
m
DonateUrl
()
{
public
String
getDonateUrl
()
{
return
mDonateUrl
;
}
public
String
get
m
SupportUrl
()
{
public
String
getSupportUrl
()
{
return
mSupportUrl
;
}
}
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
5124cd4b
...
...
@@ -16,9 +16,10 @@ public class Module extends BaseModule {
private
String
mZipUrl
,
mLogUrl
;
private
boolean
mEnable
,
mRemove
,
mUpdateAvailable
=
false
,
mIsInstalled
;
public
Module
(
String
path
,
Context
context
)
{
public
Module
(
Context
context
,
String
path
)
{
super
(
Utils
.
readFile
(
path
+
"/module.prop"
));
super
();
parseProps
(
Utils
.
readFile
(
path
+
"/module.prop"
));
mRemoveFile
=
path
+
"/remove"
;
mDisableFile
=
path
+
"/disable"
;
...
...
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
View file @
5124cd4b
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java
View file @
5124cd4b
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
0 → 100644
View file @
5124cd4b
This diff is collapsed.
Click to expand it.
app/src/main/res/values/strings.xml
View file @
5124cd4b
...
...
@@ -105,4 +105,6 @@
<string
name=
"some_string"
>
GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus
</string>
<string
name=
"downloads"
>
Downloads
</string>
<string
name=
"url_main"
>
https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=
</string>
<string
name=
"file_url"
>
https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s
</string>
<string
name=
"zip_url"
>
https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip
</string>
</resources>
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