mirror of
https://github.com/DanielPollithy/flashwifi.git
synced 2025-10-16 11:45:32 +00:00
Async Task Re-work
-Re-organized Async Tasks into their own classes -Re-enabled scanner -Currently using Testnet -Added loading icon
This commit is contained in:
parent
969f6867f1
commit
eb8f7f62b2
@ -33,5 +33,6 @@ dependencies {
|
|||||||
compile 'com.google.code.gson:gson:2.8.1'
|
compile 'com.google.code.gson:gson:2.8.1'
|
||||||
compile 'com.github.kenglxn.QRGen:android:2.4.0'
|
compile 'com.github.kenglxn.QRGen:android:2.4.0'
|
||||||
compile 'me.dm7.barcodescanner:zxing:1.9.8'
|
compile 'me.dm7.barcodescanner:zxing:1.9.8'
|
||||||
|
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
package com.flashwifi.wifip2p;
|
||||||
|
|
||||||
|
public class AddressBalanceTransfer {
|
||||||
|
|
||||||
|
private String depositAddress;
|
||||||
|
private String balance;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public AddressBalanceTransfer(String inDepositAddress, String inBalance, String inMessage){
|
||||||
|
depositAddress = inDepositAddress;
|
||||||
|
balance = inBalance;
|
||||||
|
message = inMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepositAddress() {
|
||||||
|
return depositAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepositAddress(String depositAddress) {
|
||||||
|
this.depositAddress = depositAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBalance() {
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBalance(String balance) {
|
||||||
|
this.balance = balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,11 +3,11 @@ package com.flashwifi.wifip2p;
|
|||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -19,8 +19,7 @@ import com.flashwifi.wifip2p.iotaAPI.Requests.WalletAddressAndBalanceChecker;
|
|||||||
|
|
||||||
import net.glxn.qrgen.android.QRCode;
|
import net.glxn.qrgen.android.QRCode;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@ -29,7 +28,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class FundWalletFragment extends Fragment {
|
public class FundWalletFragment extends Fragment {
|
||||||
|
|
||||||
private static final int TASK_COMPLETE = 1;
|
private static final int FUND_WALLET = 0;
|
||||||
|
private static final int BALANCE_RETRIEVE_TASK_COMPLETE = 1;
|
||||||
private String seed;
|
private String seed;
|
||||||
private String depositAddress;
|
private String depositAddress;
|
||||||
private String balance;
|
private String balance;
|
||||||
@ -38,8 +38,15 @@ public class FundWalletFragment extends Fragment {
|
|||||||
private TextView addressTextView;
|
private TextView addressTextView;
|
||||||
private ImageView qrImageView;
|
private ImageView qrImageView;
|
||||||
|
|
||||||
|
private GifImageView loadingGifImageView;
|
||||||
|
|
||||||
|
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
|
private static Boolean transactionInProgress = false;
|
||||||
|
private WalletAddressAndBalanceChecker addressAndBalanceChecker;
|
||||||
|
|
||||||
public FundWalletFragment() {
|
public FundWalletFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
@ -68,8 +75,14 @@ public class FundWalletFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message inputMessage) {
|
public void handleMessage(Message inputMessage) {
|
||||||
switch (inputMessage.what) {
|
switch (inputMessage.what) {
|
||||||
case TASK_COMPLETE:
|
case BALANCE_RETRIEVE_TASK_COMPLETE:
|
||||||
String returnStatus = (String) inputMessage.obj;
|
AddressBalanceTransfer addressBalanceTransfer = (AddressBalanceTransfer) inputMessage.obj;
|
||||||
|
balance = addressBalanceTransfer.getBalance();
|
||||||
|
depositAddress = addressBalanceTransfer.getDepositAddress();
|
||||||
|
String returnStatus = addressBalanceTransfer.getMessage();
|
||||||
|
|
||||||
|
hideLoadingGIF();
|
||||||
|
transactionInProgress = false;
|
||||||
|
|
||||||
if(returnStatus == "noError"){
|
if(returnStatus == "noError"){
|
||||||
balanceTextView.setText(balance + " i");
|
balanceTextView.setText(balance + " i");
|
||||||
@ -95,6 +108,23 @@ public class FundWalletFragment extends Fragment {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
addressAndBalanceChecker.cancel(true);
|
||||||
|
transactionInProgress = false;
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideLoadingGIF() {
|
||||||
|
loadingGifImageView.setVisibility(View.GONE);
|
||||||
|
qrImageView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showLoadingGIF() {
|
||||||
|
loadingGifImageView.setVisibility(View.VISIBLE);
|
||||||
|
qrImageView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
private void makeToastFundWalletFragment(String s) {
|
private void makeToastFundWalletFragment(String s) {
|
||||||
if(getActivity() != null){
|
if(getActivity() != null){
|
||||||
Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show();
|
||||||
@ -115,6 +145,8 @@ public class FundWalletFragment extends Fragment {
|
|||||||
balanceTextView = (TextView) fundWalletFragmentView.findViewById(R.id.FundWalletBalanceValue);
|
balanceTextView = (TextView) fundWalletFragmentView.findViewById(R.id.FundWalletBalanceValue);
|
||||||
addressTextView = (TextView) fundWalletFragmentView.findViewById(R.id.AddressValue);
|
addressTextView = (TextView) fundWalletFragmentView.findViewById(R.id.AddressValue);
|
||||||
qrImageView = (ImageView) fundWalletFragmentView.findViewById(R.id.QRCode);
|
qrImageView = (ImageView) fundWalletFragmentView.findViewById(R.id.QRCode);
|
||||||
|
loadingGifImageView = (GifImageView) fundWalletFragmentView.findViewById(R.id.FundWalletLoadingGIF);
|
||||||
|
mSwipeRefreshLayout = (SwipeRefreshLayout) fundWalletFragmentView.findViewById(R.id.FundWalletSwipeRefresh);
|
||||||
|
|
||||||
// Set Listeners
|
// Set Listeners
|
||||||
balanceTextView.setOnClickListener(new View.OnClickListener() {
|
balanceTextView.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -131,48 +163,38 @@ public class FundWalletFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Toast.makeText(getActivity(), "Retrieving balance and address...",
|
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
AsyncTask.execute(new Runnable() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void onRefresh() {
|
||||||
WalletAddressAndBalanceChecker addressAndBalanceChecker = new WalletAddressAndBalanceChecker(getActivity(),getActivity().getString(R.string.preference_file_key));
|
initiateRefresh();
|
||||||
List<String> addressList = addressAndBalanceChecker.getAddress(seed);
|
|
||||||
|
|
||||||
if(addressList != null && addressList.get(0) == "Unable to resolve host"){
|
|
||||||
Message completeMessage = mHandler.obtainMessage(TASK_COMPLETE, "hostError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
else if(addressList != null){
|
|
||||||
|
|
||||||
System.out.println("|AddressListReturned:|");
|
|
||||||
System.out.println(addressList.size());
|
|
||||||
System.out.println(addressList.get(addressList.size()-1));
|
|
||||||
|
|
||||||
depositAddress = addressList.get(addressList.size()-1);
|
|
||||||
|
|
||||||
balance = addressAndBalanceChecker.getBalance(addressList);
|
|
||||||
if(balance != null){
|
|
||||||
Message completeMessage = mHandler.obtainMessage(TASK_COMPLETE, "noError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Balance Retrieval Error
|
|
||||||
Message completeMessage = mHandler.obtainMessage(TASK_COMPLETE, "balanceError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Address Retrieval Error
|
|
||||||
Message completeMessage = mHandler.obtainMessage(TASK_COMPLETE, "addressError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
showLoadingGIF();
|
||||||
|
Toast.makeText(getActivity(), "Retrieving balance and address...", Toast.LENGTH_SHORT).show();
|
||||||
|
getBalance();
|
||||||
|
|
||||||
return fundWalletFragmentView;
|
return fundWalletFragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initiateRefresh() {
|
||||||
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
|
||||||
|
if(transactionInProgress == false){
|
||||||
|
balanceTextView.setText("");
|
||||||
|
addressTextView.setText("");
|
||||||
|
showLoadingGIF();
|
||||||
|
Toast.makeText(getActivity(), "Retrieving balance and address...", Toast.LENGTH_SHORT).show();
|
||||||
|
getBalance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getBalance(){
|
||||||
|
transactionInProgress = true;
|
||||||
|
addressAndBalanceChecker = new WalletAddressAndBalanceChecker(getActivity(),getActivity().getString(R.string.preference_file_key),seed, mHandler,FUND_WALLET,true);
|
||||||
|
addressAndBalanceChecker.execute();
|
||||||
|
}
|
||||||
|
|
||||||
public void textCopyBalanceClick()
|
public void textCopyBalanceClick()
|
||||||
{
|
{
|
||||||
String balanceValue = balanceTextView.getText().toString();
|
String balanceValue = balanceTextView.getText().toString();
|
||||||
|
|||||||
@ -60,15 +60,9 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void decryptSeed(String password) {
|
private void decryptSeed(String password) {
|
||||||
View view = findViewById(R.id.home_view);
|
|
||||||
|
|
||||||
if(password.equals("")){
|
|
||||||
Snackbar.make(view, getString(R.string.password_empty), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EncryptedPreferences encryptedPreferences = new EncryptedPreferences.Builder(this).withEncryptionPassword(password).build();
|
EncryptedPreferences encryptedPreferences = new EncryptedPreferences.Builder(this).withEncryptionPassword(password).build();
|
||||||
String seed = encryptedPreferences.getString(getString(R.string.encrypted_seed), null);
|
String seed = encryptedPreferences.getString(getString(R.string.encrypted_seed), null);
|
||||||
|
View view = findViewById(R.id.home_view);
|
||||||
|
|
||||||
if (seed != null) {
|
if (seed != null) {
|
||||||
Snackbar.make(view, getString(R.string.seed_decrypted), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
Snackbar.make(view, getString(R.string.seed_decrypted), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
@ -94,10 +88,7 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void generateNewSeed() {
|
private void generateNewSeed() {
|
||||||
// generate the seed
|
// generate the seed
|
||||||
|
final String seed = SeedRandomGenerator.generateNewSeed();
|
||||||
//final String seed = SeedRandomGenerator.generateNewSeed();
|
|
||||||
//Set Testnet seed here:
|
|
||||||
final String seed = "EJ9SPL9GIK9EFICFRPQU9LLSCPNESAWRPYVKQRBZQVACRBVKVZRIWOWUBRJKWJMXLPAXDXWI9IDMAOTOZ";
|
|
||||||
|
|
||||||
TextView seedText = (TextView) findViewById(R.id.seedTextView);
|
TextView seedText = (TextView) findViewById(R.id.seedTextView);
|
||||||
seedText.setVisibility(View.VISIBLE);
|
seedText.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@ -3,14 +3,10 @@ package com.flashwifi.wifip2p;
|
|||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.hardware.Camera;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
@ -18,7 +14,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.ViewGroup;
|
import android.view.View;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
public class MainActivity extends AppCompatActivity
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.flashwifi.wifip2p;
|
package com.flashwifi.wifip2p;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@ -24,10 +25,15 @@ public class QRScannerFragment extends Fragment implements ZXingScannerView.Resu
|
|||||||
editTextAddress = addressEditTextTransfer.getEditTextAddress();
|
editTextAddress = addressEditTextTransfer.getEditTextAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
scannerView = new ZXingScannerView(getActivity());
|
if(getActivity() != null){
|
||||||
|
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
scannerView = new ZXingScannerView(getActivity());
|
||||||
|
|
||||||
ViewGroup contentFrame = (ViewGroup) getActivity().findViewById(R.id.content_frame);
|
ViewGroup contentFrame = (ViewGroup) getActivity().findViewById(R.id.content_frame);
|
||||||
contentFrame.addView(scannerView);
|
if(contentFrame != null && scannerView != null){
|
||||||
|
contentFrame.addView(scannerView);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,6 +50,12 @@ public class QRScannerFragment extends Fragment implements ZXingScannerView.Resu
|
|||||||
scannerView.stopCameraPreview();
|
scannerView.stopCameraPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDestroy() {
|
||||||
|
scannerView.stopCamera();
|
||||||
|
scannerView.stopCameraPreview();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleResult(Result result) {
|
public void handleResult(Result result) {
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
package com.flashwifi.wifip2p;
|
package com.flashwifi.wifip2p;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -22,11 +23,9 @@ import android.widget.Toast;
|
|||||||
import com.flashwifi.wifip2p.iotaAPI.Requests.WalletAddressAndBalanceChecker;
|
import com.flashwifi.wifip2p.iotaAPI.Requests.WalletAddressAndBalanceChecker;
|
||||||
import com.flashwifi.wifip2p.iotaAPI.Requests.WalletTransferRequest;
|
import com.flashwifi.wifip2p.iotaAPI.Requests.WalletTransferRequest;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import jota.IotaAPI;
|
|
||||||
|
|
||||||
import jota.error.ArgumentException;
|
import jota.error.ArgumentException;
|
||||||
import jota.utils.Checksum;
|
import jota.utils.Checksum;
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
|
|
||||||
import static android.Manifest.permission.CAMERA;
|
import static android.Manifest.permission.CAMERA;
|
||||||
|
|
||||||
@ -40,6 +39,7 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
|
|
||||||
private static final int BALANCE_RETRIEVE_TASK_COMPLETE = 1;
|
private static final int BALANCE_RETRIEVE_TASK_COMPLETE = 1;
|
||||||
private static final int TRANSFER_TASK_COMPLETE = 2;
|
private static final int TRANSFER_TASK_COMPLETE = 2;
|
||||||
|
private static final int WITHDRAW_WALLET = 1;
|
||||||
private String appWalletSeed;
|
private String appWalletSeed;
|
||||||
private String appWalletBalance;
|
private String appWalletBalance;
|
||||||
private ImageButton qrScannerButton;
|
private ImageButton qrScannerButton;
|
||||||
@ -47,11 +47,17 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
private EditText editTextAmount;
|
private EditText editTextAmount;
|
||||||
private EditText editTextMessage;
|
private EditText editTextMessage;
|
||||||
private EditText editTextTag;
|
private EditText editTextTag;
|
||||||
|
private WalletAddressAndBalanceChecker addressAndBalanceChecker;
|
||||||
|
|
||||||
|
private GifImageView loadingGifImageView;
|
||||||
|
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
|
||||||
private Button sendButton;
|
private Button sendButton;
|
||||||
private TextView balanceTextView;
|
private TextView balanceTextView;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
|
private static Boolean transactionInProgress = false;
|
||||||
|
|
||||||
public WithdrawWalletFragment() {
|
public WithdrawWalletFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
@ -80,9 +86,13 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
mHandler = new Handler(Looper.getMainLooper()) {
|
mHandler = new Handler(Looper.getMainLooper()) {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message inputMessage) {
|
public void handleMessage(Message inputMessage) {
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = (AddressBalanceTransfer) inputMessage.obj;
|
||||||
switch (inputMessage.what) {
|
switch (inputMessage.what) {
|
||||||
case BALANCE_RETRIEVE_TASK_COMPLETE:
|
case BALANCE_RETRIEVE_TASK_COMPLETE:
|
||||||
String returnStatus = (String) inputMessage.obj;
|
appWalletBalance = addressBalanceTransfer.getBalance();
|
||||||
|
String returnStatus = addressBalanceTransfer.getMessage();
|
||||||
|
hideLoadingGIF();
|
||||||
|
transactionInProgress = false;
|
||||||
|
|
||||||
if(returnStatus == "noError"){
|
if(returnStatus == "noError"){
|
||||||
balanceTextView.setText(appWalletBalance + " i");
|
balanceTextView.setText(appWalletBalance + " i");
|
||||||
@ -90,6 +100,8 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
else if (returnStatus == "noErrorNoUpdateMessage"){
|
else if (returnStatus == "noErrorNoUpdateMessage"){
|
||||||
balanceTextView.setText(appWalletBalance + " i");
|
balanceTextView.setText(appWalletBalance + " i");
|
||||||
|
clearAllTransferValues();
|
||||||
|
makeFieldsEditable();
|
||||||
}
|
}
|
||||||
else if (returnStatus == "hostError"){
|
else if (returnStatus == "hostError"){
|
||||||
makeToastFundWalletFragment("Unable to reach host (node)");
|
makeToastFundWalletFragment("Unable to reach host (node)");
|
||||||
@ -106,13 +118,37 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TRANSFER_TASK_COMPLETE:
|
case TRANSFER_TASK_COMPLETE:
|
||||||
String transferStatus = (String) inputMessage.obj;
|
String transferStatus = addressBalanceTransfer.getMessage();
|
||||||
makeToastFundWalletFragment(transferStatus);
|
makeToastFundWalletFragment(transferStatus);
|
||||||
|
getBalance(false);
|
||||||
|
Toast.makeText(getActivity(), "Updating balance...", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
addressAndBalanceChecker.cancel(true);
|
||||||
|
transactionInProgress = false;
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearAllTransferValues() {
|
||||||
|
editTextAddress.setText("");
|
||||||
|
editTextAmount.setText("");
|
||||||
|
editTextMessage.setText("");
|
||||||
|
editTextTag.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideLoadingGIF() {
|
||||||
|
loadingGifImageView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showLoadingGIF() {
|
||||||
|
loadingGifImageView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
@ -126,8 +162,9 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
editTextAmount = (EditText) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletAmount);
|
editTextAmount = (EditText) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletAmount);
|
||||||
editTextMessage = (EditText) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletMessage);
|
editTextMessage = (EditText) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletMessage);
|
||||||
editTextTag = (EditText) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletTag);
|
editTextTag = (EditText) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletTag);
|
||||||
|
loadingGifImageView = (GifImageView) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletLoadingGIF);
|
||||||
balanceTextView = (TextView) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletBalanceValue);
|
balanceTextView = (TextView) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletBalanceValue);
|
||||||
|
mSwipeRefreshLayout = (SwipeRefreshLayout) withdrawWalletFragmentView.findViewById(R.id.WithdrawWalletSwipeRefresh);
|
||||||
|
|
||||||
// Set Listeners
|
// Set Listeners
|
||||||
qrScannerButton.setOnClickListener(new View.OnClickListener() {
|
qrScannerButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -144,103 +181,55 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
initiateRefresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
showLoadingGIF();
|
||||||
Toast.makeText(getActivity(), "Retrieving balance...",
|
Toast.makeText(getActivity(), "Retrieving balance...",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
getBalance(true,false);
|
getBalance(true);
|
||||||
return withdrawWalletFragmentView;
|
return withdrawWalletFragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getBalance(Boolean async, Boolean inNoUpdateMessage) {
|
private void getBalance(Boolean updateMessage) {
|
||||||
|
transactionInProgress = true;
|
||||||
|
addressAndBalanceChecker = new WalletAddressAndBalanceChecker(getActivity(),getActivity().getString(R.string.preference_file_key),appWalletSeed, mHandler,WITHDRAW_WALLET,updateMessage);
|
||||||
|
addressAndBalanceChecker.execute();
|
||||||
|
}
|
||||||
|
|
||||||
final Boolean noUpdateMessageFinal = inNoUpdateMessage;
|
private void initiateRefresh() {
|
||||||
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
|
||||||
if(async){
|
if(transactionInProgress == false){
|
||||||
//Get balance with new async call
|
balanceTextView.setText("");
|
||||||
AsyncTask.execute(new Runnable() {
|
showLoadingGIF();
|
||||||
@Override
|
Toast.makeText(getActivity(), "Retrieving balance...", Toast.LENGTH_SHORT).show();
|
||||||
public void run() {
|
getBalance(true);
|
||||||
WalletAddressAndBalanceChecker addressAndBalanceChecker = new WalletAddressAndBalanceChecker(getActivity(),getActivity().getString(R.string.preference_file_key));
|
|
||||||
List<String> addressList = addressAndBalanceChecker.getAddress(appWalletSeed);
|
|
||||||
|
|
||||||
if(addressList != null && addressList.get(0) == "Unable to resolve host"){
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "hostError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
else if(addressList != null){
|
|
||||||
appWalletBalance = addressAndBalanceChecker.getBalance(addressList);
|
|
||||||
if(appWalletBalance != null){
|
|
||||||
if(noUpdateMessageFinal){
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "noErrorNoUpdateMessage");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "noError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Balance Retrieval Error
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "balanceError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Address Retrieval Error
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "addressError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Get balance without async call (perform on called thread)
|
|
||||||
WalletAddressAndBalanceChecker addressAndBalanceChecker = new WalletAddressAndBalanceChecker(getActivity(),getActivity().getString(R.string.preference_file_key));
|
|
||||||
List<String> addressList = addressAndBalanceChecker.getAddress(appWalletSeed);
|
|
||||||
|
|
||||||
if(addressList != null && addressList.get(0) == "Unable to resolve host"){
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "hostError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
else if(addressList != null){
|
|
||||||
appWalletBalance = addressAndBalanceChecker.getBalance(addressList);
|
|
||||||
if(appWalletBalance != null){
|
|
||||||
if(noUpdateMessageFinal){
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "noErrorNoUpdateMessage");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "noError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Balance Retrieval Error
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "balanceError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//Address Retrieval Error
|
|
||||||
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, "addressError");
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeToastFundWalletFragment(String s) {
|
private void makeToastFundWalletFragment(String s) {
|
||||||
if(getActivity() != null){
|
if(getActivity() != null){
|
||||||
System.out.println("makeToastFundWalletFragment: "+s);
|
|
||||||
Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void qrScannerButtonClick() {
|
private void qrScannerButtonClick() {
|
||||||
if (!hasCameraPermission(getActivity())) {
|
if(transactionInProgress == false) {
|
||||||
Toast.makeText(getActivity(), "Camera permission not granted", Toast.LENGTH_SHORT).show();
|
if (!hasCameraPermission(getActivity())) {
|
||||||
|
Toast.makeText(getActivity(), "Camera permission not granted", Toast.LENGTH_SHORT).show();
|
||||||
/* TODO: Ask for permission. Currently depends on manifest for permission. Should ask at runtime */
|
/* TODO: Ask for permission. Currently depends on manifest for permission. Should ask at runtime */
|
||||||
} else {
|
} else {
|
||||||
launchQRScanner();
|
launchQRScanner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Toast.makeText(getActivity(), "Please wait for balance to be retrieved", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +240,7 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
final String message = editTextMessage.getText().toString();
|
final String message = editTextMessage.getText().toString();
|
||||||
final String tag = editTextTag.getText().toString();
|
final String tag = editTextTag.getText().toString();
|
||||||
|
|
||||||
if(appWalletBalance == null || appWalletBalance.isEmpty()){
|
if(appWalletBalance == null || appWalletBalance.isEmpty() || transactionInProgress){
|
||||||
Toast.makeText(getActivity(), "Please wait for balance to be retrieved", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "Please wait for balance to be retrieved", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
else if(isValidAddress() == false){
|
else if(isValidAddress() == false){
|
||||||
@ -274,42 +263,54 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK",
|
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK",
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
showLoadingGIF();
|
||||||
|
makeFieldsNonEditable();
|
||||||
|
Toast.makeText(getActivity(), "Sending... (It is assumed that the balance is up to date)", Toast.LENGTH_SHORT).show();
|
||||||
//Send transfer
|
//Send transfer
|
||||||
AsyncTask.execute(new Runnable() {
|
sendTransfer(sendAddress,sendAmount,message,tag);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
String result;
|
|
||||||
if(sendAmount.isEmpty()){
|
|
||||||
String zeroSendAmount = "0";
|
|
||||||
WalletTransferRequest transferRequest = new WalletTransferRequest(sendAddress,appWalletSeed,zeroSendAmount,message,tag,getActivity());
|
|
||||||
result = transferRequest.sendRequest();
|
|
||||||
System.out.println("sendButtonClick: "+result);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
WalletTransferRequest transferRequest = new WalletTransferRequest(sendAddress,appWalletSeed,sendAmount,message,tag,getActivity());
|
|
||||||
result = transferRequest.sendRequest();
|
|
||||||
System.out.println("sendButtonClick: "+result);
|
|
||||||
}
|
|
||||||
getBalance(false,true);
|
|
||||||
Message completeMessage = mHandler.obtainMessage(TRANSFER_TASK_COMPLETE, result);
|
|
||||||
completeMessage.sendToTarget();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//TODO: Empty all fields
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendTransfer(String sendAddress, String sendAmount, String message, String tag) {
|
||||||
|
String finalSendAmount;
|
||||||
|
if(sendAmount.isEmpty()){
|
||||||
|
finalSendAmount = "0";
|
||||||
|
}else{
|
||||||
|
finalSendAmount = sendAmount;
|
||||||
|
}
|
||||||
|
WalletTransferRequest transferRequest = new WalletTransferRequest(sendAddress,appWalletSeed,finalSendAmount,message,tag,getActivity(),mHandler);
|
||||||
|
transactionInProgress = true;
|
||||||
|
transferRequest.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void makeFieldsNonEditable() {
|
||||||
|
editTextAddress.setEnabled(false);
|
||||||
|
editTextAmount.setEnabled(false);
|
||||||
|
editTextMessage.setEnabled(false);
|
||||||
|
editTextTag.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void makeFieldsEditable() {
|
||||||
|
editTextAddress.setText("");
|
||||||
|
editTextAmount.setText("");
|
||||||
|
editTextMessage.setText("");
|
||||||
|
editTextTag.setText("");
|
||||||
|
|
||||||
|
editTextAddress.setEnabled(true);
|
||||||
|
editTextAmount.setEnabled(true);
|
||||||
|
editTextMessage.setEnabled(true);
|
||||||
|
editTextTag.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasCameraPermission(Context context) {
|
public static boolean hasCameraPermission(Context context) {
|
||||||
int result = context.checkCallingOrSelfPermission(CAMERA);
|
int result = context.checkCallingOrSelfPermission(CAMERA);
|
||||||
return result == PackageManager.PERMISSION_GRANTED;
|
return result == PackageManager.PERMISSION_GRANTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchQRScanner() {
|
private void launchQRScanner() {
|
||||||
/*
|
|
||||||
TODO:Uncomment to re-enable scanner
|
|
||||||
Fragment fragment = new QRScannerFragment();
|
Fragment fragment = new QRScannerFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
@ -322,14 +323,8 @@ public class WithdrawWalletFragment extends Fragment {
|
|||||||
getActivity().getFragmentManager().beginTransaction()
|
getActivity().getFragmentManager().beginTransaction()
|
||||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||||
.add(fragment, null)
|
.add(fragment, null)
|
||||||
//.add(R.id.content_frame, fragment, null)
|
|
||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
.commit();
|
.commit();
|
||||||
//fragment.setRetainInstance(true);
|
|
||||||
*/
|
|
||||||
|
|
||||||
editTextAddress.setText("ULRSUDTQLEQLXUMXEOWPEUIHRZUJFPUZRHVBZC9XYIVZJWGFOJNLDHQNQAZPPVOSTVBUT9T9EJRNMGGO9");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -6,8 +6,11 @@ package com.flashwifi.wifip2p.iotaAPI.Requests;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
|
||||||
import com.flashwifi.wifip2p.R;
|
import com.flashwifi.wifip2p.AddressBalanceTransfer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -18,16 +21,30 @@ import jota.dto.response.GetNewAddressResponse;
|
|||||||
import jota.error.ArgumentException;
|
import jota.error.ArgumentException;
|
||||||
import jota.model.Transaction;
|
import jota.model.Transaction;
|
||||||
|
|
||||||
public class WalletAddressAndBalanceChecker {
|
public class WalletAddressAndBalanceChecker extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
|
private static final int BALANCE_RETRIEVE_TASK_COMPLETE = 1;
|
||||||
|
|
||||||
|
private static final int FUND_WALLET = 0;
|
||||||
|
private static final int WITHDRAW_WALLET = 1;
|
||||||
|
|
||||||
private static IotaAPI api;
|
private static IotaAPI api;
|
||||||
private static Context context;
|
private static Context context;
|
||||||
private String prefFile;
|
private String prefFile;
|
||||||
|
private String seed;
|
||||||
|
private Handler mHandler;
|
||||||
|
private int type;
|
||||||
|
private Boolean updateMessage;
|
||||||
|
|
||||||
//GetNodeInfoResponse response = api.getNodeInfo();
|
//GetNodeInfoResponse response = api.getNodeInfo();
|
||||||
|
|
||||||
public WalletAddressAndBalanceChecker(Context inActivity, String inPrefFile) {
|
public WalletAddressAndBalanceChecker(Context inActivity, String inPrefFile, String inSeed, Handler inMHandler, int inType, Boolean inUpdateMessage) {
|
||||||
context = inActivity;
|
context = inActivity;
|
||||||
prefFile = inPrefFile;
|
prefFile = inPrefFile;
|
||||||
|
seed = inSeed;
|
||||||
|
mHandler = inMHandler;
|
||||||
|
type = inType;
|
||||||
|
updateMessage = inUpdateMessage;
|
||||||
|
|
||||||
//Mainnet node:
|
//Mainnet node:
|
||||||
/*
|
/*
|
||||||
@ -47,6 +64,50 @@ public class WalletAddressAndBalanceChecker {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... voids) {
|
||||||
|
if(context != null){
|
||||||
|
List<String> addressList = getAddress(seed);
|
||||||
|
|
||||||
|
if(addressList != null && addressList.get(0) == "Unable to resolve host"){
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = new AddressBalanceTransfer(null,null,"hostError");
|
||||||
|
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, addressBalanceTransfer);
|
||||||
|
completeMessage.sendToTarget();
|
||||||
|
}
|
||||||
|
else if(addressList != null){
|
||||||
|
|
||||||
|
String depositAddress = addressList.get(addressList.size()-1);
|
||||||
|
String balance = getBalance(addressList);
|
||||||
|
|
||||||
|
if(balance != null){
|
||||||
|
if(type == WITHDRAW_WALLET && updateMessage == false){
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = new AddressBalanceTransfer(depositAddress,balance,"noErrorNoUpdateMessage");
|
||||||
|
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE,addressBalanceTransfer);
|
||||||
|
completeMessage.sendToTarget();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = new AddressBalanceTransfer(depositAddress,balance,"noError");
|
||||||
|
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE,addressBalanceTransfer);
|
||||||
|
completeMessage.sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//Balance Retrieval Error
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = new AddressBalanceTransfer(null,null,"balanceError");
|
||||||
|
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, addressBalanceTransfer);
|
||||||
|
completeMessage.sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//Address Retrieval Error
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = new AddressBalanceTransfer(null,null,"addressError");
|
||||||
|
Message completeMessage = mHandler.obtainMessage(BALANCE_RETRIEVE_TASK_COMPLETE, addressBalanceTransfer);
|
||||||
|
completeMessage.sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getBalance(List<String> inAddresses){
|
public String getBalance(List<String> inAddresses){
|
||||||
String[] balanceArray;
|
String[] balanceArray;
|
||||||
try {
|
try {
|
||||||
@ -56,7 +117,14 @@ public class WalletAddressAndBalanceChecker {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return balanceArray[balanceArray.length-2];
|
|
||||||
|
if(balanceArray.length>1){
|
||||||
|
return balanceArray[balanceArray.length-2];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return balanceArray[balanceArray.length-1];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAddress(String seed) {
|
public List<String> getAddress(String seed) {
|
||||||
@ -98,12 +166,19 @@ public class WalletAddressAndBalanceChecker {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Found transactions, increment for new address
|
//Found transactions, increment for new address
|
||||||
keyIndex+=1;
|
keyIndex = keyIndex + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Put the second last address to search
|
|
||||||
putKeyIndex(keyIndex-1);
|
if(keyIndex == 0){
|
||||||
|
//Put the initial address to search. No transactions for the seed yet.
|
||||||
|
putKeyIndex(keyIndex);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//Put the second last address to search
|
||||||
|
putKeyIndex(keyIndex-1);
|
||||||
|
}
|
||||||
return addressList;
|
return addressList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
package com.flashwifi.wifip2p.iotaAPI.Requests;
|
package com.flashwifi.wifip2p.iotaAPI.Requests;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.content.Context;
|
||||||
import android.widget.Toast;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
|
||||||
|
import com.flashwifi.wifip2p.AddressBalanceTransfer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -9,29 +13,31 @@ import java.util.List;
|
|||||||
import jota.IotaAPI;
|
import jota.IotaAPI;
|
||||||
import jota.dto.response.SendTransferResponse;
|
import jota.dto.response.SendTransferResponse;
|
||||||
import jota.error.ArgumentException;
|
import jota.error.ArgumentException;
|
||||||
import jota.model.Transaction;
|
|
||||||
import jota.model.Transfer;
|
import jota.model.Transfer;
|
||||||
|
|
||||||
public class WalletTransferRequest {
|
public class WalletTransferRequest extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
|
private static final int TRANSFER_TASK_COMPLETE = 2;
|
||||||
|
|
||||||
private static IotaAPI api;
|
private static IotaAPI api;
|
||||||
private static Activity activity;
|
private static Context context;
|
||||||
private String appWalletSeed;
|
private String appWalletSeed;
|
||||||
private String sendAddress;
|
private String sendAddress;
|
||||||
private String sendAmount;
|
private String sendAmount;
|
||||||
private String message;
|
private String message;
|
||||||
private String tag;
|
private String tag;
|
||||||
private String transferResult;
|
private String transferResult;
|
||||||
|
private Handler mHandler;
|
||||||
|
|
||||||
|
public WalletTransferRequest(String inSendAddress, String inAppWalletSeed, String inSendAmount, String inMessage, String inTag, Context inContext, Handler inMHandler) {
|
||||||
public WalletTransferRequest(String inSendAddress, String inAppWalletSeed, String inSendAmount, String inMessage, String inTag, Activity inActivity) {
|
|
||||||
|
|
||||||
sendAddress = inSendAddress;
|
sendAddress = inSendAddress;
|
||||||
appWalletSeed = inAppWalletSeed;
|
appWalletSeed = inAppWalletSeed;
|
||||||
sendAmount = inSendAmount;
|
sendAmount = inSendAmount;
|
||||||
message = inMessage;
|
message = inMessage;
|
||||||
tag = inTag;
|
tag = inTag;
|
||||||
activity = inActivity;
|
context = inContext;
|
||||||
|
mHandler = inMHandler;
|
||||||
|
|
||||||
//Mainnet node:
|
//Mainnet node:
|
||||||
/*
|
/*
|
||||||
@ -51,6 +57,24 @@ public class WalletTransferRequest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... voids) {
|
||||||
|
sendRequest();
|
||||||
|
|
||||||
|
String result = null;
|
||||||
|
|
||||||
|
if(context != null){
|
||||||
|
result = sendRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
AddressBalanceTransfer addressBalanceTransfer = new AddressBalanceTransfer(null,null,null);
|
||||||
|
addressBalanceTransfer.setMessage(result);
|
||||||
|
|
||||||
|
Message completeMessage = mHandler.obtainMessage(TRANSFER_TASK_COMPLETE, addressBalanceTransfer);
|
||||||
|
completeMessage.sendToTarget();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String sendRequest(){
|
public String sendRequest(){
|
||||||
|
|
||||||
List<Transfer> transfers = new ArrayList<>();
|
List<Transfer> transfers = new ArrayList<>();
|
||||||
@ -106,5 +130,4 @@ public class WalletTransferRequest {
|
|||||||
}
|
}
|
||||||
return transferResult;
|
return transferResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
app/src/main/res/drawable/iota_progress.gif
Normal file
BIN
app/src/main/res/drawable/iota_progress.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
@ -1,110 +1,137 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="com.flashwifi.wifip2p.FundWalletFragment"
|
||||||
|
android:id="@+id/FundWalletSwipeRefresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context="com.flashwifi.wifip2p.FundWalletFragment">
|
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="#0D47A1"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/FundWalletBalanceLabel"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#0D47A1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:text="@string/FundWalletBalanceLabel"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/FundWalletBalanceValue"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#0D47A1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="40dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="#1365E5"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/FundWalletTitleLabel"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#1365E5"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:text="@string/FundWalletAddressLabel"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/AddressValue"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#1365E5"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="40dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:text=""
|
|
||||||
android:textColor="#ffffff" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#1570FF"
|
android:fillViewport="true">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/QRCodeLabel"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="20dp"
|
android:background="#1365E5"
|
||||||
android:paddingEnd="20dp"
|
android:orientation="vertical">
|
||||||
android:paddingStart="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:text="@string/FundWalletQRCodeLabel"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/QRCode"
|
android:layout_width="match_parent"
|
||||||
android:paddingBottom="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:paddingEnd="20dp"
|
android:background="#0D47A1"
|
||||||
android:paddingStart="20dp"
|
android:orientation="horizontal">
|
||||||
android:paddingTop="10dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
android:id="@+id/FundWalletBalanceLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#0D47A1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text="@string/FundWalletBalanceLabel"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
android:id="@+id/FundWalletBalanceValue"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#0D47A1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="40dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#1365E5"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/FundWalletTitleLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#1365E5"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text="@string/FundWalletAddressLabel"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/AddressValue"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#1365E5"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="40dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="#ffffff" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:animateLayoutChanges="true"
|
||||||
|
android:background="#1570FF"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/QRCodeLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text="@string/FundWalletQRCodeLabel"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<pl.droidsonroids.gif.GifImageView
|
||||||
|
android:id="@+id/FundWalletLoadingGIF"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_gravity="center_horizontal|center_vertical"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="#1570FF"
|
||||||
|
android:src="@drawable/iota_progress" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/QRCode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:contentDescription="@string/QRCodeContentDescription"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingTop="10dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
@ -1,204 +1,227 @@
|
|||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="com.flashwifi.wifip2p.WithdrawWalletFragment"
|
||||||
|
android:id="@+id/WithdrawWalletSwipeRefresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:fillViewport="true"
|
|
||||||
tools:context="com.flashwifi.wifip2p.WithdrawWalletFragment">
|
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:background="#1570FF"
|
||||||
android:orientation="vertical">
|
android:fillViewport="true"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#0D47A1"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/WithdrawWalletBalanceLabel"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#0D47A1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:text="@string/WithdarWalletBalanceLabel"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/WithdrawWalletBalanceValue"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#0D47A1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="40dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="#1365E5"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/WithdrawWalletTransferLabel"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#1365E5"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:text="@string/WithdrawWalletTransferLabel"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/WithdrawWalletQRScannerButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal|center_vertical"
|
|
||||||
android:background="#1365E5"
|
|
||||||
android:clickable="true"
|
|
||||||
android:contentDescription="@string/QRScannerDescription"
|
|
||||||
android:focusable="true"
|
|
||||||
android:paddingBottom="5dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:paddingStart="5dp"
|
|
||||||
android:paddingTop="5dp"
|
|
||||||
android:src="@drawable/qrcode_scan"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:tint="#ffffff" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="#1570FF"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/WithdrawWalletAddress"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="20dp"
|
|
||||||
android:layout_marginStart="20dp"
|
|
||||||
android:ems="10"
|
|
||||||
android:hint="Address"
|
|
||||||
android:inputType="textPersonName"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:textColor="#ffffff" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#0D47A1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/WithdrawWalletAmount"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="20dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ems="10"
|
|
||||||
android:hint="Amount"
|
|
||||||
android:inputType="number"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:textColor="#ffffff" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/WithdrawWalletUnitsLabel"
|
android:id="@+id/WithdrawWalletBalanceLabel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:background="#0D47A1"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="20dp"
|
android:paddingBottom="20dp"
|
||||||
android:paddingEnd="20dp"
|
android:paddingEnd="20dp"
|
||||||
android:paddingStart="10dp"
|
android:paddingStart="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text="@string/WithdrawWalletBalanceLabel"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/WithdrawWalletBalanceValue"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#0D47A1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="40dp"
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="20dp"
|
||||||
android:text="i"
|
|
||||||
android:textColor="#ffffff"
|
android:textColor="#ffffff"
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText
|
<LinearLayout
|
||||||
android:id="@+id/WithdrawWalletMessage"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="20dp"
|
android:background="#1365E5"
|
||||||
android:layout_marginStart="20dp"
|
android:orientation="horizontal">
|
||||||
android:ems="10"
|
|
||||||
android:hint="Message (optional, A-Z and 9 only)"
|
|
||||||
android:inputType="text"
|
|
||||||
android:digits="9ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:textColor="#ffffff" />
|
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/WithdrawWalletTag"
|
android:id="@+id/WithdrawWalletTransferLabel"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#1365E5"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text="@string/WithdrawWalletTransferLabel"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/WithdrawWalletQRScannerButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal|center_vertical"
|
||||||
|
android:background="#1365E5"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="@string/QRScannerDescription"
|
||||||
|
android:focusable="true"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:src="@drawable/qrcode_scan"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:tint="#ffffff" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="20dp"
|
android:background="#1570FF"
|
||||||
android:layout_marginStart="20dp"
|
android:animateLayoutChanges="true"
|
||||||
android:ems="10"
|
android:orientation="vertical">
|
||||||
android:hint="Tag (optional, A-Z and 9 only)"
|
|
||||||
android:inputType="text"
|
<EditText
|
||||||
android:digits="9ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
android:id="@+id/WithdrawWalletAddress"
|
||||||
android:paddingBottom="20dp"
|
android:layout_width="match_parent"
|
||||||
android:paddingTop="20dp"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="#ffffff" />
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Address"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:textColor="#ffffff" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#1570FF"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/WithdrawWalletAmount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Amount"
|
||||||
|
android:inputType="number"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:textColor="#ffffff" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/WithdrawWalletUnitsLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:text="i"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/WithdrawWalletMessage"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Message (optional, A-Z and 9 only)"
|
||||||
|
android:inputType="text"
|
||||||
|
android:digits="9ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:textColor="#ffffff" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/WithdrawWalletTag"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Tag (optional, A-Z and 9 only)"
|
||||||
|
android:inputType="text"
|
||||||
|
android:digits="9ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:textColor="#ffffff" />
|
||||||
|
|
||||||
|
<pl.droidsonroids.gif.GifImageView
|
||||||
|
android:id="@+id/WithdrawWalletLoadingGIF"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_gravity="center_horizontal|center_vertical"
|
||||||
|
android:background="#1570FF"
|
||||||
|
android:src="@drawable/iota_progress"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#1570FF">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/WithdrawWalletSend"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|left"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:background="#051c40"
|
||||||
|
android:clickable="true"
|
||||||
|
android:elevation="10dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:text=">"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
</ScrollView>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#1570FF">
|
|
||||||
|
|
||||||
<Button
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
android:id="@+id/WithdrawWalletSend"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|left"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:background="#051c40"
|
|
||||||
android:clickable="true"
|
|
||||||
android:elevation="10dp"
|
|
||||||
android:focusable="true"
|
|
||||||
android:text=">"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
@ -48,8 +48,10 @@
|
|||||||
<string name="FundWalletBalanceLabel">ACCOUNT BLANCE: </string>
|
<string name="FundWalletBalanceLabel">ACCOUNT BLANCE: </string>
|
||||||
<string name="FundWalletQRCodeLabel">QR CODE: </string>
|
<string name="FundWalletQRCodeLabel">QR CODE: </string>
|
||||||
|
|
||||||
<!-- Withdar Wallet Fragment -->
|
<string name="QRCodeContentDescription">QR Code</string>
|
||||||
<string name="WithdarWalletBalanceLabel">ACCOUNT BLANCE: </string>
|
|
||||||
|
<!-- Withdraw Wallet Fragment -->
|
||||||
|
<string name="WithdrawWalletBalanceLabel">ACCOUNT BALANCE: </string>
|
||||||
<string name="WithdrawWalletTransferLabel">NEW TRANSFER: </string>
|
<string name="WithdrawWalletTransferLabel">NEW TRANSFER: </string>
|
||||||
<string name="QRScannerDescription">QR Code Scanner</string>
|
<string name="QRScannerDescription">QR Code Scanner</string>
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ buildscript {
|
|||||||
url 'https://maven.google.com/'
|
url 'https://maven.google.com/'
|
||||||
name 'Google'
|
name 'Google'
|
||||||
}
|
}
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||||
@ -19,6 +20,7 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
maven {url 'https://jitpack.io'}
|
maven {url 'https://jitpack.io'}
|
||||||
maven {
|
maven {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user