Skip to content

Commit fff82df

Browse files
committed
webview made dynamic for careem pay to load properly
1 parent 583f0ad commit fff82df

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
android:layout_width="match_parent"
1818
android:layout_height="wrap_content"
1919
android:id="@+id/text"
20-
android:layout_marginStart="@dimen/_10sdp"
20+
android:layout_marginTop="@dimen/_150sdp"
2121
android:scrollbars="vertical"
2222
tools:text="Hello guys"
2323
/>

knet-sdk/src/main/java/company/tap/tapWebForm/Extension.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fun Context.twoThirdHeightView(): Double {
164164
fun Context.getDeviceSpecs(): Pair<Int, Int> {
165165
val displayMetrics = DisplayMetrics()
166166
(this.getActivity())?.windowManager?.defaultDisplay?.getMetrics(displayMetrics)
167-
val height = displayMetrics.heightPixels
167+
val height = Resources.getSystem().displayMetrics.heightPixels
168168
val width = displayMetrics.widthPixels
169169
val pair: Pair<Int, Int> = Pair(height, width)
170170
return pair

knet-sdk/src/main/java/company/tap/tapWebForm/open/web_wrapper/TapKnetPay.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class TapKnetPay : LinearLayout {
103103
knetWebView = findViewById(R.id.webview)
104104
webViewFrame = findViewById(R.id.webViewFrame)
105105

106+
106107
with(knetWebView) {
107108

108109
with(settings) {
@@ -327,6 +328,7 @@ class TapKnetPay : LinearLayout {
327328

328329

329330
if (request?.url.toString().startsWith(careemPayUrlHandler)) {
331+
webViewFrame.layoutParams = LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)
330332
threeDsResponse = ThreeDsResponse(
331333
id = "",
332334
url = request?.url.toString(),
@@ -454,6 +456,7 @@ class TapKnetPay : LinearLayout {
454456

455457
return true
456458
} else {
459+
457460
return false
458461
}
459462
}

knet-sdk/src/main/java/company/tap/tapWebForm/open/web_wrapper/enums/enums.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const val urlKey = "url"
2121
const val careemPayUrlHandler ="https://checkout"
2222

2323
enum class KnetStatusDelegate {
24-
onReady, onClick, onOrderCreated, onChargeCreated, onError, onSuccess, cancel, onClosePopup,onHeightChange,on3dsRedirect,onBinIdentification,
24+
onReady, onClick, onOrderCreated, onChargeCreated, onError, onSuccess, cancel, onClosePopup,onHeightChange,on3dsRedirect,onBinIdentification, launch
2525

2626
}
2727

knet-sdk/src/main/java/company/tap/tapWebForm/open/web_wrapper/threeDsWebView/ThreeDsWebViewActivityButton.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,22 @@ class ThreeDsWebViewActivityButton : AppCompatActivity() {
4040
setContentView(R.layout.activity_three_ds_web_view)
4141
LocalizationManager.setLocale(this, Locale(KnetDataConfiguration.lanuage.toString()))
4242
val webView = WebView(this)
43+
val linearLayout : LinearLayout = findViewById(R.id.linear)
4344
webView.layoutParams = this.getDeviceSpecs().first.let {
4445
LinearLayout.LayoutParams(
4546
LinearLayout.LayoutParams.MATCH_PARENT,
4647
it
4748
)
4849
}
50+
//linearLayout.addView(we)
4951

5052
with(webView.settings) {
5153
javaScriptEnabled = true
5254
domStorageEnabled = true
5355

5456
}
55-
webView.isVerticalScrollBarEnabled = true
57+
58+
// webView.isVerticalScrollBarEnabled = true
5659
webView.requestFocus()
5760
webView.webViewClient = threeDsWebViewClient()
5861
val data = intent.extras
@@ -104,7 +107,7 @@ class ThreeDsWebViewActivityButton : AppCompatActivity() {
104107
true -> {
105108
threeDsBottomsheet.dialog?.dismiss()
106109
val splittiedString = request.url.toString().split("?", ignoreCase = true)
107-
Log.e("splittedString", splittiedString.toString())
110+
if(splittiedString!=null)Log.e("splittedString", splittiedString.toString())
108111
try {
109112
TapKnetPay.retrieve(splittiedString[1])
110113
} catch (e: Exception) {

knet-sdk/src/main/res/layout/activity_button_web_wrapper.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<FrameLayout
1212
android:id="@+id/webViewFrame"
1313
android:layout_width="match_parent"
14-
android:layout_height="@dimen/_45sdp"
14+
android:layout_height="wrap_content"
1515
app:layout_constraintEnd_toEndOf="parent"
1616
app:layout_constraintStart_toStartOf="parent"
1717
app:layout_constraintTop_toTopOf="parent">

0 commit comments

Comments
 (0)