diff --git a/app/build.gradle b/app/build.gradle
index 3f950fb..fd00f38 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -35,9 +35,10 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.1.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
- implementation 'com.google.android.material:material:1.0.0-rc02'
+ androidTestImplementation 'androidx.test:runner:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
+ implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
+ implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5d04370..e71149c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,6 +24,14 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/OptionsActivity.kt b/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/OptionsActivity.kt
index 08442cb..0a70656 100644
--- a/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/OptionsActivity.kt
+++ b/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/OptionsActivity.kt
@@ -31,6 +31,10 @@ class OptionsActivity : AppCompatActivity() {
buttonClStates.setOnClickListener {
startActivity(Intent(this, ConstraintLayoutStatesExampleActivity::class.java))
}
+
+ buttonSwipeRecyclerView.setOnClickListener {
+ startActivity(Intent(this, RecyclerViewSwipeMotionActivity::class.java))
+ }
}
}
diff --git a/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/RecyclerViewSwipeMotionActivity.kt b/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/RecyclerViewSwipeMotionActivity.kt
new file mode 100644
index 0000000..6f01f3c
--- /dev/null
+++ b/app/src/main/java/za/co/riggaroo/constraintlayoutdemo/RecyclerViewSwipeMotionActivity.kt
@@ -0,0 +1,97 @@
+package za.co.riggaroo.constraintlayoutdemo
+
+import android.content.Context
+import android.os.Bundle
+import android.util.TypedValue
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.ListAdapter
+import androidx.recyclerview.widget.RecyclerView
+import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment
+import com.google.android.material.shape.CornerTreatment
+import com.google.android.material.shape.MaterialShapeDrawable
+import com.google.android.material.shape.RoundedCornerTreatment
+import com.google.android.material.shape.ShapePathModel
+import kotlinx.android.synthetic.main.activity_swipe_recycler_view.*
+import kotlinx.android.synthetic.main.list_item_email.view.*
+
+class RecyclerViewSwipeMotionActivity : AppCompatActivity(){
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_swipe_recycler_view)
+
+ val shapePathModel = ShapePathModel().apply {
+ val margin = applicationContext.dipToPixels(36f)
+ val corner = RoundedCornerTreatment(margin)
+ val noCorner = CornerTreatment()
+ setCornerTreatments(corner, corner, noCorner, noCorner)
+ topEdge = BottomAppBarTopEdgeTreatment(margin, margin, margin)
+ }
+
+ val backgroundDrawable = MaterialShapeDrawable(shapePathModel).apply {
+ setTint(ContextCompat.getColor(this@RecyclerViewSwipeMotionActivity, R.color.white))
+ isShadowEnabled = true
+ }
+ background_view.background = backgroundDrawable
+
+ val listItems = listOf(Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"),
+ Email("Rebecca Franks", "It's the holidays!"))
+
+ val emailAdapter = EmailAdapter()
+
+ recyclerViewEmails.adapter = emailAdapter
+ recyclerViewEmails.layoutManager = LinearLayoutManager(applicationContext, RecyclerView.VERTICAL, false)
+
+ emailAdapter.submitList(listItems)
+ }
+
+ fun Context.dipToPixels(dipValue: Float) =
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, resources.displayMetrics)
+
+ data class Email(val name: String, val subject: String)
+
+
+ class EmailAdapter: ListAdapter(DIFFER){
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EmailViewHolder {
+ return EmailViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.list_item_email, parent, false))
+ }
+
+ override fun onBindViewHolder(holder: EmailViewHolder, position: Int) {
+ holder.bind(getItem(position))
+ }
+
+ companion object {
+ val DIFFER = object : DiffUtil.ItemCallback() {
+ override fun areItemsTheSame(oldItem: Email, newItem: Email): Boolean {
+ return oldItem == newItem
+ }
+
+ override fun areContentsTheSame(oldItem: Email, newItem: Email): Boolean {
+ return oldItem == newItem
+ }
+ }
+ }
+ }
+
+ class EmailViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+
+ fun bind(email : Email){
+ itemView.textViewEmailName.text = email.name
+ itemView.textViewSubject.text = email.subject
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dvt_hyde_park.png b/app/src/main/res/drawable/dvt_hyde_park.png
deleted file mode 100644
index 5bb0bad..0000000
Binary files a/app/src/main/res/drawable/dvt_hyde_park.png and /dev/null differ
diff --git a/app/src/main/res/layout/activity_options.xml b/app/src/main/res/layout/activity_options.xml
index ef9e330..a528b34 100644
--- a/app/src/main/res/layout/activity_options.xml
+++ b/app/src/main/res/layout/activity_options.xml
@@ -68,4 +68,16 @@
app:layout_constraintTop_toBottomOf="@+id/buttonImageFilterView"
android:text="STATES"/>
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_swipe_recycler_view.xml b/app/src/main/res/layout/activity_swipe_recycler_view.xml
new file mode 100644
index 0000000..9c7bf40
--- /dev/null
+++ b/app/src/main/res/layout/activity_swipe_recycler_view.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_email.xml b/app/src/main/res/layout/list_item_email.xml
new file mode 100644
index 0000000..773943f
--- /dev/null
+++ b/app/src/main/res/layout/list_item_email.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index dbfd138..d994033 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -2,7 +2,7 @@
#26a69a
#00bfa5
- #FF1744
+ #B39DDB
#eeeeee
#ffffff
#eeeeee
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 228337b..6f9d9fd 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-