update event type at event activity
This commit is contained in:
parent
80f38ddcb9
commit
e41010603f
|
@ -29,6 +29,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
private var mReminder3Minutes = 0
|
||||
private var mRepeatInterval = 0
|
||||
private var mRepeatLimit = 0
|
||||
private var mEventType = DBHelper.REGULAR_EVENT_ID
|
||||
private var mDialogTheme = 0
|
||||
|
||||
lateinit var mEventStartDateTime: DateTime
|
||||
|
@ -83,7 +84,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
event_reminder_2.setOnClickListener { showReminder2Dialog() }
|
||||
event_reminder_3.setOnClickListener { showReminder3Dialog() }
|
||||
|
||||
event_type.setOnClickListener { }
|
||||
event_type.setOnClickListener { }
|
||||
|
||||
if (mEvent.flags and FLAG_ALL_DAY != 0)
|
||||
event_all_day.toggle()
|
||||
|
@ -104,6 +105,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
mReminder3Minutes = mEvent.reminder3Minutes
|
||||
mRepeatInterval = mEvent.repeatInterval
|
||||
mRepeatLimit = mEvent.repeatLimit
|
||||
mEventType = mEvent.eventType
|
||||
checkRepeatLimit(mRepeatInterval)
|
||||
}
|
||||
|
||||
|
@ -223,7 +225,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
}
|
||||
|
||||
private fun updateEventType() {
|
||||
|
||||
event_type.text = DBHelper.newInstance(applicationContext).getEventTypeTitle(mEventType)
|
||||
}
|
||||
|
||||
private fun getRepetitionToString(seconds: Int) = getString(when (seconds) {
|
||||
|
|
|
@ -226,6 +226,22 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
return -1
|
||||
}
|
||||
|
||||
fun getEventTypeTitle(id: Int): String {
|
||||
val cols = arrayOf(COL_TYPE_TITLE)
|
||||
val selection = "$COL_TYPE_ID = ?"
|
||||
val selectionArgs = arrayOf(id.toString())
|
||||
var cursor: Cursor? = null
|
||||
try {
|
||||
cursor = mDb.query(TYPES_TABLE_NAME, cols, selection, selectionArgs, null, null, null)
|
||||
if (cursor?.moveToFirst() == true) {
|
||||
return cursor.getStringValue(COL_TYPE_TITLE)
|
||||
}
|
||||
} finally {
|
||||
cursor?.close()
|
||||
}
|
||||
return context.resources.getString(R.string.regular_event)
|
||||
}
|
||||
|
||||
fun deleteEvents(ids: Array<String>) {
|
||||
val args = TextUtils.join(", ", ids)
|
||||
val selection = "$COL_ID IN ($args)"
|
||||
|
|
Loading…
Reference in New Issue