-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
141 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
vangogh-sample/src/main/java/com/example/vangogh/samples/SingleAnimation.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
vangogh-sample/src/main/java/com/example/vangogh/samples/SingleAnimationActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.vangogh.samples; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
|
||
import com.example.vangogh.R; | ||
|
||
public abstract class SingleAnimationActivity extends AppCompatActivity { | ||
|
||
private FloatingActionButton fab; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_single_animation); | ||
fab = findViewById(R.id.fab); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
onFabClicked(fab); | ||
} | ||
}); | ||
} | ||
|
||
protected abstract void onFabClicked(FloatingActionButton fab); | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
vangogh-sample/src/main/java/com/example/vangogh/samples/SingleFadeAnimationActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.example.vangogh.samples; | ||
|
||
import android.support.design.widget.FloatingActionButton; | ||
import android.view.View; | ||
|
||
import io.reactivex.functions.Consumer; | ||
|
||
import static com.pspdfkit.labs.vangogh.api.FadeAnimations.fadeIn; | ||
import static com.pspdfkit.labs.vangogh.api.FadeAnimations.fadeOut; | ||
|
||
public class SingleFadeAnimationActivity extends SingleAnimationActivity { | ||
|
||
@Override | ||
protected void onFabClicked(final FloatingActionButton fab) { | ||
fadeOut(fab) | ||
.doOnAnimationStart(new Consumer<View>() { | ||
@Override | ||
public void accept(View view) throws Exception { | ||
fab.setEnabled(false); | ||
} | ||
}) | ||
.doOnAnimationEnd(new Consumer<View>() { | ||
@Override | ||
public void accept(View view) throws Exception { | ||
fab.setEnabled(true); | ||
} | ||
}) | ||
.andThen(fadeIn(fab)) | ||
.subscribe(); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
vangogh-sample/src/main/java/com/example/vangogh/samples/SingleRotateAnimationActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.vangogh.samples; | ||
|
||
import android.support.design.widget.FloatingActionButton; | ||
import android.view.View; | ||
|
||
import io.reactivex.functions.Consumer; | ||
|
||
import static com.pspdfkit.labs.vangogh.api.RotateAnimations.rotateBy; | ||
|
||
public class SingleRotateAnimationActivity extends SingleAnimationActivity { | ||
|
||
@Override | ||
protected void onFabClicked(final FloatingActionButton fab) { | ||
rotateBy(fab, 360) | ||
.doOnAnimationStart(new Consumer<View>() { | ||
@Override | ||
public void accept(View view) throws Exception { | ||
fab.setEnabled(false); | ||
} | ||
}) | ||
.doOnAnimationEnd(new Consumer<View>() { | ||
@Override | ||
public void accept(View view) throws Exception { | ||
fab.setEnabled(true); | ||
} | ||
}) | ||
.andThen(rotateBy(fab, -360)) | ||
.subscribe(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
vangogh-sample/src/main/res/drawable/ic_flash_on_white_24px.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M7,2v11h3v9l7,-12h-4l4,-8z" | ||
android:fillColor="#FFFFFF"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
vangogh-sample/src/main/res/layout/activity_single_animation.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="96dp" | ||
android:layout_height="96dp" | ||
android:layout_centerInParent="true" | ||
android:src="@drawable/ic_flash_on_white_24px" | ||
app:elevation="4dp"/> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_centerHorizontal="true" | ||
android:padding="12dp" | ||
android:text="Click on the button to start the animation."/> | ||
|
||
</RelativeLayout> |