Skip to content

Commit

Permalink
Merge branch 'release/v0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Jan 24, 2016
2 parents 38dd2e1 + 154b33b commit 619464b
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 68 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ These `Animators` correctly work with all view states and `RecyclerView` states
#Include in your project
##Using Maven
```javascript
compile('com.mikepenz:itemanimators:0.2.0-SNAPSHOT@aar') {
compile('com.mikepenz:itemanimators:0.2.1@aar') {
transitive = true
}

//only on the SNAPSHOT repo right now:
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
```

##How to use
Expand All @@ -37,6 +32,7 @@ mRecyclerView.setItemAnimator(new ScaleUpAnimator());

* **Simple**
* `AlphaInAnimator`
* `AlphaCrossFadeAnimator`

* **Resize**
* `ScaleUpAnimator`
Expand Down
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
versionCode 20
versionName '0.2.0-SNAPSHOT'
versionCode 21
versionName '0.2.1'

applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand Down Expand Up @@ -52,7 +52,7 @@ dependencies {

//used to generate the drawer on the left
//https://github.com/mikepenz/MaterialDrawer
compile('com.mikepenz:materialdrawer:5.0.0.fastAdapter.b7-SNAPSHOT@aar') {
compile('com.mikepenz:materialdrawer:5.0.0.fastAdapter.b14-SNAPSHOT@aar') {
transitive = true
exclude module: "itemanimators"
exclude module: "fastadapter"
Expand All @@ -61,11 +61,11 @@ dependencies {
// used to fill the RecyclerView with the DrawerItems
// and provides single and multi selection, collapsable items
// https://github.com/mikepenz/FastAdapter
compile 'com.mikepenz:fastadapter:0.7.1@aar'
compile 'com.mikepenz:fastadapter:0.9.3@aar'

//used to generate the Open Source section
//https://github.com/mikepenz/AboutLibraries
compile('com.mikepenz:aboutlibraries:5.3.4@aar') {
compile('com.mikepenz:aboutlibraries:5.3.6@aar') {
transitive = true
}
//used to display the icons in the drawer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.mikepenz.fastadapter.IItem;
import com.mikepenz.fastadapter.adapters.ItemAdapter;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.itemanimators.AlphaCrossFadeAnimator;
import com.mikepenz.itemanimators.AlphaInAnimator;
import com.mikepenz.itemanimators.BaseItemAnimator;
import com.mikepenz.itemanimators.ScaleUpAnimator;
Expand All @@ -45,6 +46,7 @@

public class SampleActivity extends AppCompatActivity {
enum Type {
CrossFade(new AlphaCrossFadeAnimator()),
FadeIn(new AlphaInAnimator()),
ScaleUp(new ScaleUpAnimator()),
ScaleX(new ScaleXAnimator()),
Expand Down Expand Up @@ -122,16 +124,17 @@ public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
//create our FastAdapter which will manage everything
mFastAdapter = new FastAdapter();
mFastAdapter.withMultiSelect(true);
mFastAdapter.withMultiSelectOnLongClick(false);
mFastAdapter.withSelectOnLongClick(false);
//create our ItemAdapter which will host our items
mItemAdapter = new ItemAdapter();

//configure our fastAdapter
//get our recyclerView and do basic setup
mRecyclerView = (RecyclerView) findViewById(R.id.rv);
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 3));
//mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(mItemAdapter.wrap(mFastAdapter));
mRecyclerView.setItemAnimator(new AlphaInAnimator());
mRecyclerView.setItemAnimator(new AlphaCrossFadeAnimator());
mRecyclerView.getItemAnimator().setAddDuration(500);
mRecyclerView.getItemAnimator().setRemoveDuration(500);

Expand Down Expand Up @@ -160,6 +163,7 @@ public void onNothingSelected(AdapterView<?> parent) {
}
});

//if we do this. the first added items will be animated :D
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public static List<ImageItem> getImages() {
new ImageItem().withName("Texas United States").withDescription("#100084").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/texas-united_states-84.jpg"),
new ImageItem().withName("Tabuaeran Kiribati").withDescription("#100050").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/tabuaeran-kiribati-50.jpg"),
new ImageItem().withName("Stanislaus River United States").withDescription("#100061").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/stanislaus_river-united_states-61.jpg"),
new ImageItem().withName("S?ehitkamil Turkey").withDescription("#100072").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/s?ehitkamil-turkey-72.jpg"),
new ImageItem().withName("Salinas Grandes Argentina").withDescription("#100025").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/salinas_grandes-argentina-25.jpg"),
new ImageItem().withName("Shadegan Refuge Iran").withDescription("#100012").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/shadegan_refuge-iran-12.jpg"),
new ImageItem().withName("San Pedro De Atacama Chile").withDescription("#100043").withImage("https://raw.githubusercontent.com/mikepenz/earthview-wallpapers/develop/thumb/san_pedro_de_atacama-chile-43.jpg"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.mikepenz.itemanimators.app.items;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.FrameLayout;
Expand Down Expand Up @@ -52,16 +53,13 @@ public int getLayoutRes() {
return R.layout.image_item;
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void bindView(RecyclerView.ViewHolder holder) {
Context ctx = holder.itemView.getContext();
//get our viewHolder
final ViewHolder viewHolder = (ViewHolder) holder;
public void bindView(ViewHolder viewHolder) {
super.bindView(viewHolder);

//set the item selected if it is
viewHolder.itemView.setSelected(isSelected());
//set itself as tag. (not required)
viewHolder.itemView.setTag(this);
//get context
Context ctx = viewHolder.itemView.getContext();

//define our data for the view
viewHolder.imageName.setText(mName);
Expand All @@ -70,7 +68,7 @@ public void bindView(RecyclerView.ViewHolder holder) {

//set the background for the item
int color = UIUtils.getThemeColor(ctx, R.attr.colorPrimary);
viewHolder.imageContent.setForeground(FastAdapterUIUtils.getSelectableBackground(ctx, Color.argb(100, Color.red(color), Color.green(color), Color.blue(color))));
viewHolder.view.setForeground(FastAdapterUIUtils.getSelectablePressedBackground(ctx, FastAdapterUIUtils.adjustAlpha(color, 100), 50, true));

//load glide
Glide.clear(viewHolder.imageView);
Expand Down Expand Up @@ -102,20 +100,18 @@ public ViewHolderFactory getFactory() {
* our ViewHolder
*/
protected static class ViewHolder extends RecyclerView.ViewHolder {
protected View view;
protected FrameLayout view;
@Bind(R.id.item_image_img)
protected ImageView imageView;
@Bind(R.id.item_image_name)
protected TextView imageName;
@Bind(R.id.item_image_description)
protected TextView imageDescription;
@Bind(R.id.item_image_content)
protected FrameLayout imageContent;

public ViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
this.view = view;
this.view = (FrameLayout) view;

//optimization to preset the correct height for our device
int screenWidth = view.getContext().getResources().getDisplayMetrics().widthPixels;
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/activity_sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="8dp" />
</FrameLayout>
</RelativeLayout>
5 changes: 3 additions & 2 deletions app/src/main/res/layout/image_item.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical"
tools:ignore="MissingPrefix">

Expand Down Expand Up @@ -62,4 +63,4 @@

</LinearLayout>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.CardView>
18 changes: 7 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
classpath 'com.novoda:bintray-release:0.3.4'
}
}

// To avoid manually setting the same values in all Android modules, set the value on the root
// project and then reference this from the modules
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
supportLibVersion = "23.1.1"
}

allprojects {
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}

ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
supportLibVersion = "23.1.1"
}

task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}
24 changes: 2 additions & 22 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.daemon=true
org.gradle.parallel=true

# Maven stuff
VERSION_NAME=0.2.0-SNAPSHOT
VERSION_CODE=20
VERSION_NAME=0.2.1
VERSION_CODE=21
GROUP=com.mikepenz

POM_DESCRIPTION=ItemAnimators Library
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 20
versionName '0.2.0-SNAPSHOT'
versionCode 21
versionName '0.2.1'
}
buildTypes {
release {
Expand Down
2 changes: 1 addition & 1 deletion library/gradle-jcenter-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ publish {
bintrayKey = project.hasProperty('bintray.apikey') ? project.property('bintray.apikey') : System.getenv('BINTRAY_API_KEY')
userOrg = project.property("POM_DEVELOPER_ID")
groupId = project.property("GROUP")
artifactId = project.property("GROUP") + ":" + project.property("POM_ARTIFACT_ID")
artifactId = project.property("POM_ARTIFACT_ID")
publishVersion = project.property("VERSION_NAME")
desc = project.property("POM_DESCRIPTION")
website = project.property("POM_URL")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.mikepenz.itemanimators;

/**
* Created by mikepenz on 08.01.16.
*/
public class AlphaCrossFadeAnimator extends DefaultAnimator<AlphaCrossFadeAnimator> {

@Override
public long getAddDelay(long remove, long move, long change) {
return 0;
}

@Override
public long getRemoveDelay(long remove, long move, long change) {
return remove / 2;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
The <b>ItemAnimators</b> library comes with a huge collections of pre-created Animators for your RecyclerView.
]]>
</string>
<string name="library_itemanimators_libraryVersion">0.2.0-SNAPSHOT</string>
<string name="library_itemanimators_libraryVersion">0.2.1</string>
<string name="library_itemanimators_libraryWebsite">https://github.com/mikepenz/itemanimators</string>
<string name="library_itemanimators_licenseId">apache_2_0</string>
<string name="library_itemanimators_isOpenSource">true</string>
Expand Down

0 comments on commit 619464b

Please sign in to comment.