Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/upgrade-versions-and-small-fixes #72

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile

buildscript {
repositories {
mavenCentral()
google()
maven { url = uri("https://repository.quickbirdstudios.com/repository/public") }
google()
mavenCentral()
}

dependencies {
Expand All @@ -14,8 +14,8 @@ buildscript {

allprojects {
repositories {
mavenCentral()
google()
mavenCentral()
}

tasks.withType(KotlinJvmCompile::class.java).all {
Expand Down
6 changes: 2 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@


plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
google()
mavenCentral()
}

dependencies {
implementation(gradleApi())
implementation(localGroovy())
implementation("com.android.tools.build:gradle:4.0.2")
implementation("com.android.tools.build:gradle:8.0.2")
}
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
object Versions {

const val kotlin = "1.3.50"
const val coroutines = "1.3.0"
const val kotlin = "1.8.20"
const val coroutines = "1.7.0"
const val test = "1.1.1"
const val jUnit = "5.5.2"
const val jUnitPlatform = "1.5.2"
const val lottie = "3.0.7"
const val espresso = "3.1.0"

object AndroidSupport {
const val appCompat = "1.0.0"
const val constraintLayout = "1.1.3"
const val appCompat = "1.3.0"
const val constraintLayout = "2.0.4"
const val annotation = "1.0.0"
const val recyclerView = "1.0.0"
const val recyclerView = "1.2.1"
}

object PlayServices {
const val maps = "17.0.0"
}

object Google {
const val material = "1.2.1"
const val material = "1.4.0"
}
}

Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Project.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
object Project {
object Android {
const val compileSdkVersion = 28
const val targetSdkVersion = 28
const val minSdkVersion = 21
const val compileSdkVersion = "android-32"
const val targetSdkVersion = "32"
const val minSdkVersion = "21"
const val testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}
21 changes: 15 additions & 6 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ import com.quickbirdstudios.surveykit.ApiKeys.yandexMapsKey

plugins {
id("com.android.application")
id("kotlin-parcelize")
kotlin("android")
id("org.jetbrains.kotlin.android.extensions")
}

androidExtensions { isExperimental = true }

android {
compileSdkVersion(Project.Android.compileSdkVersion)
compileSdkVersion = Project.Android.compileSdkVersion

defaultConfig {
versionName = Library.version
versionCode = 1
minSdkVersion(Project.Android.minSdkVersion)
minSdkPreview = Project.Android.minSdkVersion
targetSdkVersion(Project.Android.targetSdkVersion)
testInstrumentationRunner = Project.Android.testInstrumentationRunner
resValue("string", "google_api_key", googleMapsKey())
resValue("string", "yandex_api_key", yandexMapsKey())
}

buildFeatures {
viewBinding = true
}

packagingOptions {
exclude("META-INF/*kotlin*")
jniLibs {
excludes += setOf("META-INF/*kotlin*")
}
resources {
excludes += setOf("META-INF/*kotlin*")
}
}
namespace = "com.quickbirdstudios.example"
}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions example/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.quickbirdstudios.example">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
Expand All @@ -27,7 +26,8 @@
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity"
tools:replace="android:appComponentFactory"
tools:targetApi="p">
tools:targetApi="p"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import android.os.Parcelable
import android.util.Log
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.quickbirdstudios.example.R
import com.quickbirdstudios.example.databinding.MainActivityBinding
import com.quickbirdstudios.surveykit.AnswerFormat
import com.quickbirdstudios.surveykit.FinishReason
import com.quickbirdstudios.surveykit.Identifier
Expand All @@ -36,16 +36,13 @@ import kotlinx.android.parcel.Parcelize

class MainActivity : AppCompatActivity() {

private lateinit var survey: SurveyView
private lateinit var container: ViewGroup
private lateinit var binding: MainActivityBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_activity)

survey = findViewById(R.id.survey_view)
container = findViewById(R.id.surveyContainer)
setupSurvey(survey)
binding = MainActivityBinding.inflate(layoutInflater)
setContentView(binding.root)
setupSurvey(binding.surveyView)
}

private fun setupSurvey(surveyView: SurveyView) {
Expand Down Expand Up @@ -194,7 +191,7 @@ class MainActivity : AppCompatActivity() {
if (reason == FinishReason.Completed) {
taskResult.results.forEach { stepResult ->
Log.e("ASDF", "answer ${stepResult.results.firstOrNull()}")
container.removeAllViews()
binding.surveyContainer.removeAllViews()
}
}
}
Expand All @@ -216,7 +213,7 @@ class MainActivity : AppCompatActivity() {

override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) {
survey.backPressed()
binding.surveyView.backPressed()
true
} else false
}
Expand Down
8 changes: 4 additions & 4 deletions example/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/surveyContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/surveyContainer">
android:orientation="vertical">

<com.quickbirdstudios.surveykit.survey.SurveyView
android:id="@+id/survey_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
android:layout_height="match_parent">

</com.quickbirdstudios.surveykit.survey.SurveyView>
</LinearLayout>
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
repositoryName=SurveyKit
projectSummary=Create beautiful surveys on Android
projectSummary=Create beautiful surveys on Android
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Apr 01 15:38:24 CEST 2019
#Thu Jun 01 14:36:42 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
buildscript {
repositories {
mavenCentral()
google()
mavenCentral()
maven { url 'https://repository.quickbirdstudios.com/repository/public' }
}

dependencies {
classpath("com.quickbirdstudios:gradle-publishing:0.1.0")
classpath("com.android.tools.build:gradle:8.0.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20")
}
}

Expand Down
15 changes: 9 additions & 6 deletions survey/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
plugins {
id("com.android.library")
kotlin("android")
id("org.jetbrains.kotlin.android.extensions")
id("gradle-publishing")
id("kotlin-parcelize")
}

androidExtensions { isExperimental = true }

android {
compileSdkVersion(Project.Android.compileSdkVersion)
compileSdkVersion = Project.Android.compileSdkVersion

defaultConfig {
version = Library.version
minSdkVersion(Project.Android.minSdkVersion)
targetSdkVersion(Project.Android.targetSdkVersion)
minSdkPreview = Project.Android.minSdkVersion
targetSdkPreview = Project.Android.targetSdkVersion
testInstrumentationRunner = Project.Android.testInstrumentationRunner
}

buildFeatures {
viewBinding = true
}

testOptions {
animationsDisabled = true
}
namespace = "com.quickbirdstudios.surveykit"
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions survey/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.quickbirdstudios.surveykit">
</manifest>
<manifest />

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ sealed class AnswerFormat {
check(defaultValue == null || choices.contains(defaultValue)) {
throw IllegalStateException(
"${ValuePickerAnswerFormat::class.simpleName}:" +
"${ValuePickerAnswerFormat::defaultValue.name}($defaultValue) " +
"has to be part of " + ValuePickerAnswerFormat::choices.name + "($choices)"
"${ValuePickerAnswerFormat::defaultValue.name}($defaultValue) " +
"has to be part of " + ValuePickerAnswerFormat::choices.name + "($choices)"
)
}
}
Expand Down Expand Up @@ -151,15 +151,17 @@ sealed class AnswerFormat {
}

companion object {
operator fun invoke(): DateTimeAnswerFormat = DateTimeAnswerFormat(
defaultValue = DateTime(
day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH),
month = Calendar.getInstance().get(Calendar.MONTH),
year = Calendar.getInstance().get(Calendar.YEAR),
hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY),
minute = Calendar.getInstance().get(Calendar.MINUTE)
operator fun invoke(): DateTimeAnswerFormat = with(Calendar.getInstance()) {
DateTimeAnswerFormat(
defaultValue = DateTime(
day = get(Calendar.DAY_OF_MONTH),
month = get(Calendar.MONTH),
year = get(Calendar.YEAR),
hour = get(Calendar.HOUR_OF_DAY),
minute = get(Calendar.MINUTE)
)
)
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.quickbirdstudios.surveykit.backend.helpers.extensions

import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.Manifest.permission.ACCESS_FINE_LOCATION
import android.content.Context
import android.content.pm.PackageManager.PERMISSION_GRANTED
import androidx.core.app.ActivityCompat.checkSelfPermission

fun Context.isLocationPermissionGranted(): Boolean =
checkSelfPermission(this, ACCESS_FINE_LOCATION) == PERMISSION_GRANTED &&
checkSelfPermission(this, ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface TaskNavigator {
return history.peek()
}

fun hasPreviousStep() : Boolean {
fun hasPreviousStep(): Boolean {
val previousStep = peekHistory()
return previousStep != null
}
Expand All @@ -48,12 +48,8 @@ interface TaskNavigator {
companion object {
operator fun invoke(task: Task): TaskNavigator =
when (task) {
is OrderedTask -> OrderedTaskNavigator(
task
)
is NavigableOrderedTask -> NavigableOrderedTaskNavigator(
task
)
is OrderedTask -> OrderedTaskNavigator(task)
is NavigableOrderedTask -> NavigableOrderedTaskNavigator(task)
else -> throw NotImplementedError()
}
}
Expand Down
Loading