Skip to content

Commit

Permalink
-fix compatibility, min sdk 26 to 21
Browse files Browse the repository at this point in the history
  • Loading branch information
commandiron committed Dec 25, 2022
1 parent c1df1f3 commit 488c677
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {

defaultConfig {
applicationId "com.commandiron.wheelpickercompose"
minSdk 23
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.commandiron.wheelpickercompose

import android.os.Build
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.annotation.RequiresApi
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -23,11 +21,9 @@ import com.commandiron.wheel_picker_compose.WheelTimePicker
import com.commandiron.wheel_picker_compose.core.TimeFormat
import com.commandiron.wheel_picker_compose.core.WheelPickerDefaults
import com.commandiron.wheelpickercompose.ui.theme.WheelPickerComposeTheme
import java.sql.Time
import java.time.LocalDateTime

class MainActivity : ComponentActivity() {
@RequiresApi(Build.VERSION_CODES.O)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Expand Down
7 changes: 5 additions & 2 deletions wheel-picker-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
compileSdk 33

defaultConfig {
minSdk 23
minSdk 21
targetSdk 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -22,6 +22,7 @@ android {
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Expand All @@ -45,6 +46,8 @@ dependencies {
implementation "androidx.compose.material3:material3:1.0.0-alpha15"

implementation "dev.chrisbanes.snapper:snapper:0.3.0"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.6"
}

afterEvaluate {
Expand All @@ -55,7 +58,7 @@ afterEvaluate {

groupId = 'com.github.commandiron'
artifactId = 'wheel-picker-compose'
version = '1.1.7'
version = '1.1.8-alpha'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.commandiron.wheel_picker_compose

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
Expand All @@ -15,7 +13,6 @@ import com.commandiron.wheel_picker_compose.core.SelectorProperties
import com.commandiron.wheel_picker_compose.core.WheelPickerDefaults
import java.time.LocalDate

@RequiresApi(Build.VERSION_CODES.O)
@Composable
fun WheelDatePicker(
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.commandiron.wheel_picker_compose

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
Expand All @@ -16,7 +14,6 @@ import com.commandiron.wheel_picker_compose.core.TimeFormat
import com.commandiron.wheel_picker_compose.core.WheelPickerDefaults
import java.time.LocalDateTime

@RequiresApi(Build.VERSION_CODES.O)
@Composable
fun WheelDateTimePicker(
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.commandiron.wheel_picker_compose

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
Expand All @@ -16,7 +14,6 @@ import com.commandiron.wheel_picker_compose.core.TimeFormat
import com.commandiron.wheel_picker_compose.core.WheelPickerDefaults
import java.time.LocalTime

@RequiresApi(Build.VERSION_CODES.O)
@Composable
fun WheelTimePicker(
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.commandiron.wheel_picker_compose.core

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
Expand All @@ -19,7 +16,6 @@ import androidx.compose.ui.unit.dp
import java.text.DateFormatSymbols
import java.time.LocalDate

@RequiresApi(Build.VERSION_CODES.O)
@Composable
internal fun DefaultWheelDatePicker(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -214,7 +210,6 @@ internal fun DefaultWheelDatePicker(
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun isDateBefore(date: LocalDate, currentDate: LocalDate): Boolean{
return date.isBefore(currentDate)
}
Expand All @@ -237,7 +232,6 @@ private data class Year(
val index: Int
)

@RequiresApi(Build.VERSION_CODES.O)
internal fun calculateDayOfMonths(month: Int, year: Int): List<DayOfMonth> {

val isLeapYear = LocalDate.of(year, month, 1).isLeapYear
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.commandiron.wheel_picker_compose.core

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
Expand All @@ -19,7 +16,6 @@ import androidx.compose.ui.unit.dp
import java.time.LocalDateTime
import java.time.temporal.ChronoUnit

@RequiresApi(Build.VERSION_CODES.O)
@Composable
internal fun DefaultWheelDateTimePicker(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -155,7 +151,6 @@ internal fun DefaultWheelDateTimePicker(
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun isDateTimeBefore(date: LocalDateTime, currentDateTime: LocalDateTime): Boolean{
return date.isBefore(currentDateTime)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.commandiron.wheel_picker_compose.core

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
Expand All @@ -19,7 +17,6 @@ import androidx.compose.ui.unit.dp
import java.time.LocalTime
import java.time.temporal.ChronoUnit

@RequiresApi(Build.VERSION_CODES.O)
@Composable
internal fun DefaultWheelTimePicker(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -301,7 +298,6 @@ internal fun DefaultWheelTimePicker(
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun isTimeBefore(time: LocalTime, currentTime: LocalTime): Boolean{
return time.isBefore(currentTime)
}
Expand All @@ -321,7 +317,6 @@ private data class AmPmHour(
val index: Int
)

@RequiresApi(Build.VERSION_CODES.O)
internal fun localTimeToAmPmHour(localTime: LocalTime): Int {

if(
Expand Down Expand Up @@ -367,7 +362,6 @@ internal fun localTimeToAmPmHour(localTime: LocalTime): Int {
return localTime.hour
}

@RequiresApi(Build.VERSION_CODES.O)
private fun isBetween(localTime: LocalTime, startTime: LocalTime, endTime: LocalTime): Boolean {
return localTime in startTime..endTime
}
Expand Down Expand Up @@ -408,7 +402,6 @@ internal enum class AmPmValue {
AM, PM
}

@RequiresApi(Build.VERSION_CODES.O)
private fun amPmValueFromTime(time: LocalTime): AmPmValue {
return if(time.hour > 11) AmPmValue.PM else AmPmValue.AM
}
Expand Down

0 comments on commit 488c677

Please sign in to comment.