Skip to content

Commit

Permalink
added layout Params and invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
aslm-android committed Oct 31, 2023
1 parent 3ff3078 commit a34c5f8
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 64 deletions.
Binary file modified .gradle/8.0/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.0/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
49 changes: 27 additions & 22 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 3 additions & 38 deletions app/src/main/java/company/tap/paybutton/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -177,44 +177,8 @@ class MainActivity : AppCompatActivity() {
configuration.put("scope",scopeKey.toString())
configuration.put("transaction",transaction)

//
// findViewById<PayButton>(R.id.paybutton).initPayButton(this, configuration,
// PayButtonType.valueOf(buttonKey.toString()),object : PayButtonStatusDelegate {
// override fun onSuccess(data: String) {
// Toast.makeText(this@MainActivity,"success $data",Toast.LENGTH_SHORT).show()
// }
//
// override fun onError(error: String) {
// Toast.makeText(this@MainActivity,"error $error",Toast.LENGTH_SHORT).show()
// Log.e("error",error.toString())
// }
//
// override fun onCancel() {
// Toast.makeText(this@MainActivity,"cancel",Toast.LENGTH_SHORT).show()
// }
//
// override fun onChargeCreated(data: String) {
// Toast.makeText(this@MainActivity,"charge created $data",Toast.LENGTH_SHORT).show()
//
// }
//
// override fun onClick() {
// Toast.makeText(this@MainActivity,"click",Toast.LENGTH_SHORT).show()
// }
//
// override fun onReady() {
// Toast.makeText(this@MainActivity,"ready",Toast.LENGTH_SHORT).show()
// }
//
// override fun onOrderCreated(data: String) {
// Toast.makeText(this@MainActivity,"order created $data",Toast.LENGTH_SHORT).show()
// }
//
// })

PayButtonConfig.initPayButton(this,configuration,PayButtonType.KNET,findViewById<PayButton>(R.id.paybutton))

PayButtonConfig.addPayButtonStatusDelegate(object : PayButtonStatusDelegate {
findViewById<PayButton>(R.id.paybutton).initPayButton(this, configuration,
PayButtonType.valueOf(buttonKey.toString()),object : PayButtonStatusDelegate {
override fun onSuccess(data: String) {
Toast.makeText(this@MainActivity,"success $data",Toast.LENGTH_SHORT).show()
}
Expand Down Expand Up @@ -248,6 +212,7 @@ class MainActivity : AppCompatActivity() {
})



}

private fun getPayButtonType(key: String): PayButtonType {
Expand Down
12 changes: 8 additions & 4 deletions tappaybutton/src/main/java/company/tap/tappaybutton/PayButton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class PayButton :LinearLayout {
PayButtonType.BENEFIT_PAY ->{
tapBenefitPay = TapBenefitPay(context)
tapBenefitPay.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
this.addView(tapBenefitPay)
this.invalidate()
this.post(Runnable {
this.addView(tapBenefitPay)
this.invalidate()
})
BeneiftPayConfiguration.configureWithTapBenfitPayDictionaryConfiguration(context,tapBenefitPay,
configuration,object :TapBenefitPayStatusDelegate{
override fun onError(error: String) = payButtonStatusDelegate.onError(error)
Expand All @@ -80,8 +82,10 @@ class PayButton :LinearLayout {
PayButtonType.KNET,PayButtonType.BENEFIT,PayButtonType.PAYPAL,PayButtonType.TABBY,PayButtonType.FAWRY-> {
tapKnetPay = TapKnetPay(context)
tapKnetPay.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
this.addView(tapKnetPay)
this.invalidate()
this.post(Runnable {
this.addView(tapKnetPay)
this.invalidate()
})
TapKnetConfiguration.configureWithKnetDictionary(
context,
tapKnetPay,
Expand Down

0 comments on commit a34c5f8

Please sign in to comment.