Skip to content

Commit a34c5f8

Browse files
committed
added layout Params and invalidation
1 parent 3ff3078 commit a34c5f8

File tree

10 files changed

+38
-64
lines changed

10 files changed

+38
-64
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
150 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
272 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

.gradle/file-system.probe

0 Bytes
Binary file not shown.

.idea/workspace.xml

Lines changed: 27 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/company/tap/paybutton/MainActivity.kt

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -177,44 +177,8 @@ class MainActivity : AppCompatActivity() {
177177
configuration.put("scope",scopeKey.toString())
178178
configuration.put("transaction",transaction)
179179

180-
//
181-
// findViewById<PayButton>(R.id.paybutton).initPayButton(this, configuration,
182-
// PayButtonType.valueOf(buttonKey.toString()),object : PayButtonStatusDelegate {
183-
// override fun onSuccess(data: String) {
184-
// Toast.makeText(this@MainActivity,"success $data",Toast.LENGTH_SHORT).show()
185-
// }
186-
//
187-
// override fun onError(error: String) {
188-
// Toast.makeText(this@MainActivity,"error $error",Toast.LENGTH_SHORT).show()
189-
// Log.e("error",error.toString())
190-
// }
191-
//
192-
// override fun onCancel() {
193-
// Toast.makeText(this@MainActivity,"cancel",Toast.LENGTH_SHORT).show()
194-
// }
195-
//
196-
// override fun onChargeCreated(data: String) {
197-
// Toast.makeText(this@MainActivity,"charge created $data",Toast.LENGTH_SHORT).show()
198-
//
199-
// }
200-
//
201-
// override fun onClick() {
202-
// Toast.makeText(this@MainActivity,"click",Toast.LENGTH_SHORT).show()
203-
// }
204-
//
205-
// override fun onReady() {
206-
// Toast.makeText(this@MainActivity,"ready",Toast.LENGTH_SHORT).show()
207-
// }
208-
//
209-
// override fun onOrderCreated(data: String) {
210-
// Toast.makeText(this@MainActivity,"order created $data",Toast.LENGTH_SHORT).show()
211-
// }
212-
//
213-
// })
214-
215-
PayButtonConfig.initPayButton(this,configuration,PayButtonType.KNET,findViewById<PayButton>(R.id.paybutton))
216-
217-
PayButtonConfig.addPayButtonStatusDelegate(object : PayButtonStatusDelegate {
180+
findViewById<PayButton>(R.id.paybutton).initPayButton(this, configuration,
181+
PayButtonType.valueOf(buttonKey.toString()),object : PayButtonStatusDelegate {
218182
override fun onSuccess(data: String) {
219183
Toast.makeText(this@MainActivity,"success $data",Toast.LENGTH_SHORT).show()
220184
}
@@ -248,6 +212,7 @@ class MainActivity : AppCompatActivity() {
248212
})
249213

250214

215+
251216
}
252217

253218
private fun getPayButtonType(key: String): PayButtonType {

tappaybutton/src/main/java/company/tap/tappaybutton/PayButton.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class PayButton :LinearLayout {
5757
PayButtonType.BENEFIT_PAY ->{
5858
tapBenefitPay = TapBenefitPay(context)
5959
tapBenefitPay.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
60-
this.addView(tapBenefitPay)
61-
this.invalidate()
60+
this.post(Runnable {
61+
this.addView(tapBenefitPay)
62+
this.invalidate()
63+
})
6264
BeneiftPayConfiguration.configureWithTapBenfitPayDictionaryConfiguration(context,tapBenefitPay,
6365
configuration,object :TapBenefitPayStatusDelegate{
6466
override fun onError(error: String) = payButtonStatusDelegate.onError(error)
@@ -80,8 +82,10 @@ class PayButton :LinearLayout {
8082
PayButtonType.KNET,PayButtonType.BENEFIT,PayButtonType.PAYPAL,PayButtonType.TABBY,PayButtonType.FAWRY-> {
8183
tapKnetPay = TapKnetPay(context)
8284
tapKnetPay.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
83-
this.addView(tapKnetPay)
84-
this.invalidate()
85+
this.post(Runnable {
86+
this.addView(tapKnetPay)
87+
this.invalidate()
88+
})
8589
TapKnetConfiguration.configureWithKnetDictionary(
8690
context,
8791
tapKnetPay,

0 commit comments

Comments
 (0)