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
841dee94
Commit
841dee94
authored
Jan 26, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Animate arrows
parent
71638191
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
10 deletions
+46
-10
PolicyAdapter.java
...ull/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
+36
-9
list_item_policy.xml
app/src/full/res/layout/list_item_policy.xml
+10
-1
No files found.
app/src/full/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
View file @
841dee94
...
@@ -5,6 +5,8 @@ import android.content.pm.PackageManager;
...
@@ -5,6 +5,8 @@ import android.content.pm.PackageManager;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.animation.Animation
;
import
android.view.animation.RotateAnimation
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -17,9 +19,7 @@ import com.topjohnwu.magisk.components.ExpandableView;
...
@@ -17,9 +19,7 @@ import com.topjohnwu.magisk.components.ExpandableView;
import
com.topjohnwu.magisk.components.SnackbarMaker
;
import
com.topjohnwu.magisk.components.SnackbarMaker
;
import
com.topjohnwu.magisk.utils.FingerprintHelper
;
import
com.topjohnwu.magisk.utils.FingerprintHelper
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.widget.SwitchCompat
;
import
androidx.appcompat.widget.SwitchCompat
;
...
@@ -31,10 +31,11 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
...
@@ -31,10 +31,11 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
private
List
<
Policy
>
policyList
;
private
List
<
Policy
>
policyList
;
private
MagiskDB
dbHelper
;
private
MagiskDB
dbHelper
;
private
PackageManager
pm
;
private
PackageManager
pm
;
private
Set
<
Policy
>
expandList
=
new
HashSet
<>()
;
private
boolean
[]
expandList
;
public
PolicyAdapter
(
List
<
Policy
>
list
,
MagiskDB
db
,
PackageManager
pm
)
{
public
PolicyAdapter
(
List
<
Policy
>
list
,
MagiskDB
db
,
PackageManager
pm
)
{
policyList
=
list
;
policyList
=
list
;
expandList
=
new
boolean
[
policyList
.
size
()];
dbHelper
=
db
;
dbHelper
=
db
;
this
.
pm
=
pm
;
this
.
pm
=
pm
;
}
}
...
@@ -50,15 +51,14 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
...
@@ -50,15 +51,14 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
Policy
policy
=
policyList
.
get
(
position
);
Policy
policy
=
policyList
.
get
(
position
);
holder
.
setExpanded
(
expandList
.
contains
(
policy
));
holder
.
setExpanded
(
expandList
[
position
]);
holder
.
trigger
.
setOnClickListener
(
view
->
{
holder
.
itemView
.
setOnClickListener
(
view
->
{
if
(
holder
.
isExpanded
())
{
if
(
holder
.
isExpanded
())
{
holder
.
collapse
();
holder
.
collapse
();
expandList
.
remove
(
policy
)
;
expandList
[
position
]
=
false
;
}
else
{
}
else
{
holder
.
expand
();
holder
.
expand
();
expandList
.
add
(
policy
)
;
expandList
[
position
]
=
true
;
}
}
});
});
...
@@ -145,7 +145,8 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
...
@@ -145,7 +145,8 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
@BindView
(
R
.
id
.
notification_switch
)
SwitchCompat
notificationSwitch
;
@BindView
(
R
.
id
.
notification_switch
)
SwitchCompat
notificationSwitch
;
@BindView
(
R
.
id
.
logging_switch
)
SwitchCompat
loggingSwitch
;
@BindView
(
R
.
id
.
logging_switch
)
SwitchCompat
loggingSwitch
;
@BindView
(
R
.
id
.
expand_layout
)
ViewGroup
expandLayout
;
@BindView
(
R
.
id
.
expand_layout
)
ViewGroup
expandLayout
;
@BindView
(
R
.
id
.
arrow
)
ImageView
arrow
;
@BindView
(
R
.
id
.
trigger
)
View
trigger
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
@BindView
(
R
.
id
.
more_info
)
ImageView
moreInfo
;
@BindView
(
R
.
id
.
more_info
)
ImageView
moreInfo
;
...
@@ -162,5 +163,31 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
...
@@ -162,5 +163,31 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
public
Container
getContainer
()
{
public
Container
getContainer
()
{
return
container
;
return
container
;
}
}
@Override
public
void
setExpanded
(
boolean
expanded
)
{
ExpandableView
.
super
.
setExpanded
(
expanded
);
arrow
.
setRotation
(
expanded
?
180
:
0
);
}
private
void
setRotate
(
RotateAnimation
rotate
)
{
rotate
.
setDuration
(
300
);
rotate
.
setFillAfter
(
true
);
arrow
.
startAnimation
(
rotate
);
}
@Override
public
void
expand
()
{
ExpandableView
.
super
.
expand
();
setRotate
(
new
RotateAnimation
(
0
,
180
,
Animation
.
RELATIVE_TO_SELF
,
0.5f
,
Animation
.
RELATIVE_TO_SELF
,
0.5f
));
}
@Override
public
void
collapse
()
{
ExpandableView
.
super
.
collapse
();
setRotate
(
new
RotateAnimation
(
180
,
0
,
Animation
.
RELATIVE_TO_SELF
,
0.5f
,
Animation
.
RELATIVE_TO_SELF
,
0.5f
));
}
}
}
}
}
app/src/full/res/layout/list_item_policy.xml
View file @
841dee94
...
@@ -72,13 +72,22 @@
...
@@ -72,13 +72,22 @@
android:layout_width=
"20dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:layout_marginStart=
"5dp"
android:layout_marginStart=
"5dp"
android:tint=
"@color/icon_grey"
app:layout_constraintBottom_toBottomOf=
"@+id/package_name"
app:layout_constraintBottom_toBottomOf=
"@+id/package_name"
app:layout_constraintEnd_toEndOf=
"@+id/app_name"
app:layout_constraintEnd_toEndOf=
"@+id/app_name"
app:layout_constraintStart_toEndOf=
"@+id/package_name"
app:layout_constraintStart_toEndOf=
"@+id/package_name"
app:layout_constraintTop_toTopOf=
"@+id/package_name"
app:layout_constraintTop_toTopOf=
"@+id/package_name"
android:tint=
"@color/icon_grey"
app:srcCompat=
"@drawable/ic_arrow"
/>
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"
/>
<androidx.appcompat.widget.SwitchCompat
<androidx.appcompat.widget.SwitchCompat
android:id=
"@+id/master_switch"
android:id=
"@+id/master_switch"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
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