mirror of https://github.com/kurisufriend/Clover
parent
a2561ff860
commit
f8213fef73
@ -0,0 +1,28 @@ |
|||||||
|
package org.floens.chan.controller; |
||||||
|
|
||||||
|
import android.animation.Animator; |
||||||
|
import android.animation.AnimatorListenerAdapter; |
||||||
|
import android.animation.AnimatorSet; |
||||||
|
import android.animation.ObjectAnimator; |
||||||
|
import android.view.View; |
||||||
|
import android.view.animation.DecelerateInterpolator; |
||||||
|
|
||||||
|
public class FadeInTransition extends ControllerTransition { |
||||||
|
@Override |
||||||
|
public void perform() { |
||||||
|
Animator toAlpha = ObjectAnimator.ofFloat(to.view, View.ALPHA, 0f, 1f); |
||||||
|
toAlpha.setDuration(200); |
||||||
|
toAlpha.setInterpolator(new DecelerateInterpolator(2f)); |
||||||
|
|
||||||
|
toAlpha.addListener(new AnimatorListenerAdapter() { |
||||||
|
@Override |
||||||
|
public void onAnimationEnd(Animator animation) { |
||||||
|
onCompleted(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
AnimatorSet set = new AnimatorSet(); |
||||||
|
set.playTogether(toAlpha); |
||||||
|
set.start(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package org.floens.chan.controller; |
||||||
|
|
||||||
|
import android.animation.Animator; |
||||||
|
import android.animation.AnimatorListenerAdapter; |
||||||
|
import android.animation.AnimatorSet; |
||||||
|
import android.animation.ObjectAnimator; |
||||||
|
import android.view.View; |
||||||
|
import android.view.animation.DecelerateInterpolator; |
||||||
|
|
||||||
|
public class FadeOutTransition extends ControllerTransition { |
||||||
|
@Override |
||||||
|
public void perform() { |
||||||
|
Animator toAlpha = ObjectAnimator.ofFloat(from.view, View.ALPHA, 1f, 0f); |
||||||
|
toAlpha.setDuration(200); |
||||||
|
toAlpha.setInterpolator(new DecelerateInterpolator(2f)); |
||||||
|
|
||||||
|
toAlpha.addListener(new AnimatorListenerAdapter() { |
||||||
|
@Override |
||||||
|
public void onAnimationEnd(Animator animation) { |
||||||
|
onCompleted(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
AnimatorSet set = new AnimatorSet(); |
||||||
|
set.playTogether(toAlpha); |
||||||
|
set.start(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package org.floens.chan.ui.controller; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.view.View; |
||||||
|
import android.widget.Button; |
||||||
|
|
||||||
|
import org.floens.chan.R; |
||||||
|
import org.floens.chan.controller.Controller; |
||||||
|
|
||||||
|
public class ImageViewController extends Controller implements View.OnClickListener { |
||||||
|
private Button button; |
||||||
|
|
||||||
|
public ImageViewController(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onCreate() { |
||||||
|
super.onCreate(); |
||||||
|
|
||||||
|
view = inflateRes(R.layout.controller_view_image); |
||||||
|
|
||||||
|
button = (Button) view.findViewById(R.id.button); |
||||||
|
button.setOnClickListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean onBack() { |
||||||
|
stopPresenting(); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onClick(View v) { |
||||||
|
if (v == button) { |
||||||
|
stopPresenting(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package org.floens.chan.ui.view; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.util.AttributeSet; |
||||||
|
import android.view.MotionEvent; |
||||||
|
import android.widget.FrameLayout; |
||||||
|
|
||||||
|
public class TouchBlockingFrameLayout extends FrameLayout { |
||||||
|
public TouchBlockingFrameLayout(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
public TouchBlockingFrameLayout(Context context, AttributeSet attrs) { |
||||||
|
super(context, attrs); |
||||||
|
} |
||||||
|
|
||||||
|
public TouchBlockingFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { |
||||||
|
super(context, attrs, defStyleAttr); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean onTouchEvent(MotionEvent event) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<org.floens.chan.ui.view.TouchBlockingFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:orientation="vertical" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:background="#ffffffff" |
||||||
|
android:padding="16dp"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="Hello, world!" |
||||||
|
android:textColor="#dd000000" |
||||||
|
android:textSize="20sp" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/button" |
||||||
|
android:text="Back" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
</org.floens.chan.ui.view.TouchBlockingFrameLayout> |
Loading…
Reference in new issue