Fix event tap ui

This commit is contained in:
Tommaso Berlose
2020-05-04 19:28:06 +02:00
parent 6279846cea
commit dd450443c8
18 changed files with 102 additions and 105 deletions

View File

@ -147,9 +147,9 @@ class CalendarSettingsFragment : Fragment() {
}
})
viewModel.eventAppName.observe(viewLifecycleOwner, Observer {
viewModel.openEventDetails.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
event_app_label.text = if (it != "") it else getString(R.string.default_calendar_app)
open_event_details_label.text = if (it) getString(R.string.default_event_app) else getString(R.string.default_calendar_app)
}
})
@ -301,8 +301,15 @@ class CalendarSettingsFragment : Fragment() {
}
}
action_event_app.setOnClickListener {
startActivityForResult(Intent(requireContext(), ChooseApplicationActivity::class.java), RequestCode.EVENT_APP_REQUEST_CODE.code)
action_open_event_details.setOnClickListener {
if (Preferences.showEvents) {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_event_app_title)).setSelectedValue(Preferences.openEventDetails)
.addItem(getString(R.string.default_event_app), true)
.addItem(getString(R.string.default_calendar_app), false)
.addOnSelectItemListener { value ->
Preferences.openEventDetails = value
}.show()
}
}
action_calendar_app.setOnClickListener {

View File

@ -21,10 +21,9 @@ class MainViewModel : ViewModel() {
val showDiffTime = Preferences.asLiveData(Preferences::showDiffTime)
val showDeclinedEvents = Preferences.asLiveData(Preferences::showDeclinedEvents)
val showNextEvent = Preferences.asLiveData(Preferences::showNextEvent)
val openEventDetails = Preferences.asLiveData(Preferences::openEventDetails)
val calendarAppName = Preferences.asLiveData(Preferences::calendarAppName)
val eventAppName = Preferences.asLiveData(Preferences::eventAppName)
// Clock Settings
val showClock = Preferences.asLiveData(Preferences::showClock)

View File

@ -156,7 +156,8 @@ class MainWidget : AppWidgetProvider() {
val mapIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address), 0)
views.setOnClickPendingIntent(R.id.second_row_rect, mapIntent)
} else {
views.setOnClickPendingIntent(R.id.second_row_rect, pIntent)
val pIntentDetail = PendingIntent.getActivity(context, widgetID, IntentHelper.getEventIntent(context, nextEvent, forceEventDetails = true), 0)
views.setOnClickPendingIntent(R.id.second_row_rect, pIntentDetail)
}
views.setImageViewBitmap(R.id.next_event_rect, BitmapHelper.getBitmapFromView(v.next_event, draw = false))