From d74c352c131485d2f20d8e92c9d72d12510c83eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Sch=C3=BCrg?= Date: Sun, 10 Feb 2019 16:39:45 +0100 Subject: [PATCH] Fixed ktlint issues and added codeStyleConfig. --- .gitignore | 12 +++++++- .idea/codeStyles/Project.xml | 29 +++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 ++++ .../weekview/sample/SampleActivity.kt | 5 ++-- library/build.gradle | 4 +-- .../de/tobiasschuerg/weekview/data/Event.kt | 24 +++++++-------- .../weekview/util/DayOfWeekUtil.kt | 3 +- .../tobiasschuerg/weekview/view/EventView.kt | 8 ++--- .../weekview/view/WeekBackgroundView.kt | 2 +- .../tobiasschuerg/weekview/view/WeekView.kt | 2 +- .../weekview/util/DayOfWeekUtilTest.kt | 2 +- 11 files changed, 69 insertions(+), 27 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.gitignore b/.gitignore index 09b993d..5785fdb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,17 @@ + *.iml +.idea/libraries +.idea/misc.xml +.idea/modules.xml +.idea/runConfigurations.xml +.idea/vcs.xml +.idea/workspace.xml +.idea/caches/build_file_checksums.ser +.idea/gradle.xml + + .gradle /local.properties -/.idea .DS_Store /build /captures diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/java/de/tobiasschuerg/weekview/sample/SampleActivity.kt b/app/src/main/java/de/tobiasschuerg/weekview/sample/SampleActivity.kt index 3d86911..e5bfc3a 100644 --- a/app/src/main/java/de/tobiasschuerg/weekview/sample/SampleActivity.kt +++ b/app/src/main/java/de/tobiasschuerg/weekview/sample/SampleActivity.kt @@ -14,11 +14,11 @@ import de.tobiasschuerg.weekview.data.Event import de.tobiasschuerg.weekview.data.EventConfig import de.tobiasschuerg.weekview.data.WeekData import de.tobiasschuerg.weekview.view.EventView -import kotlinx.android.synthetic.main.activity_sample.* +import kotlinx.android.synthetic.main.activity_sample.week_view_foo import org.threeten.bp.DayOfWeek import org.threeten.bp.LocalDate import org.threeten.bp.LocalTime -import java.util.* +import java.util.Random import kotlin.math.absoluteValue class SampleActivity : AppCompatActivity() { @@ -30,7 +30,6 @@ class SampleActivity : AppCompatActivity() { private val minEventLength = 30 private val maxEventLength = 90 - private val data: WeekData by lazy { WeekData().apply { var startTime: LocalTime diff --git a/library/build.gradle b/library/build.gradle index 4b2c020..def9d95 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -10,8 +10,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 3 - versionName "1.4.0" + versionCode 4 + versionName "1.4.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/library/src/main/java/de/tobiasschuerg/weekview/data/Event.kt b/library/src/main/java/de/tobiasschuerg/weekview/data/Event.kt index 591a262..aa52d90 100644 --- a/library/src/main/java/de/tobiasschuerg/weekview/data/Event.kt +++ b/library/src/main/java/de/tobiasschuerg/weekview/data/Event.kt @@ -13,21 +13,21 @@ sealed class Event { abstract val shortTitle: String data class Single( - override val id: Long, - override val date: LocalDate, - override val title: String, - override val shortTitle: String, - val subTitle: String?, + override val id: Long, + override val date: LocalDate, + override val title: String, + override val shortTitle: String, + val subTitle: String?, - val day: DayOfWeek, - val startTime: LocalTime, - val endTime: LocalTime, + val day: DayOfWeek, + val startTime: LocalTime, + val endTime: LocalTime, - val upperText: String?, - val lowerText: String?, + val upperText: String?, + val lowerText: String?, - val textColor: Int, - val backgroundColor: Int + val textColor: Int, + val backgroundColor: Int ) : Event() { val duration: Duration = Duration.between(startTime, endTime) } diff --git a/library/src/main/java/de/tobiasschuerg/weekview/util/DayOfWeekUtil.kt b/library/src/main/java/de/tobiasschuerg/weekview/util/DayOfWeekUtil.kt index d9d7f7a..8d8b55d 100644 --- a/library/src/main/java/de/tobiasschuerg/weekview/util/DayOfWeekUtil.kt +++ b/library/src/main/java/de/tobiasschuerg/weekview/util/DayOfWeekUtil.kt @@ -2,7 +2,7 @@ package de.tobiasschuerg.weekview.util import org.threeten.bp.DayOfWeek import org.threeten.bp.temporal.WeekFields -import java.util.* +import java.util.Locale internal object DayOfWeekUtil { @@ -84,5 +84,4 @@ internal object DayOfWeekUtil { else -> throw IllegalStateException("$firstDayOfTheWeek das is not supported as start day") } } - } \ No newline at end of file diff --git a/library/src/main/java/de/tobiasschuerg/weekview/view/EventView.kt b/library/src/main/java/de/tobiasschuerg/weekview/view/EventView.kt index 068598a..4326b4a 100644 --- a/library/src/main/java/de/tobiasschuerg/weekview/view/EventView.kt +++ b/library/src/main/java/de/tobiasschuerg/weekview/view/EventView.kt @@ -24,10 +24,10 @@ import de.tobiasschuerg.weekview.util.toLocalString /** this view is only constructed during runtime. */ @SuppressLint("ViewConstructor") class EventView( - context: Context, - val event: Event.Single, - val config: EventConfig, - var scalingFactor: Float = 1f + context: Context, + val event: Event.Single, + val config: EventConfig, + var scalingFactor: Float = 1f ) : View(context) { diff --git a/library/src/main/java/de/tobiasschuerg/weekview/view/WeekBackgroundView.kt b/library/src/main/java/de/tobiasschuerg/weekview/view/WeekBackgroundView.kt index 84fb31d..d90a5e3 100644 --- a/library/src/main/java/de/tobiasschuerg/weekview/view/WeekBackgroundView.kt +++ b/library/src/main/java/de/tobiasschuerg/weekview/view/WeekBackgroundView.kt @@ -17,7 +17,7 @@ import org.threeten.bp.LocalTime import org.threeten.bp.format.TextStyle import org.threeten.bp.temporal.ChronoUnit import org.threeten.bp.temporal.WeekFields -import java.util.* +import java.util.Locale import kotlin.math.roundToInt internal class WeekBackgroundView constructor(context: Context) : View(context) { diff --git a/library/src/main/java/de/tobiasschuerg/weekview/view/WeekView.kt b/library/src/main/java/de/tobiasschuerg/weekview/view/WeekView.kt index 376dd62..7a27c82 100644 --- a/library/src/main/java/de/tobiasschuerg/weekview/view/WeekView.kt +++ b/library/src/main/java/de/tobiasschuerg/weekview/view/WeekView.kt @@ -21,7 +21,7 @@ import org.threeten.bp.DayOfWeek import org.threeten.bp.Duration import org.threeten.bp.LocalDate import org.threeten.bp.LocalTime -import java.util.* +import java.util.ArrayList import kotlin.math.roundToInt class WeekView(context: Context, attributeSet: AttributeSet) : RelativeLayout(context, attributeSet) { diff --git a/library/src/test/java/de/tobiasschuerg/weekview/util/DayOfWeekUtilTest.kt b/library/src/test/java/de/tobiasschuerg/weekview/util/DayOfWeekUtilTest.kt index 7b9d719..beb4701 100644 --- a/library/src/test/java/de/tobiasschuerg/weekview/util/DayOfWeekUtilTest.kt +++ b/library/src/test/java/de/tobiasschuerg/weekview/util/DayOfWeekUtilTest.kt @@ -3,7 +3,7 @@ package de.tobiasschuerg.weekview.util import org.junit.Assert.assertEquals import org.junit.Test import org.threeten.bp.DayOfWeek -import java.util.* +import java.util.Locale class DayOfWeekUtilTest {