Filter
This commit is contained in:
parent
7114c6199a
commit
5026415e45
@ -122,7 +122,14 @@ class BeersFragment : Fragment(), BeersRepository.Listener, BeerRecyclerAdapter.
|
|||||||
}
|
}
|
||||||
val year = if (type == FILTERTYPE.SINCE) repo.filter.brewedAfterYear else repo.filter.brewedBeforeYear
|
val year = if (type == FILTERTYPE.SINCE) repo.filter.brewedAfterYear else repo.filter.brewedBeforeYear
|
||||||
val month = if (type == FILTERTYPE.SINCE) repo.filter.brewedAfterMonth else repo.filter.brewedBeforeMonth
|
val month = if (type == FILTERTYPE.SINCE) repo.filter.brewedAfterMonth else repo.filter.brewedBeforeMonth
|
||||||
val dpd = DatePickerDialog(requireContext(), listener, year, month - 1,1)
|
val dpd = DatePickerDialog(requireContext(), R.style.beer_date_picker_dialog, listener, year, month - 1,1)
|
||||||
|
// Try to hide unused day spinner
|
||||||
|
val daySpinnerId = Resources.getSystem().getIdentifier("day", "id", "android")
|
||||||
|
if (daySpinnerId != 0) {
|
||||||
|
val daySpinnerView = dpd.datePicker.findViewById<View>(daySpinnerId)
|
||||||
|
if (daySpinnerView != null)
|
||||||
|
daySpinnerView.visibility = View.GONE
|
||||||
|
}
|
||||||
dpd.show()
|
dpd.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,16 @@
|
|||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
</style>
|
||||||
|
|
||||||
|
<!-- Date picker style -->
|
||||||
|
<style name="beer_date_picker_dialog" parent="android:Theme.Material.Dialog">
|
||||||
|
<item name="android:datePickerStyle">@style/beer_date_picker</item>
|
||||||
|
<item name="android:colorAccent">@color/accent_500</item>
|
||||||
|
<item name="android:colorControlNormal">@color/accent_500</item>
|
||||||
|
</style>
|
||||||
|
<style name="beer_date_picker" parent="android:Widget.DatePicker">
|
||||||
|
<item name="android:datePickerMode">spinner</item>
|
||||||
|
<item name="android:calendarViewShown">false</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user