Skip to content

Commit 8ba0f95

Browse files
committed
version update
1 parent 16440a3 commit 8ba0f95

File tree

2 files changed

+61
-57
lines changed

2 files changed

+61
-57
lines changed

tapcheckoutsdk/build.gradle

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ android {
4141
kotlinOptions {
4242
jvmTarget = "11"
4343
}
44+
// Include assets and resources
45+
sourceSets {
46+
main {
47+
java.srcDirs += 'src/main/java'
48+
kotlin.srcDirs += 'src/main/kotlin'
49+
res.srcDirs += 'src/main/res'
50+
assets.srcDirs += 'src/main/assets' // <-- ensures assets are packaged in AAR
51+
}
52+
53+
}
54+
55+
56+
libraryVariants.all { variant ->
57+
variant.mergeAssetsProvider.get().doLast {
58+
def destDir = variant.mergeAssetsProvider.get().outputDir.get().asFile
59+
project.copy { CopySpec spec ->
60+
spec.from("${projectDir}/src/main/assets")
61+
spec.into(destDir)
62+
}
63+
}
64+
}
4465
}
4566

4667
dependencies {
@@ -109,18 +130,17 @@ afterEvaluate {
109130
publications {
110131
create("release", MavenPublication) {
111132
// Publish AAR
112-
/* artifact("$buildDir/outputs/aar/${project.name}-release.aar") {
133+
artifact("$buildDir/outputs/aar/${project.name}-release.aar") {
113134
builtBy tasks.named("assembleRelease")
114-
} // ✅ Use the proper AAR task*/
115-
artifact(tasks.named("bundleReleaseAar"))
135+
}
116136

117137
// Attach sources and javadoc
118138
artifact(tasks.named("releaseSourcesJar"))
119139
artifact(tasks.named("releaseJavadoc"))
120140

121141
groupId = "com.github.Tap-Payments"
122142
artifactId = "Checkout-Android"
123-
version = "1.0.5.1"
143+
version = "1.0.5.2"
124144

125145
// Variant-aware: ensure dependencies are included in POM
126146
pom.withXml {
Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package company.tap.tapcheckout_android.theme
2+
23
import android.content.Context
34
import android.graphics.Typeface
45
import android.util.AttributeSet
@@ -9,12 +10,10 @@ import androidx.annotation.DrawableRes
910
import androidx.appcompat.widget.AppCompatImageView
1011
import androidx.cardview.widget.CardView
1112
import androidx.constraintlayout.widget.ConstraintLayout
12-
1313
import company.tap.tapcheckout_android.R
1414

1515
import company.tap.taplocalizationkit.LocalizationManager
1616

17-
1817
class TapBrandView : LinearLayout {
1918

2019
val poweredByImage by lazy { findViewById<AppCompatImageView>(R.id.poweredByImage) }
@@ -25,71 +24,56 @@ class TapBrandView : LinearLayout {
2524
val backTitle by lazy { findViewById<TextView>(R.id.back_title) }
2625

2726
@DrawableRes
28-
val logoIcon: Int =
29-
if (ThemeManager.currentTheme.isNotEmpty() && ThemeManager.currentTheme.contains("dark")) {
27+
private val logoIcon: Int =
28+
if (ThemeManager.currentTheme.contains("dark")) {
3029
R.drawable.poweredbytap2
31-
} else if (ThemeManager.currentTheme.isNotEmpty() && ThemeManager.currentTheme.contains("light")) {
32-
R.drawable.poweredbytap2
33-
} else R.drawable.poweredbytap2
34-
30+
} else {
31+
R.drawable.poweredbytap2
32+
}
3533

36-
/**
37-
* Simple constructor to use when creating a TapHeader from code.
38-
* @param con] ext The Context the view is running in, through which it can
39-
* access the current theme, resources, etc.
40-
**/
41-
constructor(context: Context) : super(context)
34+
constructor(context: Context) : super(context) {
35+
initView(context)
36+
}
4237

43-
/**
44-
* @param context The Context the view is running in, through which it can
45-
* access the current theme, resources, etc.
46-
* @param attrs The attributes of the XML Button tag being used to inflate the view.
47-
*
48-
*/
49-
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
38+
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
39+
initView(context)
40+
}
5041

51-
/**
52-
* @param context The Context the view is running in, through which it can
53-
* access the current theme, resources, etc.
54-
* @param attrs The attributes of the XML Button tag being used to inflate the view.
55-
* @param defStyleAttr The resource identifier of an attribute in the current theme
56-
* whose value is the the resource id of a style. The specified style’s
57-
* attribute values serve as default values for the button. Set this parameter
58-
* to 0 to avoid use of default values.
59-
*/
60-
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
61-
context,
62-
attrs,
63-
defStyleAttr
64-
)
42+
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
43+
initView(context)
44+
}
6545

66-
init {
46+
private fun initView(context: Context) {
6747
inflate(context, R.layout.tap_brandview, this)
6848
poweredByImage.setImageResource(logoIcon)
6949
backTitle.text = resources.getString(R.string.back)
7050

71-
// backTitle.setTextColor(loadAppThemManagerFromPath(AppColorTheme.PoweredByTapBackButtonLabelColor))
72-
//imageBack.backgroundTintList =
73-
// ColorStateList.valueOf(loadAppThemManagerFromPath(AppColorTheme.PoweredByTapBackButtonIconColor))
74-
75-
51+
val typeface = loadTypefaceFromLibrary(context)
7652

53+
backTitle?.typeface = typeface
7754
if (LocalizationManager.getLocale(context).language == "ar") {
7855
imageBack.rotation = 180f
79-
backTitle?.typeface = Typeface.createFromAsset(
80-
context?.assets, TapFont.tapFontType(
81-
TapFont.TajawalMedium
82-
)
83-
)
84-
}else{
85-
backTitle?.typeface = Typeface.createFromAsset(
86-
context?.assets, TapFont.tapFontType(
87-
TapFont.RobotoRegular
88-
)
89-
)
9056
}
9157
}
9258

59+
private fun loadTypefaceFromLibrary(context: Context): Typeface? {
60+
return try {
61+
val fontPath = if (LocalizationManager.getLocale(context).language == "ar") {
62+
TapFont.tapFontType(TapFont.TajawalMedium)
63+
} else {
64+
TapFont.tapFontType(TapFont.RobotoRegular)
65+
}
9366

67+
// ✅ Use class loader to get library context for font access
68+
val assetManager = this.javaClass.classLoader?.let {
69+
context.createPackageContext(context.packageName, 0).assets
70+
} ?: context.assets
9471

95-
}
72+
Typeface.createFromAsset(assetManager, fontPath)
73+
74+
} catch (e: Exception) {
75+
e.printStackTrace()
76+
null
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)