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
b2873dd4
Commit
b2873dd4
authored
Dec 02, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reboot menu
parent
bb80ab40
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
0 deletions
+61
-0
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+30
-0
menu_reboot.xml
app/src/main/res/menu/menu_reboot.xml
+25
-0
strings.xml
app/src/main/res/values-zh-rTW/strings.xml
+3
-0
strings.xml
app/src/main/res/values/strings.xml
+3
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
b2873dd4
...
...
@@ -8,6 +8,9 @@ import android.support.annotation.Nullable;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
...
...
@@ -17,6 +20,7 @@ import com.topjohnwu.magisk.asyncs.LoadModules;
import
com.topjohnwu.magisk.components.Fragment
;
import
com.topjohnwu.magisk.container.Module
;
import
com.topjohnwu.magisk.utils.Const
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Utils
;
...
...
@@ -50,6 +54,7 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber {
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_modules
,
container
,
false
);
unbinder
=
ButterKnife
.
bind
(
this
,
view
);
setHasOptionsMenu
(
true
);
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
recyclerView
.
setVisibility
(
View
.
GONE
);
...
...
@@ -99,6 +104,31 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber {
unbinder
.
unbind
();
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
menu_reboot
,
menu
);
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
reboot
:
Shell
.
su_raw
(
"/system/bin/reboot"
);
return
true
;
case
R
.
id
.
reboot_recovery
:
Shell
.
su_raw
(
"/system/bin/reboot recovery"
);
return
true
;
case
R
.
id
.
reboot_bootloader
:
Shell
.
su_raw
(
"/system/bin/reboot bootloader"
);
return
true
;
case
R
.
id
.
reboot_download
:
Shell
.
su_raw
(
"/system/bin/reboot download"
);
return
true
;
default
:
return
false
;
}
}
private
void
updateUI
()
{
listModules
.
clear
();
listModules
.
addAll
(
getApplication
().
moduleMap
.
values
());
...
...
app/src/main/res/menu/menu_reboot.xml
0 → 100644
View file @
b2873dd4
<?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/reboot"
android:title=
"@string/reboot"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/reboot_recovery"
android:title=
"@string/reboot_recovery"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/reboot_bootloader"
android:title=
"@string/reboot_bootloader"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/reboot_download"
android:title=
"@string/reboot_download"
app:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/values-zh-rTW/strings.xml
View file @
b2873dd4
...
...
@@ -207,5 +207,8 @@
<string
name=
"settings_update_custom"
>
自訂
</string>
<string
name=
"settings_update_custom_msg"
>
請輸入自訂網址
</string>
<string
name=
"su_db_corrupt"
>
SU 資料庫已毀損,將會重新建置
</string>
<string
name=
"reboot_recovery"
>
重啟到 Recovery
</string>
<string
name=
"reboot_bootloader"
>
重啟到 Bootloader
</string>
<string
name=
"reboot_download"
>
重啟到 Download
</string>
</resources>
app/src/main/res/values/strings.xml
View file @
b2873dd4
...
...
@@ -45,6 +45,9 @@
<string
name=
"disable_file_created"
>
Module will be disabled at next reboot
</string>
<string
name=
"disable_file_removed"
>
Module will be enabled at next reboot
</string>
<string
name=
"author"
>
Created by %1$s
</string>
<string
name=
"reboot_recovery"
>
Reboot to Recovery
</string>
<string
name=
"reboot_bootloader"
>
Reboot to Bootloader
</string>
<string
name=
"reboot_download"
>
Reboot to Download
</string>
<!--Repo Fragment-->
<string
name=
"update_available"
>
Update Available
</string>
...
...
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