Skip to content

Commit 3ff3078

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

File tree

11 files changed

+84
-62
lines changed

11 files changed

+84
-62
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1.43 KB
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: 13 additions & 4 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: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,44 @@ 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))
180216

181-
findViewById<PayButton>(R.id.paybutton).initPayButton(this, configuration,
182-
PayButtonType.valueOf(buttonKey.toString()),object : PayButtonStatusDelegate {
217+
PayButtonConfig.addPayButtonStatusDelegate(object : PayButtonStatusDelegate {
183218
override fun onSuccess(data: String) {
184219
Toast.makeText(this@MainActivity,"success $data",Toast.LENGTH_SHORT).show()
185220
}
@@ -213,41 +248,6 @@ class MainActivity : AppCompatActivity() {
213248
})
214249

215250

216-
// //PayButtonConfig.addPayButtonStatusDelegate(object : PayButtonStatusDelegate {
217-
// override fun onSuccess(data: String) {
218-
// Toast.makeText(this@MainActivity,"success $data",Toast.LENGTH_SHORT).show()
219-
// }
220-
//
221-
// override fun onError(error: String) {
222-
// Toast.makeText(this@MainActivity,"error $error",Toast.LENGTH_SHORT).show()
223-
// Log.e("error",error.toString())
224-
// }
225-
//
226-
// override fun onCancel() {
227-
// Toast.makeText(this@MainActivity,"cancel",Toast.LENGTH_SHORT).show()
228-
// }
229-
//
230-
// override fun onChargeCreated(data: String) {
231-
// Toast.makeText(this@MainActivity,"charge created $data",Toast.LENGTH_SHORT).show()
232-
//
233-
// }
234-
//
235-
// override fun onClick() {
236-
// Toast.makeText(this@MainActivity,"click",Toast.LENGTH_SHORT).show()
237-
// }
238-
//
239-
// override fun onReady() {
240-
// Toast.makeText(this@MainActivity,"ready",Toast.LENGTH_SHORT).show()
241-
// }
242-
//
243-
// override fun onOrderCreated(data: String) {
244-
// Toast.makeText(this@MainActivity,"order created $data",Toast.LENGTH_SHORT).show()
245-
// }
246-
//
247-
// })
248-
249-
// PayButtonConfig.initPayButton(this,configuration, PayButtonType.valueOf(buttonKey.toString()), findViewById(R.id.paybutton))
250-
251251
}
252252

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

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ class PayButton :LinearLayout {
5656
when(payButton){
5757
PayButtonType.BENEFIT_PAY ->{
5858
tapBenefitPay = TapBenefitPay(context)
59+
tapBenefitPay.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
5960
this.addView(tapBenefitPay)
61+
this.invalidate()
6062
BeneiftPayConfiguration.configureWithTapBenfitPayDictionaryConfiguration(context,tapBenefitPay,
6163
configuration,object :TapBenefitPayStatusDelegate{
6264
override fun onError(error: String) = payButtonStatusDelegate.onError(error)
@@ -76,9 +78,10 @@ class PayButton :LinearLayout {
7678
})
7779
}
7880
PayButtonType.KNET,PayButtonType.BENEFIT,PayButtonType.PAYPAL,PayButtonType.TABBY,PayButtonType.FAWRY-> {
79-
8081
tapKnetPay = TapKnetPay(context)
81-
this.addView(tapKnetPay)
82+
tapKnetPay.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
83+
this.addView(tapKnetPay)
84+
this.invalidate()
8285
TapKnetConfiguration.configureWithKnetDictionary(
8386
context,
8487
tapKnetPay,

0 commit comments

Comments
 (0)