diff --git a/.gitignore b/.gitignore
index 469f1b1..e973355 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,9 @@
+.gradle
+/local.properties
+/.idea/
+.DS_Store
+/build
+/captures
-local.properties
*.iml
-.idea/libraries
-.idea/encodings.xml
-.idea/compiler.xml
-.idea/modules.xml
-.idea/misc.xml
-.idea/vcs.xml
-build
\ No newline at end of file
+*.log
\ No newline at end of file
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index cfcac46..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-Slidr
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index cd1cd85..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,26 +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/README.md b/README.md
index 064b4a4..639893a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,10 @@
+# Deprecated
+This library is no longer supported as the modern convention of building Android apps switches from multi-Activity to single-Activity. If you are looking for similar behavior look into supporting Android's new [predictive back handling](https://developer.android.com/guide/navigation/custom-back/predictive-back-gesture)
+
Slidr
================
-[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.r0adkll/slidableactivity/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.r0adkll/slidableactivity) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Slidr-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1364) [![Stories in Ready](https://badge.waffle.io/r0adkll/Slidr.png?label=ready&title=Ready)](https://waffle.io/r0adkll/Slidr)
+[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.r0adkll/slidableactivity/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.r0adkll/slidableactivity) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Slidr-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1364)
+[![Build Status](https://travis-ci.org/r0adkll/Slidr.svg?branch=master)](https://travis-ci.org/r0adkll/Slidr)
Easily add slide-to-dismiss functionality to your Activity by calling `Slidr.attach(this)` in your `onCreate(..)` method.
@@ -17,9 +21,9 @@ public class ExampleActivity extends
+
+
+
+ ...other stuff
+
+
+
+```
+Remember: you have to add new Fragments with:
+
+```java
+getSupportFragmentManager().beginTransaction()
+ .add(R.id.fragment_container, YourFragmentClass.newInstance())
+ .commit();
+```
+
+where fragment_container is the id of a FrameLayout inside the activity's xml.
+
+
## Configuring
```java
@@ -99,9 +154,10 @@ Then in the layout of your activity you must give it a background like this;
Include this line in your gradle build file:
```groovy
-compile 'com.r0adkll:slidableactivity:2.0.4'
+implementation 'com.r0adkll:slidableactivity:2.1.0'
```
+
## Author
diff --git a/build.gradle b/build.gradle
index 096f69f..62ae308 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,15 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
+ google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
+ classpath 'com.android.tools.build:gradle:3.5.0'
}
}
allprojects {
repositories {
+ google()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
@@ -17,22 +19,22 @@ allprojects {
ext {
//App
- libraryCode = 10
- libraryVersion = '2.1.0'
+ libraryCode = VERSION_CODE
+ libraryVersion = VERSION_NAME
//Support and Build tools version
- targetSdk = 23
- buildTools = '23.0.2'
- supportLibrary = '23.1.1'
- ftKit = '0.4.1'
+ compileSdk = 28
+ targetSdk = 28
+ minSdk = 19
+ ftKit = '0.6.0'
//Support Libraries dependencies
supportDependencies = [
- support : "com.android.support:support-v4:${supportLibrary}",
- appCompat : "com.android.support:appcompat-v7:${supportLibrary}",
- recycler : "com.android.support:recyclerview-v7:${supportLibrary}",
- cardView : "com.android.support:cardview-v7:${supportLibrary}",
+ support : 'androidx.legacy:legacy-support-v4:1.0.0',
+ appCompat : 'androidx.appcompat:appcompat:1.0.0',
+ recycler : 'androidx.recyclerview:recyclerview:1.0.0',
+ cardView : 'androidx.cardview:cardview:1.0.0',
kitCore : "com.52inc:52Kit-core:${ftKit}"
]
-}
\ No newline at end of file
+}
diff --git a/example/.gitignore b/example/.gitignore
index 42afabf..d0b97c6 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -1 +1,2 @@
-/build
\ No newline at end of file
+/build
+*.iml
\ No newline at end of file
diff --git a/example/build.gradle b/example/build.gradle
index 045c419..0180145 100644
--- a/example/build.gradle
+++ b/example/build.gradle
@@ -2,14 +2,13 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion targetSdk
- buildToolsVersion buildTools
defaultConfig {
applicationId "com.r0adkll.slidr.example"
- minSdkVersion 16
+ minSdkVersion minSdk
targetSdkVersion targetSdk
- versionCode libraryCode
- versionName libraryVersion
+ versionCode 1
+ versionName VERSION_NAME
}
buildTypes {
@@ -23,19 +22,23 @@ android {
abortOnError false
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile project(':library')
-
- compile supportDependencies.appCompat
- compile supportDependencies.recycler
- compile supportDependencies.cardView
-
- compile supportDependencies.kitCore
-
- compile 'com.jakewharton:butterknife:6.1.0'
- compile 'com.github.bumptech.glide:glide:3.6.0'
- compile 'com.google.code.gson:gson:2.4'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation project(':library')
+
+ implementation supportDependencies.appCompat
+ implementation supportDependencies.recycler
+ implementation supportDependencies.cardView
+ implementation supportDependencies.kitCore
+
+ implementation 'com.jakewharton:butterknife:10.1.0'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
+ implementation 'com.github.bumptech.glide:glide:3.8.0'
+ implementation 'com.google.code.gson:gson:2.8.5'
}
diff --git a/example/example.iml b/example/example.iml
index 188b0b7..892113a 100644
--- a/example/example.iml
+++ b/example/example.iml
@@ -1,106 +1,134 @@
-
+
+
+
-
-
-
- generateDebugAndroidTestSources
generateDebugSources
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java b/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java
index 7dfc02d..8c6aa26 100644
--- a/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java
+++ b/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java
@@ -1,12 +1,10 @@
package com.r0adkll.slidr.example;
-import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import com.ftinc.kit.adapter.BetterRecyclerAdapter;
@@ -19,17 +17,17 @@
import java.lang.reflect.Type;
import java.util.List;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.Bind;
public class MainActivity extends AppCompatActivity {
- @Bind(R.id.recycler)
- RecyclerView mRecycler;
+ @BindView(R.id.recycler) RecyclerView mRecycler;
private OSVersionAdapter mAdapter;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -38,9 +36,7 @@ protected void onCreate(Bundle savedInstanceState) {
initRecycler();
}
- /**
- * Intialize Recycler
- */
+
private void initRecycler(){
mAdapter = new OSVersionAdapter();
mAdapter.addAll(getData());
@@ -57,6 +53,7 @@ public void onItemClick(View view, AndroidOS androidOS, int i) {
});
}
+
private List getData(){
InputStream is = getResources().openRawResource(R.raw.android_versions);
InputStreamReader isr = new InputStreamReader(is);
@@ -65,5 +62,4 @@ private List getData(){
List oss = gson.fromJson(isr, listType);
return oss;
}
-
}
diff --git a/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java b/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java
index 80d4855..8b6c435 100644
--- a/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java
+++ b/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java
@@ -1,6 +1,6 @@
package com.r0adkll.slidr.example;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -10,7 +10,7 @@
import com.r0adkll.slidr.example.model.AndroidOS;
import butterknife.ButterKnife;
-import butterknife.Bind;
+import butterknife.BindView;
/**
* Created by r0adkll on 1/11/15.
@@ -33,8 +33,8 @@ public void onBindViewHolder(OSViewHolder viewHolder, int i) {
}
public static class OSViewHolder extends RecyclerView.ViewHolder{
- @Bind(R.id.title) public TextView title;
- @Bind(R.id.description) public TextView description;
+ @BindView(R.id.title) public TextView title;
+ @BindView(R.id.description) public TextView description;
public OSViewHolder(View itemView) {
super(itemView);
diff --git a/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java b/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java
index 10ccae9..e2ce847 100644
--- a/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java
+++ b/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java
@@ -2,14 +2,14 @@
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.bumptech.glide.Glide;
+import com.ftinc.kit.util.SizeUtils;
import com.ftinc.kit.util.Utils;
import com.ftinc.kit.widget.AspectRatioImageView;
import com.r0adkll.slidr.Slidr;
@@ -17,35 +17,23 @@
import com.r0adkll.slidr.model.SlidrConfig;
import com.r0adkll.slidr.model.SlidrPosition;
-import java.util.List;
-
import butterknife.ButterKnife;
-import butterknife.Bind;
+import butterknife.BindView;
import butterknife.OnClick;
-/**
- * Created by r0adkll on 1/11/15.
- */
+
public class ViewerActivity extends AppCompatActivity {
public static final String EXTRA_OS = "extra_os_version";
- @Bind(R.id.toolbar)
- Toolbar mToolbar;
- @Bind(R.id.cover)
- AspectRatioImageView mCover;
- @Bind(R.id.title)
- TextView mTitle;
- @Bind(R.id.description)
- TextView mDescription;
- @Bind(R.id.date)
- TextView mDate;
- @Bind(R.id.version)
- TextView mVersion;
- @Bind(R.id.sdk)
- TextView mSdk;
- @Bind(R.id.position)
- TextView mPosition;
+ @BindView(R.id.toolbar) Toolbar mToolbar;
+ @BindView(R.id.cover) AspectRatioImageView mCover;
+ @BindView(R.id.title) TextView mTitle;
+ @BindView(R.id.description) TextView mDescription;
+ @BindView(R.id.date) TextView mDate;
+ @BindView(R.id.version) TextView mVersion;
+ @BindView(R.id.sdk) TextView mSdk;
+ @BindView(R.id.position) TextView mPosition;
private AndroidOS mOS;
private SlidrConfig mConfig;
@@ -68,11 +56,11 @@ protected void onCreate(Bundle savedInstanceState) {
mConfig = new SlidrConfig.Builder()
.primaryColor(primary)
.secondaryColor(secondary)
- .position(position)
+ .position(SlidrPosition.VERTICAL)
.velocityThreshold(2400)
- .distanceThreshold(.25f)
- .edge(true)
- .touchSize(Utils.dpToPx(this, 32))
+// .distanceThreshold(.25f)
+// .edge(true)
+ .touchSize(SizeUtils.dpToPx(this, 32))
.build();
// Attach the Slidr Mechanism to this activity
diff --git a/example/src/main/java/com/r0adkll/slidr/example/model/AndroidOS.java b/example/src/main/java/com/r0adkll/slidr/example/model/AndroidOS.java
index f80840a..35f60c1 100644
--- a/example/src/main/java/com/r0adkll/slidr/example/model/AndroidOS.java
+++ b/example/src/main/java/com/r0adkll/slidr/example/model/AndroidOS.java
@@ -3,9 +3,7 @@
import android.os.Parcel;
import android.os.Parcelable;
-/**
- * Created by r0adkll on 1/11/15.
- */
+
public class AndroidOS implements Parcelable{
public String name;
public String version;
diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml
index c1d58a9..fedc7b2 100644
--- a/example/src/main/res/layout/activity_main.xml
+++ b/example/src/main/res/layout/activity_main.xml
@@ -4,7 +4,7 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
-
-
+ android:layout_height="match_parent">
-
+ android:layout_height="wrap_content"
+ android:background="@color/background_material_light"
+ android:orientation="vertical">
-
+ android:layout_marginBottom="8dp"
+ android:elevation="4dp">
-
- tools:text="@string/placeholder_lorem_ipsum"
- android:textColor="@color/white"
- android:textSize="34sp"
+
+ android:paddingLeft="76dp"
+ android:textColor="@color/white"
+ android:textSize="34sp"
-
+ tools:text="@string/placeholder_lorem_ipsum"
+ />
-
+
-
- android:fontFamily="sans-serif-medium"
- tools:text="Left"
- android:textSize="16sp"
- android:textColor="@color/black55"
+
+ android:gravity="center_vertical"
+ android:textColor="@color/black55"
+ android:textSize="16sp"
+ tools:text="Left"
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
+
+
+ android:orientation="horizontal">
-
+
+ android:layout_weight="1"
+ android:background="@color/red_500"
+ />
-
-
-
+
- android:layout_margin="8dp"
- android:background="@color/red_500"
- />
+
- android:layout_margin="8dp"
- android:background="@color/blue_500"
- />
+
- android:layout_margin="8dp"
- android:background="@color/pink_500"
- />
+
- android:layout_margin="8dp"
- android:background="@color/purple_500"
- />
-
- android:layout_margin="8dp"
- android:background="@color/orange_500"
- />
+
+
+
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/example/src/main/res/layout/layout_item.xml b/example/src/main/res/layout/layout_item.xml
index 018b1c6..6036440 100644
--- a/example/src/main/res/layout/layout_item.xml
+++ b/example/src/main/res/layout/layout_item.xml
@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:padding="16dp"
android:background="?attr/selectableItemBackground">
diff --git a/example/src/main/res/values/styles.xml b/example/src/main/res/values/styles.xml
index e2916b3..6aa72fb 100644
--- a/example/src/main/res/values/styles.xml
+++ b/example/src/main/res/values/styles.xml
@@ -4,16 +4,16 @@
-