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
49e54691
Commit
49e54691
authored
Jan 29, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update logs
parent
586015c2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
23 deletions
+67
-23
MagiskLogFragment.java
...src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
+0
-3
SettingsActivity.java
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
+21
-12
SuLogFragment.java
app/src/main/java/com/topjohnwu/magisk/SuLogFragment.java
+39
-2
SuLogAdapter.java
...main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java
+1
-0
SuLogDatabaseHelper.java
...a/com/topjohnwu/magisk/superuser/SuLogDatabaseHelper.java
+6
-0
menu_log.xml
app/src/main/res/menu/menu_log.xml
+0
-6
No files found.
app/src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
View file @
49e54691
...
...
@@ -103,9 +103,6 @@ public class MagiskLogFragment extends Fragment {
case
R
.
id
.
menu_refresh
:
new
LogManager
().
read
();
return
true
;
case
R
.
id
.
menu_send
:
new
LogManager
().
send
();
return
true
;
case
R
.
id
.
menu_save
:
new
LogManager
().
save
();
return
true
;
...
...
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
49e54691
...
...
@@ -77,6 +77,8 @@ public class SettingsActivity extends AppCompatActivity {
private
SharedPreferences
prefs
;
private
PreferenceScreen
prefScreen
;
private
ListPreference
suAccess
,
autoRes
,
suNotification
,
requestTimeout
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -87,19 +89,12 @@ public class SettingsActivity extends AppCompatActivity {
PreferenceCategory
magiskCategory
=
(
PreferenceCategory
)
findPreference
(
"magisk"
);
PreferenceCategory
suCategory
=
(
PreferenceCategory
)
findPreference
(
"superuser"
);
ListPreference
suAccess
=
(
ListPreference
)
findPreference
(
"su_access"
);
ListPreference
autoRes
=
(
ListPreference
)
findPreference
(
"su_auto_response"
);
ListPreference
requestTimeout
=
(
ListPreference
)
findPreference
(
"su_request_timeout"
);
ListPreference
suNotification
=
(
ListPreference
)
findPreference
(
"su_notification"
);
suAccess
=
(
ListPreference
)
findPreference
(
"su_access"
);
autoRes
=
(
ListPreference
)
findPreference
(
"su_auto_response"
);
requestTimeout
=
(
ListPreference
)
findPreference
(
"su_request_timeout"
);
suNotification
=
(
ListPreference
)
findPreference
(
"su_notification"
);
suAccess
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_access
)[
Utils
.
getPrefsInt
(
prefs
,
"su_access"
,
3
)]);
autoRes
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
auto_response
)[
Utils
.
getPrefsInt
(
prefs
,
"su_auto_response"
,
0
)]);
suNotification
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_notification
)[
Utils
.
getPrefsInt
(
prefs
,
"su_notification"
,
1
)]);
requestTimeout
.
setSummary
(
getString
(
R
.
string
.
request_timeout_summary
,
prefs
.
getString
(
"su_request_timeout"
,
"10"
)));
setSummary
();
CheckBoxPreference
busyboxPreference
=
(
CheckBoxPreference
)
findPreference
(
"busybox"
);
CheckBoxPreference
magiskhidePreference
=
(
CheckBoxPreference
)
findPreference
(
"magiskhide"
);
...
...
@@ -206,6 +201,8 @@ public class SettingsActivity extends AppCompatActivity {
case
"su_access"
:
Global
.
Configs
.
suAccessState
=
Utils
.
getPrefsInt
(
prefs
,
"su_access"
,
0
);
Shell
.
su
(
"setprop persist.sys.root_access "
+
Global
.
Configs
.
suAccessState
);
suAccess
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_access
)[
Global
.
Configs
.
suAccessState
]);
break
;
case
"su_request_timeout"
:
Global
.
Configs
.
suRequestTimeout
=
Utils
.
getPrefsInt
(
prefs
,
"su_request_timeout"
,
10
);
...
...
@@ -223,6 +220,18 @@ public class SettingsActivity extends AppCompatActivity {
Global
.
Configs
.
shellLogging
=
prefs
.
getBoolean
(
"shell_logging"
,
false
);
break
;
}
setSummary
();
}
private
void
setSummary
()
{
suAccess
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_access
)[
Global
.
Configs
.
suAccessState
]);
autoRes
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
auto_response
)[
Global
.
Configs
.
suResponseType
]);
suNotification
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_notification
)[
Global
.
Configs
.
suNotificationType
]);
requestTimeout
.
setSummary
(
getString
(
R
.
string
.
request_timeout_summary
,
prefs
.
getString
(
"su_request_timeout"
,
"10"
)));
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/SuLogFragment.java
View file @
49e54691
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.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
...
...
@@ -24,6 +28,19 @@ public class SuLogFragment extends Fragment {
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
private
Unbinder
unbinder
;
private
SuLogDatabaseHelper
dbHelper
;
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setHasOptionsMenu
(
true
);
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
menu_log
,
menu
);
menu
.
findItem
(
R
.
id
.
menu_save
).
setVisible
(
false
);
}
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
...
...
@@ -32,7 +49,14 @@ public class SuLogFragment extends Fragment {
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_su_log
,
container
,
false
);
unbinder
=
ButterKnife
.
bind
(
this
,
v
);
SuLogDatabaseHelper
dbHelper
=
new
SuLogDatabaseHelper
(
getActivity
());
dbHelper
=
new
SuLogDatabaseHelper
(
getActivity
());
updateList
();
return
v
;
}
private
void
updateList
()
{
List
<
SuLogEntry
>
logs
=
dbHelper
.
getLogList
();
if
(
logs
.
size
()
==
0
)
{
...
...
@@ -43,8 +67,21 @@ public class SuLogFragment extends Fragment {
emptyRv
.
setVisibility
(
View
.
GONE
);
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
}
}
return
v
;
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
menu_refresh
:
updateList
();
return
true
;
case
R
.
id
.
menu_clear
:
dbHelper
.
clearLogs
();
updateList
();
return
true
;
default
:
return
true
;
}
}
@Override
...
...
app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java
View file @
49e54691
...
...
@@ -108,6 +108,7 @@ public class SuLogAdapter {
@Override
public
void
onBindGroupViewHolder
(
LogGroupViewHolder
holder
,
int
flatPosition
,
ExpandableGroup
group
)
{
holder
.
date
.
setText
(
group
.
getTitle
());
if
(
isGroupExpanded
(
flatPosition
))
holder
.
expand
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/superuser/SuLogDatabaseHelper.java
View file @
49e54691
...
...
@@ -38,6 +38,12 @@ public class SuLogDatabaseHelper extends SQLiteOpenHelper {
db
.
close
();
}
public
void
clearLogs
()
{
SQLiteDatabase
db
=
getWritableDatabase
();
db
.
delete
(
TABLE_NAME
,
null
,
null
);
db
.
close
();
}
public
List
<
SuLogEntry
>
getLogList
()
{
return
getLogList
(
null
);
}
...
...
app/src/main/res/menu/menu_log.xml
View file @
49e54691
...
...
@@ -8,12 +8,6 @@
android:title=
"@string/menuSaveToSd"
app:showAsAction=
"ifRoom"
/>
<item
android:id=
"@+id/menu_send"
android:icon=
"@drawable/ic_send"
android:title=
"@string/menuSend"
app:showAsAction=
"ifRoom"
/>
<item
android:id=
"@+id/menu_clear"
android:icon=
"@drawable/ic_delete"
...
...
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