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
40e92721
Commit
40e92721
authored
Sep 12, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up graphics and animations
parent
204e940d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
59 deletions
+83
-59
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+28
-20
list_item_repo.xml
app/src/main/res/layout/list_item_repo.xml
+55
-39
No files found.
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
View file @
40e92721
...
...
@@ -117,6 +117,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
View
.
OnClickListener
oCl
=
view
->
{
Log
.
d
(
"Magisk"
,
"Onlick captured, view is "
+
view
.
getId
());
if
(
view
.
getId
()
==
mHolder
.
updateImage
.
getId
())
{
if
(!
mIsInstalled
|
mCanUpdate
)
{
...
...
@@ -132,12 +133,18 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
}
else
{
Toast
.
makeText
(
context
,
repo
.
getId
()
+
" is already installed."
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
else
if
(
view
.
getId
()
==
mHolder
.
changeLog
.
getId
())
{
}
if
(
view
.
getId
()
==
mHolder
.
changeLog
.
getId
())
{
new
WebWindow
(
"Changelog"
,
repo
.
getmLogUrl
(),
this
.
context
);
}
if
(
view
.
getId
()
==
mHolder
.
authorLink
.
getId
())
{
new
WebWindow
(
"Donate"
,
repo
.
getmDonateUrl
(),
this
.
context
);
}
if
(
view
.
getId
()
==
mHolder
.
supportLink
.
getId
())
{
new
WebWindow
(
"Support"
,
repo
.
getmSupportUrl
(),
this
.
context
);
}
};
mHolder
.
changeLog
.
setOnClickListener
(
oCl
);
mHolder
.
updateImage
.
setOnClickListener
(
oCl
);
mHolder
.
authorLink
.
setOnClickListener
(
oCl
);
mHolder
.
supportLink
.
setOnClickListener
(
oCl
);
if
(
prefs
.
contains
(
"repo-isInstalled_"
+
repo
.
getId
()))
{
mIsInstalled
=
prefs
.
getBoolean
(
"repo-isInstalled_"
+
repo
.
getId
(),
false
);
...
...
@@ -174,8 +181,13 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
ImageView
installedImage
;
@BindView
(
R
.
id
.
changeLog
)
ImageView
changeLog
;
@BindView
(
R
.
id
.
authorLink
)
ImageView
authorLink
;
@BindView
(
R
.
id
.
supportLink
)
ImageView
supportLink
;
private
ValueAnimator
mAnimator
;
private
AnimatorSet
animSetUpRight
,
animSetDownLeft
;
private
ObjectAnimator
animY2
;
private
ViewHolder
holder
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
...
...
@@ -183,26 +195,22 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
ButterKnife
.
bind
(
this
,
itemView
);
DisplayMetrics
dimension
=
new
DisplayMetrics
();
windowmanager
.
getDefaultDisplay
().
getMetrics
(
dimension
);
expandLayout
.
getViewTreeObserver
().
addOnPreDrawListener
(
holder
=
this
;
this
.
expandLayout
.
getViewTreeObserver
().
addOnPreDrawListener
(
new
ViewTreeObserver
.
OnPreDrawListener
()
{
@Override
public
boolean
onPreDraw
()
{
final
int
widthSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
0
,
View
.
MeasureSpec
.
UNSPECIFIED
);
final
int
heightSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
0
,
View
.
MeasureSpec
.
UNSPECIFIED
);
expandLayout
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
expandLayout
.
setVisibility
(
View
.
GONE
);
expandLayout
.
measure
(
widthSpec
,
heightSpec
);
mAnimator
=
slideAnimator
(
0
,
expandLayout
.
getMeasuredHeight
());
ObjectAnimator
animX2
=
ObjectAnimator
.
ofFloat
(
mHolder
.
updateImage
,
"x"
,
-
45
);
ObjectAnimator
animY2
=
ObjectAnimator
.
ofFloat
(
mHolder
.
updateImage
,
"y"
,
-
134
);
animSetDownLeft
=
new
AnimatorSet
();
animSetDownLeft
.
playTogether
(
animX2
,
animY2
);
ObjectAnimator
animX
=
ObjectAnimator
.
ofFloat
(
mHolder
.
updateImage
,
"x"
,
45
);
ObjectAnimator
animY
=
ObjectAnimator
.
ofFloat
(
mHolder
.
updateImage
,
"y"
,
134
);
animSetUpRight
=
new
AnimatorSet
();
animSetUpRight
.
playTogether
(
animX
,
animY
);
animSetUpRight
.
start
();
holder
.
expandLayout
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
holder
.
expandLayout
.
setVisibility
(
View
.
GONE
);
holder
.
expandLayout
.
measure
(
widthSpec
,
heightSpec
);
final
int
holderHeight
=
holder
.
expandLayout
.
getMeasuredHeight
();
mAnimator
=
slideAnimator
(
0
,
holderHeight
);
animY2
=
ObjectAnimator
.
ofFloat
(
holder
.
updateImage
,
"translationY"
,
holderHeight
/
2
);
return
true
;
}
...
...
@@ -211,9 +219,9 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
viewMain
.
setOnClickListener
(
view
->
{
int
position
=
getAdapterPosition
();
if
(
mExpandedList
.
get
(
position
))
{
collapse
(
expandLayout
);
collapse
(
holder
.
expandLayout
);
}
else
{
expand
(
expandLayout
);
expand
(
holder
.
expandLayout
);
}
mExpandedList
.
set
(
position
,
!
mExpandedList
.
get
(
position
));
...
...
@@ -224,7 +232,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
private
void
expand
(
View
view
)
{
view
.
setVisibility
(
View
.
VISIBLE
);
mAnimator
.
start
();
anim
SetDownLeft
.
start
();
anim
Y2
.
start
();
}
...
...
@@ -251,7 +259,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
}
});
mAnimator
.
start
();
anim
SetUpRight
.
start
();
anim
Y2
.
reverse
();
}
...
...
app/src/main/res/layout/list_item_repo.xml
View file @
40e92721
...
...
@@ -19,29 +19,28 @@
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<
Linear
Layout
<
Relative
Layout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:orientation=
"horizontal"
android:padding=
"8dp"
>
<
Linear
Layout
android:layout_width=
"
0dip
"
<
Relative
Layout
android:layout_width=
"
match_parent
"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"4dip"
android:layout_marginRight=
"4dip"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
>
<TextView
android:id=
"@+id/title"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
300dip
"
android:layout_height=
"wrap_content"
android:singleLine=
"false"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textIsSelectable=
"false"
/>
android:textIsSelectable=
"false"
android:layout_alignParentStart=
"true"
android:layout_alignParentTop=
"true"
android:layout_marginTop=
"0dp"
/>
<TextView
android:id=
"@+id/version_name"
...
...
@@ -50,7 +49,23 @@
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
android:textStyle=
"bold|italic"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/title"
/>
<ImageView
android:id=
"@+id/update"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:focusable=
"false"
android:gravity=
"right"
android:background=
"@drawable/ic_file_download_black"
android:layout_marginEnd=
"10dp"
android:layout_gravity=
"right"
android:layout_alignBaseline=
"@id/title"
android:layout_alignParentEnd=
"true"
/>
<TextView
android:id=
"@+id/description"
...
...
@@ -58,7 +73,10 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
android:textIsSelectable=
"false"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/update"
/>
<LinearLayout
...
...
@@ -66,7 +84,11 @@
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"100dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
android:layout_below=
"@id/description"
android:layout_alignParentStart=
"true"
>
<TextView
android:id=
"@+id/author"
...
...
@@ -90,13 +112,15 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
android:textIsSelectable=
"false"
android:layout_marginBottom=
"20dip"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
50dip
"
android:layout_gravity=
"center"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
android:layout_marginBottom=
"0dip"
>
<ImageView
android:id=
"@+id/changeLog"
android:layout_width=
"wrap_content"
...
...
@@ -105,12 +129,14 @@
android:layout_marginEnd=
"10dp"
android:background=
"@drawable/ic_changelog"
/>
<ImageView
android:id=
"@+id/authorLink"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"10dp"
android:background=
"@drawable/ic_author"
/>
<ImageView
android:id=
"@+id/supportLink"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
...
...
@@ -118,36 +144,26 @@
android:background=
"@drawable/ic_support"
/>
<ImageView
android:id=
"@+id/update"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:focusable=
"false"
android:gravity=
"center"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"10dp"
/>
<ImageView
android:id=
"@+id/installed"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:focusable=
"false"
android:visibility=
"gone"
android:gravity=
"center_vertical"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"10dp"
/>
</LinearLayout>
</LinearLayout>
</
Linear
Layout>
</
Relative
Layout>
</LinearLayout>
<ImageView
android:id=
"@+id/installed"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:focusable=
"false"
android:visibility=
"gone"
android:gravity=
"right"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"10dp"
/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
...
...
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