Skip to content

Commit

Permalink
Migration TextFields, Dropdown and Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Jan 15, 2023
1 parent 5dd5cdb commit 87f1eb3
Show file tree
Hide file tree
Showing 33 changed files with 543 additions and 314 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
}

namespace 'com.jeluchu.composer'

}

dependencies {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~
~ Copyright 2022 Jeluchu
~
Expand All @@ -17,7 +16,7 @@
android:supportsRtl="true">
<activity
android:name="com.jeluchu.composer.MainActivity"
android:exported="true" >
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/java/com/jeluchu/composer/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package com.jeluchu.composer

import android.os.Bundle
import android.widget.SearchView
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -34,8 +35,7 @@ import com.jeluchu.jchucomponents.ui.composables.cards.DebutCard
import com.jeluchu.jchucomponents.ui.composables.cards.PostCardTop
import com.jeluchu.jchucomponents.ui.composables.cards.StoryCard
import com.jeluchu.jchucomponents.ui.migration.sheets.BottomSheetWithCloseDialog
import com.jeluchu.jchucomponents.ui.migration.textfields.SearchView
import com.jeluchu.jchucomponents.ui.runtime.remember.rememberMutableStateOf
import com.jeluchu.jchucomponents.ui.composables.textfields.SearchTextField
import com.jeluchu.jchucomponents.ui.themes.darkPastelBlue

class MainActivity : ComponentActivity() {
Expand Down Expand Up @@ -66,7 +66,7 @@ class MainActivity : ComponentActivity() {
) {

val textState = remember { mutableStateOf(String.empty()) }
SearchView(state = textState)
SearchTextField(state = textState)

StoryCard(
modifier = Modifier.animateItem(),
Expand All @@ -75,7 +75,10 @@ class MainActivity : ComponentActivity() {
circleImage = R.drawable.ic_btnfavourite,
navigateToScreen = {
// SUPPORTED API LEVEL S+ CUSTOM TAB
context.openInCustomTab("https://developer.android.com/about/versions/marshmallow/android-6.0?hl=es-419", R.color.teal_700)
context.openInCustomTab(
"https://developer.android.com/about/versions/marshmallow/android-6.0?hl=es-419",
R.color.teal_700
)
}
)

Expand All @@ -96,7 +99,12 @@ class MainActivity : ComponentActivity() {
debutShape = RoundedCornerShape(topStart = 20.dp),
)

Image(bitmap = createQR(R.drawable.qr_logo, "https://www.google.es/")!!.asImageBitmap(), contentDescription = "")
Image(
bitmap = createQR(
R.drawable.qr_logo,
"https://www.google.es/"
)!!.asImageBitmap(), contentDescription = ""
)

DebutCard(
image = "https://i.picsum.photos/id/0/5616/3744.jpg?hmac=3GAAioiQziMGEtLbfrdbcoenXoWAW-zlyEAMkfEdBzQ",
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~
~ Copyright 2022 Jeluchu
~
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~
~ Copyright 2022 Jeluchu
~
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~
~ Copyright 2022 Jeluchu
~
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~
~ Copyright 2022 Jeluchu
~
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath libs.com.android.tools.build.gradle
classpath 'com.android.tools.build:gradle:7.4.0'
classpath libs.org.jetbrains.kotlin.kotlin.gradle.plugin
classpath libs.org.jetbrains.dokka.dokka.gradle.plugin
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ androidx-compose-material3 = "androidx.compose.material3:material3:1.0.1"
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidx-compose-runtime" }
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose-ui" }
androidx-compose-ui-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose-ui" }
androidx-compose-ui-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "androidx-compose-ui" }
androidx-compose-ui-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version = "1.3.3" }
androidx-constraintlayout-constraintlayout-compose = "androidx.constraintlayout:constraintlayout-compose:1.0.1"
org-jetbrains-kotlinx-kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "org-jetbrains-kotlinx" }
org-jetbrains-kotlinx-kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "org-jetbrains-kotlinx" }
Expand Down
10 changes: 2 additions & 8 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#
#
# Copyright 2022 Jeluchu
#
#

#Sat Aug 14 01:57:01 CEST 2021
#Fri Jan 13 08:13:24 CET 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
4 changes: 2 additions & 2 deletions jchucomponents-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~
~ Copyright 2022 Jeluchu
~
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ fun Failure?.handleFailure() = when (this) {
is Failure.NetworkConnection -> "Network Connection Failed: $errorMessage"
is Failure.ServerError -> "Server Failed (Code: $errorCode): $errorMessage"
is Failure.CustomError -> errorMessage
is Failure.LegacyError -> errorMessage
else -> "Unknow Error"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package com.jeluchu.jchucomponents.utils
import com.google.gson.TypeAdapter
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonWriter
import org.json.JSONObject
import java.io.IOException
import org.json.JSONObject

class JsonConverterObjectToString : TypeAdapter<String?>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

package com.jeluchu.jchucomponents.utils.location

import kotlin.math.*
import kotlin.math.atan2
import kotlin.math.cos
import kotlin.math.pow
import kotlin.math.sin
import kotlin.math.sqrt

/**
* Calculate distance between two points in latitude and longitude taking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class MediaPlayerHolder(context: Context) : PlayerAdapter {
} else 0F

override val currentTime: String
get() = if (mMediaPlayer != null) mMediaPlayer?.currentPosition?.milliSecondsToTimer().orEmpty()
get() = if (mMediaPlayer != null) mMediaPlayer?.currentPosition?.milliSecondsToTimer()
.orEmpty()
else ""

override val totalTime: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ package com.jeluchu.jchucomponents.utils.network

import com.jeluchu.jchucomponents.core.exception.Failure
import com.jeluchu.jchucomponents.utils.network.models.Resource
import java.io.IOException
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emitAll
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.map
import retrofit2.HttpException
import java.io.IOException

inline fun <ResultType, RequestType> networkBoundResource(
crossinline query: () -> Flow<ResultType>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
package com.jeluchu.jchucomponents.utils.network

import com.jeluchu.jchucomponents.utils.network.NetworkUtils.saveResponseBodyToFile
import okhttp3.ResponseBody
import java.io.File
import java.io.FileOutputStream
import okhttp3.ResponseBody

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ package com.jeluchu.jchucomponents.utils.network
import android.content.Context
import com.jeluchu.jchucomponents.utils.network.interceptors.DebugInterceptor
import com.jeluchu.jchucomponents.utils.network.interceptors.Interceptor
import java.util.concurrent.TimeUnit
import okhttp3.ConnectionPool
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Converter
import retrofit2.Retrofit
import java.util.concurrent.TimeUnit

object RetrofitClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
package com.jeluchu.jchucomponents.utils.network.interceptors

import android.os.Build
import okhttp3.Interceptor
import okhttp3.Response
import java.text.Normalizer
import java.util.*
import okhttp3.Interceptor
import okhttp3.Response

class Interceptor(
private val interceptorHeaders: InterceptorHeaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ object Validators {
fun String.isLocal() =
!isEmptyString() && (startsWith("http://") || startsWith("https://"))

fun CharSequence.isEmptyString(): Boolean = this.isEmpty() || this.toString().equals("null", true)
fun CharSequence.isEmptyString(): Boolean =
this.isEmpty() || this.toString().equals("null", true)
}
Loading

0 comments on commit 87f1eb3

Please sign in to comment.