Skip to content

Commit

Permalink
Revert "Update sample app with Today button and add test for month li…
Browse files Browse the repository at this point in the history
…stener on scrollToDate()"

This reverts commit c9e18d3.
  • Loading branch information
kizitonwose committed Aug 16, 2020
1 parent c9e18d3 commit 0e5e59e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class CalenderViewTests {
val homeScreenRule = ActivityTestRule(HomeActivity::class.java, true, false)

private val currentMonth = YearMonth.now()
private val today = LocalDate.now()

@Before
fun setup() {
Expand Down Expand Up @@ -225,28 +224,6 @@ class CalenderViewTests {
assertEquals(targetCalMonth?.yearMonth, targetMonth)
}

@Test
fun monthScrollListenerIsCalledWhenScrolledToDate() {
onView(withId(R.id.examplesRv)).perform(actionOnItemAtPosition<RecyclerView.ViewHolder>(0, click()))

val calendarView = findFragment<Example1Fragment>().findViewById<CalendarView>(R.id.exOneCalendar)

val targetDay = today.plusDays(60)

var targetCalMonth: CalendarMonth? = null
calendarView.monthScrollListener = { month ->
targetCalMonth = month
}

homeScreenRule.runOnUiThread {
calendarView.scrollToDate(targetDay)
}

sleep(5000) // Enough time for smooth scrolling animation.

assertEquals(targetDay.yearMonth, targetCalMonth?.yearMonth)
}

@Test
fun findVisibleDaysAndMonthsWorksOnVerticalOrientation() {
onView(withId(R.id.examplesRv)).perform(actionOnItemAtPosition<RecyclerView.ViewHolder>(1, click()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ class Example1Fragment : BaseFragment(R.layout.example_1_fragment), HasToolbar {
animator.duration = 250
animator.start()
}

binding.todayButton.setOnClickListener {
binding.exOneCalendar.scrollToDate(LocalDate.now())
}
}

override fun onStart() {
Expand Down
10 changes: 0 additions & 10 deletions sample/src/main/res/layout/example_1_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@
android:textSize="18sp"
android:layout_gravity="bottom|center_horizontal" />

<Button
android:id="@+id/todayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/today"
android:textSize="18sp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="86dp"
style="@style/Widget.AppCompat.Button.Borderless"/>

</FrameLayout>


Expand Down
1 change: 0 additions & 1 deletion sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@
<string name="end_date">End date</string>
<string name="clear">Clear</string>
<string name="week_mode">Week mode</string>
<string name="today">Today</string>

</resources>

0 comments on commit 0e5e59e

Please sign in to comment.