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
3a238e9d
Commit
3a238e9d
authored
Aug 31, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement file picker and install methods into Modules section.
Tested and working.
parent
9d9fea49
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+34
-0
ic_add.xml
app/src/main/res/drawable/ic_add.xml
+9
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
3a238e9d
package
com
.
topjohnwu
.
magisk
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.TabLayout
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentManager
;
...
...
@@ -17,8 +21,11 @@ import android.view.ViewGroup;
import
android.widget.ProgressBar
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
...
...
@@ -30,8 +37,11 @@ public class ModulesFragment extends Fragment {
public
static
List
<
Module
>
listModules
=
new
ArrayList
<>();
public
static
List
<
Module
>
listModulesCache
=
new
ArrayList
<>();
private
static
final
int
FILE_SELECT_CODE
=
0
;
private
File
input
;
@BindView
(
R
.
id
.
progressBar
)
ProgressBar
progressBar
;
@BindView
(
R
.
id
.
fab
)
FloatingActionButton
fabio
;
@BindView
(
R
.
id
.
pager
)
ViewPager
viewPager
;
@BindView
(
R
.
id
.
tab_layout
)
TabLayout
tabLayout
;
...
...
@@ -51,7 +61,31 @@ public class ModulesFragment extends Fragment {
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
super
.
onCreateOptionsMenu
(
menu
,
inflater
);
inflater
.
inflate
(
R
.
menu
.
menu_module
,
menu
);
fabio
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
();
intent
.
setType
(
"*/zip"
);
intent
.
setAction
(
Intent
.
ACTION_GET_CONTENT
);
startActivityForResult
(
intent
,
FILE_SELECT_CODE
);
}
});
}
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
switch
(
requestCode
)
{
case
FILE_SELECT_CODE:
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
// Get the Uri of the selected file
Uri
uri
=
data
.
getData
();
String
path
=
uri
.
getPath
();
String
fileName
=
uri
.
getLastPathSegment
();
new
Utils
.
FlashZIP
(
getActivity
(),
fileName
,
path
).
execute
();
}
break
;
}}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
...
...
app/src/main/res/drawable/ic_add.xml
0 → 100644
View file @
3a238e9d
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
/>
</vector>
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