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
ffedb796
Commit
ffedb796
authored
Sep 02, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Synch update - WIP
Not finished, just synchronizing workflows.
parent
0e239354
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
472 additions
and
35 deletions
+472
-35
BaseRepoFragment.java
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
+47
-0
ModulesAdapter.java
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
+0
-2
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+5
-7
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+94
-0
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+10
-21
Repo.java
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
+112
-0
RepoAdapter.java
...rc/main/java/com/topjohnwu/magisk/module/RepoAdapter.java
+130
-0
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+10
-5
list_item_repo.xml
app/src/main/res/layout/list_item_repo.xml
+64
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
0 → 100644
View file @
ffedb796
package
com
.
topjohnwu
.
magisk
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Repo
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
public
abstract
class
BaseRepoFragment
extends
Fragment
{
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
if
(
listRepos
().
size
()
==
0
)
{
emptyTv
.
setVisibility
(
View
.
VISIBLE
);
recyclerView
.
setVisibility
(
View
.
GONE
);
return
view
;
}
recyclerView
.
setAdapter
(
new
ReposAdapter
(
listRepos
())
{
});
return
view
;
}
protected
abstract
List
<
Repo
>
listRepos
();
}
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
View file @
ffedb796
...
...
@@ -5,12 +5,10 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.CheckBox
;
import
android.widget.CompoundButton
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.ModuleRepo
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
ffedb796
...
...
@@ -22,7 +22,7 @@ import android.view.ViewGroup;
import
android.widget.ProgressBar
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.
Module
Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
...
...
@@ -36,7 +36,7 @@ public class ModulesFragment extends Fragment {
public
static
List
<
Module
>
listModules
=
new
ArrayList
<>();
public
static
List
<
Module
>
listModulesCache
=
new
ArrayList
<>();
public
static
List
<
Module
>
listModulesDownload
=
new
ArrayList
<>();
public
static
List
<
Repo
>
listModulesDownload
=
new
ArrayList
<>();
private
static
final
int
FILE_SELECT_CODE
=
0
;
private
File
input
;
...
...
@@ -50,9 +50,8 @@ public class ModulesFragment extends Fragment {
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
new
Utils
.
LoadModules
(
getContext
()).
execute
();
new
updateUI
().
execute
();
setHasOptionsMenu
(
true
);
return
view
;
}
...
...
@@ -125,10 +124,10 @@ public class ModulesFragment extends Fragment {
}
}
public
static
class
DownloadModuleFragment
extends
Base
Module
Fragment
{
public
static
class
DownloadModuleFragment
extends
Base
Repo
Fragment
{
@Override
protected
List
<
Module
>
listModule
s
()
{
protected
List
<
Repo
>
listRepo
s
()
{
return
listModulesDownload
;
}
...
...
@@ -180,7 +179,6 @@ public class ModulesFragment extends Fragment {
}
else
if
(
position
==
1
)
{
return
new
CacheModuleFragment
();
}
else
{
Log
.
d
(
"Magisk"
,
"DL Fragment picked here"
);
return
new
DownloadModuleFragment
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
0 → 100644
View file @
ffedb796
package
com
.
topjohnwu
.
magisk
;
import
android.content.Context
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.CheckBox
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
public
class
ReposAdapter
extends
RecyclerView
.
Adapter
<
ReposAdapter
.
ViewHolder
>
{
private
final
List
<
Repo
>
mList
;
private
View
view
;
private
Context
context
;
public
ReposAdapter
(
List
<
Repo
>
list
)
{
this
.
mList
=
list
;
}
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_repo
,
parent
,
false
);
context
=
parent
.
getContext
();
return
new
ViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
final
ViewHolder
holder
,
int
position
)
{
final
Repo
repo
=
mList
.
get
(
position
);
holder
.
title
.
setText
(
repo
.
getName
());
holder
.
versionName
.
setText
(
repo
.
getVersion
());
holder
.
description
.
setText
(
repo
.
getDescription
());
view
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Utils
.
DownloadReceiver
reciever
=
new
Utils
.
DownloadReceiver
()
{
@Override
public
void
task
(
File
file
)
{
Log
.
d
(
"Magisk"
,
"Task firing"
);
new
Utils
.
FlashZIP
(
context
,
repo
.
getName
(),
file
.
toString
()).
execute
();
}
};
String
filename
=
repo
.
getName
().
replace
(
" "
,
""
)
+
".zip"
;
Utils
.
downloadAndReceive
(
context
,
reciever
,
repo
.
getZipUrl
(),
filename
);
}
});
}
@Override
public
int
getItemCount
()
{
return
mList
.
size
();
}
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
ffedb796
package
com
.
topjohnwu
.
magisk
.
module
;
import
android.util.Log
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileReader
;
public
class
Module
{
private
String
mRemoveFile
;
...
...
@@ -17,6 +10,7 @@ public class Module {
private
String
mName
=
null
;
private
String
mVersion
=
"(No version provided)"
;
private
String
mDescription
=
"(No description provided)"
;
private
String
mUrl
=
null
;
private
boolean
mEnable
;
private
boolean
mRemove
;
...
...
@@ -24,7 +18,6 @@ public class Module {
private
String
mId
;
private
int
mVersionCode
;
public
Module
(
String
path
)
{
mRemoveFile
=
path
+
"/remove"
;
mDisableFile
=
path
+
"/disable"
;
...
...
@@ -74,25 +67,21 @@ public class Module {
}
public
Module
(
ModuleRepo
.
Repo
repo
)
{
mName
=
repo
.
getName
();
mVersion
=
repo
.
getVersion
();
mDescription
=
repo
.
getDescription
();
mId
=
"foo"
;
mVersionCode
=
111
;
public
Module
(
Repo
repo
)
{
mName
=
repo
.
getName
();
mVersion
=
repo
.
getVersion
();
mDescription
=
repo
.
getDescription
();
mId
=
"foo"
;
mVersionCode
=
111
;
mUrl
=
repo
.
getZipUrl
();
mEnable
=
true
;
mRemove
=
false
;
}
public
String
getName
()
{
return
mName
;
}
...
...
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
0 → 100644
View file @
ffedb796
package
com
.
topjohnwu
.
magisk
.
module
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
com.topjohnwu.magisk.utils.WebRequest
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.HashSet
;
import
java.util.Set
;
public
class
Repo
{
public
String
name
;
public
String
baseUrl
,
zipUrl
,
manifestUrl
,
logUrl
;
public
String
manifest
,
version
,
moduleName
,
moduleDescription
,
moduleAuthor
,
moduleAuthorUrl
;
public
Boolean
usesRoot
,
usesXposed
;
private
Context
appContext
;
private
SharedPreferences
prefs
;
public
Repo
(
String
name
,
String
url
,
Context
context
)
{
appContext
=
context
;
this
.
name
=
name
;
this
.
baseUrl
=
url
;
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
appContext
);
}
public
Repo
(
String
moduleName
,
String
moduleDescription
,
String
zipUrl
)
{
this
.
zipUrl
=
zipUrl
;
this
.
moduleDescription
=
moduleDescription
;
this
.
moduleName
=
moduleName
;
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
appContext
);
}
public
void
fetch
()
{
WebRequest
webreq
=
new
WebRequest
();
// Construct initial url for contents
Log
.
d
(
"Magisk"
,
"Manifest string is: "
+
baseUrl
+
"/contents/"
);
String
repoString
=
webreq
.
makeWebServiceCall
(
baseUrl
+
"/contents/"
,
WebRequest
.
GET
);
try
{
JSONArray
repoArray
=
new
JSONArray
(
repoString
);
for
(
int
f
=
0
;
f
<
repoArray
.
length
();
f
++)
{
JSONObject
jsonobject
=
repoArray
.
getJSONObject
(
f
);
String
name
=
jsonobject
.
getString
(
"name"
);
if
(
name
.
contains
(
".zip"
))
{
this
.
zipUrl
=
jsonobject
.
getString
(
"download_url"
);
}
else
if
(
name
.
equals
(
"module.json"
))
{
this
.
manifestUrl
=
jsonobject
.
getString
(
"download_url"
);
}
else
if
(
name
.
equals
(
"Changelog.txt"
))
{
this
.
logUrl
=
jsonobject
.
getString
(
"download_url"
);
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
Log
.
d
(
"Magisk"
,
"Inner fetch: "
+
repoString
);
try
{
WebRequest
jsonReq
=
new
WebRequest
();
// Construct initial url for contents
String
manifestString
=
webreq
.
makeWebServiceCall
(
this
.
manifestUrl
,
WebRequest
.
GET
);
JSONObject
manifestObject
=
new
JSONObject
(
manifestString
);
Log
.
d
(
"Magisk"
,
"Object: "
+
manifestObject
.
toString
());
version
=
manifestObject
.
getString
(
"versionCode"
);
moduleName
=
manifestObject
.
getString
(
"moduleName"
);
moduleDescription
=
manifestObject
.
getString
(
"moduleDescription"
);
moduleAuthor
=
manifestObject
.
getString
(
"moduleAuthor"
);
usesRoot
=
Boolean
.
getBoolean
(
manifestObject
.
getString
(
"usesRoot"
));
usesXposed
=
Boolean
.
getBoolean
(
manifestObject
.
getString
(
"usesXposed"
));
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
String
prefsString
=
"[{\"moduleDescription\":\""
+
moduleDescription
+
"\","
+
"\"moduleName\":\""
+
moduleName
+
"\","
+
"\"moduleAuthor\":\""
+
moduleAuthor
+
"\","
+
"\"moduleAuthorUrl\":\""
+
moduleAuthorUrl
+
"\","
+
"\"usesRoot\":\""
+
usesRoot
+
"\","
+
"\"usesXposed\":\""
+
usesXposed
+
"\","
+
"\"zipUrl\":\""
+
zipUrl
+
"\","
+
"\"logUrl\":\""
+
logUrl
+
"\"}]"
;
editor
.
putString
(
"module_"
+
moduleName
,
prefsString
);
editor
.
putBoolean
(
"hasCachedRepos"
,
true
);
editor
.
apply
();
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
public
String
getName
()
{
return
moduleName
;
}
public
String
getVersion
()
{
return
version
;
}
public
String
getLogUrl
()
{
return
logUrl
;
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/module/
ModuleRepo
.java
→
app/src/main/java/com/topjohnwu/magisk/module/
RepoAdapter
.java
View file @
ffedb796
...
...
@@ -2,8 +2,10 @@ package com.topjohnwu.magisk.module;
import
android.app.ListActivity
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
com.topjohnwu.magisk.utils.WebRequest
;
...
...
@@ -16,8 +18,9 @@ import java.net.MalformedURLException;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
ModuleRepo
{
public
class
RepoAdapter
{
private
String
[]
result
;
private
static
String
url
=
"https://api.github.com/orgs/Magisk-Modules-Repo/repos"
;
private
static
List
<
Repo
>
repos
=
new
ArrayList
<
Repo
>();
...
...
@@ -26,36 +29,49 @@ public class ModuleRepo {
private
Context
activityContext
;
public
List
<
Repo
>
listRepos
()
{
MyAsyncTask
asynchTask
=
new
MyAsyncTask
();
Log
.
d
(
"Magisk"
,
"Gitagent init called"
);
asynchTask
.
execute
();
List
<
String
>
out
=
null
;
public
List
<
Repo
>
listRepos
(
Context
context
)
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(!
prefs
.
contains
(
"hasCachedRepos"
))
{
activityContext
=
context
;
MyAsyncTask
asynchTask
=
new
MyAsyncTask
();
asynchTask
.
execute
();
List
<
String
>
out
=
null
;
}
else
{
Log
.
d
(
"Magisk"
,
"Building from cache"
);
Map
<
String
,?>
map
=
prefs
.
getAll
();
for
(
Map
.
Entry
<
String
,?>
entry
:
map
.
entrySet
())
{
if
(
entry
.
getKey
().
contains
(
"module_"
))
{
String
repoString
=
entry
.
getValue
().
toString
();
JSONArray
repoArray
=
null
;
try
{
repoArray
=
new
JSONArray
(
repoString
);
repos
.
clear
();
for
(
int
f
=
0
;
f
<
repoArray
.
length
();
f
++)
{
JSONObject
jsonobject
=
repoArray
.
getJSONObject
(
f
);
String
name
=
jsonobject
.
getString
(
"name"
);
String
moduleName
,
moduleDescription
,
zipUrl
;
moduleName
=
jsonobject
.
getString
(
"moduleName"
);
moduleDescription
=
jsonobject
.
getString
(
"moduleDescription"
);
zipUrl
=
jsonobject
.
getString
(
"zipUrl"
);
repos
.
add
(
new
Repo
(
moduleName
,
moduleDescription
,
zipUrl
));
return
repos
;
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
System
.
out
.
println
(
entry
.
getKey
()
+
"/"
+
entry
.
getValue
());
}
public
JSONArray
fetchModuleArray
()
{
fetchRepoInfo
();
parseRepoInfo
();
JSONArray
moduleArray
=
enumerateModules
();
return
null
;
}
}
private
void
fetchRepoInfo
()
{
return
repos
;
}
private
void
parseRepoInfo
()
{
}
private
JSONArray
enumerateModules
()
{
JSONArray
enumeratedModules
=
new
JSONArray
();
return
enumeratedModules
;
}
class
MyAsyncTask
extends
AsyncTask
<
String
,
String
,
Void
>
{
...
...
@@ -83,27 +99,17 @@ public class ModuleRepo {
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
JSONObject
jsonobject
=
jsonArray
.
getJSONObject
(
i
);
String
name
=
jsonobject
.
getString
(
"name"
);
String
urlString
=
jsonobject
.
getString
(
"html_url"
);
try
{
URL
url
=
new
URL
(
urlString
);
String
url
=
jsonobject
.
getString
(
"url"
);
if
(!
name
.
contains
(
"Repo.github.io"
))
{
repos
.
add
(
new
Repo
(
name
,
url
));
repos
.
add
(
new
Repo
(
name
,
url
,
activityContext
));
}
}
catch
(
MalformedURLException
e
)
{
e
.
printStackTrace
();
for
(
int
f
=
0
;
f
<
repos
.
size
();
f
++
)
{
repos
.
get
(
f
).
fetch
();
}
}
for
(
int
i
=
0
;
i
<
repos
.
size
();
i
++)
{
Repo
repo
=
repos
.
get
(
i
);
Log
.
d
(
"Magisk"
,
repo
.
name
+
" URL: "
+
repo
.
url
);
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
return
null
;
...
...
@@ -119,52 +125,6 @@ public class ModuleRepo {
}
public
class
Repo
{
public
String
name
;
public
URL
url
;
public
String
manifest
,
version
,
moduleName
,
moduleDescription
,
moduleAuthor
,
moduleAuthorUrl
;
public
Boolean
usesRoot
,
usesXposed
;
public
Repo
(
String
name
,
URL
url
)
{
this
.
name
=
name
;
this
.
url
=
url
;
this
.
manifest
=
(
"https://raw.githubusercontent.com/Magisk-Modules-Repo/"
+
name
+
"/master/module.json"
);
WebRequest
webreq
=
new
WebRequest
();
// Making a request to url and getting response
String
manifestString
=
webreq
.
makeWebServiceCall
(
manifest
,
WebRequest
.
GET
);
Log
.
d
(
"Magisk"
,
"Inner fetch: "
+
manifestString
);
try
{
JSONObject
jsonobject
=
new
JSONObject
(
manifestString
);
Log
.
d
(
"Magisk"
,
"Object: "
+
jsonobject
.
toString
());
version
=
jsonobject
.
getString
(
"versionCode"
);
moduleName
=
jsonobject
.
getString
(
"moduleName"
);
moduleDescription
=
jsonobject
.
getString
(
"moduleDescription"
);
moduleAuthor
=
jsonobject
.
getString
(
"moduleAuthor"
);
moduleAuthorUrl
=
jsonobject
.
getString
(
"authorUrl"
);
usesRoot
=
Boolean
.
getBoolean
(
jsonobject
.
getString
(
"usesRoot"
));
usesXposed
=
Boolean
.
getBoolean
(
jsonobject
.
getString
(
"usesXposed"
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
Log
.
d
(
"Magisk"
,
"We're in! "
+
" "
+
version
+
" "
+
moduleName
+
" "
+
moduleAuthor
+
" "
+
moduleDescription
+
" "
+
moduleAuthorUrl
);
}
public
String
getName
()
{
return
moduleName
;
}
public
String
getVersion
()
{
return
version
;
}
public
String
getDescription
()
{
return
moduleDescription
;
}
}
}
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
ffedb796
...
...
@@ -8,11 +8,13 @@ import android.content.BroadcastReceiver;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.SharedPreferences
;
import
android.content.pm.PackageManager
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Environment
;
import
android.preference.PreferenceManager
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v7.app.AlertDialog
;
...
...
@@ -23,7 +25,8 @@ import android.widget.Toast;
import
com.topjohnwu.magisk.ModulesFragment
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.ModuleRepo
;
import
com.topjohnwu.magisk.module.RepoAdapter
;
import
com.topjohnwu.magisk.module.Repo
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -376,8 +379,9 @@ public class Utils {
List
<
String
>
magisk
=
getModList
(
MAGISK_PATH
);
Log
.
d
(
"Magisk"
,
String
.
valueOf
(
magisk
));
List
<
String
>
magiskCache
=
getModList
(
MAGISK_CACHE_PATH
);
ModuleRepo
mr
=
new
ModuleRepo
();
List
<
ModuleRepo
.
Repo
>
magiskRepos
=
mr
.
listRepos
();
RepoAdapter
mr
=
new
RepoAdapter
();
List
<
Repo
>
magiskRepos
=
mr
.
listRepos
(
mContext
);
for
(
String
mod
:
magisk
)
{
Log
.
d
(
"Magisk"
,
"Utils, listing modules "
+
mod
);
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
));
...
...
@@ -385,8 +389,8 @@ public class Utils {
for
(
String
mod
:
magiskCache
)
{
ModulesFragment
.
listModulesCache
.
add
(
new
Module
(
mod
));
}
for
(
ModuleRepo
.
Repo
repo
:
magiskRepos
)
{
ModulesFragment
.
listModulesDownload
.
add
(
new
Module
(
repo
)
);
for
(
Repo
repo
:
magiskRepos
)
{
ModulesFragment
.
listModulesDownload
.
add
(
repo
);
}
return
null
;
...
...
@@ -424,6 +428,7 @@ public class Utils {
"BOOTMODE=true sh /data/tmp/META-INF/com/google/android/update-binary dummy 1 /data/tmp/install.zip"
,
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
);
Log
.
d
(
"Magisk"
,
"ZipResult: "
+
ret
.
toString
());
return
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
));
}
}
...
...
app/src/main/res/layout/list_item_repo.xml
0 → 100644
View file @
ffedb796
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginBottom=
"3dip"
android:layout_marginLeft=
"8dip"
android:layout_marginRight=
"8dip"
android:layout_marginTop=
"3dip"
android:background=
"?android:attr/selectableItemBackground"
android:minHeight=
"?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius=
"2dp"
card_view:cardElevation=
"2dp"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:orientation=
"horizontal"
android:padding=
"8dp"
>
<LinearLayout
android:layout_width=
"0dip"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"4dip"
android:layout_marginRight=
"4dip"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/title"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:singleLine=
"false"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/version_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
<TextView
android:id=
"@+id/description"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
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