Skip to content

Commit

Permalink
Merge branch 'release/0.10.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
h6ah4i committed Jan 21, 2017
2 parents 5b31d41 + 67251ca commit 9dbe2fd
Show file tree
Hide file tree
Showing 20 changed files with 212 additions and 51 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This RecyclerView extension library provides Google's Inbox app like swiping, Pl

[ ![Download](https://api.bintray.com/packages/h6ah4i/maven/android-advancedrecyclerview/images/download.svg) ](https://bintray.com/h6ah4i/maven/android-advancedrecyclerview/_latestVersion)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Advanced%20RecyclerView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1432)
[![Method Count](https://img.shields.io/badge/Methods and size-core: 1684 | deps: 19003 | 230 KB-e91e63.svg) ](http://www.methodscount.com/?lib=com.h6ah4i.android.widget.advrecyclerview%3Aadvrecyclerview%3A0.10.2)
[![Method Count](https://img.shields.io/badge/Methods and size-core: 1684 | deps: 21547 | 230 KB-e91e63.svg) ](http://www.methodscount.com/?lib=com.h6ah4i.android.widget.advrecyclerview%3Aadvrecyclerview%3A0.10.3)
---

### Download the example app
Expand All @@ -32,7 +32,7 @@ Target platforms
Latest version
---

- Version 0.10.2 (November 27, 2016) ([RELEASE NOTES](./RELEASE-NOTES.md))
- Version 0.10.3 (January 21, 2017) ([RELEASE NOTES](./RELEASE-NOTES.md))


Getting started
Expand All @@ -42,7 +42,7 @@ This library is published on jCenter. Just add these lines to `build.gradle`.

```gradle
dependencies {
compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.10.2@aar'){
compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.10.3@aar'){
transitive=true
}
}
Expand Down
13 changes: 12 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
## 0.10.2
[Bug fixes]
- Fix createDraggingItemImage() method regression (issue #325)
- Fixed IllegalStateException on touching a group item while RecyclerView is calculating layout (issue #339)
- Fixed onBindGroupViewHolder()/onBindChildViewHolder() method with palyloads parameter not used bug

[Improvements]
- Reduce overdraws of "Button under swipeable item" (PR #331, thx. @AnirudhaAgashe)
- Updated support library to v25.1.0


## 0.10.2
[Bug fixes]
- Fixed createDraggingItemImage() method regression (issue #325)


## 0.10.1
[Improvements]
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 3 additions & 3 deletions common/android-set-common-properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

android {
compileSdkVersion 23
compileSdkVersion 25

if (System.getenv("JITPACK") == "true") {
buildToolsVersion '23.0.2'
buildToolsVersion '25.0.2'
} else {
buildToolsVersion '23.0.3'
buildToolsVersion '25.0.2'
}

compileOptions {
Expand Down
10 changes: 6 additions & 4 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId "com.h6ah4i.android.example.advrecyclerview"
minSdkVersion 9
targetSdkVersion 25
versionCode 24
versionName "0.10.2"
versionCode 25
versionName "0.10.3"
vectorDrawables.useSupportLibrary = true
}

Expand Down Expand Up @@ -60,6 +60,8 @@ if (loadSigningConfigFromPropertiesFile(
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
compile 'com.android.support:design:25.0.1'
compile 'com.h6ah4i.android.tablayouthelper:tablayouthelper:0.7.0'
compile 'com.android.support:design:25.1.0'
compile ('com.h6ah4i.android.tablayouthelper:tablayouthelper:0.7.0') {
exclude group: 'com.android.support'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.h6ah4i.android.example.advrecyclerview.R;
Expand Down Expand Up @@ -60,12 +61,14 @@ public interface EventListener {

public static class MyViewHolder extends AbstractSwipeableItemViewHolder {
public FrameLayout mContainer;
public RelativeLayout mBehindViews;
public TextView mTextView;
public Button mButton;

public MyViewHolder(View v) {
super(v);
mContainer = (FrameLayout) v.findViewById(R.id.container);
mBehindViews = (RelativeLayout) v.findViewById(R.id.behind_views);
mTextView = (TextView) v.findViewById(android.R.id.text1);
mButton = (Button) v.findViewById(android.R.id.button1);
}
Expand Down Expand Up @@ -188,20 +191,11 @@ public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int

@Override
public void onSetSwipeBackground(MyViewHolder holder, int position, int type) {
int bgRes = 0;
switch (type) {
case Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_neutral;
break;
case Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_left;
break;
case Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_right;
break;
if (type == Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND) {
holder.mBehindViews.setVisibility(View.GONE);
} else {
holder.mBehindViews.setVisibility(View.VISIBLE);
}

holder.itemView.setBackgroundResource(bgRes);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.h6ah4i.android.example.advrecyclerview.demo_s_viewpager;

import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
Expand Down Expand Up @@ -130,6 +132,11 @@ public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int

@Override
public void onSetSwipeBackground(MyViewHolder holder, int position, int type) {
if (type == Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND) {
holder.itemView.setBackgroundColor(Color.TRANSPARENT);
} else {
holder.itemView.setBackgroundColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.bg_swipe_item_gray));
}
}

@Override
Expand Down
5 changes: 2 additions & 3 deletions example/src/main/res/layout/list_item_view_pager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:background="@color/bg_swipe_item_gray">
android:layout_height="@dimen/list_item_height">

<com.h6ah4i.android.example.advrecyclerview.demo_s_viewpager.PagerSwipeItemFrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:background="@color/bg_item_normal_state"
android:clickable="true"
android:foreground="?attr/selectableItemBackground">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@drawable/bg_swipe_item_neutral">
android:layout_height="64dp">

<RelativeLayout
android:id="@+id/behind_views"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#888888">
android:background="@color/bg_swipe_item_gray"
android:visibility="gone"
tools:visibility="visible">

<Button
android:id="@android:id/button1"
Expand All @@ -45,7 +47,7 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:background="@color/bg_item_normal_state"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
tools:visibility="invisible">
Expand Down
96 changes: 96 additions & 0 deletions gen_methodscount_badge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#! /usr/bin/env bash

# assemble fat-aar and copy dependencies
./gradlew :methodscount:copyDependencies > /dev/null

BUILD_TOOOLS_VERSION=$(ls $ANDROID_HOME/build-tools/ | sort -n -r | head -n 1)
BUILD_TOOOLS_DIR="$ANDROID_HOME/build-tools/$BUILD_TOOOLS_VERSION"
export BUILD_TOOOLS_DIR

function aar-method-counts() {
local aar_file=$1
local aar_basename=$(basename $aar_file '.aar')
local aar_unzip_dest="/tmp/aar-method-counts/$aar_basename"

rm -rf "$aar_unzip_dest"
mkdir -p "$aar_unzip_dest"

unzip "$aar_file" -d "$aar_unzip_dest" > /dev/null
"$BUILD_TOOOLS_DIR/dx"\
--dex --no-optimize \
--output="$aar_unzip_dest/classes.dex" \
"$aar_unzip_dest/classes.jar"

dex-method-counts "$aar_unzip_dest/classes.dex" | grep 'Overall method count:' | sed -E 's/Overall method count: ([0-9]+)/\1/g'
}

function jar-method-counts() {
local jar_file=$1
local jar_basename=$(basename $jar_file '.jar')
local jar_dir_dest="/tmp/jar-method-counts/$jar_basename"

mkdir -p "$jar_dir_dest"

"$BUILD_TOOOLS_DIR/dx"\
--dex --no-optimize \
--output="$jar_dir_dest/classes.dex" \
"$jar_file"

dex-method-counts "$jar_dir_dest/classes.dex" | grep 'Overall method count:' | sed -E 's/Overall method count: ([0-9]+)/\1/g'
}

function file_size() {
echo $(
${DU:-du} --apparent-size --block-size=1 "$1" 2>/dev/null ||
${GDU:-gdu} --apparent-size --block-size=1 "$1" 2>/dev/null ||
${FIND:-find} "$1" -printf "%s" 2>/dev/null ||
${GFIND:-gfind} "$1" -printf "%s" 2>/dev/null ||
${STAT:-stat} --printf="%s" "$1" 2>/dev/null ||
${STAT:-stat} -f%z "$1" 2>/dev/null ||
${WC:-wc} -c <"$1" 2>/dev/null
) | awk '{print $1}'
}

LIBRARY_AAR="./methodscount/build/dependencies/library-release.aar"
DEPENDENCIES_AARS=$(find ./methodscount/build/dependencies -type f -name '*.aar' | grep -v 'library-release.aar')
DEPENDENCIES_JARS=$(find ./methodscount/build/dependencies -type f -name '*.jar')

#
# count library's method counts
#
lib_method_counts=$(aar-method-counts "$LIBRARY_AAR")

#
# count dependencies' method counts
#
deps_method_counts=0
IFS=$'\n'
for dep_aar in $(echo "$DEPENDENCIES_AARS"); do
count=$(aar-method-counts "$dep_aar")
deps_method_counts=$(($deps_method_counts + $count))
# echo "$(basename $dep_aar) $deps_method_counts $count"
done

for dep_jar in $(echo "$DEPENDENCIES_JARS"); do
count=$(jar-method-counts "$dep_jar")
deps_method_counts=$(($deps_method_counts + $count))
# echo "$(basename $dep_jar) $deps_method_counts $count"
done
unset IFS

#
# library version
#
lib_version=$(cat library/library-data.properties | grep 'VERSION_NAME' | sed -E 's/VERSION_NAME=(.*)/\1/g')

#
# library (AAR) file size
#
lib_file_size=$(file_size "$LIBRARY_AAR")
lib_file_size_kb=$(( ($lib_file_size + 999) / 1000 ))

methodscount_site_url="http://www.methodscount.com/?lib=com.h6ah4i.android.widget.advrecyclerview%3Aadvrecyclerview%3A$lib_version"
methodscount_badge_url="https://img.shields.io/badge/Methods and size-core: $lib_method_counts | deps: $deps_method_counts | $lib_file_size_kb KB-e91e63.svg"

# echo "<a href=\"$methodscount_site_url\"><img src=\"$methodscount_badge_url\"/></a>"
echo "[![Method Count]($methodscount_badge_url) ]($methodscount_site_url)"
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'

testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3'
Expand Down
4 changes: 2 additions & 2 deletions library/library-data.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# suppress inspection "UnusedProperty" for whole file
# common
VERSION_NAME=0.10.2
VERSION_CODE=24
VERSION_NAME=0.10.3
VERSION_CODE=25

# for maven-publish
POM_GROUP_ID=com.h6ah4i.android.widget.advrecyclerview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ExpandableRecyclerViewWrapperAdapter

private static final String TAG = "ARVExpandableWrapper";

//
// NOTE: Make accessible with short name
private interface Constants extends ExpandableItemConstants {
}
Expand Down Expand Up @@ -196,9 +197,9 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List<
correctItemDragStateFlags(holder, groupPosition, childPosition);

if (childPosition == RecyclerView.NO_POSITION) {
mExpandableItemAdapter.onBindGroupViewHolder(holder, groupPosition, viewType);
mExpandableItemAdapter.onBindGroupViewHolder(holder, groupPosition, viewType, payloads);
} else {
mExpandableItemAdapter.onBindChildViewHolder(holder, groupPosition, childPosition, viewType);
mExpandableItemAdapter.onBindChildViewHolder(holder, groupPosition, childPosition, viewType, payloads);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ private boolean handleActionUpOrCancel(RecyclerView rv, MotionEvent e) {
return false;
}

if (mRecyclerView.isComputingLayout()) {
return false;
}

final int touchX = (int) (e.getX() + 0.5f);
final int touchY = (int) (e.getY() + 0.5f);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private boolean handleActionMove(RecyclerView rv, MotionEvent e) {

final int distance = mLastTouchY - mInitialTouchY;

if (mInterceptScrollingWhileAnimationRunning && (Math.abs(distance) > mTouchSlop) && isAnimationRunning(rv)) {
if (mInterceptScrollingWhileAnimationRunning && (Math.abs(distance) > mTouchSlop) && rv.isAnimating()) {
// intercept vertical move touch events while animation is running
mGuarding = true;
}
Expand All @@ -169,11 +169,6 @@ private boolean handleActionMove(RecyclerView rv, MotionEvent e) {
return mGuarding;
}

private static boolean isAnimationRunning(RecyclerView rv) {
final RecyclerView.ItemAnimator itemAnimator = rv.getItemAnimator();
return (itemAnimator != null) && (itemAnimator.isRunning());
}

private void handleActionUpOrCancel() {
mGuarding = false;
mInitialTouchY = 0;
Expand Down
2 changes: 2 additions & 0 deletions methodscount/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build

Loading

0 comments on commit 9dbe2fd

Please sign in to comment.