(animator);
15 | }
16 |
17 | @Override
18 | public boolean isNativeAnimator() {
19 | return false;
20 | }
21 |
22 | @Override
23 | public Object get() {
24 | return mSupportFramework.get();
25 | }
26 |
27 | @Override
28 | public void start() {
29 | Animator a = mSupportFramework.get();
30 | if(a != null) {
31 | a.start();
32 | }
33 | }
34 |
35 | @Override
36 | public void setDuration(int duration) {
37 | Animator a = mSupportFramework.get();
38 | if(a != null) {
39 | a.setDuration(duration);
40 | }
41 | }
42 |
43 | @Override
44 | public void setInterpolator(Interpolator value) {
45 | Animator a = mSupportFramework.get();
46 | if(a != null) {
47 | a.setInterpolator(value);
48 | }
49 | }
50 |
51 | @Override
52 | public void addListener(final AnimatorListener listener) {
53 | Animator a = mSupportFramework.get();
54 | if(a == null) {
55 | return;
56 | }
57 |
58 | if(listener == null){
59 | a.addListener(null);
60 | return;
61 | }
62 |
63 | a.addListener(new Animator.AnimatorListener() {
64 | @Override
65 | public void onAnimationStart(Animator animation) {
66 | listener.onAnimationStart();
67 | }
68 |
69 | @Override
70 | public void onAnimationEnd(Animator animation) {
71 | listener.onAnimationEnd();
72 | }
73 |
74 | @Override
75 | public void onAnimationCancel(Animator animation) {
76 | listener.onAnimationCancel();
77 | }
78 |
79 | @Override
80 | public void onAnimationRepeat(Animator animation) {
81 | listener.onAnimationRepeat();
82 | }
83 | });
84 | }
85 |
86 | @Override
87 | public boolean isRunning() {
88 | Animator a = mSupportFramework.get();
89 | return a != null && a.isRunning();
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/java/io/codetail/animation/ViewAnimationUtils.java:
--------------------------------------------------------------------------------
1 | package io.codetail.animation;
2 |
3 | import android.annotation.TargetApi;
4 | import android.graphics.Rect;
5 | import android.os.Build;
6 | import android.view.View;
7 | import android.view.animation.AccelerateDecelerateInterpolator;
8 |
9 | import com.nineoldandroids.animation.Animator;
10 | import com.nineoldandroids.animation.ObjectAnimator;
11 | import com.nineoldandroids.view.ViewHelper;
12 | import com.nineoldandroids.view.ViewPropertyAnimator;
13 |
14 | import static android.os.Build.VERSION.SDK_INT;
15 | import static android.os.Build.VERSION_CODES.LOLLIPOP;
16 |
17 | public class ViewAnimationUtils {
18 |
19 | private final static boolean LOLLIPOP_PLUS = SDK_INT >= LOLLIPOP;
20 |
21 | public static final int SCALE_UP_DURATION = 500;
22 |
23 | /**
24 | * Returns an Animator which can animate a clipping circle.
25 | *
26 | * Any shadow cast by the View will respect the circular clip from this animator.
27 | *
28 | * Only a single non-rectangular clip can be applied on a View at any time.
29 | * Views clipped by a circular reveal animation take priority over
30 | * {@link android.view.View#setClipToOutline(boolean) View Outline clipping}.
31 | *
32 | * Note that the animation returned here is a one-shot animation. It cannot
33 | * be re-used, and once started it cannot be paused or resumed.
34 | *
35 | * @param view The View will be clipped to the animating circle.
36 | * @param centerX The x coordinate of the center of the animating circle.
37 | * @param centerY The y coordinate of the center of the animating circle.
38 | * @param startRadius The starting radius of the animating circle.
39 | * @param endRadius The ending radius of the animating circle.
40 | */
41 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
42 | public static SupportAnimator createCircularReveal(View view,
43 | int centerX, int centerY,
44 | float startRadius, float endRadius) {
45 |
46 | if(LOLLIPOP_PLUS){
47 | return new SupportAnimatorLollipop(android.view.ViewAnimationUtils
48 | .createCircularReveal(view, centerX, centerY, startRadius, endRadius));
49 | }
50 |
51 | if(!(view.getParent() instanceof RevealAnimator)){
52 | throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout.");
53 | }
54 |
55 | RevealAnimator revealLayout = (RevealAnimator) view.getParent();
56 | revealLayout.setTarget(view);
57 | revealLayout.setCenter(centerX, centerY);
58 |
59 | Rect bounds = new Rect();
60 | view.getHitRect(bounds);
61 |
62 | ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, "revealRadius", startRadius, endRadius);
63 | reveal.addListener(getRevealFinishListener(revealLayout, bounds));
64 |
65 | return new SupportAnimatorPreL(reveal);
66 | }
67 |
68 |
69 | static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target, Rect bounds){
70 | if(SDK_INT >= 17){
71 | return new RevealAnimator.RevealFinishedJellyBeanMr1(target, bounds);
72 | }else if(SDK_INT >= 14){
73 | return new RevealAnimator.RevealFinishedIceCreamSandwich(target, bounds);
74 | }else {
75 | return new RevealAnimator.RevealFinishedGingerbread(target, bounds);
76 | }
77 | }
78 |
79 |
80 | /**
81 | * Lifting view
82 | *
83 | * @param view The animation target
84 | * @param baseRotation initial Rotation X in 3D space
85 | * @param fromY initial Y position of view
86 | * @param duration aniamtion duration
87 | * @param startDelay start delay before animation begin
88 | */
89 | public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){
90 | ViewHelper.setRotationX(view, baseRotation);
91 | ViewHelper.setTranslationY(view, fromY);
92 |
93 | ViewPropertyAnimator
94 | .animate(view)
95 | .setInterpolator(new AccelerateDecelerateInterpolator())
96 | .setDuration(duration)
97 | .setStartDelay(startDelay)
98 | .rotationX(0)
99 | .translationY(0)
100 | .start();
101 |
102 | }
103 |
104 | /**
105 | * Lifting view
106 | *
107 | * @param view The animation target
108 | * @param baseRotation initial Rotation X in 3D space
109 | * @param duration aniamtion duration
110 | * @param startDelay start delay before animation begin
111 | */
112 | public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){
113 | ViewHelper.setRotationX(view, baseRotation);
114 | ViewHelper.setTranslationY(view, view.getHeight() / 3);
115 |
116 | ViewPropertyAnimator
117 | .animate(view)
118 | .setInterpolator(new AccelerateDecelerateInterpolator())
119 | .setDuration(duration)
120 | .setStartDelay(startDelay)
121 | .rotationX(0)
122 | .translationY(0)
123 | .start();
124 |
125 | }
126 |
127 | /**
128 | * Lifting view
129 | *
130 | * @param view The animation target
131 | * @param baseRotation initial Rotation X in 3D space
132 | * @param duration aniamtion duration
133 | */
134 | public static void liftingFromBottom(View view, float baseRotation, int duration){
135 | ViewHelper.setRotationX(view, baseRotation);
136 | ViewHelper.setTranslationY(view, view.getHeight() / 3);
137 |
138 | ViewPropertyAnimator
139 | .animate(view)
140 | .setInterpolator(new AccelerateDecelerateInterpolator())
141 | .setDuration(duration)
142 | .rotationX(0)
143 | .translationY(0)
144 | .start();
145 |
146 | }
147 |
148 | public static class SimpleAnimationListener implements Animator.AnimatorListener{
149 |
150 | @Override
151 | public void onAnimationStart(Animator animation) {
152 |
153 | }
154 |
155 | @Override
156 | public void onAnimationEnd(Animator animation) {
157 |
158 | }
159 |
160 | @Override
161 | public void onAnimationCancel(Animator animation) {
162 |
163 | }
164 |
165 | @Override
166 | public void onAnimationRepeat(Animator animation) {
167 |
168 | }
169 | }
170 |
171 | }
172 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/java/io/codetail/widget/RevealFrameLayout.java:
--------------------------------------------------------------------------------
1 | package io.codetail.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Path;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.FrameLayout;
9 |
10 | import io.codetail.animation.RevealAnimator;
11 |
12 | public class RevealFrameLayout extends FrameLayout implements RevealAnimator{
13 |
14 | Path mRevealPath;
15 |
16 | boolean mClipOutlines;
17 |
18 | float mCenterX;
19 | float mCenterY;
20 | float mRadius;
21 |
22 | View mTarget;
23 |
24 | public RevealFrameLayout(Context context) {
25 | this(context, null);
26 | }
27 |
28 | public RevealFrameLayout(Context context, AttributeSet attrs) {
29 | this(context, attrs, 0);
30 | }
31 |
32 | public RevealFrameLayout(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs, defStyle);
34 | mRevealPath = new Path();
35 | }
36 |
37 | /**
38 | * Animation target
39 | *
40 | * @hide
41 | */
42 | @Override
43 | public void setTarget(View view){
44 | mTarget = view;
45 | }
46 |
47 | /**
48 | * Epicenter of animation circle reveal
49 | *
50 | * @hide
51 | */
52 | @Override
53 | public void setCenter(float centerX, float centerY){
54 | mCenterX = centerX;
55 | mCenterY = centerY;
56 | }
57 |
58 | /**
59 | * Flag that animation is enabled
60 | *
61 | * @hide
62 | */
63 | @Override
64 | public void setClipOutlines(boolean clip){
65 | mClipOutlines = clip;
66 | }
67 |
68 | /**
69 | * Circle radius size
70 | *
71 | * @hide
72 | */
73 | @Override
74 | public void setRevealRadius(float radius){
75 | mRadius = radius;
76 | invalidate();
77 | }
78 |
79 | /**
80 | * Circle radius size
81 | *
82 | * @hide
83 | */
84 | @Override
85 | public float getRevealRadius(){
86 | return mRadius;
87 | }
88 |
89 |
90 | @Override
91 | protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
92 | if(!mClipOutlines && child != mTarget)
93 | return super.drawChild(canvas, child, drawingTime);
94 |
95 | final int state = canvas.save();
96 |
97 | mRevealPath.reset();
98 | mRevealPath.addCircle(mCenterX, mCenterY, mRadius, Path.Direction.CW);
99 |
100 | canvas.clipPath(mRevealPath);
101 |
102 | boolean isInvalided = super.drawChild(canvas, child, drawingTime);
103 |
104 | canvas.restoreToCount(state);
105 |
106 | return isInvalided;
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/java/io/codetail/widget/RevealLinearLayout.java:
--------------------------------------------------------------------------------
1 | package io.codetail.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Path;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.LinearLayout;
9 |
10 | import io.codetail.animation.RevealAnimator;
11 |
12 | public class RevealLinearLayout extends LinearLayout implements RevealAnimator{
13 |
14 | Path mRevealPath;
15 |
16 | boolean mClipOutlines;
17 |
18 | float mCenterX;
19 | float mCenterY;
20 | float mRadius;
21 |
22 | View mTarget;
23 |
24 | public RevealLinearLayout(Context context) {
25 | this(context, null);
26 | }
27 |
28 | public RevealLinearLayout(Context context, AttributeSet attrs) {
29 | this(context, attrs, 0);
30 | }
31 |
32 | public RevealLinearLayout(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs);
34 | mRevealPath = new Path();
35 | }
36 |
37 | /**
38 | * @hide
39 | */
40 | @Override
41 | public void setTarget(View view){
42 | mTarget = view;
43 | }
44 |
45 | /**
46 | * @hide
47 | */
48 | @Override
49 | public void setCenter(float centerX, float centerY){
50 | mCenterX = centerX;
51 | mCenterY = centerY;
52 | }
53 |
54 | /**
55 | * @hide
56 | */
57 | @Override
58 | public void setClipOutlines(boolean clip){
59 | mClipOutlines = clip;
60 | }
61 |
62 | /**
63 | * @hide
64 | */
65 | @Override
66 | public void setRevealRadius(float radius){
67 | mRadius = radius;
68 | invalidate();
69 | }
70 |
71 | /**
72 | * @hide
73 | */
74 | @Override
75 | public float getRevealRadius(){
76 | return mRadius;
77 | }
78 |
79 |
80 | @Override
81 | protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
82 | if (!mClipOutlines && child != mTarget)
83 | return super.drawChild(canvas, child, drawingTime);
84 |
85 | final int state = canvas.save();
86 |
87 | mRevealPath.reset();
88 | mRevealPath.addCircle(mCenterX, mCenterY, mRadius, Path.Direction.CW);
89 |
90 | canvas.clipPath(mRevealPath);
91 |
92 | boolean isInvalided = super.drawChild(canvas, child, drawingTime);
93 |
94 | canvas.restoreToCount(state);
95 |
96 | return isInvalided;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/anim/anim_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-hdpi/ic_action_mic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-hdpi/ic_action_mic.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-hdpi/ic_clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-hdpi/ic_clear.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-hdpi/ic_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-hdpi/ic_up.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-hdpi/search_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-hdpi/search_bg.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-mdpi/ic_action_mic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-mdpi/ic_action_mic.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-mdpi/ic_clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-mdpi/ic_clear.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-mdpi/ic_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-mdpi/ic_up.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-mdpi/search_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-mdpi/search_bg.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xhdpi/ic_action_mic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xhdpi/ic_action_mic.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xhdpi/ic_clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xhdpi/ic_clear.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xhdpi/ic_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xhdpi/ic_up.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xhdpi/search_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xhdpi/search_bg.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/ic_action_mic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/ic_action_mic.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/ic_clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/ic_clear.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/ic_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/ic_up.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_bg.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_bg_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_bg_shadow.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_bg_transparent.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_bg_transparent.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_frame.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoireFHC/NHentai-android/140f9ae647994423f3df6447f7f45fa05c5e1ef9/libraries/PersistentSearch/src/main/res/drawable-xxhdpi/search_frame.9.png
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/layout/search_option.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
24 |
25 |
36 |
37 |
46 |
47 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/layout/searchbox.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
17 |
18 |
24 |
25 |
26 |
32 |
33 |
47 |
48 |
62 |
63 |
64 |
65 |
66 |
77 |
78 |
86 |
87 |
97 |
98 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Speak now
4 |
5 |
6 |
--------------------------------------------------------------------------------
/libraries/PersistentSearch/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':libraries:PersistentSearch'
2 |
--------------------------------------------------------------------------------