Skip to content

Commit

Permalink
Fix lint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Budnik authored and Mateusz Budnik committed Nov 8, 2023
1 parent 905a3ff commit ba4ff43
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 70 deletions.
15 changes: 8 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ plugins {
}

android {
compileSdk 33
compileSdk 34

defaultConfig {
applicationId "com.mabn.calendar"
minSdk 26
targetSdk 32
targetSdk 34
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -43,19 +43,20 @@ android {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
namespace 'com.mabn.calendar'
}

dependencies {
implementation(project(path:":library"))
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose:1.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.8.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mabn.calendar">
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/mabn/calendar/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.runtime.Composable

private val DarkColorPalette = darkColors(
private val _darkColorPalette = darkColors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200
)

private val LightColorPalette = lightColors(
private val _lightColorPalette = lightColors(
primary = MintGreen,
primaryVariant = TeaGreen,
secondary = Teal200,
Expand All @@ -31,9 +31,9 @@ private val LightColorPalette = lightColors(
@Composable
fun CalendarTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) {
DarkColorPalette
_darkColorPalette
} else {
LightColorPalette
_lightColorPalette
}

MaterialTheme(
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="beige">#FFF2F5DE</color>
<color name="medium_aquamarine">#FF86E7B8</color>
</resources>
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
buildscript {
ext {
compose_version = '1.2.1'
compose_version = '1.5.4'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
id 'org.jetbrains.kotlinx.kover' version "0.6.0"
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Sep 19 11:07:20 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
30 changes: 15 additions & 15 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
PRG="$link";
else
PRG=`dirname "$PRG"`"/$link"
fi
Expand Down Expand Up @@ -68,16 +68,16 @@ nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
;
Darwin* )
darwin=true
;;
;
MINGW* )
msys=true
;;
;
NONSTOP* )
nonstop=true
;;
;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
Expand Down Expand Up @@ -159,16 +159,16 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;
1) set -- "$args0" ;
2) set -- "$args0" "$args1" ;
3) set -- "$args0" "$args1" "$args2" ;
4) set -- "$args0" "$args1" "$args2" "$args3" ;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;
esac
fi

Expand Down
18 changes: 9 additions & 9 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ plugins {
}

android {
compileSdk 33
compileSdk 34

defaultConfig {
minSdk 26
targetSdk 32

targetSdk 34
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -33,24 +32,25 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'com.mabn.calendarlibrary'
}

dependencies {

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "com.google.accompanist:accompanist-pager:0.23.1"
implementation "com.google.accompanist:accompanist-flowlayout:0.26.4-beta"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
// lifecycle
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2"


// Compose testing dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.test.*
import androidx.compose.ui.test.junit4.createComposeRule
import com.mabn.calendarlibrary.component.DayView
import com.mabn.calendarlibrary.core.calendarDefaultTheme
import com.mabn.calendarlibrary.utils.getBackgroundColor
import org.junit.*
import org.junit.runners.MethodSorters
Expand All @@ -26,8 +27,8 @@ internal class DayViewTest {
composeTestRule.setContent {
Surface(Modifier.background(Color.White)){
Row {
DayView(todayDate, onDayClick = {})
DayView(tomorrowDate, onDayClick = {})
DayView(todayDate, onDayClick = {}, theme = calendarDefaultTheme)
DayView(tomorrowDate, onDayClick = {}, theme = calendarDefaultTheme)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.mabn.calendarlibrary">
<manifest>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.lifecycle.viewModelScope
import com.mabn.calendarlibrary.core.CalendarIntent
import com.mabn.calendarlibrary.core.Period
import com.mabn.calendarlibrary.utils.*
import com.mabn.calendarlibrary.utils.getMonthStartDate
import com.mabn.calendarlibrary.utils.getNextDates
import com.mabn.calendarlibrary.utils.getRemainingDatesInWeek
import com.mabn.calendarlibrary.utils.getWeekStartDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@ package com.mabn.calendarlibrary

import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.*
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import java.time.YearMonth
import androidx.lifecycle.viewmodel.compose.viewModel
import com.mabn.calendarlibrary.core.CalendarIntent
import com.mabn.calendarlibrary.core.Period
import com.mabn.calendarlibrary.utils.getWeekStartDate
import com.mabn.calendarlibrary.component.InlineCalendar
import com.mabn.calendarlibrary.component.MonthText
import com.mabn.calendarlibrary.component.MonthViewCalendar
import com.mabn.calendarlibrary.component.ToggleExpandCalendarButton
import com.mabn.calendarlibrary.core.CalendarIntent
import com.mabn.calendarlibrary.core.CalendarTheme
import com.mabn.calendarlibrary.core.Period
import com.mabn.calendarlibrary.core.calendarDefaultTheme
import com.mabn.calendarlibrary.utils.yearMonth
import com.mabn.calendarlibrary.utils.getWeekStartDate
import java.time.LocalDate
import java.time.YearMonth

@Composable
fun ExpandableCalendar(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.mabn.calendarlibrary.component

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.unit.dp
import com.google.accompanist.flowlayout.FlowColumn
import com.google.accompanist.flowlayout.FlowRow
import com.mabn.calendarlibrary.core.CalendarTheme
import com.mabn.calendarlibrary.utils.dayViewModifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ internal fun LocalDate.getWeekStartDate(weekStartDay: DayOfWeek = DayOfWeek.MOND
return date
}

/**
* @return first date of the month
*/
internal fun LocalDate.getMonthStartDate(): LocalDate {
return LocalDate.of(this.year, this.month, 1)
}

/**
* @return list of dates remaining in the week
*/
Expand Down

0 comments on commit ba4ff43

Please sign in to comment.