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
3e97d29b
Commit
3e97d29b
authored
Aug 24, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge conflict
parents
a5ea2145
91c6ae22
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
5 deletions
+94
-5
BaseModuleFragment.java
...rc/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
+9
-0
MagiskFragment.java
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
+4
-0
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+27
-3
WelcomeActivity.java
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
+28
-2
single_module_fragment.xml
app/src/main/res/layout/single_module_fragment.xml
+12
-0
menu_modules.xml
app/src/main/res/menu/menu_modules.xml
+11
-0
strings.xml
app/src/main/res/values/strings.xml
+3
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
View file @
3e97d29b
...
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
...
@@ -9,6 +9,7 @@ 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
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.rv.ItemClickListener
;
import
com.topjohnwu.magisk.rv.ItemClickListener
;
...
@@ -22,6 +23,7 @@ import butterknife.ButterKnife;
...
@@ -22,6 +23,7 @@ import butterknife.ButterKnife;
public
abstract
class
BaseModuleFragment
extends
Fragment
{
public
abstract
class
BaseModuleFragment
extends
Fragment
{
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
@Nullable
@Nullable
@Override
@Override
...
@@ -29,6 +31,13 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -29,6 +31,13 @@ public abstract class BaseModuleFragment extends Fragment {
View
view
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
if
(
listModules
().
size
()
==
0
)
{
emptyTv
.
setVisibility
(
View
.
VISIBLE
);
recyclerView
.
setVisibility
(
View
.
GONE
);
return
view
;
}
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
new
ItemClickListener
()
{
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
new
ItemClickListener
()
{
@Override
@Override
public
void
onItemClick
(
View
view
,
int
position
)
{
public
void
onItemClick
(
View
view
,
int
position
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
3e97d29b
...
@@ -188,4 +188,8 @@ public class MagiskFragment extends Fragment {
...
@@ -188,4 +188,8 @@ public class MagiskFragment extends Fragment {
}
}
}
}
}
}
public
void
onRootGranted
()
{
updateStatus
();
}
}
}
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
3e97d29b
...
@@ -9,6 +9,9 @@ import android.support.v4.app.FragmentManager;
...
@@ -9,6 +9,9 @@ import android.support.v4.app.FragmentManager;
import
android.support.v4.app.FragmentPagerAdapter
;
import
android.support.v4.app.FragmentPagerAdapter
;
import
android.support.v4.view.ViewPager
;
import
android.support.v4.view.ViewPager
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.ProgressBar
;
import
android.widget.ProgressBar
;
...
@@ -51,14 +54,32 @@ public class ModulesFragment extends Fragment {
...
@@ -51,14 +54,32 @@ public class ModulesFragment extends Fragment {
View
view
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
tabLayout
.
setupWithViewPager
(
viewPager
);
new
CheckFolders
().
execute
();
new
CheckFolders
().
execute
();
setHasOptionsMenu
(
true
);
return
view
;
return
view
;
}
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
super
.
onCreateOptionsMenu
(
menu
,
inflater
);
inflater
.
inflate
(
R
.
menu
.
menu_modules
,
menu
);
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
force_reload
:
listModules
.
clear
();
listModulesCache
.
clear
();
new
CheckFolders
().
execute
();
break
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
public
static
class
NormalModuleFragment
extends
BaseModuleFragment
{
public
static
class
NormalModuleFragment
extends
BaseModuleFragment
{
@Override
@Override
...
@@ -96,6 +117,9 @@ public class ModulesFragment extends Fragment {
...
@@ -96,6 +117,9 @@ public class ModulesFragment extends Fragment {
super
.
onPostExecute
(
v
);
super
.
onPostExecute
(
v
);
progressBar
.
setVisibility
(
View
.
GONE
);
progressBar
.
setVisibility
(
View
.
GONE
);
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
tabLayout
.
setupWithViewPager
(
viewPager
);
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
View file @
3e97d29b
package
com
.
topjohnwu
.
magisk
;
package
com
.
topjohnwu
.
magisk
;
import
android.app.ProgressDialog
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Build
;
...
@@ -45,8 +46,9 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
...
@@ -45,8 +46,9 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_welcome
);
setContentView
(
R
.
layout
.
activity_welcome
);
view
=
findViewById
(
R
.
id
.
toolbar
);
ButterKnife
.
bind
(
this
);
ButterKnife
.
bind
(
this
);
view
=
toolbar
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
}
}
...
@@ -123,17 +125,21 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
...
@@ -123,17 +125,21 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
private
void
navigate
(
final
int
itemId
)
{
private
void
navigate
(
final
int
itemId
)
{
Fragment
navFragment
=
null
;
Fragment
navFragment
=
null
;
String
tag
=
""
;
switch
(
itemId
)
{
switch
(
itemId
)
{
case
R
.
id
.
magisk
:
case
R
.
id
.
magisk
:
setTitle
(
R
.
string
.
magisk
);
setTitle
(
R
.
string
.
magisk
);
tag
=
"magisk"
;
navFragment
=
new
MagiskFragment
();
navFragment
=
new
MagiskFragment
();
break
;
break
;
case
R
.
id
.
modules
:
case
R
.
id
.
modules
:
setTitle
(
R
.
string
.
modules
);
setTitle
(
R
.
string
.
modules
);
tag
=
"modules"
;
navFragment
=
new
ModulesFragment
();
navFragment
=
new
ModulesFragment
();
break
;
break
;
case
R
.
id
.
log
:
case
R
.
id
.
log
:
setTitle
(
R
.
string
.
log
);
setTitle
(
R
.
string
.
log
);
tag
=
"log"
;
navFragment
=
new
LogFragment
();
navFragment
=
new
LogFragment
();
break
;
break
;
case
R
.
id
.
app_about
:
case
R
.
id
.
app_about
:
...
@@ -147,7 +153,7 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
...
@@ -147,7 +153,7 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
try
{
try
{
toolbar
.
setElevation
(
navFragment
instanceof
ModulesFragment
?
0
:
10
);
toolbar
.
setElevation
(
navFragment
instanceof
ModulesFragment
?
0
:
10
);
transaction
.
replace
(
R
.
id
.
content_frame
,
navFragment
).
commit
();
transaction
.
replace
(
R
.
id
.
content_frame
,
navFragment
,
tag
).
commit
();
}
catch
(
IllegalStateException
ignored
)
{
}
catch
(
IllegalStateException
ignored
)
{
}
}
}
}
...
@@ -155,6 +161,20 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
...
@@ -155,6 +161,20 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
public
static
class
Init
extends
AsyncTask
<
Void
,
Integer
,
Void
>
{
public
static
class
Init
extends
AsyncTask
<
Void
,
Integer
,
Void
>
{
private
final
AppCompatActivity
activity
;
private
ProgressDialog
progress
;
public
Init
(
AppCompatActivity
activity
)
{
this
.
activity
=
activity
;
}
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
progress
=
ProgressDialog
.
show
(
activity
,
null
,
activity
.
getString
(
R
.
string
.
loading
),
true
,
false
);
}
@Override
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
protected
Void
doInBackground
(
Void
...
voids
)
{
return
null
;
return
null
;
...
@@ -164,9 +184,15 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
...
@@ -164,9 +184,15 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
protected
void
onPostExecute
(
Void
v
)
{
protected
void
onPostExecute
(
Void
v
)
{
super
.
onPostExecute
(
v
);
super
.
onPostExecute
(
v
);
progress
.
dismiss
();
if
(!
Shell
.
rootAccess
())
{
if
(!
Shell
.
rootAccess
())
{
Snackbar
.
make
(
view
,
R
.
string
.
no_root_access
,
Snackbar
.
LENGTH_LONG
).
show
();
Snackbar
.
make
(
view
,
R
.
string
.
no_root_access
,
Snackbar
.
LENGTH_LONG
).
show
();
return
;
}
}
MagiskFragment
fragment
=
(
MagiskFragment
)
activity
.
getSupportFragmentManager
().
findFragmentByTag
(
"magisk"
);
fragment
.
onRootGranted
();
}
}
}
}
}
}
app/src/main/res/layout/single_module_fragment.xml
View file @
3e97d29b
...
@@ -11,4 +11,16 @@
...
@@ -11,4 +11,16 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
app:layoutManager=
"android.support.v7.widget.LinearLayoutManager"
/>
app:layoutManager=
"android.support.v7.widget.LinearLayoutManager"
/>
<TextView
android:id=
"@+id/empty_rv"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:fontFamily=
"sans-serif-light"
android:gravity=
"center"
android:text=
"@string/no_modules_found"
android:textSize=
"20sp"
android:textStyle=
"italic"
android:visibility=
"gone"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/menu/menu_modules.xml
0 → 100644
View file @
3e97d29b
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/force_reload"
android:icon=
"@drawable/ic_refresh"
android:title=
"@string/force_reload"
app:showAsAction=
"always"
/>
</menu>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
3e97d29b
...
@@ -46,5 +46,8 @@
...
@@ -46,5 +46,8 @@
<string
name=
"app_source_code"
>
Source code
</string>
<string
name=
"app_source_code"
>
Source code
</string>
<string
name=
"app_translators"
>
App\'s translators
</string>
<string
name=
"app_translators"
>
App\'s translators
</string>
<string
name=
"support_thread"
>
Support thread
</string>
<string
name=
"support_thread"
>
Support thread
</string>
<string
name=
"force_reload"
>
Refresh
</string>
<string
name=
"no_modules_found"
>
No modules found
</string>
<string
name=
"loading"
>
Loading…
</string>
</resources>
</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