Skip to content

Commit efa8650

Browse files
committed
Pass bitmap to factory for custom tabs util
1 parent 0abb0b1 commit efa8650

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ publish {
3131
userOrg = 'buffer'
3232
groupId = 'org.buffer.android'
3333
artifactId = 'android-utils'
34-
publishVersion = '0.5'
34+
publishVersion = '0.6'
3535
desc = 'An Android library for frequently used utility functions'
3636
website = 'https://github.com/bufferapp/android-utils'
3737
}

lib/src/main/java/org/buffer/android/utils/CustomTabUtil.kt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ package org.buffer.android.utils
33
import android.content.ActivityNotFoundException
44
import android.content.Context
55
import android.content.Intent
6-
import android.graphics.BitmapFactory
6+
import android.graphics.Bitmap
77
import android.net.Uri
88
import android.util.Log
99
import androidx.annotation.ColorRes
10-
import androidx.annotation.DrawableRes
1110
import androidx.browser.customtabs.CustomTabsIntent
1211
import androidx.core.content.ContextCompat
1312

@@ -17,9 +16,9 @@ object CustomTabUtil {
1716
context: Context,
1817
uri: Uri,
1918
@ColorRes color: Int,
20-
@DrawableRes backArrow: Int
19+
closeBitmap: Bitmap
2120
) {
22-
val intent = buildIntent(context, uri, color, backArrow)
21+
val intent = buildIntent(context, uri, color, closeBitmap)
2322
try {
2423
context.startActivity(intent)
2524
} catch (error: ActivityNotFoundException) {
@@ -35,17 +34,12 @@ object CustomTabUtil {
3534
context: Context,
3635
uri: Uri,
3736
@ColorRes color: Int,
38-
@DrawableRes backArrow: Int
37+
closeBitmap: Bitmap
3938
): Intent {
4039
val customTabsIntent = CustomTabsIntent.Builder()
4140
.setToolbarColor(ContextCompat.getColor(context, color))
4241
.setShowTitle(true)
43-
.setCloseButtonIcon(
44-
BitmapFactory.decodeResource(
45-
context.resources,
46-
backArrow
47-
)
48-
)
42+
.setCloseButtonIcon(closeBitmap)
4943
.addDefaultShareMenuItem()
5044
.build()
5145
return customTabsIntent.intent.apply {

0 commit comments

Comments
 (0)