-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android 13880 Hide last divider in XML Lists (#327)
- Loading branch information
1 parent
2d26365
commit afb1e1a
Showing
7 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
Binary file modified
BIN
-48 Bytes
(100%)
library/screenshots/check_ListRowItem_with_32x32_asset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+36 Bytes
(100%)
library/screenshots/check_ListRowItem_with_64x64_asset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.7 KB
library/screenshots/check_MisticaRecyclerView_xml_hides_last_divider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
library/src/test/java/com/telefonica/mistica/list/MisticaRecyclerViewTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.telefonica.mistica.list | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import android.widget.FrameLayout | ||
import androidx.recyclerview.widget.RecyclerView | ||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import com.telefonica.mistica.DummyActivity | ||
import com.telefonica.mistica.R | ||
import com.telefonica.mistica.testutils.ScreenshotsTest | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
internal class MisticaRecyclerViewTest: ScreenshotsTest() { | ||
@get:Rule | ||
val rule = activityScenarioRule<DummyActivity>() | ||
|
||
@Test | ||
fun `check MisticaRecyclerView xml hides last divider`() { | ||
rule.scenario.onActivity { activity -> | ||
val wrapper: FrameLayout = activity.findViewById(R.id.dummy_activity_wrapper) | ||
val view = activity.layoutInflater.inflate(R.layout.test_mistica_recycler_view, wrapper, false) | ||
activity.setContentView(view) | ||
|
||
val list: MisticaRecyclerView = view.findViewById(R.id.test_list) | ||
list.adapter = ClickableListAdapter() | ||
compareScreenshot(Espresso.onView(ViewMatchers.withId(R.id.test_recycler_view))) | ||
} | ||
} | ||
|
||
class ListViewHolder(val rowView: ListRowView) : RecyclerView.ViewHolder(rowView) | ||
class ClickableListAdapter : RecyclerView.Adapter<ListViewHolder>() { | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListViewHolder { | ||
return ListViewHolder( | ||
LayoutInflater.from(parent.context).inflate( | ||
R.layout.sheet_list_row_selectable_item, | ||
parent, | ||
false | ||
) as ListRowView | ||
) | ||
} | ||
|
||
override fun getItemCount(): Int = 2 | ||
|
||
override fun onBindViewHolder(holder: ListViewHolder, position: Int) { | ||
holder.rowView.setTitle("Row $position") | ||
} | ||
} | ||
|
||
} | ||
|
19 changes: 19 additions & 0 deletions
19
library/src/test/res/layout/test_mistica_recycler_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/test_recycler_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="16dp" | ||
android:orientation="vertical" | ||
> | ||
|
||
<com.telefonica.mistica.list.MisticaRecyclerView | ||
android:id="@+id/test_list" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
android:nestedScrollingEnabled="false" | ||
app:listLayoutType="full_width" | ||
/> | ||
</LinearLayout> |