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
15ddd0e2
Commit
15ddd0e2
authored
Mar 13, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More MagiskHide list UI improvements
parent
18ac6b27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
22 deletions
+60
-22
ApplicationAdapter.java
...ava/com/topjohnwu/magisk/adapters/ApplicationAdapter.java
+35
-17
list_item_hide_app.xml
app/src/main/res/layout/list_item_hide_app.xml
+25
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java
View file @
15ddd0e2
...
@@ -23,6 +23,8 @@ import com.buildware.widget.indeterm.IndeterminateCheckBox;
...
@@ -23,6 +23,8 @@ import com.buildware.widget.indeterm.IndeterminateCheckBox;
import
com.topjohnwu.magisk.App
;
import
com.topjohnwu.magisk.App
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.uicomponents.ArrowExpandable
;
import
com.topjohnwu.magisk.uicomponents.Expandable
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.Shell
;
...
@@ -110,30 +112,30 @@ public class ApplicationAdapter extends SectionedAdapter
...
@@ -110,30 +112,30 @@ public class ApplicationAdapter extends SectionedAdapter
holder
.
app_icon
.
setImageDrawable
(
app
.
info
.
loadIcon
(
pm
));
holder
.
app_icon
.
setImageDrawable
(
app
.
info
.
loadIcon
(
pm
));
holder
.
package_name
.
setText
(
app
.
info
.
packageName
);
holder
.
package_name
.
setText
(
app
.
info
.
packageName
);
holder
.
checkBox
.
setOnStateChangedListener
(
null
);
holder
.
checkBox
.
setOnStateChangedListener
(
null
);
holder
.
checkBox
.
setOnStateChangedListener
(
app
.
listener
);
holder
.
checkBox
.
setState
(
app
.
getState
());
holder
.
checkBox
.
setState
(
app
.
getState
());
if
(
app
.
expanded
)
{
holder
.
ex
.
setExpanded
(
app
.
expanded
);
holder
.
checkBox
.
setVisibility
(
View
.
GONE
);
getMargins
(
holder
).
bottomMargin
=
0
;
int
index
=
getItemPosition
(
section
,
0
);
}
else
{
holder
.
checkBox
.
setOnStateChangedListener
((
IndeterminateCheckBox
box
,
@Nullable
Boolean
status
)
->
{
holder
.
checkBox
.
setVisibility
(
View
.
VISIBLE
);
if
(
status
!=
null
)
{
getMargins
(
holder
).
bottomMargin
=
BOTTOM_MARGIN
;
for
(
HideProcessInfo
p
:
app
.
processList
)
{
}
String
cmd
=
Utils
.
fmt
(
"magiskhide --%s %s %s"
,
holder
.
itemView
.
setOnClickListener
((
v
)
->
{
status
?
"add"
:
"rm"
,
app
.
info
.
packageName
,
p
.
name
);
int
index
=
getItemPosition
(
section
,
0
);
Shell
.
su
(
cmd
).
submit
();
p
.
hidden
=
status
;
}
notifyItemRangeChanged
(
index
,
app
.
processList
.
size
());
}
});
holder
.
trigger
.
setOnClickListener
((
v
)
->
{
if
(
app
.
expanded
)
{
if
(
app
.
expanded
)
{
app
.
expanded
=
false
;
app
.
expanded
=
false
;
notifyItemRangeRemoved
(
index
,
app
.
processList
.
size
());
notifyItemRangeRemoved
(
index
,
app
.
processList
.
size
());
getMargins
(
holder
).
bottomMargin
=
BOTTOM_MARGIN
;
holder
.
ex
.
collapse
();
holder
.
checkBox
.
setOnStateChangedListener
(
null
);
holder
.
checkBox
.
setVisibility
(
View
.
VISIBLE
);
holder
.
checkBox
.
setState
(
app
.
getState
());
holder
.
checkBox
.
setOnStateChangedListener
(
app
.
listener
);
}
else
{
}
else
{
holder
.
checkBox
.
setVisibility
(
View
.
GONE
);
getMargins
(
holder
).
bottomMargin
=
0
;
app
.
expanded
=
true
;
app
.
expanded
=
true
;
notifyItemRangeInserted
(
index
,
app
.
processList
.
size
());
notifyItemRangeInserted
(
index
,
app
.
processList
.
size
());
holder
.
ex
.
expand
();
}
}
});
});
}
}
...
@@ -149,6 +151,7 @@ public class ApplicationAdapter extends SectionedAdapter
...
@@ -149,6 +151,7 @@ public class ApplicationAdapter extends SectionedAdapter
Shell
.
su
(
Utils
.
fmt
(
"magiskhide --%s %s %s"
,
checked
?
"add"
:
"rm"
,
Shell
.
su
(
Utils
.
fmt
(
"magiskhide --%s %s %s"
,
checked
?
"add"
:
"rm"
,
hideApp
.
info
.
packageName
,
target
.
name
)).
submit
();
hideApp
.
info
.
packageName
,
target
.
name
)).
submit
();
target
.
hidden
=
checked
;
target
.
hidden
=
checked
;
notifyItemChanged
(
getSectionPosition
(
section
));
});
});
getMargins
(
holder
).
bottomMargin
=
getMargins
(
holder
).
bottomMargin
=
position
==
hideApp
.
processList
.
size
()
-
1
?
BOTTOM_MARGIN
:
0
;
position
==
hideApp
.
processList
.
size
()
-
1
?
BOTTOM_MARGIN
:
0
;
...
@@ -350,10 +353,25 @@ public class ApplicationAdapter extends SectionedAdapter
...
@@ -350,10 +353,25 @@ public class ApplicationAdapter extends SectionedAdapter
@BindView
(
R
.
id
.
app_name
)
TextView
app_name
;
@BindView
(
R
.
id
.
app_name
)
TextView
app_name
;
@BindView
(
R
.
id
.
package_name
)
TextView
package_name
;
@BindView
(
R
.
id
.
package_name
)
TextView
package_name
;
@BindView
(
R
.
id
.
checkbox
)
IndeterminateCheckBox
checkBox
;
@BindView
(
R
.
id
.
checkbox
)
IndeterminateCheckBox
checkBox
;
@BindView
(
R
.
id
.
trigger
)
View
trigger
;
@BindView
(
R
.
id
.
arrow
)
ImageView
arrow
;
Expandable
ex
;
AppViewHolder
(
@NonNull
View
itemView
)
{
AppViewHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
new
ApplicationAdapter$AppViewHolder_ViewBinding
(
this
,
itemView
);
new
ApplicationAdapter$AppViewHolder_ViewBinding
(
this
,
itemView
);
ex
=
new
ArrowExpandable
(
new
Expandable
()
{
@Override
protected
void
onExpand
()
{
getMargins
(
AppViewHolder
.
this
).
bottomMargin
=
0
;
}
@Override
protected
void
onCollapse
()
{
getMargins
(
AppViewHolder
.
this
).
bottomMargin
=
BOTTOM_MARGIN
;
}
},
arrow
);
}
}
}
}
...
...
app/src/main/res/layout/list_item_hide_app.xml
View file @
15ddd0e2
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
style=
"?attr/cardStyle"
style=
"?attr/cardStyle"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
...
@@ -57,10 +56,32 @@
...
@@ -57,10 +56,32 @@
android:textColor=
"@android:color/tertiary_text_dark"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_to
EndOf=
"@+id/app_name
"
app:layout_constraintEnd_to
StartOf=
"@id/arrow
"
app:layout_constraintStart_toStartOf=
"@+id/app_name"
app:layout_constraintStart_toStartOf=
"@+id/app_name"
app:layout_constraintTop_toBottomOf=
"@+id/app_name"
/>
app:layout_constraintTop_toBottomOf=
"@+id/app_name"
/>
<ImageView
android:id=
"@+id/arrow"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_marginStart=
"5dp"
android:layout_marginEnd=
"5dp"
android:tint=
"?attr/imageColorTint"
app:layout_constraintBottom_toBottomOf=
"@+id/package_name"
app:layout_constraintEnd_toEndOf=
"@+id/app_name"
app:layout_constraintStart_toEndOf=
"@+id/package_name"
app:layout_constraintTop_toTopOf=
"@+id/package_name"
app:srcCompat=
"@drawable/ic_arrow"
/>
<View
android:id=
"@+id/trigger"
android:layout_width=
"35dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"@+id/arrow"
app:layout_constraintStart_toStartOf=
"@+id/arrow"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.buildware.widget.indeterm.IndeterminateCheckBox
<com.buildware.widget.indeterm.IndeterminateCheckBox
android:id=
"@+id/checkbox"
android:id=
"@+id/checkbox"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -70,8 +91,7 @@
...
@@ -70,8 +91,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/app_name"
app:layout_constraintStart_toEndOf=
"@+id/app_name"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
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