diff --git a/example/build.gradle b/example/build.gradle index de3cb274..f55cfd77 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -20,6 +20,9 @@ android { lintOptions { abortOnError false } + buildFeatures { + dataBinding true + } } dependencies { diff --git a/example/src/main/java/com/ncorti/slidetoact/example/MainActivity.java b/example/src/main/java/com/ncorti/slidetoact/example/MainActivity.java index 357a418f..4839ce6b 100644 --- a/example/src/main/java/com/ncorti/slidetoact/example/MainActivity.java +++ b/example/src/main/java/com/ncorti/slidetoact/example/MainActivity.java @@ -34,6 +34,7 @@ protected void onCreate(Bundle savedInstanceState) { findViewById(R.id.button_reversed_slider).setOnClickListener(this); findViewById(R.id.button_animation_duration).setOnClickListener(this); findViewById(R.id.button_bump_vibration).setOnClickListener(this); + findViewById(R.id.button_bound).setOnClickListener(this); } public boolean onCreateOptionsMenu(Menu menu) { diff --git a/example/src/main/java/com/ncorti/slidetoact/example/SampleActivity.java b/example/src/main/java/com/ncorti/slidetoact/example/SampleActivity.java index 71f03c24..13ee3cd3 100644 --- a/example/src/main/java/com/ncorti/slidetoact/example/SampleActivity.java +++ b/example/src/main/java/com/ncorti/slidetoact/example/SampleActivity.java @@ -1,5 +1,7 @@ package com.ncorti.slidetoact.example; +import android.annotation.SuppressLint; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; @@ -9,8 +11,10 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; import com.ncorti.slidetoact.SlideToActView; +import com.ncorti.slidetoact.example.databinding.ContentBoundBinding; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -97,6 +101,15 @@ public void onClick(final View v) { case R.id.button_bump_vibration: setContentView(R.layout.content_bumb_vibration); break; + case R.id.button_bound: + ContentBoundBinding binding = DataBindingUtil.setContentView(this, R.layout.content_bound); + @SuppressLint("UseCompatLoadingForDrawables") + SliderData fullData = new SliderData("Bound SlideToAct View", + getResources().getDrawable(R.drawable.ic_android), + getResources().getDrawable(R.drawable.ic_cloud)); + binding.setFullData(fullData); + binding.setPlay(true); + break; default: finish(); break; @@ -184,4 +197,16 @@ public void onSlideResetAnimationEnded(@NonNull SlideToActView view) { private String getTime() { return dateFormat.format(new Date()); } + + public class SliderData { + public String text; + public Drawable sliderIcon; + public Drawable completeIcon; + + public SliderData(String text, Drawable sliderIcon, Drawable completeIcon) { + this.text = text; + this.sliderIcon = sliderIcon; + this.completeIcon = completeIcon; + } + } } diff --git a/example/src/main/res/drawable/ic_pause.xml b/example/src/main/res/drawable/ic_pause.xml new file mode 100644 index 00000000..906295eb --- /dev/null +++ b/example/src/main/res/drawable/ic_pause.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/example/src/main/res/drawable/ic_play.xml b/example/src/main/res/drawable/ic_play.xml new file mode 100644 index 00000000..e6bafc8a --- /dev/null +++ b/example/src/main/res/drawable/ic_play.xml @@ -0,0 +1,12 @@ + + + + diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml index 49155bbd..1c0da8d2 100644 --- a/example/src/main/res/layout/activity_main.xml +++ b/example/src/main/res/layout/activity_main.xml @@ -112,5 +112,11 @@ android:layout_height="wrap_content" android:text="@string/bump_vibration" /> +