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 mReminder3Minutes = 0
|
||||||
private var mRepeatInterval = 0
|
private var mRepeatInterval = 0
|
||||||
private var mRepeatLimit = 0
|
private var mRepeatLimit = 0
|
||||||
|
private var mEventType = DBHelper.REGULAR_EVENT_ID
|
||||||
private var mDialogTheme = 0
|
private var mDialogTheme = 0
|
||||||
|
|
||||||
lateinit var mEventStartDateTime: DateTime
|
lateinit var mEventStartDateTime: DateTime
|
||||||
|
@ -104,6 +105,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
mReminder3Minutes = mEvent.reminder3Minutes
|
mReminder3Minutes = mEvent.reminder3Minutes
|
||||||
mRepeatInterval = mEvent.repeatInterval
|
mRepeatInterval = mEvent.repeatInterval
|
||||||
mRepeatLimit = mEvent.repeatLimit
|
mRepeatLimit = mEvent.repeatLimit
|
||||||
|
mEventType = mEvent.eventType
|
||||||
checkRepeatLimit(mRepeatInterval)
|
checkRepeatLimit(mRepeatInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +225,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateEventType() {
|
private fun updateEventType() {
|
||||||
|
event_type.text = DBHelper.newInstance(applicationContext).getEventTypeTitle(mEventType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRepetitionToString(seconds: Int) = getString(when (seconds) {
|
private fun getRepetitionToString(seconds: Int) = getString(when (seconds) {
|
||||||
|
|
|
@ -226,6 +226,22 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||||
return -1
|
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>) {
|
fun deleteEvents(ids: Array<String>) {
|
||||||
val args = TextUtils.join(", ", ids)
|
val args = TextUtils.join(", ", ids)
|
||||||
val selection = "$COL_ID IN ($args)"
|
val selection = "$COL_ID IN ($args)"
|
||||||
|
|
Loading…
Reference in New Issue