diff --git a/.gitignore b/.gitignore
index 68e3d8f..d41d8e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,30 @@
-.gradle
-/local.properties
-/.idea/workspace.xml
-/.idea/tasks.xml
-/.idea/libraries
-.DS_Store
-/build
-/captures
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+bin/
+gen/
+
+# Key
+*.jks
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Intellij project files
+*.iml
+*.ipr
*.iws
+.idea/
+*.prefs
+
+# Gradle
+build/
+.gradle
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index 58dcb30..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-SwipeSelector-master
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 96cc43e..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/SwipeSelector.xml b/.idea/copyright/SwipeSelector.xml
deleted file mode 100644
index c9442bc..0000000
--- a/.idea/copyright/SwipeSelector.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf3..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 97626ba..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 3ee4ec8..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 13cf8af..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 3b31283..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 1a3eaff..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index b1a074d..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SwipeSelector.iml b/SwipeSelector.iml
deleted file mode 100644
index d9213e1..0000000
--- a/SwipeSelector.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 630c771..21ce18c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,8 +5,8 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
+ classpath 'com.android.tools.build:gradle:2.1.0'
+ classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/gradle.properties b/gradle.properties
index 1d3591c..7020ce9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -15,4 +15,9 @@
# 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.parallel=true
\ No newline at end of file
+# org.gradle.parallel=true
+
+ANDROID_BUILD_MIN_SDK_VERSION=8
+ANDROID_BUILD_TARGET_SDK_VERSION=23
+ANDROID_BUILD_SDK_VERSION=23
+ANDROID_BUILD_TOOLS_VERSION=23.0.3
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f23df6e..933a325 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Oct 21 11:34:03 PDT 2015
+#Fri Jun 03 12:29:56 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/sample/build.gradle b/sample/build.gradle
index 6ae75b6..3c02c21 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
+ buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.example.swipeselectordemo"
- minSdkVersion 8
- targetSdkVersion 23
+ minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
+ targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode 2
versionName "1.0"
}
@@ -22,6 +22,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:23.2.0'
+ compile 'com.android.support:appcompat-v7:23.4.0'
compile project(':swipe-selector')
}
diff --git a/sample/sample.iml b/sample/sample.iml
deleted file mode 100644
index 78f5648..0000000
--- a/sample/sample.iml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugAndroidTestSources
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/swipe-selector/build.gradle b/swipe-selector/build.gradle
index 6d17349..d781c44 100644
--- a/swipe-selector/build.gradle
+++ b/swipe-selector/build.gradle
@@ -25,14 +25,12 @@ ext {
}
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
+ buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
- minSdkVersion 8
- targetSdkVersion 23
- versionCode 1
- versionName "1.0"
+ minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
+ targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
}
buildTypes {
release {
@@ -45,7 +43,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:23.2.0'
+ compile 'com.android.support:appcompat-v7:23.4.0'
}
apply plugin: 'com.github.dcendents.android-maven'
diff --git a/swipe-selector/src/main/AndroidManifest.xml b/swipe-selector/src/main/AndroidManifest.xml
index 3185cb1..4c5e846 100644
--- a/swipe-selector/src/main/AndroidManifest.xml
+++ b/swipe-selector/src/main/AndroidManifest.xml
@@ -1,11 +1 @@
-
-
-
-
-
-
-
+
diff --git a/swipe-selector/src/main/java/com/roughike/swipeselector/SwipeAdapter.java b/swipe-selector/src/main/java/com/roughike/swipeselector/SwipeAdapter.java
index ecff7ef..1c88e63 100644
--- a/swipe-selector/src/main/java/com/roughike/swipeselector/SwipeAdapter.java
+++ b/swipe-selector/src/main/java/com/roughike/swipeselector/SwipeAdapter.java
@@ -1,9 +1,13 @@
package com.roughike.swipeselector;
import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Matrix;
import android.graphics.Typeface;
+import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.os.Build;
import android.os.Bundle;
@@ -99,9 +103,29 @@ private SwipeAdapter(ViewPager viewPager, ViewGroup indicatorContainer, int indi
mLeftButton = leftButton;
mLeftButton.setImageResource(leftButtonResource);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ mLeftButton.getDrawable().setAutoMirrored(true);
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ Configuration config = mContext.getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ mLeftButton.setImageDrawable(flip(leftButtonResource));
+ }
+ } else {
+ // Not supported
+ }
mRightButton = rightButton;
mRightButton.setImageResource(rightButtonResource);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ mRightButton.getDrawable().setAutoMirrored(true);
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ Configuration config = mContext.getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ mRightButton.setImageDrawable(flip(rightButtonResource));
+ }
+ } else {
+ // Not supported
+ }
// Calculate paddings for the content so the left and right buttons
// don't overlap.
@@ -241,6 +265,7 @@ protected SwipeAdapter build() {
/**
* Protected methods used by SwipeSelector
*/
+
protected void setOnItemSelectedListener(OnSwipeItemSelectedListener listener) {
mOnItemSelectedListener = listener;
}
@@ -527,4 +552,12 @@ private void setAlpha(float alpha, ImageView button) {
button.setAlpha((int) (alpha * 255));
}
}
+
+ private BitmapDrawable flip(int buttonRes) {
+ Matrix m = new Matrix();
+ m.preScale(-1, 1);
+ Bitmap src = BitmapFactory.decodeResource(mContext.getResources(), buttonRes);
+ Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false);
+ return new BitmapDrawable(mContext.getResources(), dst);
+ }
}
diff --git a/swipe-selector/src/test/java/com/iroughapps/swipeselector/ExampleUnitTest.java b/swipe-selector/src/test/java/com/iroughapps/swipeselector/ExampleUnitTest.java
deleted file mode 100644
index 9a917e9..0000000
--- a/swipe-selector/src/test/java/com/iroughapps/swipeselector/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.roughike.swipeselector;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/swipe-selector/swipe-selector.iml b/swipe-selector/swipe-selector.iml
deleted file mode 100644
index 55d82cf..0000000
--- a/swipe-selector/swipe-selector.iml
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugAndroidTestSources
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file