Skip to content

Commit

Permalink
Merge branch 'release/0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
h6ah4i committed May 10, 2015
2 parents 1334831 + 2ab6180 commit 81ce480
Show file tree
Hide file tree
Showing 67 changed files with 2,657 additions and 394 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Target platforms
Latest version
---

- Version 0.6.2 (February 23, 2015)
- Version 0.7.0 (May 11, 2015)

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

```groovy
dependencies {
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.6.2'
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.7.0'
}
```

Expand Down
14 changes: 14 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 0.7.0

[Breaking changes]
- Changed method signitures of SwipeableItemAdapter (commit: `56e0084342f6e86ae26078f7c329368e2a59b92b`)
- Changed method of DraggableItemAnimator (commit: `56e0084342f6e86ae26078f7c329368e2a59b92b`)

[Improvements]
- Upgraded support library to v22.1.1
- Fixed issue #3 (ClassCastException bug)
- Fixed issue #13 (Can't set child item draggable range in children group)
- Fixed issue #23 (overscrolling effect)
- Fixed issue #29 (Begin drag and drop using OnLongClick
- Fixed issue #30 (Enhancement to Swiping)
- Merged pull request from @jcamp1 (related to #29, #30)

## 0.6.2

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:1.0.1'
classpath 'com.android.tools.build:gradle:1.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion common/android-maven-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ task cleanDocsOutDir(type: Delete) {

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
excludes += '**/BuildConfig.java'
excludes += '**/R.java'
options.encoding "utf-8"
Expand All @@ -49,6 +48,7 @@ task androidSourcesJar(type: Jar) {
}

afterEvaluate {
androidJavadocs.classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
}

Expand Down
4 changes: 2 additions & 2 deletions common/android-set-common-properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
compileSdkVersion 22
buildToolsVersion '22.0.1'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down
8 changes: 4 additions & 4 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ android {
defaultConfig {
applicationId "com.h6ah4i.android.example.advrecyclerview"
minSdkVersion 9
targetSdkVersion 21
versionCode 4
versionName "0.6.2"
targetSdkVersion 22
versionCode 5
versionName "0.7.0"
}

signingConfigs {
Expand All @@ -50,5 +50,5 @@ if (loadSigningConfigFromPropertiesFile(
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
compile 'com.nispok:snackbar:2.9.1'
compile 'com.nispok:snackbar:2.10.8'
}
8 changes: 8 additions & 0 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@
android:name=".demo_d.DraggableExampleActivity"
android:label="@string/activity_title_demo_d" />

<activity
android:name=".demo_d_with_longpress.DraggableWithLongPressExampleActivity"
android:label="@string/activity_title_demo_d_with_longpress" />

<activity
android:name=".demo_s.SwipeableExampleActivity"
android:label="@string/activity_title_demo_s" />

<activity
android:name=".demo_us.UnderSwipeableExampleActivity"
android:label="@string/activity_title_demo_us" />

<activity
android:name=".demo_e.ExpandableExampleActivity"
android:label="@string/activity_title_demo_e" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
Expand All @@ -33,7 +33,7 @@
import java.util.List;


public class AboutActivity extends ActionBarActivity {
public class AboutActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
/*
* Copyright (C) 2015 Haruki Hasegawa
*
* 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.
*/

package com.h6ah4i.android.example.advrecyclerview.common.data;

import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;

import java.util.LinkedList;
import java.util.List;

public class DebugDataProvider extends AbstractDataProvider {
private List<ConcreteData> mData;
private ConcreteData mLastRemovedData;
private int mLastRemovedPosition = -1;

public DebugDataProvider() {
final String atoz = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

mData = new LinkedList<>();
@SuppressWarnings("PointlessBitwiseExpression")
final int[] swipeReactionTable = {
RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT | RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT,
RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT | RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT_WITH_RUBBER_BAND_EFFECT,
RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT | RecyclerViewSwipeManager.REACTION_CAN_SWIPE_RIGHT,
RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT_WITH_RUBBER_BAND_EFFECT | RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT,
RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT_WITH_RUBBER_BAND_EFFECT | RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT_WITH_RUBBER_BAND_EFFECT,
RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT_WITH_RUBBER_BAND_EFFECT | RecyclerViewSwipeManager.REACTION_CAN_SWIPE_RIGHT,
RecyclerViewSwipeManager.REACTION_CAN_SWIPE_LEFT | RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT,
RecyclerViewSwipeManager.REACTION_CAN_SWIPE_LEFT | RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT_WITH_RUBBER_BAND_EFFECT,
RecyclerViewSwipeManager.REACTION_CAN_SWIPE_LEFT | RecyclerViewSwipeManager.REACTION_CAN_SWIPE_RIGHT,
};

for (int i = 0; i < 2; i++) {
for (int j = 0; j < atoz.length(); j++) {
final long id = mData.size();
final int viewType = j % 2;
final String text = Character.toString(atoz.charAt(j));
final int swipeReaction = swipeReactionTable[j % swipeReactionTable.length];
mData.add(new ConcreteData(id, viewType, text, swipeReaction));
}
}
}

@Override
public int getCount() {
return mData.size();
}

@Override
public Data getItem(int index) {
if (index < 0 || index >= getCount()) {
throw new IndexOutOfBoundsException("index = " + index);
}

return mData.get(index);
}

@Override
public int undoLastRemoval() {
if (mLastRemovedData != null) {
int insertedPosition;
if (mLastRemovedPosition >= 0 && mLastRemovedPosition < mData.size()) {
insertedPosition = mLastRemovedPosition;
} else {
insertedPosition = mData.size();
}

mData.add(insertedPosition, mLastRemovedData);

mLastRemovedData = null;
mLastRemovedPosition = -1;

return insertedPosition;
} else {
return -1;
}
}

@Override
public void moveItem(int fromPosition, int toPosition) {
if (fromPosition == toPosition) {
return;
}

final ConcreteData item = mData.remove(fromPosition);

mData.add(toPosition, item);
mLastRemovedPosition = -1;
}

@Override
public void removeItem(int position) {
//noinspection UnnecessaryLocalVariable
final ConcreteData removedItem = mData.remove(position);

mLastRemovedData = removedItem;
mLastRemovedPosition = position;
}

public static final class ConcreteData extends Data {

private final long mId;
private final String mText;
private final int mViewType;
private final int mSwipeReaction;
private boolean mPinnedToSwipeLeft;

ConcreteData(long id, int viewType, String text, int swipeReaction) {
mId = id;
mViewType = viewType;
mText = makeText(id, text, swipeReaction);
mSwipeReaction = swipeReaction;
}

private static String makeText(long id, String text, int swipeReaction) {
final StringBuilder sb = new StringBuilder();

sb.append(id);
sb.append(" - ");
sb.append(text);

sb.append("\n");

sb.append("(LEFT: ");
switch (swipeReaction & 0x03) {
case RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT:
sb.append("disabled");
break;
case RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_LEFT_WITH_RUBBER_BAND_EFFECT:
sb.append("rubber band effect");
break;
case RecyclerViewSwipeManager.REACTION_CAN_SWIPE_LEFT:
sb.append("enabled");
break;
}
sb.append(", RIGHT: ");
switch (swipeReaction & (0x03 << 16)) {
case RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT:
sb.append("disabled");
break;
case RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_RIGHT_WITH_RUBBER_BAND_EFFECT:
sb.append("rubber band effect");
break;
case RecyclerViewSwipeManager.REACTION_CAN_SWIPE_RIGHT:
sb.append("enabled");
break;
}
sb.append(")");

return sb.toString();
}

@Override
public boolean isSectionHeader() {
return false;
}

@Override
public int getViewType() {
return mViewType;
}

@Override
public long getId() {
return mId;
}

@Override
public String toString() {
return mText;
}

@Override
public int getSwipeReactionType() {
return mSwipeReaction;
}

@Override
public String getText() {
return mText;
}

@Override
public boolean isPinnedToSwipeLeft() {
return mPinnedToSwipeLeft;
}

@Override
public void setPinnedToSwipeLeft(boolean pinedToSwipeLeft) {
mPinnedToSwipeLeft = pinedToSwipeLeft;
}
}
}
Loading

0 comments on commit 81ce480

Please sign in to comment.