Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 15 22:01:37 WAT 2017
#Sun Feb 10 15:33:08 EAT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
1 change: 0 additions & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
applicationId "ng.max.slideview.sample"
Expand Down
12 changes: 12 additions & 0 deletions sample/src/main/java/ng/max/slideview/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import android.os.Bundle;
import android.os.Vibrator;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import ng.max.slideview.SlideView;
import ng.max.slideview.TwoWaySlideView;
import ng.max.slideview.TwoWaySlider;

public class MainActivity extends AppCompatActivity {

Expand All @@ -22,5 +25,14 @@ public void onSlideComplete(SlideView slideView) {
slideView.setText("Disabled");
}
});
((TwoWaySlideView) findViewById(R.id.twoWaySlideView)).setOnSlideCompleteListener(new TwoWaySlideView.OnTwoWaySlideListener() {
@Override
public void onSlideComplete(TwoWaySlideView slideView, TwoWaySlider.SlideDirection slideDirection) {
if (slideDirection== TwoWaySlider.SlideDirection.END)
Toast.makeText(MainActivity.this, "Thank you for accepting", Toast.LENGTH_SHORT).show();
else
Toast.makeText(MainActivity.this, "did you just decline my offer?", Toast.LENGTH_SHORT).show();
}
});
}
}
9 changes: 9 additions & 0 deletions sample/src/main/res/drawable/ic_favorite_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF00"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>
52 changes: 35 additions & 17 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="ng.max.slideview.sample.MainActivity">

<ng.max.slideview.SlideView
android:id="@+id/slider1"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
app:sv_buttonBackgroundColor="#fff"
app:sv_buttonImage="@drawable/ic_chevron_double_right_pink"
app:sv_slideBackgroundColor="@color/colorAccent"
Expand All @@ -27,8 +26,8 @@
android:id="@+id/slider2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
app:sv_buttonBackgroundColor="@android:color/white"
app:sv_buttonImage="@drawable/ic_chevron_double_right_purple"
app:sv_reverseSlide="true"
Expand All @@ -50,35 +49,54 @@
android:id="@+id/slider4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:sv_reverseSlide="true"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
app:sv_buttonBackgroundColor="@color/colorPrimary"
app:sv_buttonImage="@drawable/ic_chevron_double_right_white_24dp"
app:sv_reverseSlide="true"
app:sv_slideBackgroundColor="@android:color/white"
app:sv_slideText="Reverse"
app:sv_slideTextColor="@color/colorPrimary"
app:sv_strokeColor="@color/colorPrimary"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"/>
app:sv_strokeColor="@color/colorPrimary" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide_to_disable"
android:layout_marginTop="25dp"
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:textColor="@color/colorPrimary"/>
android:layout_marginTop="25dp"
android:text="@string/slide_to_disable"
android:textColor="@color/colorPrimary"
android:textSize="20sp" />

<ng.max.slideview.SlideView
android:id="@+id/slider5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
app:sv_buttonBackgroundColor="@android:color/white"
app:sv_buttonImage="@drawable/ic_settings_purple"
app:sv_buttonImageDisabled="@drawable/ic_settings_grey600_24dp"
app:sv_slideBackgroundColor="@color/slide_button_bg_selector"
app:sv_slideText="Enabled"
app:sv_buttonImageDisabled="@drawable/ic_settings_grey600_24dp" />
app:sv_slideText="Enabled" />
<TextView
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="would you date me?"
/>
<ng.max.slideview.TwoWaySlideView
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tsv_slideEndText="😍"
android:id="@+id/twoWaySlideView"
app:tsv_buttonBackgroundColor="@android:color/white"
app:tsv_buttonImage="@drawable/ic_favorite_black_24dp"
app:tsv_slideBackgroundColor="@android:color/darker_gray"
app:tsv_slideStartText="😑"

/>

</LinearLayout>
1 change: 0 additions & 1 deletion slideview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ group = 'com.github.MAXDeliveryNG'

android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.minSdkVersion
Expand Down
6 changes: 5 additions & 1 deletion slideview/src/main/java/ng/max/slideview/Slider.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public boolean onTouchEvent(MotionEvent event) {
if (listener != null) listener.onSlideComplete(slideView);
}
getParent().requestDisallowInterceptTouchEvent(false);
setProgress(0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setProgress(0, true);
} else
setProgress(0);

} else
super.onTouchEvent(event);

Expand Down
Loading