adding a helper function for setting integer bits

This commit is contained in:
tibbi
2018-11-15 12:22:19 +01:00
parent e6ab8282c9
commit 5221f75941
4 changed files with 5 additions and 10 deletions

View File

@@ -52,7 +52,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.3.15' implementation 'com.simplemobiletools:commons:5.3.16'
implementation 'joda-time:joda-time:2.10.1' implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.multidex:multidex:2.0.0' implementation 'androidx.multidex:multidex:2.0.0'

View File

@@ -765,7 +765,7 @@ class EventActivity : SimpleActivity() {
reminder3Minutes = reminder3 reminder3Minutes = reminder3
repeatInterval = mRepeatInterval repeatInterval = mRepeatInterval
importId = newImportId importId = newImportId
flags = if (event_all_day.isChecked) (mEvent.flags.addBit(FLAG_ALL_DAY)) else (mEvent.flags.removeBit(FLAG_ALL_DAY)) flags = mEvent.flags.addBitIf(event_all_day.isChecked, FLAG_ALL_DAY)
repeatLimit = if (repeatInterval == 0) 0 else mRepeatLimit repeatLimit = if (repeatInterval == 0) 0 else mRepeatLimit
repeatRule = mRepeatRule repeatRule = mRepeatRule
eventType = newEventType eventType = newEventType

View File

@@ -7,8 +7,7 @@ import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.simplemobiletools.calendar.pro.extensions.seconds import com.simplemobiletools.calendar.pro.extensions.seconds
import com.simplemobiletools.calendar.pro.helpers.* import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.commons.extensions.addBit import com.simplemobiletools.commons.extensions.addBitIf
import com.simplemobiletools.commons.extensions.removeBit
import org.joda.time.DateTime import org.joda.time.DateTime
import java.io.Serializable import java.io.Serializable
@@ -157,11 +156,7 @@ data class Event(
var isPastEvent: Boolean var isPastEvent: Boolean
get() = flags and FLAG_IS_PAST_EVENT != 0 get() = flags and FLAG_IS_PAST_EVENT != 0
set(isPastEvent) { set(isPastEvent) {
flags = if (isPastEvent) { flags = flags.addBitIf(isPastEvent, FLAG_IS_PAST_EVENT)
flags.addBit(FLAG_IS_PAST_EVENT)
} else {
flags.removeBit(FLAG_IS_PAST_EVENT)
}
} }
var color: Int = 0 var color: Int = 0

View File

@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.0' ext.kotlin_version = '1.3.10'
repositories { repositories {
google() google()