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
a4f0fbf8
Commit
a4f0fbf8
authored
Oct 17, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to butterknife
Finally support AndroidX and obfuscation
parent
190cdadd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
216 additions
and
514 deletions
+216
-514
build.gradle
app/build.gradle
+8
-0
AboutActivity.java
app/src/full/java/com/topjohnwu/magisk/AboutActivity.java
+9
-8
DonationActivity.java
app/src/full/java/com/topjohnwu/magisk/DonationActivity.java
+5
-4
FlashActivity.java
app/src/full/java/com/topjohnwu/magisk/FlashActivity.java
+11
-6
MainActivity.java
app/src/full/java/com/topjohnwu/magisk/MainActivity.java
+5
-4
SuRequestActivity.java
...src/full/java/com/topjohnwu/magisk/SuRequestActivity.java
+11
-10
ViewBinder.java
app/src/full/java/com/topjohnwu/magisk/ViewBinder.java
+0
-293
ApplicationAdapter.java
...ava/com/topjohnwu/magisk/adapters/ApplicationAdapter.java
+8
-8
ModulesAdapter.java
...ll/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java
+12
-10
PolicyAdapter.java
...ull/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
+14
-12
ReposAdapter.java
...full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
+13
-13
SuLogAdapter.java
...full/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java
+14
-14
AboutCardRow.java
...ll/java/com/topjohnwu/magisk/components/AboutCardRow.java
+7
-6
BaseFragment.java
...ll/java/com/topjohnwu/magisk/components/BaseFragment.java
+9
-0
CustomAlertDialog.java
...va/com/topjohnwu/magisk/components/CustomAlertDialog.java
+8
-8
LogFragment.java
...full/java/com/topjohnwu/magisk/fragments/LogFragment.java
+4
-10
MagiskFragment.java
...l/java/com/topjohnwu/magisk/fragments/MagiskFragment.java
+44
-45
MagiskHideFragment.java
...va/com/topjohnwu/magisk/fragments/MagiskHideFragment.java
+4
-10
MagiskLogFragment.java
...ava/com/topjohnwu/magisk/fragments/MagiskLogFragment.java
+9
-15
ModulesFragment.java
.../java/com/topjohnwu/magisk/fragments/ModulesFragment.java
+8
-12
ReposFragment.java
...ll/java/com/topjohnwu/magisk/fragments/ReposFragment.java
+5
-6
SuLogFragment.java
...ll/java/com/topjohnwu/magisk/fragments/SuLogFragment.java
+4
-10
SuperuserFragment.java
...ava/com/topjohnwu/magisk/fragments/SuperuserFragment.java
+4
-10
No files found.
app/build.gradle
View file @
a4f0fbf8
...
...
@@ -79,4 +79,12 @@ dependencies {
fullImplementation
'com.github.topjohnwu:libsu:2.0.2'
fullImplementation
'com.atlassian.commonmark:commonmark:0.11.0'
fullImplementation
'org.kamranzafar:jtar:2.3'
def
butterKnifeVersion
=
'9.0.0-rc1'
if
(
properties
.
containsKey
(
'android.injected.invoked.from.ide'
))
{
fullImplementation
"com.jakewharton:butterknife-reflect:${butterKnifeVersion}"
}
else
{
fullImplementation
"com.jakewharton:butterknife-runtime:${butterKnifeVersion}"
fullAnnotationProcessor
"com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
}
}
app/src/full/java/com/topjohnwu/magisk/AboutActivity.java
View file @
a4f0fbf8
...
...
@@ -15,16 +15,17 @@ import java.util.Locale;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.ActionBar
;
import
androidx.appcompat.widget.Toolbar
;
import
butterknife.BindView
;
public
class
AboutActivity
extends
BaseActivity
{
Toolbar
toolbar
;
AboutCardRow
appVersionInfo
;
AboutCardRow
appChangelog
;
AboutCardRow
appTranslators
;
AboutCardRow
appSourceCode
;
AboutCardRow
supportThread
;
AboutCardRow
twitter
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
@BindView
(
R
.
id
.
app_version_info
)
AboutCardRow
appVersionInfo
;
@BindView
(
R
.
id
.
app_changelog
)
AboutCardRow
appChangelog
;
@BindView
(
R
.
id
.
app_translators
)
AboutCardRow
appTranslators
;
@BindView
(
R
.
id
.
app_source_code
)
AboutCardRow
appSourceCode
;
@BindView
(
R
.
id
.
support_thread
)
AboutCardRow
supportThread
;
@BindView
(
R
.
id
.
follow_twitter
)
AboutCardRow
twitter
;
@Override
public
int
getDarkTheme
()
{
...
...
@@ -35,7 +36,7 @@ public class AboutActivity extends BaseActivity {
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_about
);
ViewBinder
.
bind
(
this
);
new
AboutActivity_ViewBinding
(
this
);
setSupportActionBar
(
toolbar
);
toolbar
.
setNavigationOnClickListener
(
view
->
finish
());
...
...
app/src/full/java/com/topjohnwu/magisk/DonationActivity.java
View file @
a4f0fbf8
...
...
@@ -10,12 +10,13 @@ import com.topjohnwu.magisk.utils.Utils;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.ActionBar
;
import
androidx.appcompat.widget.Toolbar
;
import
butterknife.BindView
;
public
class
DonationActivity
extends
BaseActivity
{
Toolbar
toolbar
;
AboutCardRow
paypal
;
AboutCardRow
patreon
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
@BindView
(
R
.
id
.
paypal
)
AboutCardRow
paypal
;
@BindView
(
R
.
id
.
patreon
)
AboutCardRow
patreon
;
@Override
public
int
getDarkTheme
()
{
...
...
@@ -26,7 +27,7 @@ public class DonationActivity extends BaseActivity {
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_donation
);
ViewBinder
.
bind
(
this
);
new
DonationActivity_ViewBinding
(
this
);
setSupportActionBar
(
toolbar
);
toolbar
.
setNavigationOnClickListener
(
view
->
finish
());
...
...
app/src/full/java/com/topjohnwu/magisk/FlashActivity.java
View file @
a4f0fbf8
...
...
@@ -31,21 +31,25 @@ import java.util.Locale;
import
androidx.appcompat.app.ActionBar
;
import
androidx.appcompat.widget.Toolbar
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
public
class
FlashActivity
extends
BaseActivity
{
Toolbar
toolbar
;
TextView
flashLogs
;
public
LinearLayout
buttonPanel
;
public
Button
reboot
;
ScrollView
sv
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
@BindView
(
R
.
id
.
txtLog
)
TextView
flashLogs
;
@BindView
(
R
.
id
.
button_panel
)
public
LinearLayout
buttonPanel
;
@BindView
(
R
.
id
.
reboot
)
public
Button
reboot
;
@BindView
(
R
.
id
.
scrollView
)
ScrollView
sv
;
private
List
<
String
>
logs
;
@OnClick
(
R
.
id
.
reboot
)
void
reboot
()
{
Shell
.
su
(
"/system/bin/reboot"
).
submit
();
}
@OnClick
(
R
.
id
.
save_logs
)
void
saveLogs
()
{
runWithPermission
(
new
String
[]
{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
()
->
{
Calendar
now
=
Calendar
.
getInstance
();
...
...
@@ -78,7 +82,8 @@ public class FlashActivity extends BaseActivity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_flash
);
ViewBinder
.
bind
(
this
);
new
FlashActivity_ViewBinding
(
this
);
setSupportActionBar
(
toolbar
);
ActionBar
ab
=
getSupportActionBar
();
if
(
ab
!=
null
)
{
...
...
app/src/full/java/com/topjohnwu/magisk/MainActivity.java
View file @
a4f0fbf8
...
...
@@ -26,6 +26,7 @@ import androidx.appcompat.widget.Toolbar;
import
androidx.drawerlayout.widget.DrawerLayout
;
import
androidx.fragment.app.Fragment
;
import
androidx.fragment.app.FragmentTransaction
;
import
butterknife.BindView
;
public
class
MainActivity
extends
BaseActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
,
Topic
.
Subscriber
{
...
...
@@ -34,9 +35,9 @@ public class MainActivity extends BaseActivity
private
int
mDrawerItem
;
private
static
boolean
fromShortcut
=
false
;
public
Toolbar
toolbar
;
DrawerLayout
drawer
;
NavigationView
navigationView
;
@BindView
(
R
.
id
.
toolbar
)
public
Toolbar
toolbar
;
@BindView
(
R
.
id
.
drawer_layout
)
DrawerLayout
drawer
;
@BindView
(
R
.
id
.
nav_view
)
NavigationView
navigationView
;
private
float
toolbarElevation
;
...
...
@@ -54,7 +55,7 @@ public class MainActivity extends BaseActivity
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
ViewBinder
.
bind
(
this
);
new
MainActivity_ViewBinding
(
this
);
setSupportActionBar
(
toolbar
);
...
...
app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java
View file @
a4f0fbf8
...
...
@@ -27,17 +27,18 @@ import java.io.IOException;
import
java.io.OutputStream
;
import
androidx.annotation.Nullable
;
import
butterknife.BindView
;
public
class
SuRequestActivity
extends
BaseActivity
{
LinearLayout
suPopup
;
Spinner
timeout
;
ImageView
appIcon
;
TextView
appNameView
;
TextView
packageNameView
;
Button
grant_btn
;
Button
deny_btn
;
ImageView
fingerprintImg
;
TextView
warning
;
@BindView
(
R
.
id
.
su_popup
)
LinearLayout
suPopup
;
@BindView
(
R
.
id
.
timeout
)
Spinner
timeout
;
@BindView
(
R
.
id
.
app_icon
)
ImageView
appIcon
;
@BindView
(
R
.
id
.
app_name
)
TextView
appNameView
;
@BindView
(
R
.
id
.
package_name
)
TextView
packageNameView
;
@BindView
(
R
.
id
.
grant_btn
)
Button
grant_btn
;
@BindView
(
R
.
id
.
deny_btn
)
Button
deny_btn
;
@BindView
(
R
.
id
.
fingerprint
)
ImageView
fingerprintImg
;
@BindView
(
R
.
id
.
warning
)
TextView
warning
;
private
SuConnector
connector
;
private
Policy
policy
;
...
...
@@ -157,7 +158,7 @@ public class SuRequestActivity extends BaseActivity {
}
setContentView
(
R
.
layout
.
activity_request
);
ViewBinder
.
bind
(
this
);
new
SuRequestActivity_ViewBinding
(
this
);
appIcon
.
setImageDrawable
(
policy
.
info
.
loadIcon
(
pm
));
appNameView
.
setText
(
policy
.
appName
);
...
...
app/src/full/java/com/topjohnwu/magisk/ViewBinder.java
deleted
100644 → 0
View file @
190cdadd
This diff is collapsed.
Click to expand it.
app/src/full/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java
View file @
a4f0fbf8
...
...
@@ -17,7 +17,6 @@ import android.widget.TextView;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.utils.LocaleManager
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.superuser.Shell
;
...
...
@@ -29,6 +28,7 @@ import java.util.List;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
ApplicationAdapter
extends
RecyclerView
.
Adapter
<
ApplicationAdapter
.
ViewHolder
>
{
...
...
@@ -122,20 +122,20 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
AsyncTask
.
THREAD_POOL_EXECUTOR
.
execute
(
this
::
loadApps
);
}
public
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
ImageView
appIcon
;
public
TextView
appName
;
public
TextView
appPackage
;
public
CheckBox
checkBox
;
@BindView
(
R
.
id
.
app_icon
)
ImageView
appIcon
;
@BindView
(
R
.
id
.
app_name
)
TextView
appName
;
@BindView
(
R
.
id
.
package_name
)
TextView
appPackage
;
@BindView
(
R
.
id
.
checkbox
)
CheckBox
checkBox
;
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
ApplicationAdapter$ViewHolder_ViewBinding
(
this
,
itemView
);
}
}
private
class
ApplicationFilter
extends
Filter
{
class
ApplicationFilter
extends
Filter
{
private
boolean
lowercaseContains
(
String
s
,
CharSequence
filter
)
{
return
!
TextUtils
.
isEmpty
(
s
)
&&
s
.
toLowerCase
().
contains
(
filter
);
...
...
app/src/full/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java
View file @
a4f0fbf8
...
...
@@ -11,14 +11,15 @@ import android.widget.TextView;
import
com.google.android.material.snackbar.Snackbar
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.components.SnackbarMaker
;
import
com.topjohnwu.magisk.container.Module
;
import
com.topjohnwu.superuser.Shell
;
import
java.util.List
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
ModulesAdapter
extends
RecyclerView
.
Adapter
<
ModulesAdapter
.
ViewHolder
>
{
...
...
@@ -28,6 +29,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
mList
=
list
;
}
@NonNull
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_module
,
parent
,
false
);
...
...
@@ -101,19 +103,19 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
return
mList
.
size
();
}
public
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
title
;
public
TextView
versionName
;
public
TextView
description
;
public
TextView
notice
;
public
CheckBox
checkBox
;
public
TextView
author
;
public
ImageView
delete
;
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
@BindView
(
R
.
id
.
notice
)
TextView
notice
;
@BindView
(
R
.
id
.
checkbox
)
CheckBox
checkBox
;
@BindView
(
R
.
id
.
author
)
TextView
author
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
ModulesAdapter$ViewHolder_ViewBinding
(
this
,
itemView
);
if
(!
Shell
.
rootAccess
())
{
checkBox
.
setEnabled
(
false
);
...
...
app/src/full/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
View file @
a4f0fbf8
...
...
@@ -12,7 +12,6 @@ import android.widget.TextView;
import
com.google.android.material.snackbar.Snackbar
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.components.CustomAlertDialog
;
import
com.topjohnwu.magisk.components.ExpandableView
;
import
com.topjohnwu.magisk.components.SnackbarMaker
;
...
...
@@ -24,7 +23,9 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Set
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
PolicyAdapter
extends
RecyclerView
.
Adapter
<
PolicyAdapter
.
ViewHolder
>
{
...
...
@@ -39,6 +40,7 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
this
.
pm
=
pm
;
}
@NonNull
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
v
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_policy
,
parent
,
false
);
...
...
@@ -138,24 +140,24 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
return
policyList
.
size
();
}
public
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
implements
ExpandableView
{
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
implements
ExpandableView
{
public
TextView
appName
;
public
TextView
packageName
;
public
ImageView
appIcon
;
public
Switch
masterSwitch
;
public
Switch
notificationSwitch
;
public
Switch
loggingSwitch
;
public
ViewGroup
expandLayout
;
@BindView
(
R
.
id
.
app_name
)
TextView
appName
;
@BindView
(
R
.
id
.
package_name
)
TextView
packageName
;
@BindView
(
R
.
id
.
app_icon
)
ImageView
appIcon
;
@BindView
(
R
.
id
.
master_switch
)
Switch
masterSwitch
;
@BindView
(
R
.
id
.
notification_switch
)
Switch
notificationSwitch
;
@BindView
(
R
.
id
.
logging_switch
)
Switch
loggingSwitch
;
@BindView
(
R
.
id
.
expand_layout
)
ViewGroup
expandLayout
;
public
ImageView
delete
;
public
ImageView
moreInfo
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
@BindView
(
R
.
id
.
more_info
)
ImageView
moreInfo
;
private
Container
container
=
new
Container
();
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
PolicyAdapter$ViewHolder_ViewBinding
(
this
,
itemView
);
container
.
expandLayout
=
expandLayout
;
setupExpandable
();
}
...
...
app/src/full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
View file @
a4f0fbf8
...
...
@@ -12,7 +12,6 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.asyncs.MarkDownWindow
;
import
com.topjohnwu.magisk.asyncs.ProcessRepoZip
;
import
com.topjohnwu.magisk.components.BaseActivity
;
...
...
@@ -26,6 +25,7 @@ import java.util.List;
import
java.util.Map
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
ReposAdapter
extends
SectionedAdapter
<
ReposAdapter
.
SectionHolder
,
ReposAdapter
.
RepoHolder
>
{
...
...
@@ -163,29 +163,29 @@ public class ReposAdapter extends SectionedAdapter<ReposAdapter.SectionHolder, R
notifyDataSetChanged
();
}
public
static
class
SectionHolder
extends
RecyclerView
.
ViewHolder
{
static
class
SectionHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
sectionText
;
@BindView
(
R
.
id
.
section_text
)
TextView
sectionText
;
SectionHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
ReposAdapter$SectionHolder_ViewBinding
(
this
,
itemView
);
}
}
public
static
class
RepoHolder
extends
RecyclerView
.
ViewHolder
{
static
class
RepoHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
title
;
public
TextView
versionName
;
public
TextView
description
;
public
TextView
author
;
public
LinearLayout
infoLayout
;
public
ImageView
downloadImage
;
public
TextView
updateTime
;
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
@BindView
(
R
.
id
.
author
)
TextView
author
;
@BindView
(
R
.
id
.
info_layout
)
LinearLayout
infoLayout
;
@BindView
(
R
.
id
.
download
)
ImageView
downloadImage
;
@BindView
(
R
.
id
.
update_time
)
TextView
updateTime
;
RepoHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
ReposAdapter$RepoHolder_ViewBinding
(
this
,
itemView
);
}
}
...
...
app/src/full/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java
View file @
a4f0fbf8
...
...
@@ -10,7 +10,6 @@ import android.widget.ImageView;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.components.ExpandableView
;
import
com.topjohnwu.magisk.container.SuLogEntry
;
import
com.topjohnwu.magisk.database.MagiskDatabaseHelper
;
...
...
@@ -21,6 +20,7 @@ import java.util.List;
import
java.util.Set
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
SuLogAdapter
extends
SectionedAdapter
<
SuLogAdapter
.
SectionHolder
,
SuLogAdapter
.
LogViewHolder
>
{
...
...
@@ -116,32 +116,32 @@ public class SuLogAdapter extends SectionedAdapter<SuLogAdapter.SectionHolder, S
notifyDataSetChanged
();
}
public
static
class
SectionHolder
extends
RecyclerView
.
ViewHolder
{
static
class
SectionHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
date
;
public
ImageView
arrow
;
@BindView
(
R
.
id
.
date
)
TextView
date
;
@BindView
(
R
.
id
.
arrow
)
ImageView
arrow
;
SectionHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
SuLogAdapter$SectionHolder_ViewBinding
(
this
,
itemView
);
}
}
public
static
class
LogViewHolder
extends
RecyclerView
.
ViewHolder
implements
ExpandableView
{
static
class
LogViewHolder
extends
RecyclerView
.
ViewHolder
implements
ExpandableView
{
public
TextView
appName
;
public
TextView
action
;
public
TextView
time
;
public
TextView
fromPid
;
public
TextView
toUid
;
public
TextView
command
;
public
ViewGroup
expandLayout
;
@BindView
(
R
.
id
.
app_name
)
TextView
appName
;
@BindView
(
R
.
id
.
action
)
TextView
action
;
@BindView
(
R
.
id
.
time
)
TextView
time
;
@BindView
(
R
.
id
.
fromPid
)
TextView
fromPid
;
@BindView
(
R
.
id
.
toUid
)
TextView
toUid
;
@BindView
(
R
.
id
.
command
)
TextView
command
;
@BindView
(
R
.
id
.
expand_layout
)
ViewGroup
expandLayout
;
private
Container
container
=
new
Container
();
LogViewHolder
(
View
itemView
)
{
super
(
itemView
);
ViewBinder
.
bind
(
this
,
itemView
);
new
SuLogAdapter$LogViewHolder_ViewBinding
(
this
,
itemView
);
container
.
expandLayout
=
expandLayout
;
setupExpandable
();
}
...
...
app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java
View file @
a4f0fbf8
...
...
@@ -27,17 +27,18 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
butterknife.BindView
;
/**
* @author dvdandroid
*/
public
class
AboutCardRow
extends
LinearLayout
{
public
TextView
mTitle
;
public
TextView
mSummary
;
public
ImageView
mIcon
;
public
View
mView
;
@BindView
(
android
.
R
.
id
.
title
)
TextView
mTitle
;
@BindView
(
android
.
R
.
id
.
summary
)
TextView
mSummary
;
@BindView
(
android
.
R
.
id
.
icon
)
ImageView
mIcon
;
@BindView
(
R
.
id
.
container
)
View
mView
;
public
AboutCardRow
(
Context
context
)
{
this
(
context
,
null
);
...
...
@@ -50,7 +51,7 @@ public class AboutCardRow extends LinearLayout {
public
AboutCardRow
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
info_item_row
,
this
);
ViewBinder
.
bind
(
this
,
this
);
new
AboutCardRow_ViewBinding
(
this
,
this
);
TypedArray
a
=
context
.
getTheme
().
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
AboutCardRow
,
0
,
0
);
String
title
;
...
...
app/src/full/java/com/topjohnwu/magisk/components/BaseFragment.java
View file @
a4f0fbf8
...
...
@@ -7,10 +7,12 @@ import com.topjohnwu.magisk.MagiskManager;
import
com.topjohnwu.magisk.utils.Topic
;
import
androidx.fragment.app.Fragment
;
import
butterknife.Unbinder
;
public
class
BaseFragment
extends
Fragment
implements
Topic
.
AutoSubscriber
{
public
MagiskManager
mm
;
protected
Unbinder
unbinder
=
null
;
public
BaseFragment
()
{
mm
=
Data
.
MM
();
...
...
@@ -28,6 +30,13 @@ public class BaseFragment extends Fragment implements Topic.AutoSubscriber {
super
.
onPause
();
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
if
(
unbinder
!=
null
)
unbinder
.
unbind
();
}
@Override
public
void
startActivityForResult
(
Intent
intent
,
int
requestCode
)
{
startActivityForResult
(
intent
,
requestCode
,
this
::
onActivityResult
);
...
...
app/src/full/java/com/topjohnwu/magisk/components/CustomAlertDialog.java
View file @
a4f0fbf8
...
...
@@ -9,13 +9,13 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.StringRes
;
import
androidx.annotation.StyleRes
;
import
androidx.appcompat.app.AlertDialog
;
import
butterknife.BindView
;
public
class
CustomAlertDialog
extends
AlertDialog
.
Builder
{
...
...
@@ -27,16 +27,16 @@ public class CustomAlertDialog extends AlertDialog.Builder {
private
ViewHolder
vh
;
public
class
ViewHolder
{
public
LinearLayout
dialogLayout
;
public
LinearLayout
buttons
;
@BindView
(
R
.
id
.
dialog_layout
)
public
LinearLayout
dialogLayout
;
@BindView
(
R
.
id
.
button_panel
)
public
LinearLayout
buttons
;
public
TextView
messageView
;
public
Button
negative
;
public
Button
positive
;
public
Button
neutral
;
@BindView
(
R
.
id
.
message
)
public
TextView
messageView
;
@BindView
(
R
.
id
.
negative
)
public
Button
negative
;
@BindView
(
R
.
id
.
positive
)
public
Button
positive
;
@BindView
(
R
.
id
.
neutral
)
public
Button
neutral
;
ViewHolder
(
View
v
)
{
ViewBinder
.
bind
(
this
,
v
);
new
CustomAlertDialog$ViewHolder_ViewBinding
(
this
,
v
);
messageView
.
setVisibility
(
View
.
GONE
);
negative
.
setVisibility
(
View
.
GONE
);
positive
.
setVisibility
(
View
.
GONE
);
...
...
app/src/full/java/com/topjohnwu/magisk/fragments/LogFragment.java
View file @
a4f0fbf8
...
...
@@ -11,23 +11,23 @@ import com.topjohnwu.magisk.Const;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MainActivity
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.adapters.TabFragmentAdapter
;
import
com.topjohnwu.magisk.components.BaseFragment
;
import
androidx.viewpager.widget.ViewPager
;
import
butterknife.BindView
;
public
class
LogFragment
extends
BaseFragment
{
public
ViewPager
viewPager
;
public
TabLayout
tab
;
@BindView
(
R
.
id
.
container
)
ViewPager
viewPager
;
@BindView
(
R
.
id
.
tab
)
TabLayout
tab
;
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_log
,
container
,
false
);
ViewBinder
.
bind
(
this
,
v
);
unbinder
=
new
LogFragment_ViewBinding
(
this
,
v
);
((
MainActivity
)
requireActivity
()).
toolbar
.
setElevation
(
0
);
...
...
@@ -44,10 +44,4 @@ public class LogFragment extends BaseFragment {
return
v
;
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
}
app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java
View file @
a4f0fbf8
...
...
@@ -20,7 +20,6 @@ import com.topjohnwu.magisk.Const;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MainActivity
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.asyncs.CheckSafetyNet
;
import
com.topjohnwu.magisk.asyncs.CheckUpdates
;
import
com.topjohnwu.magisk.components.BaseActivity
;
...
...
@@ -42,6 +41,9 @@ import androidx.annotation.Nullable;
import
androidx.annotation.StringRes
;
import
androidx.cardview.widget.CardView
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
butterknife.BindColor
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
public
class
MagiskFragment
extends
BaseFragment
implements
SwipeRefreshLayout
.
OnRefreshListener
,
ExpandableView
,
Topic
.
Subscriber
{
...
...
@@ -49,41 +51,42 @@ public class MagiskFragment extends BaseFragment
private
Container
expandableContainer
=
new
Container
();
private
static
boolean
shownDialog
=
false
;
public
SwipeRefreshLayout
mSwipeRefreshLayout
;
public
CardView
coreOnlyNotice
;
public
RelativeLayout
magiskUpdate
;
public
ImageView
magiskUpdateIcon
;
public
TextView
magiskUpdateText
;
public
ProgressBar
magiskUpdateProgress
;
public
ImageView
magiskStatusIcon
;
public
TextView
magiskVersionText
;
public
CardView
safetyNetCard
;
public
ImageView
safetyNetRefreshIcon
;
public
TextView
safetyNetStatusText
;
public
ProgressBar
safetyNetProgress
;
public
LinearLayout
expandLayout
;
public
ImageView
ctsStatusIcon
;
public
TextView
ctsStatusText
;
public
ImageView
basicStatusIcon
;
public
TextView
basicStatusText
;
public
CardView
installOptionCard
;
public
CheckBox
keepEncChkbox
;
public
CheckBox
keepVerityChkbox
;
public
CardView
installButton
;
public
TextView
installText
;
public
CardView
uninstallButton
;
public
int
colorBad
;
public
int
colorOK
;
public
int
colorWarn
;
public
int
colorNeutral
;
public
int
colorInfo
;
public
void
safetyNet
()
{
@BindView
(
R
.
id
.
swipeRefreshLayout
)
public
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
core_only_notice
)
CardView
coreOnlyNotice
;
@BindView
(
R
.
id
.
magisk_update
)
RelativeLayout
magiskUpdate
;
@BindView
(
R
.
id
.
magisk_update_icon
)
ImageView
magiskUpdateIcon
;
@BindView
(
R
.
id
.
magisk_update_status
)
TextView
magiskUpdateText
;
@BindView
(
R
.
id
.
magisk_update_progress
)
ProgressBar
magiskUpdateProgress
;
@BindView
(
R
.
id
.
magisk_status_icon
)
ImageView
magiskStatusIcon
;
@BindView
(
R
.
id
.
magisk_version
)
TextView
magiskVersionText
;
@BindView
(
R
.
id
.
safetyNet_card
)
CardView
safetyNetCard
;
@BindView
(
R
.
id
.
safetyNet_refresh
)
ImageView
safetyNetRefreshIcon
;
@BindView
(
R
.
id
.
safetyNet_status
)
TextView
safetyNetStatusText
;
@BindView
(
R
.
id
.
safetyNet_check_progress
)
ProgressBar
safetyNetProgress
;
@BindView
(
R
.
id
.
expand_layout
)
LinearLayout
expandLayout
;
@BindView
(
R
.
id
.
cts_status_icon
)
ImageView
ctsStatusIcon
;
@BindView
(
R
.
id
.
cts_status
)
TextView
ctsStatusText
;
@BindView
(
R
.
id
.
basic_status_icon
)
ImageView
basicStatusIcon
;
@BindView
(
R
.
id
.
basic_status
)
TextView
basicStatusText
;
@BindView
(
R
.
id
.
install_option_card
)
CardView
installOptionCard
;
@BindView
(
R
.
id
.
keep_force_enc
)
CheckBox
keepEncChkbox
;
@BindView
(
R
.
id
.
keep_verity
)
CheckBox
keepVerityChkbox
;
@BindView
(
R
.
id
.
install_button
)
CardView
installButton
;
@BindView
(
R
.
id
.
install_text
)
TextView
installText
;
@BindView
(
R
.
id
.
uninstall_button
)
CardView
uninstallButton
;
@BindColor
(
R
.
color
.
red500
)
int
colorBad
;
@BindColor
(
R
.
color
.
green500
)
int
colorOK
;
@BindColor
(
R
.
color
.
yellow500
)
int
colorWarn
;
@BindColor
(
R
.
color
.
green500
)
int
colorNeutral
;
@BindColor
(
R
.
color
.
blue500
)
int
colorInfo
;
@OnClick
(
R
.
id
.
safetyNet_title
)
void
safetyNet
()
{
Runnable
task
=
()
->
{
safetyNetProgress
.
setVisibility
(
View
.
VISIBLE
);
safetyNetRefreshIcon
.
setVisibility
(
View
.
GONE
);
...
...
@@ -106,7 +109,8 @@ public class MagiskFragment extends BaseFragment
}
public
void
install
()
{
@OnClick
(
R
.
id
.
install_button
)
void
install
()
{
shownDialog
=
true
;
// Show Manager update first
...
...
@@ -119,7 +123,8 @@ public class MagiskFragment extends BaseFragment
new
MagiskInstallDialog
((
BaseActivity
)
getActivity
()).
show
();
}
public
void
uninstall
()
{
@OnClick
(
R
.
id
.
uninstall_button
)
void
uninstall
()
{
new
UninstallDialog
(
requireActivity
()).
show
();
}
...
...
@@ -128,7 +133,7 @@ public class MagiskFragment extends BaseFragment
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_magisk
,
container
,
false
);
ViewBinder
.
bind
(
this
,
v
);
unbinder
=
new
MagiskFragment_ViewBinding
(
this
,
v
);
requireActivity
().
setTitle
(
R
.
string
.
magisk
);
expandableContainer
.
expandLayout
=
expandLayout
;
...
...
@@ -145,12 +150,6 @@ public class MagiskFragment extends BaseFragment
return
v
;
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
@Override
public
void
onRefresh
()
{
Data
.
loadMagiskInfo
();
...
...
app/src/full/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java
View file @
a4f0fbf8
...
...
@@ -9,7 +9,6 @@ import android.view.ViewGroup;
import
android.widget.SearchView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.adapters.ApplicationAdapter
;
import
com.topjohnwu.magisk.components.BaseFragment
;
import
com.topjohnwu.magisk.utils.Topic
;
...
...
@@ -18,11 +17,12 @@ import androidx.annotation.NonNull;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
butterknife.BindView
;
public
class
MagiskHideFragment
extends
BaseFragment
implements
Topic
.
Subscriber
{
public
SwipeRefreshLayout
mSwipeRefreshLayout
;
public
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
swipeRefreshLayout
)
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
SearchView
search
;
private
ApplicationAdapter
appAdapter
;
...
...
@@ -39,7 +39,7 @@ public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_magisk_hide
,
container
,
false
);
ViewBinder
.
bind
(
this
,
view
);
unbinder
=
new
MagiskHideFragment_ViewBinding
(
this
,
view
);
appAdapter
=
new
ApplicationAdapter
(
requireActivity
());
recyclerView
.
setAdapter
(
appAdapter
);
...
...
@@ -73,12 +73,6 @@ public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber
search
.
setOnQueryTextListener
(
searchListener
);
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
@Override
public
int
[]
getSubscribedTopics
()
{
return
new
int
[]
{
Topic
.
MAGISK_HIDE_DONE
};
...
...
app/src/full/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java
View file @
a4f0fbf8
...
...
@@ -17,7 +17,6 @@ import android.widget.TextView;
import
com.google.android.material.snackbar.Snackbar
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.components.BaseFragment
;
import
com.topjohnwu.magisk.components.SnackbarMaker
;
import
com.topjohnwu.magisk.utils.Download
;
...
...
@@ -29,19 +28,20 @@ import java.io.IOException;
import
java.util.Calendar
;
import
androidx.annotation.Nullable
;
import
butterknife.BindView
;
public
class
MagiskLogFragment
extends
BaseFragment
{
public
TextView
txtLog
;
public
ScrollView
svLog
;
public
HorizontalScrollView
hsvLog
;
public
ProgressBar
progressBar
;
@BindView
(
R
.
id
.
txtLog
)
TextView
txtLog
;
@BindView
(
R
.
id
.
svLog
)
ScrollView
svLog
;
@BindView
(
R
.
id
.
hsvLog
)
HorizontalScrollView
hsvLog
;
@BindView
(
R
.
id
.
progressBar
)
ProgressBar
progressBar
;
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_magisk_log
,
container
,
false
);
ViewBinder
.
bind
(
this
,
view
);
unbinder
=
new
MagiskLogFragment_ViewBinding
(
this
,
view
);
setHasOptionsMenu
(
true
);
txtLog
.
setTextIsSelectable
(
true
);
return
view
;
...
...
@@ -59,12 +59,6 @@ public class MagiskLogFragment extends BaseFragment {
readLogs
();
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
menu_log
,
menu
);
...
...
@@ -87,7 +81,7 @@ public class MagiskLogFragment extends BaseFragment {
}
}
p
ublic
void
readLogs
()
{
p
rivate
void
readLogs
()
{
Shell
.
su
(
"cat "
+
Const
.
MAGISK_LOG
+
" | tail -n 5000"
).
submit
(
result
->
{
progressBar
.
setVisibility
(
View
.
GONE
);
if
(
result
.
getOut
().
isEmpty
())
...
...
@@ -99,7 +93,7 @@ public class MagiskLogFragment extends BaseFragment {
});
}
p
ublic
void
saveLogs
()
{
p
rivate
void
saveLogs
()
{
Calendar
now
=
Calendar
.
getInstance
();
String
filename
=
Utils
.
fmt
(
"magisk_log_%04d%02d%02d_%02d%02d%02d.log"
,
now
.
get
(
Calendar
.
YEAR
),
now
.
get
(
Calendar
.
MONTH
)
+
1
,
...
...
@@ -117,7 +111,7 @@ public class MagiskLogFragment extends BaseFragment {
SnackbarMaker
.
make
(
txtLog
,
logFile
.
getPath
(),
Snackbar
.
LENGTH_SHORT
).
show
());
}
p
ublic
void
clearLogs
()
{
p
rivate
void
clearLogs
()
{
Shell
.
su
(
"echo -n > "
+
Const
.
MAGISK_LOG
).
submit
();
txtLog
.
setText
(
R
.
string
.
log_is_empty
);
SnackbarMaker
.
make
(
txtLog
,
R
.
string
.
logs_cleared
,
Snackbar
.
LENGTH_SHORT
).
show
();
...
...
app/src/full/java/com/topjohnwu/magisk/fragments/ModulesFragment.java
View file @
a4f0fbf8
...
...
@@ -16,7 +16,6 @@ import com.topjohnwu.magisk.Const;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.adapters.ModulesAdapter
;
import
com.topjohnwu.magisk.components.BaseFragment
;
import
com.topjohnwu.magisk.container.Module
;
...
...
@@ -32,14 +31,17 @@ import androidx.annotation.NonNull;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
public
class
ModulesFragment
extends
BaseFragment
implements
Topic
.
Subscriber
{
public
SwipeRefreshLayout
mSwipeRefreshLayout
;
public
RecyclerView
recyclerView
;
public
TextView
emptyRv
;
@BindView
(
R
.
id
.
swipeRefreshLayout
)
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyRv
;
public
void
selectFile
()
{
@OnClick
(
R
.
id
.
fab
)
void
selectFile
()
{
runWithPermission
(
new
String
[]
{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
()
->
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_GET_CONTENT
);
intent
.
setType
(
"application/zip"
);
...
...
@@ -53,7 +55,7 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_modules
,
container
,
false
);
ViewBinder
.
bind
(
this
,
view
);
unbinder
=
new
ModulesFragment_ViewBinding
(
this
,
view
);
setHasOptionsMenu
(
true
);
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
...
...
@@ -98,12 +100,6 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
}
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
menu_reboot
,
menu
);
...
...
app/src/full/java/com/topjohnwu/magisk/fragments/ReposFragment.java
View file @
a4f0fbf8
...
...
@@ -14,7 +14,6 @@ import android.widget.TextView;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.adapters.ReposAdapter
;
import
com.topjohnwu.magisk.asyncs.UpdateRepos
;
import
com.topjohnwu.magisk.components.BaseFragment
;
...
...
@@ -27,12 +26,13 @@ import androidx.annotation.NonNull;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
butterknife.BindView
;
public
class
ReposFragment
extends
BaseFragment
implements
Topic
.
Subscriber
{
public
RecyclerView
recyclerView
;
public
TextView
emptyRv
;
public
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyRv
;
@BindView
(
R
.
id
.
swipeRefreshLayout
)
SwipeRefreshLayout
mSwipeRefreshLayout
;
private
ReposAdapter
adapter
;
...
...
@@ -46,7 +46,7 @@ public class ReposFragment extends BaseFragment implements Topic.Subscriber {
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_repos
,
container
,
false
);
ViewBinder
.
bind
(
this
,
view
);
unbinder
=
new
ReposFragment_ViewBinding
(
this
,
view
);
mSwipeRefreshLayout
.
setRefreshing
(
true
);
recyclerView
.
setVisibility
(
View
.
GONE
);
...
...
@@ -120,6 +120,5 @@ public class ReposFragment extends BaseFragment implements Topic.Subscriber {
public
void
onDestroyView
()
{
super
.
onDestroyView
();
mm
.
repoDB
.
unregisterAdapter
();
ViewBinder
.
unbind
(
this
);
}
}
app/src/full/java/com/topjohnwu/magisk/fragments/SuLogFragment.java
View file @
a4f0fbf8
...
...
@@ -10,17 +10,17 @@ import android.view.ViewGroup;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.adapters.SuLogAdapter
;
import
com.topjohnwu.magisk.components.BaseFragment
;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
SuLogFragment
extends
BaseFragment
{
public
TextView
emptyRv
;
public
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyRv
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
private
SuLogAdapter
adapter
;
...
...
@@ -41,7 +41,7 @@ public class SuLogFragment extends BaseFragment {
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_su_log
,
container
,
false
);
ViewBinder
.
bind
(
this
,
v
);
unbinder
=
new
SuLogFragment_ViewBinding
(
this
,
v
);
adapter
=
new
SuLogAdapter
(
mm
.
mDB
);
recyclerView
.
setAdapter
(
adapter
);
...
...
@@ -76,10 +76,4 @@ public class SuLogFragment extends BaseFragment {
return
true
;
}
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
}
app/src/full/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java
View file @
a4f0fbf8
...
...
@@ -8,7 +8,6 @@ import android.view.ViewGroup;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.adapters.PolicyAdapter
;
import
com.topjohnwu.magisk.components.BaseFragment
;
import
com.topjohnwu.magisk.container.Policy
;
...
...
@@ -17,11 +16,12 @@ import java.util.List;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
public
class
SuperuserFragment
extends
BaseFragment
{
public
RecyclerView
recyclerView
;
public
TextView
emptyRv
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyRv
;
private
PackageManager
pm
;
...
...
@@ -29,7 +29,7 @@ public class SuperuserFragment extends BaseFragment {
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_superuser
,
container
,
false
);
ViewBinder
.
bind
(
this
,
view
);
unbinder
=
new
SuperuserFragment_ViewBinding
(
this
,
view
);
pm
=
getActivity
().
getPackageManager
();
return
view
;
...
...
@@ -47,12 +47,6 @@ public class SuperuserFragment extends BaseFragment {
displayPolicyList
();
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
ViewBinder
.
unbind
(
this
);
}
private
void
displayPolicyList
()
{
List
<
Policy
>
policyList
=
mm
.
mDB
.
getPolicyList
(
pm
);
...
...
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