diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt index 679f74199..e7aac1b7a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt @@ -1,6 +1,8 @@ package com.simplemobiletools.calendar.activities import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.adapters.EventTypeAdapter import com.simplemobiletools.calendar.dialogs.NewEventTypeDialog @@ -19,11 +21,7 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteItemsListener { setContentView(R.layout.activity_manage_event_types) getEventTypes() - manage_event_types_fab.setOnClickListener { - showEventTypeDialog() - } - - updateTextColors(manage_event_types_coordinator) + updateTextColors(manage_event_types_list) } private fun showEventTypeDialog(eventType: EventType? = null) { @@ -42,6 +40,19 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteItemsListener { } } + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.menu_event_types, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.add_event_type -> showEventTypeDialog() + else -> return super.onOptionsItemSelected(item) + } + return true + } + override fun deleteItems(ids: ArrayList) { if (ids.contains(DBHelper.REGULAR_EVENT_TYPE_ID)) { toast(R.string.cannot_delete_default_type) diff --git a/app/src/main/res/layout/activity_manage_event_types.xml b/app/src/main/res/layout/activity_manage_event_types.xml index 67f9209b3..c897ce022 100644 --- a/app/src/main/res/layout/activity_manage_event_types.xml +++ b/app/src/main/res/layout/activity_manage_event_types.xml @@ -1,26 +1,9 @@ - - - - - - - + android:layout_height="match_parent" + android:clipToPadding="false" + app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> diff --git a/app/src/main/res/menu/menu_event_types.xml b/app/src/main/res/menu/menu_event_types.xml new file mode 100644 index 000000000..22289485b --- /dev/null +++ b/app/src/main/res/menu/menu_event_types.xml @@ -0,0 +1,9 @@ + + + +