From 2622f2f68fcf77611ef84b8dbe9eefdfa8ed5621 Mon Sep 17 00:00:00 2001 From: Alen Ajam Date: Fri, 4 Oct 2024 15:38:32 +0200 Subject: [PATCH] chore: update project to latest dependencies --- app/build.gradle | 3 +- build.gradle | 6 ++-- core/aosp/build.gradle.kts | 1 + feature/callDetail/build.gradle.kts | 1 - .../feature/callDetail/CallDetailFragment.kt | 3 -- .../feature/callDetail/RecentsAdapter.kt | 34 ------------------- feature/calls/build.gradle.kts | 1 - .../feature/calls/RecentsAdapter.kt | 34 ------------------- feature/contacts/build.gradle.kts | 1 - .../feature/contacts/CommonUtils.kt | 21 +++--------- .../feature/contacts/ContactAdapter.java | 13 ------- feature/contactsSearch/build.gradle.kts | 1 - .../contactsSearch/SearchContactsAdapter.kt | 29 ---------------- gradle.properties | 1 - gradle/wrapper/gradle-wrapper.properties | 4 +-- 15 files changed, 11 insertions(+), 142 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4e8597e..b7cff6d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -93,7 +93,6 @@ dependencies { implementation 'com.google.android.material:material:1.10.0' implementation 'com.google.code.gson:gson:2.9.0' - implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' implementation 'com.google.dagger:hilt-android:2.48.1' kapt 'com.google.dagger:hilt-compiler:2.48.1' @@ -102,6 +101,8 @@ dependencies { testImplementation 'com.google.dagger:hilt-android-testing:2.48.1' kaptTest 'com.google.dagger:hilt-compiler:2.48.1' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + testImplementation 'junit:junit:4.13.2' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' } diff --git a/build.gradle b/build.gradle index 1b021e5..d5d51a3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.21' + ext.kotlin_version = '2.0.20' repositories { google() jcenter() @@ -9,7 +9,7 @@ buildscript { } dependencies { classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.7.5' - classpath 'com.android.tools.build:gradle:8.1.4' + classpath 'com.android.tools.build:gradle:8.7.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.dagger:hilt-android-gradle-plugin:2.48.1' } @@ -23,8 +23,6 @@ allprojects { repositories { google() jcenter() - maven { url 'https://jitpack.io' } - maven { url 'https://dl.bintray.com/amulyakhare/maven' } } } diff --git a/core/aosp/build.gradle.kts b/core/aosp/build.gradle.kts index f2e82d9..48ebf34 100644 --- a/core/aosp/build.gradle.kts +++ b/core/aosp/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") implementation("com.google.guava:guava:21.0") + implementation ("com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava") } kotlin { diff --git a/feature/callDetail/build.gradle.kts b/feature/callDetail/build.gradle.kts index 1641c25..e54d78b 100644 --- a/feature/callDetail/build.gradle.kts +++ b/feature/callDetail/build.gradle.kts @@ -63,7 +63,6 @@ dependencies { implementation("androidx.preference:preference-ktx:1.2.1") implementation("androidx.recyclerview:recyclerview:1.3.2") - implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1") implementation("com.squareup.picasso:picasso:2.71828") implementation("org.ocpsoft.prettytime:prettytime:4.0.1.Final") } diff --git a/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/CallDetailFragment.kt b/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/CallDetailFragment.kt index 9cce89d..bafe99c 100644 --- a/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/CallDetailFragment.kt +++ b/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/CallDetailFragment.kt @@ -12,7 +12,6 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager -import com.amulyakhare.textdrawable.util.ColorGenerator import com.squareup.picasso.Picasso import com.squareup.picasso.Transformation import dagger.hilt.android.AndroidEntryPoint @@ -35,7 +34,6 @@ private val colorList = listOf( Color.parseColor("#EF4423"), Color.parseColor("#328AF0") ) -private val generator = ColorGenerator.create(colorList) @AndroidEntryPoint class CallDetailFragment : Fragment(), View.OnClickListener { @@ -136,7 +134,6 @@ class CallDetailFragment : Fragment(), View.OnClickListener { Picasso.get() .load(call.contactInfo.photoUri) - .placeholder(context.getContactImagePlaceholder(call, generator)) .transform(circleTransform) .into(binding.contactIcon) } diff --git a/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/RecentsAdapter.kt b/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/RecentsAdapter.kt index 8b34f77..9657979 100644 --- a/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/RecentsAdapter.kt +++ b/feature/callDetail/src/main/java/dev/alenajam/opendialer/feature/callDetail/RecentsAdapter.kt @@ -18,8 +18,6 @@ import androidx.core.content.ContextCompat import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import com.amulyakhare.textdrawable.TextDrawable -import com.amulyakhare.textdrawable.util.ColorGenerator import com.squareup.picasso.Picasso import com.squareup.picasso.Transformation import dev.alenajam.opendialer.core.common.CircleTransform @@ -36,14 +34,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext private val circleTransform: Transformation = CircleTransform() -private val colorList = listOf( - Color.parseColor("#4FAF44"), - Color.parseColor("#F6D145"), - Color.parseColor("#FF9526"), - Color.parseColor("#EF4423"), - Color.parseColor("#328AF0") -) -private val generator = ColorGenerator.create(colorList) private const val itemHeight = 75f private const val optionHeight = 50 private const val expandAnimDuration = 200L @@ -161,7 +151,6 @@ class RecentsAdapter( Picasso.get() .load(contact.photoUri) - .placeholder(context.getContactImagePlaceholder(currentCall, generator)) .transform(circleTransform) .into(contactIcon) @@ -260,29 +249,6 @@ class RecentsAdapter( } } -fun Context.getContactImagePlaceholder(call: DialerCall, generator: ColorGenerator): TextDrawable { - var name = call.contactInfo.name - - if (call.isAnonymous()) { - name = getString(R.string.anonymous) - } else if (name.isNullOrBlank()) { - name = call.contactInfo.number ?: "" - } - - val filteredName = name.replace("[^a-zA-Z0-9]".toRegex(), "") - var firstCharStr = "" - - if (filteredName.isNotEmpty()) { - val firstChar = filteredName[0] - firstCharStr = firstChar.toString() - } - - return TextDrawable.builder() - .beginConfig() - .endConfig() - .buildRound(firstCharStr, generator.getColor(call.id)) -} - inline fun getValueAnimator( forward: Boolean = true, duration: Long? = null, diff --git a/feature/calls/build.gradle.kts b/feature/calls/build.gradle.kts index c65e6b7..b3b9415 100644 --- a/feature/calls/build.gradle.kts +++ b/feature/calls/build.gradle.kts @@ -47,7 +47,6 @@ dependencies { testImplementation("com.google.dagger:hilt-android-testing:2.48.1") kaptTest("com.google.dagger:hilt-compiler:2.48.1") - implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1") implementation("com.squareup.picasso:picasso:2.71828") implementation("org.ocpsoft.prettytime:prettytime:4.0.1.Final") diff --git a/feature/calls/src/main/java/dev/alenajam/opendialer/feature/calls/RecentsAdapter.kt b/feature/calls/src/main/java/dev/alenajam/opendialer/feature/calls/RecentsAdapter.kt index 7f8b378..9b8b870 100644 --- a/feature/calls/src/main/java/dev/alenajam/opendialer/feature/calls/RecentsAdapter.kt +++ b/feature/calls/src/main/java/dev/alenajam/opendialer/feature/calls/RecentsAdapter.kt @@ -19,8 +19,6 @@ import androidx.core.content.ContextCompat import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import com.amulyakhare.textdrawable.TextDrawable -import com.amulyakhare.textdrawable.util.ColorGenerator import com.squareup.picasso.Picasso import com.squareup.picasso.Transformation import dev.alenajam.opendialer.core.common.CircleTransform @@ -37,14 +35,6 @@ import kotlinx.coroutines.withContext import org.ocpsoft.prettytime.PrettyTime private val circleTransform: Transformation = CircleTransform() -private val colorList = listOf( - Color.parseColor("#4FAF44"), - Color.parseColor("#F6D145"), - Color.parseColor("#FF9526"), - Color.parseColor("#EF4423"), - Color.parseColor("#328AF0") -) -private val generator = ColorGenerator.create(colorList) private const val itemHeight = 75f private const val optionHeight = 50 private const val expandAnimDuration = 200L @@ -150,7 +140,6 @@ class RecentsAdapter( Picasso.get() .load(contact.photoUri) - .placeholder(context.getContactImagePlaceholder(currentCall, generator)) .transform(circleTransform) .into(contactIcon) @@ -262,27 +251,4 @@ inline fun getValueAnimator( fun convertDpToPixels(dp: Float, context: Context): Float { return dp * (context.resources.displayMetrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT) -} - -fun Context.getContactImagePlaceholder(call: DialerCall, generator: ColorGenerator): TextDrawable { - var name = call.contactInfo.name - - if (call.isAnonymous()) { - name = getString(R.string.anonymous) - } else if (name.isNullOrBlank()) { - name = call.contactInfo.number ?: "" - } - - val filteredName = name.replace("[^a-zA-Z0-9]".toRegex(), "") - var firstCharStr = "" - - if (filteredName.isNotEmpty()) { - val firstChar = filteredName[0] - firstCharStr = firstChar.toString() - } - - return TextDrawable.builder() - .beginConfig() - .endConfig() - .buildRound(firstCharStr, generator.getColor(call.id)) } \ No newline at end of file diff --git a/feature/contacts/build.gradle.kts b/feature/contacts/build.gradle.kts index eed3d44..ae3dddf 100644 --- a/feature/contacts/build.gradle.kts +++ b/feature/contacts/build.gradle.kts @@ -45,7 +45,6 @@ dependencies { testImplementation("com.google.dagger:hilt-android-testing:2.48.1") kaptTest("com.google.dagger:hilt-compiler:2.48.1") - implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1") implementation("com.squareup.picasso:picasso:2.71828") implementation("org.ocpsoft.prettytime:prettytime:4.0.1.Final") diff --git a/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/CommonUtils.kt b/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/CommonUtils.kt index 9af990d..88e6a70 100644 --- a/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/CommonUtils.kt +++ b/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/CommonUtils.kt @@ -1,24 +1,11 @@ package dev.alenajam.opendialer.feature.contacts import android.content.Context -import com.amulyakhare.textdrawable.TextDrawable -import com.amulyakhare.textdrawable.util.ColorGenerator +import android.graphics.drawable.Drawable import dev.alenajam.opendialer.data.contacts.DialerContact fun Context.getContactImagePlaceholder( - contact: DialerContact, - generator: ColorGenerator -): TextDrawable { - val filteredName = contact.name.replace("[^a-zA-Z0-9]".toRegex(), "") - var firstCharStr = "" - - if (filteredName.isNotEmpty()) { - val firstChar = filteredName[0] - firstCharStr = firstChar.toString() - } - - return TextDrawable.builder() - .beginConfig() - .endConfig() - .buildRound(firstCharStr, generator.getColor(contact.id)) + contact: DialerContact +): Drawable? { + return null; } \ No newline at end of file diff --git a/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/ContactAdapter.java b/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/ContactAdapter.java index 557a234..2ef809c 100644 --- a/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/ContactAdapter.java +++ b/feature/contacts/src/main/java/dev/alenajam/opendialer/feature/contacts/ContactAdapter.java @@ -12,7 +12,6 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.RecyclerView; -import com.amulyakhare.textdrawable.util.ColorGenerator; import com.squareup.picasso.Picasso; import com.squareup.picasso.Transformation; @@ -25,15 +24,6 @@ import dev.alenajam.opendialer.data.contacts.DialerContact; public class ContactAdapter extends RecyclerView.Adapter { - private final List colorList = Arrays.asList( - Color.parseColor("#4FAF44"), - Color.parseColor("#F6D145"), - Color.parseColor("#FF9526"), - Color.parseColor("#EF4423"), - Color.parseColor("#328AF0") - ); - - private ColorGenerator generator = ColorGenerator.create(colorList); private Transformation circleTransform = new CircleTransform(); private Activity context; private ArrayList contacts = new ArrayList<>(); @@ -74,9 +64,6 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) { Picasso.get() .load(photoUri) - .placeholder( - CommonUtilsKt.getContactImagePlaceholder(context, contacts.get(position), generator) - ) .transform(circleTransform) .into(holder.contactIcon); diff --git a/feature/contactsSearch/build.gradle.kts b/feature/contactsSearch/build.gradle.kts index 708d64c..2ab2aaa 100644 --- a/feature/contactsSearch/build.gradle.kts +++ b/feature/contactsSearch/build.gradle.kts @@ -46,7 +46,6 @@ dependencies { testImplementation("com.google.dagger:hilt-android-testing:2.48.1") kaptTest("com.google.dagger:hilt-compiler:2.48.1") - implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1") implementation("com.squareup.picasso:picasso:2.71828") implementation("org.ocpsoft.prettytime:prettytime:4.0.1.Final") diff --git a/feature/contactsSearch/src/main/java/dev/alenajam/opendialer/feature/contactsSearch/SearchContactsAdapter.kt b/feature/contactsSearch/src/main/java/dev/alenajam/opendialer/feature/contactsSearch/SearchContactsAdapter.kt index 58bb78f..6ac3fc7 100644 --- a/feature/contactsSearch/src/main/java/dev/alenajam/opendialer/feature/contactsSearch/SearchContactsAdapter.kt +++ b/feature/contactsSearch/src/main/java/dev/alenajam/opendialer/feature/contactsSearch/SearchContactsAdapter.kt @@ -10,8 +10,6 @@ import android.widget.ImageView import android.widget.TextView import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView -import com.amulyakhare.textdrawable.TextDrawable -import com.amulyakhare.textdrawable.util.ColorGenerator import com.squareup.picasso.Picasso import com.squareup.picasso.Transformation import dev.alenajam.opendialer.core.aosp.QueryBoldingUtil @@ -21,14 +19,6 @@ import dev.alenajam.opendialer.core.common.ContactsHelper import dev.alenajam.opendialer.data.contactsSearch.DialerSearchContact private val circleTransform: Transformation = CircleTransform() -private val colorList = listOf( - Color.parseColor("#4FAF44"), - Color.parseColor("#F6D145"), - Color.parseColor("#FF9526"), - Color.parseColor("#EF4423"), - Color.parseColor("#328AF0") -) -private val generator = ColorGenerator.create(colorList) class SearchContactsAdapter(private val onClick: (item: Item) -> Unit) : RecyclerView.Adapter() { @@ -77,7 +67,6 @@ class SearchContactsAdapter(private val onClick: (item: Item) -> Unit) : Picasso.get() .load(current.image) - .placeholder(context.getContactImagePlaceholder(current, generator)) .transform(circleTransform) .into(contactIcon) @@ -153,22 +142,4 @@ class SearchContactsAdapter(private val onClick: (item: Item) -> Unit) : ACTION } } -} - -fun Context.getContactImagePlaceholder( - contact: DialerSearchContact, - generator: ColorGenerator -): TextDrawable { - val filteredName = contact.name.replace("[^a-zA-Z0-9]".toRegex(), "") - var firstCharStr = "" - - if (filteredName.isNotEmpty()) { - val firstChar = filteredName[0] - firstCharStr = firstChar.toString() - } - - return TextDrawable.builder() - .beginConfig() - .endConfig() - .buildRound(firstCharStr, generator.getColor(contact.id)) } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b028ae1..f856717 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,5 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true -android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index af3d0bb..891890c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Dec 05 04:01:50 CET 2020 +#Fri Oct 04 12:18:32 CEST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip