-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from davideas/dev
v1.0.0
- Loading branch information
Showing
143 changed files
with
2,728 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
[![Download](https://api.bintray.com/packages/davideas/maven/flipview/images/download.svg) ](https://bintray.com/davideas/maven/flipview/_latestVersion) | ||
|
||
# Flip View | ||
|
||
###### Gmail like View & beyond - Master branch: v1 of 2015.11.01 | ||
|
||
#### Concept | ||
FlipView is a ViewGroup (FrameLayout) that is designed to display 2 views/layouts by flipping | ||
the front one in favor of the back one, and vice versa. Optionally more views can be | ||
displayed in series one after another since it extends `android.widget.ViewAnimator`. | ||
|
||
Usage is very simple. You just need to add this View to any layout (like you would do with | ||
any other View) and you customize the behaviours by assigning values to the optional | ||
properties in the layout or programmatically. | ||
|
||
Please, refer to those attributes documentation for more details. | ||
|
||
#### Main functionalities | ||
- Visible during design time ;-) | ||
- Custom In/Out animation. | ||
- Entry animation. | ||
- Custom layout, ImageView & TextView for front layout. | ||
- Custom layout, ImageView for rear layout. | ||
- Custom background Drawable & color. | ||
- Custom rear ImageView animation. | ||
- Properties customizable at design time and at run time. | ||
|
||
# Showcase | ||
![Showcase1](/showcase/showcase1.gif) ![Showcase2](/showcase/showcase2.gif) | ||
|
||
#Setup | ||
Import the library into your project using Gradle with JCenter | ||
``` | ||
dependencies { | ||
compile 'eu.davidea:flipview:1.0.0' | ||
} | ||
``` | ||
Using bintray.com | ||
``` | ||
repositories { | ||
maven { url "http://dl.bintray.com/davideas/maven" } | ||
} | ||
dependencies { | ||
compile 'eu.davidea:flipview:1.0.0@aar' | ||
} | ||
``` | ||
#### Pull requests / Issues / Improvement requests | ||
Feel free to contribute and ask! | ||
|
||
#Usage | ||
Supported attributes with default values: | ||
``` xml | ||
<eu.davidea.flipview.FlipView | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android usual attrs | ||
(see below).../> | ||
``` | ||
**ViewAnimator** | ||
- `android:inAnimation="@anim/grow_from_middle_x_axis"` - Identifier for the animation to use when a view is shown. | ||
- `android:outAnimation="@anim/shrink_to_middle_x_axis"` - Identifier for the animation to use when a view is hidden. | ||
- `android:animateFirstView="true"` - Defines whether to animate the current View when the ViewAnimation is first displayed. | ||
|
||
**ViewFlipper** | ||
- `android:autoStart="false"` - When true, automatically start animating. | ||
- `android:flipInterval="3000"` - Time before next animation. | ||
|
||
**FlipView** | ||
- `android:clickable="false"` - (!!) Set this if you want view react to the taps and animate it. | ||
- `app:checked="false"` - Whether or not this component is flipped at startup | ||
- `app:animateDesignLayoutOnly="false"` - false, if main animation should be applied only to the child views from design layout; true, to use inner layout. | ||
- `app:animationDuration="100"` - Set the main animation duration. | ||
- `app:anticipateInAnimationTime="0"` - Anticipate the beginning of the InAnimation. | ||
- `app:enableInitialAnimation="false"` - Whether or not the initial animation should start at the beginning. | ||
- `app:initialLayoutAnimation="@anim/scale_up"` - Starting animation. | ||
- `app:initialLayoutAnimationDuration="250"` - Starting animation duration. | ||
- `app:animateRearImage="true"` - Use default rear image animation. | ||
- `app:frontLayout="@layout/flipview_front"` - Front view layout resource (for checked state -> false). | ||
- `app:frontBackground="<OvalShape Drawable generated programmatically>"` - Front drawable resource (for checked state -> false). | ||
- `app:frontBackgroundColor="<Color.GRAY set programmatically>"` - Front view color resource (for checked state -> false). | ||
- `app:frontImage="@null"` - Front image resource (for checked state -> false). | ||
- `app:frontImagePadding="0dp"` - Front image padding. | ||
- `app:rearLayout="<OvalShape Drawable generated programmatically>"` - Rear view layout resource (for checked state -> true). | ||
- `app:rearBackground="<Color.GRAY set programmatically>"` - Rear drawable resource (for checked state -> true). | ||
- `app:reartBackgroundColor="Color.GRAY set programmatically"` - Rear view color resource (for checked state -> true). | ||
- `app:rearImage="@drawable/ic_action_done"` - Rear accept image resource. | ||
- `app:rearImagePadding="0dp"` - Rear image padding. | ||
- `app:rearImageAnimation="@anim/scale_up"` - Rear image animation. | ||
- `app:rearImageAnimationDuration="150"` - Rear image animation duration. | ||
|
||
**Not changable values** (in ms) | ||
- `DEFAULT_INITIAL_DELAY = 500` - This gives time to the activity to load. | ||
- `SCALE_STEP_DELAY = 35` - This gives an acceptable nice loading effect. | ||
- `STOP_LAYOUT_ANIMATION_DELAY = 1500` - This gives the time to perform all entry animations but to stop further animations when screen is fully rendered. | ||
|
||
# Change Log | ||
###### v1.0.0 - 2015.11.01 (Initial release) | ||
- Initial LayoutAnimation & Initial LayoutAnimationDuration | ||
Reset & stop LayoutAnimationDelay | ||
- Custom In&Out Animation | ||
Rear ImageAnimation & Rear ImageAnimationDuration | ||
- MainAnimationDuration | ||
- Flip & flipSilently | ||
- Custom FrontLayout & several custom RearLayout | ||
- Create BitmapFrom, PictureDrawable & ImageBitmap | ||
- Custom FrontImage, custom FrontText &, custom RearImage | ||
- Custom Child BackgroundDrawable & color | ||
- Create inner OvalDrawable, ScaleAnimation | ||
- Some animation and Drawables already included into he project, so you can start to test it | ||
- OnFlippingListener, inner onClick | ||
- Example Activity | ||
|
||
###### Old releases | ||
See [releases](https://github.com/davideas/FlipView/releases) for old versions. | ||
|
||
# License | ||
|
||
Copyright 2015 Davide Steduto | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,54 @@ | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
version = libraryVersion | ||
|
||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'sources' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
artifacts { | ||
archives javadocJar | ||
archives sourcesJar | ||
} | ||
|
||
// Bintray | ||
Properties properties = new Properties() | ||
properties.load(project.rootProject.file('local.properties').newDataInputStream()) | ||
|
||
bintray { | ||
user = properties.getProperty("bintray.user") | ||
key = properties.getProperty("bintray.apikey") | ||
|
||
configurations = ['archives'] | ||
pkg { | ||
repo = bintrayRepo | ||
name = bintrayName | ||
desc = libraryDescription | ||
websiteUrl = siteUrl | ||
vcsUrl = gitUrl | ||
licenses = allLicenses | ||
labels = ['android', 'flipview', 'viewanimator', 'viewflipper', 'gmail'] | ||
publish = true | ||
publicDownloadNumbers = true | ||
version { | ||
name = libraryVersion | ||
desc = libraryDescription | ||
vcsTag = libraryVersion | ||
gpg { | ||
sign = true //Determines whether to GPG sign the files. The default is false | ||
passphrase = properties.getProperty("bintray.gpg.password") | ||
//Optional. The passphrase for GPG signing' | ||
} | ||
} | ||
} | ||
} |
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,67 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
ext { | ||
//Author | ||
developerId = 'davideas' | ||
developerName = 'Davide Steduto' | ||
developerEmail = '[email protected]' | ||
|
||
//Library | ||
libraryCode = 1 | ||
libraryVersion = '1.0.0' | ||
libraryDate = " of 2015.11.01" | ||
libraryDescription = 'Flipping image like Gmail & beyond' | ||
libraryName = 'FlipView' | ||
|
||
//Library Repository | ||
bintrayRepo = 'maven' | ||
bintrayName = 'flipview' | ||
publishedGroupId = 'eu.davidea' | ||
artifact = bintrayName | ||
siteUrl = 'https://github.com/davideas/FlipView' | ||
gitUrl = 'https://github.com/davideas/FlipView.git' | ||
|
||
//Support and Build tools version | ||
minSdk = 14 | ||
targetSdk = 23 | ||
buildTools = '23.0.1' | ||
supportLibrary = '23.1.0' | ||
|
||
//Support Libraries dependencies | ||
supportDependencies = [ | ||
design : "com.android.support:design:${supportLibrary}", | ||
recyclerview : "com.android.support:recyclerview-v7:${supportLibrary}", | ||
cardview : "com.android.support:cardview-v7:${supportLibrary}", | ||
appcompat : "com.android.support:appcompat-v7:${supportLibrary}", | ||
customtabs : "com.android.support:customtabs:${supportLibrary}", | ||
support : "com.android.support:support-v13:${supportLibrary}'", | ||
annotations : "com.android.support:support-annotations:${supportLibrary}" | ||
] | ||
|
||
licenseName = 'The Apache Software License, Version 2.0' | ||
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
allLicenses = ["Apache-2.0"] | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.3.0' | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' | ||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' | ||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
jcenter() | ||
maven { url "http://dl.bintray.com/davideas/maven" } | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
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 @@ | ||
/build |
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 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion targetSdk | ||
buildToolsVersion buildTools | ||
|
||
defaultConfig { | ||
applicationId "eu.davidea.examples.flipview" | ||
minSdkVersion minSdk | ||
targetSdkVersion targetSdk | ||
versionCode versionCode | ||
versionName libraryVersion + libraryDate | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
//See main build.gradle for values & versions | ||
//compile 'eu.davidea:flipview:1.0.0@aar' | ||
compile project (':flipview') | ||
compile (supportDependencies.appcompat) { | ||
transitive = true; | ||
} | ||
compile supportDependencies.recyclerview | ||
compile supportDependencies.design | ||
|
||
} |
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,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in C:\Pgm\android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
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"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="eu.davidea.examples.flipview" > | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme.NoActionBar" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions
66
flipview-app/src/main/java/eu/davidea/examples/flipview/FlipViewAdapter.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,66 @@ | ||
package eu.davidea.examples.flipview; | ||
|
||
import android.support.v7.widget.RecyclerView; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import eu.davidea.flipview.FlipView; | ||
|
||
public class FlipViewAdapter extends RecyclerView.Adapter<FlipViewAdapter.FlipViewHolder> { | ||
|
||
private static final String TAG = FlipViewAdapter.class.getSimpleName(); | ||
private List<String> mItems = new ArrayList<>(); | ||
|
||
public FlipViewAdapter(int item_count) { | ||
for (int i = 1; i <= item_count; i++) { | ||
mItems.add(String.valueOf(i)); | ||
} | ||
} | ||
|
||
public String getItem(int position) { | ||
return mItems.get(position); | ||
} | ||
|
||
@Override | ||
public FlipViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
View view = LayoutInflater.from(parent.getContext()) | ||
.inflate(R.layout.recycler_view_item, parent, false); | ||
Log.d(TAG, "onCreateViewHolder"); | ||
return new FlipViewHolder(view); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return mItems.size(); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(FlipViewHolder holder, int position) { | ||
Log.d(TAG, "Binding position "+position); | ||
holder.mFlipView.setFrontText(getItem(position)); | ||
} | ||
|
||
/** | ||
* Provide a reference to the views for each data item. | ||
* Complex data items may need more than one view per item, and | ||
* you provide access to all the views for a data item in a view holder. | ||
*/ | ||
static final class FlipViewHolder extends RecyclerView.ViewHolder { | ||
|
||
FlipView mFlipView; | ||
|
||
public FlipViewHolder(View view) { | ||
super(view); | ||
this.mFlipView = (FlipView) view.findViewById(R.id.flip_view); | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
} |
Oops, something went wrong.