Skip to content

Commit

Permalink
change send payment to activity and refrsh wallet activity
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoukoul committed May 28, 2021
1 parent 221020b commit 5580a4e
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 259 deletions.
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@

<application
android:allowBackup="true"
android:extractNativeLibs="true"
android:icon="@mipmap/ic_logo_foreground"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_logo_foreground"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:extractNativeLibs="true"
tools:targetApi="q">
<activity android:name=".SendPaymentActivity"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".DebugWalletActivity" />
<activity
android:name=".WalletActivity"
android:windowSoftInputMode="stateHidden|adjustResize" />
android:windowSoftInputMode="adjustResize" />
<activity android:name=".ForgotPasswordSuccessActivity" />
<activity
android:name=".ForgotPasswordActivity"
Expand Down
56 changes: 56 additions & 0 deletions app/src/main/java/co/anode/anodium/SendPaymentActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package co.anode.anodium

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import com.google.protobuf.ByteString

class SendPaymentActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_send_payment)
//actionbar
val actionbar = supportActionBar
//set actionbar title
actionbar!!.title = getString(R.string.send_pkt_send_payment)
//set back button
actionbar.setDisplayHomeAsUpEnabled(true)
val sendbutton = findViewById<Button>(R.id.button_sendPKTPayment)
sendbutton.setOnClickListener {
var sendcoins = true
val bspassword: ByteString = ByteString.copyFrom("password", Charsets.UTF_8)
//Check fields
val address = findViewById<EditText>(R.id.editTextReceiverAddress)
if (address.text.toString().isNullOrEmpty()) {
Toast.makeText(applicationContext, "Please fill in the receiver's address", Toast.LENGTH_SHORT).show()
sendcoins = false
}
val amount = findViewById<EditText>(R.id.editTextPKTAmount)
if (amount.text.toString().isNullOrEmpty()) {
Toast.makeText(applicationContext, "Please fill in the PKT amount", Toast.LENGTH_SHORT).show()
sendcoins = false
}
val password = findViewById<EditText>(R.id.editTextPKTPassword)
if (password.text.toString().isNullOrEmpty()) {
Toast.makeText(applicationContext, "Please fill in the password", Toast.LENGTH_SHORT).show()
sendcoins = false
} else if (ByteString.copyFrom(password.text.toString(),Charsets.UTF_8) != bspassword ) {
Toast.makeText(applicationContext, "Wrong password", Toast.LENGTH_SHORT).show()
sendcoins = false
}
//Send coins
if (sendcoins) {
LndRPCController.sendCoins(address.text.toString(), amount.text.toString().toLong())
Toast.makeText(applicationContext, "Payment of ${amount.text}PKT send", Toast.LENGTH_SHORT).show()
finish()
}
}
}

override fun onSupportNavigateUp(): Boolean {
onBackPressed()
return true
}
}
88 changes: 0 additions & 88 deletions app/src/main/java/co/anode/anodium/SendPaymentFragment.kt

This file was deleted.

Loading

0 comments on commit 5580a4e

Please sign in to comment.