Skip to content

Commit

Permalink
chore: update project to latest dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
oxcened committed Oct 4, 2024
1 parent 3e98190 commit 2622f2f
Show file tree
Hide file tree
Showing 15 changed files with 11 additions and 142 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
}
Expand Down
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// 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()
mavenCentral()
}
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'
}
Expand All @@ -23,8 +23,6 @@ allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://dl.bintray.com/amulyakhare/maven' }
}
}

Expand Down
1 change: 1 addition & 0 deletions core/aosp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion feature/callDetail/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -161,7 +151,6 @@ class RecentsAdapter(

Picasso.get()
.load(contact.photoUri)
.placeholder(context.getContactImagePlaceholder(currentCall, generator))
.transform(circleTransform)
.into(contactIcon)

Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion feature/calls/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -150,7 +140,6 @@ class RecentsAdapter(

Picasso.get()
.load(contact.photoUri)
.placeholder(context.getContactImagePlaceholder(currentCall, generator))
.transform(circleTransform)
.into(contactIcon)

Expand Down Expand Up @@ -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))
}
1 change: 0 additions & 1 deletion feature/contacts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -25,15 +24,6 @@
import dev.alenajam.opendialer.data.contacts.DialerContact;

public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ViewHolder> {
private final List<Integer> 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<DialerContact> contacts = new ArrayList<>();
Expand Down Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion feature/contactsSearch/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<SearchContactsAdapter.ViewHolder>() {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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))
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@
#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

0 comments on commit 2622f2f

Please sign in to comment.