Compare commits
No commits in common. "develop" and "master" have entirely different histories.
Binary file not shown.
|
@ -5,26 +5,22 @@
|
|||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="7">
|
||||
<list size="5">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="6">
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,45 +1,32 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
compileSdkVersion 26
|
||||
defaultConfig {
|
||||
applicationId 'com.monnethic.appmobile'
|
||||
applicationId "com.example.monnthic.monnthicmobile"
|
||||
multiDexEnabled true
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 27
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
buildToolsVersion '28.0.3'
|
||||
productFlavors {
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||
implementation 'com.android.support:design:26.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.json:json:20140107'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation 'com.google.zxing:core:3.2.1'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
|
||||
implementation 'com.google.android.gms:play-services-vision:17.0.2'
|
||||
implementation 'com.j256.ormlite:ormlite-core:5.1'
|
||||
implementation 'com.j256.ormlite:ormlite-jdbc:5.1'
|
||||
implementation 'org.postgresql:postgresql:42.2.5'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
||||
compile ('org.web3j:core:3.3.1-android')
|
||||
compile ('com.j256.ormlite:ormlite-android:4.48')
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package monnethic.mobile.test;
|
||||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
|
@ -1,54 +0,0 @@
|
|||
package monnethic.mobile.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
|
||||
|
||||
public class LearningTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
System.out.println(appContext.getFilesDir());
|
||||
|
||||
System.out.println(appContext.getPackageName());
|
||||
|
||||
InputStream is = appContext.getResources().openRawResource(R.raw.config);
|
||||
/*
|
||||
try (JsonReader reader = Json.createReader(is)) {
|
||||
JsonObject jsonConfig = (JsonObject) reader.read();
|
||||
System.out.println(jsonConfig);
|
||||
System.out.println(jsonConfig.getClass());
|
||||
NetworkConfig config;
|
||||
config = NetworkConfig.fromJsonObject(jsonConfig);
|
||||
//System.out.println(config!=null);
|
||||
}*/
|
||||
|
||||
/*
|
||||
Writer writer = new StringWriter();
|
||||
char[] buffer = new char[1024];
|
||||
try {
|
||||
Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
int n;
|
||||
while ((n = reader.read(buffer)) != -1) {
|
||||
writer.write(buffer, 0, n);
|
||||
}
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
|
||||
String jsonString = writer.toString();
|
||||
JSONObject jsonObject = new JSONObject(jsonString);
|
||||
System.out.println(jsonObject.getString("name"));
|
||||
System.out.println(jsonObject.getJSONObject("organizations"));
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.monnthic.monnethicmobile">
|
||||
package="com.example.monnthic.monnthicmobile">
|
||||
|
||||
<!-- To auto-complete the email text field in the login form with Useruser's emails -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -17,33 +17,20 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.vision.DEPENDENCIES"
|
||||
android:value="barcode" />
|
||||
|
||||
<activity android:name="monnethic.mobile.homepage.HomepageActivity">
|
||||
<activity android:name=".HomepageActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="monnethic.mobile.homepage.RegisterActivity" />
|
||||
<activity android:name="monnethic.mobile.homepage.LoginActivity" />
|
||||
<activity android:name="monnethic.mobile.user.UserAccountActivity" />
|
||||
<activity android:name="monnethic.mobile.transaction.TransactionActivity" />
|
||||
<activity android:name="monnethic.mobile.qrcode.QrCodeActivity" />
|
||||
<activity android:name="monnethic.mobile.transaction.ReceivePayementActivity" />
|
||||
<activity android:name="monnethic.mobile.transaction.MakePayementActivity" />
|
||||
<activity android:name="monnethic.mobile.qrcode.QrCodeScannerActivity" />
|
||||
<activity android:name="monnethic.mobile.transaction.ApprovePayementActivity" />
|
||||
<activity android:name="monnethic.mobile.wallet.HomeWalletActivity" />
|
||||
<activity android:name="monnethic.mobile.wallet.CreateWalletActivity" />
|
||||
<activity android:name="monnethic.mobile.wallet.SelectWalletActivity" />
|
||||
<activity android:name="monnethic.mobile.search.SearchUser" />
|
||||
<activity android:name="monnethic.mobile.search.DisplayWalletSearch" />
|
||||
<activity android:name="monnethic.mobile.history.HistoryActivity" />
|
||||
<activity android:name="monnethic.mobile.history.HistoryDetailsActivity"></activity>
|
||||
<activity android:name=".SignupActivity" />
|
||||
<activity android:name=".LoginActivity" />
|
||||
<activity android:name=".WalletActivity" />
|
||||
<activity android:name=".UserAccountActivity" />
|
||||
<activity android:name=".DemoActivity" />
|
||||
<activity android:name=".WalletPresenterActivity" />
|
||||
<activity android:name=".TransactionActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,161 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import org.web3j.crypto.RawTransaction;
|
||||
import org.web3j.protocol.Web3j;
|
||||
import org.web3j.protocol.Web3jFactory;
|
||||
import org.web3j.protocol.core.methods.response.EthGetBalance;
|
||||
import org.web3j.protocol.core.methods.response.EthGetTransactionCount;
|
||||
import org.web3j.protocol.core.methods.request.Transaction;
|
||||
import org.web3j.protocol.core.methods.response.EthSendTransaction;
|
||||
import org.web3j.protocol.core.methods.response.TransactionReceipt;
|
||||
import org.web3j.protocol.http.HttpService;
|
||||
import org.web3j.protocol.core.DefaultBlockParameterName;
|
||||
import org.web3j.utils.Convert;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Created by Guillaume on 28/05/2018.
|
||||
*/
|
||||
|
||||
public class AccessBlockchain {
|
||||
private static final String node3 = "http://5.51.59.70:1403";
|
||||
private static final String node2 = "http://93.30.148.59:1402";
|
||||
private static final String node1 = "http://93.30.148.59:1401";
|
||||
//private static String address_test = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e";
|
||||
private static String address_node3 = "0x869abc2dadd7e23c8b38f054276813a67d8131a7";
|
||||
//Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
||||
|
||||
public static void main(String [ ] args)
|
||||
{
|
||||
try{
|
||||
//USED FOR TEST
|
||||
|
||||
/*
|
||||
Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
||||
System.out.println(web3jNode1.ethCoinbase().sendAsync().get().getResult());
|
||||
|
||||
EthGetTransactionCount transactionCount = web3jNode1.ethGetTransactionCount(address_test, DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
System.out.println(transactionCount);
|
||||
BigInteger nonce = transactionCount.getTransactionCount();
|
||||
System.out.println(nonce);
|
||||
*/
|
||||
Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
||||
System.out.println("Node 1 : ethAccounts : "+web3jNode1.ethAccounts().send().getAccounts());
|
||||
EthGetBalance ethGetBalance1 = web3jNode1.ethGetBalance("0x5421c79d465a288c28e10aa43f9b7dff1b313c8e", DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
|
||||
|
||||
Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
||||
System.out.println("Noded 2 ethAccounts : "+web3jNode2.ethAccounts().send().getAccounts());
|
||||
EthGetBalance ethGetBalance2 = web3jNode2.ethGetBalance("0xef816528949bda3b87e19b86848fb28767156232", DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
|
||||
System.out.println("Node 1 ethMining : "+web3jNode1.ethMining().send().getResult());
|
||||
|
||||
System.out.println("Node 1 sync : "+web3jNode1.ethSyncing().send().getResult().toString());
|
||||
|
||||
|
||||
BigInteger wei1 = ethGetBalance1.getBalance();
|
||||
System.out.println("Node 1 balance is : "+wei1);
|
||||
|
||||
BigInteger wei2 = ethGetBalance2.getBalance();
|
||||
System.out.println("Node 2 balance is : "+wei2);
|
||||
|
||||
System.out.println("ethBlockNumber Node 1 : "+web3jNode1.ethBlockNumber().send().getResult());
|
||||
System.out.println("ethGetWork Node 1 : "+web3jNode1.ethGetWork().send().getResult());
|
||||
|
||||
|
||||
Web3j web3jNode3 = Web3jFactory.build(new HttpService(node3));
|
||||
System.out.println("Node 3 : ethAccounts : "+web3jNode3.ethAccounts().send().getAccounts());
|
||||
|
||||
EthGetBalance ethGetBalance_n3 = web3jNode1.ethGetBalance(address_node3, DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
System.out.println("TEST node 1 wallet 3 : "+ethGetBalance_n3);
|
||||
|
||||
//BigInteger test = getTheBalanceOfWallet(address);
|
||||
//System.out.println(test);
|
||||
|
||||
//Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
||||
//Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
||||
//System.out.println("ethAccounts : "+web3jNode1.ethAccounts().send().getAccounts());
|
||||
//System.out.println("ethGasPrice : "+web3jNode1.ethGasPrice().send().getGasPrice());
|
||||
//System.out.println("ethGetWork : "+web3jNode1.ethGetWork().send().getResult());
|
||||
//System.out.println("ethBlockNumber : "+web3jNode1.ethBlockNumber().send().getResult());
|
||||
//EthGetBalance ethGetBalance = web3jNode1.ethGetBalance("0x5421c79d465a288c28e10aa43f9b7dff1b313c8e", DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
// BigInteger wei = ethGetBalance.getBalance();
|
||||
//System.out.println("wei is : "+wei);
|
||||
|
||||
//System.out.println("*************************************************");
|
||||
//Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
||||
//Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
||||
//System.out.println("ethAccounts : "+web3jNode1.ethAccounts().send().getAccounts());
|
||||
//System.out.println("ethAccounts : "+web3jNode2.ethAccounts().send().getAccounts());
|
||||
//System.out.println("ethGasPrice : "+web3jNode2.ethGasPrice().send().getGasPrice());
|
||||
//System.out.println("ethGetWork : "+web3jNode2.ethGetWork().send().getResult());
|
||||
//System.out.println("ethBlockNumber : "+web3jNode2.ethBlockNumber().send().getResult());
|
||||
//EthGetBalance ethGetBalance2 = web3jNode2.ethGetBalance("0x0278467c617c13604b3d88b95c2257a3a8a7bc01", DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
//BigInteger wei2 = ethGetBalance2.getBalance();
|
||||
//System.out.println("wei is : "+wei2);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Get Balance function
|
||||
public BigInteger getTheBalanceOfWallet(String walletAddress){
|
||||
Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
||||
try{
|
||||
EthGetBalance ethGetBalance = web3jNode1.ethGetBalance(walletAddress, DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
BigInteger wei = ethGetBalance.getBalance();
|
||||
return wei;
|
||||
}catch (Exception e){
|
||||
e.getMessage();
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//Send DbTransaction demo function
|
||||
public static boolean sendTransationTo(String addressSource, String addressDestination, BigInteger amountToSend){
|
||||
Web3j n1 = Web3jFactory.build(new HttpService(node1));
|
||||
try{
|
||||
EthGetTransactionCount transactionCount = n1.ethGetTransactionCount(addressSource, DefaultBlockParameterName.LATEST).sendAsync().get();
|
||||
String coinbase = n1.ethCoinbase().sendAsync().get().getResult();
|
||||
BigInteger nonce = transactionCount.getTransactionCount();
|
||||
BigInteger gasPrice = n1.ethGasPrice().send().getGasPrice();
|
||||
BigInteger gasLimit = gasPrice.multiply(BigInteger.valueOf(2));
|
||||
|
||||
BigInteger amountEther = Convert.toWei(amountToSend.toString(), Convert.Unit.ETHER).toBigInteger();
|
||||
Transaction transaction = Transaction.createEtherTransaction(coinbase, nonce, gasPrice, gasLimit, addressDestination, amountEther);
|
||||
String txUnit = "ETHER";
|
||||
|
||||
System.out.println("source : "+coinbase+"\nnonce : "+nonce+"\ngasPrice : "+gasPrice);
|
||||
System.out.println("gasLimit : "+gasLimit+"\ndestination : "+addressDestination+"\namount : "+amountEther);
|
||||
|
||||
/*
|
||||
Send the transaction
|
||||
*/
|
||||
//EthSendTransaction ethSendTransaction = n1.ethSendTransaction(transaction).sendAsync().get();
|
||||
//String txHash = ethSendTransaction.getTransactionHash();
|
||||
//TransactionReceipt txR = n1.ethGetTransactionReceipt(txHash).send().getResult();
|
||||
//txR.getBlockNumber();
|
||||
//insertTransaction(addressSource, addressDestination, amountToSend, txHash, txR.getBlockNumber().toString(), txUnit);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.getMessage();
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void insertTransaction(String adS, String adD, BigInteger amTs, String txH, String blN, String txUnit){
|
||||
|
||||
DbTransaction dbTrs = new DbTransaction();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.util.Log;
|
||||
|
||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.support.ConnectionSource;
|
||||
import com.j256.ormlite.table.TableUtils;
|
||||
|
||||
public class DatabaseManager extends OrmLiteSqliteOpenHelper{
|
||||
private static final String DATABASE_NAME = "WalletTransaction.db";
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
public DatabaseManager(Context context){
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
|
||||
try{
|
||||
TableUtils.clearTable(connectionSource, DbTransaction.class);
|
||||
Log.i("DATABASE","onCreate invoked");
|
||||
}catch(Exception exception){
|
||||
Log.e("DATABASE","Can't create Database", exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
|
||||
try{
|
||||
TableUtils.dropTable(connectionSource, DbTransaction.class, true);
|
||||
onCreate(database, connectionSource);
|
||||
Log.i("DATABASE","onUpdate invoked");
|
||||
}catch(Exception exception){
|
||||
Log.e("DATABASE","Can't update Database", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertTransaction(DbTransaction tx){
|
||||
try{
|
||||
Dao<DbTransaction, Integer> dao = getDao(DbTransaction.class);
|
||||
dao.create(tx);
|
||||
} catch(Exception exception){
|
||||
Log.e("DATABASE","Can't insert DbTransaction into Database", exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
|
||||
@DatabaseTable(tableName = "T_TRANSACTION")
|
||||
public class DbTransaction {
|
||||
@DatabaseField(columnName = "transactionId", generatedId = true, unique = true)
|
||||
private int id;
|
||||
@DatabaseField(columnName = "transactionDate")
|
||||
private Date transactionDate;
|
||||
@DatabaseField(columnName = "transactionDSrcAddress")
|
||||
private String sourceAddress;
|
||||
@DatabaseField(columnName = "transactionDestAddress")
|
||||
private String destAddress;
|
||||
@DatabaseField(columnName = "transactionHash")
|
||||
private String transactionHash;
|
||||
@DatabaseField(columnName = "transactionBlockNumber")
|
||||
private String blockNumber;
|
||||
@DatabaseField(columnName = "transactionAmout")
|
||||
private BigInteger amount;
|
||||
@DatabaseField(columnName = "transactionUnit")
|
||||
private String unit;
|
||||
|
||||
public DbTransaction() {
|
||||
super();
|
||||
}
|
||||
|
||||
public DbTransaction(Date transactionDate, String sourceAddress, String destAddress, String transactionHash, String blockNumber, BigInteger amount, String unit) {
|
||||
super();
|
||||
this.transactionDate = transactionDate;
|
||||
this.sourceAddress = sourceAddress;
|
||||
this.destAddress = destAddress;
|
||||
this.transactionHash = transactionHash;
|
||||
this.blockNumber = blockNumber;
|
||||
this.amount = amount;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getSourceAddress() {
|
||||
return sourceAddress;
|
||||
}
|
||||
|
||||
public void setSourceAddress(String sourceAddress) {
|
||||
this.sourceAddress = sourceAddress;
|
||||
}
|
||||
|
||||
public String getDestAddress() {
|
||||
return destAddress;
|
||||
}
|
||||
|
||||
public void setDestAddress(String destAddress) {
|
||||
this.destAddress = destAddress;
|
||||
}
|
||||
|
||||
public String getTransactionHash() {
|
||||
return transactionHash;
|
||||
}
|
||||
|
||||
public void setTransactionHash(String transactionHash) {
|
||||
this.transactionHash = transactionHash;
|
||||
}
|
||||
|
||||
public BigInteger getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigInteger amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
return transactionDate;
|
||||
}
|
||||
|
||||
public void setTransactionDate(Date transactionDate) {
|
||||
this.transactionDate = transactionDate;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getBlockNumber() {
|
||||
return blockNumber;
|
||||
}
|
||||
|
||||
public void setBlockNumber(String blockNumber) {
|
||||
this.blockNumber = blockNumber;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class DemoActivity extends AppCompatActivity {
|
||||
private static final String WALLET_A = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e";
|
||||
private static final String WALLET_B = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_demo_wallet);
|
||||
Button bWalletA = findViewById(R.id.walletA);
|
||||
Button bWalletB = findViewById(R.id.walletB);
|
||||
|
||||
bWalletA.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
launchWalletPresenterActivity(0);
|
||||
}
|
||||
});
|
||||
bWalletB.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
launchWalletPresenterActivity(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void launchWalletPresenterActivity(int idWallet) {
|
||||
if (idWallet == 0) {
|
||||
Intent demoWalletIntent = new Intent(DemoActivity.this, WalletPresenterActivity.class);
|
||||
demoWalletIntent.putExtra("WALLET_ADDRESS",WALLET_A);
|
||||
DemoActivity.this.startActivity(demoWalletIntent);
|
||||
} else {
|
||||
Intent demoWalletIntent = new Intent(DemoActivity.this, WalletPresenterActivity.class);
|
||||
demoWalletIntent.putExtra("WALLET_ADDRESS","WALLET B");
|
||||
DemoActivity.this.startActivity(demoWalletIntent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
package monnethic.mobile.homepage;
|
||||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class HomepageActivity extends AppCompatActivity {
|
||||
//TODO MOVE TO LOGIN ACTIVITY
|
||||
private static final String[] DUMMY_CREDENTIALS = new String[]{
|
||||
"dummy:test"
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -19,6 +19,7 @@ public class HomepageActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_homepage);
|
||||
Button bRegister = findViewById(R.id.register);
|
||||
Button bLogin = findViewById(R.id.login);
|
||||
Button bDemo = findViewById(R.id.demo);
|
||||
|
||||
bRegister.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -32,22 +33,23 @@ public class HomepageActivity extends AppCompatActivity {
|
|||
launchLoginActivity();
|
||||
}
|
||||
});
|
||||
bDemo.setOnClickListener(new View.OnClickListener(){
|
||||
public void onClick(View view){
|
||||
launchDemoActivity();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void launchRegisterActivity(){
|
||||
if(ContextCompat.checkSelfPermission(this,Manifest.permission.INTERNET)!=PackageManager.PERMISSION_GRANTED){
|
||||
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.INTERNET},1);
|
||||
}
|
||||
Intent registerIntent = new Intent(HomepageActivity.this, RegisterActivity.class);
|
||||
Intent registerIntent = new Intent(HomepageActivity.this, SignupActivity.class);
|
||||
HomepageActivity.this.startActivity(registerIntent);
|
||||
}
|
||||
|
||||
public void launchLoginActivity(){
|
||||
if(ContextCompat.checkSelfPermission(this,Manifest.permission.INTERNET)!=PackageManager.PERMISSION_GRANTED){
|
||||
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.INTERNET},1);
|
||||
}
|
||||
Intent loginIntent = new Intent(HomepageActivity.this, LoginActivity.class);
|
||||
HomepageActivity.this.startActivity(loginIntent);
|
||||
}
|
||||
|
||||
public void launchDemoActivity(){
|
||||
Intent demoIntent = new Intent(HomepageActivity.this, DemoActivity.class);
|
||||
HomepageActivity.this.startActivity(demoIntent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private EditText email;
|
||||
private EditText password;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
email = findViewById(R.id.editTextEmail);
|
||||
password = findViewById(R.id.editTextPassword);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
Button buttonOk = findViewById(R.id.buttonOk);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
validateInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onClickForgetPassword(View v){
|
||||
Toast.makeText(this, "Forget password", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void onClickForgetEmail(View v){
|
||||
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void validateInput(){
|
||||
if(isEmptyEdit(email)){
|
||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(password)) {
|
||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
if(checkUser(email.getText().toString(),password.getText().toString())){
|
||||
launchWalletActivity(1);
|
||||
}else{
|
||||
Toast.makeText(this, "Wrong authentification", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
private boolean isEmptyEdit(EditText etText) {
|
||||
return etText.getText().toString().trim().length() == 0;
|
||||
}
|
||||
//TODO CHECK USER AND SEND BACK ID
|
||||
private boolean checkUser(String m, String p){
|
||||
return true;
|
||||
}
|
||||
public void launchWalletActivity(int ldapId){;
|
||||
//LAUNCH APP WALLET WITH ID USER
|
||||
Intent walletIntent = new Intent(LoginActivity.this, WalletActivity.class);
|
||||
walletIntent.putExtra("idUser", ldapId);
|
||||
LoginActivity.this.startActivity(walletIntent);
|
||||
finish();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class SignupActivity extends AppCompatActivity {
|
||||
|
||||
private EditText name;
|
||||
private EditText firstname;
|
||||
private EditText email;
|
||||
private EditText confirmEmail;
|
||||
private EditText password;
|
||||
private EditText confirmPassword;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_signup);
|
||||
|
||||
name = findViewById(R.id.inputName);
|
||||
firstname = findViewById(R.id.inputPrenom);
|
||||
email = findViewById(R.id.inputEmail);
|
||||
confirmEmail = findViewById(R.id.inputConfEmail);
|
||||
password = findViewById(R.id.inputPassword);
|
||||
confirmPassword = findViewById(R.id.inputConfPassword);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
Button buttonOk = findViewById(R.id.buttonOk);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
validateInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//TODO VERIFY EACH EDIT TEXT
|
||||
public void validateInput(){
|
||||
if(isEmptyEdit(name)){
|
||||
Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(firstname)){
|
||||
Toast.makeText(this, "You did not enter your firstname", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(email)){
|
||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(confirmEmail)){
|
||||
Toast.makeText(this, "You did not confirm your email", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(password)){
|
||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(confirmPassword)){
|
||||
Toast.makeText(this, "You did not confirm your password", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
if(!(password.getText().toString().equals(confirmPassword.getText().toString()))){
|
||||
Toast.makeText(this, "Password don't match confirmation password", Toast.LENGTH_SHORT).show();
|
||||
}else if(!(email.getText().toString().equals(confirmEmail.getText().toString()))){
|
||||
Toast.makeText(this, "Email don't match confirmation email", Toast.LENGTH_SHORT).show();
|
||||
} else{
|
||||
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString());
|
||||
insertUserLdap(inputUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO INSERT VALIDE USER INTO LDAP
|
||||
public void insertUserLdap(User u){
|
||||
//CHECK IF USER ALREADY EXIST
|
||||
|
||||
//IF USER DOESN'T EXIST, INSERT USER INTO LDAP
|
||||
|
||||
//CHECK RESPONSE OR RESULT OF INSERT
|
||||
|
||||
//IF SUCCESSFULLY INSERTED INTO LDAP CALL LAUNCHWALLET
|
||||
|
||||
//TEMPORARY
|
||||
if(checkUser(u.getEmail())){
|
||||
Toast.makeText(this, "User already have an account, please log in", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
Toast.makeText(this, "INSERT", Toast.LENGTH_SHORT).show();
|
||||
launchWalletActivity(1);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO LAUNCH WALLET ACTIVITY
|
||||
public void launchWalletActivity(int ldapId){;
|
||||
//LAUNCH APP WALLET WITH ID USER
|
||||
Intent walletIntent = new Intent(SignupActivity.this, WalletActivity.class);
|
||||
walletIntent.putExtra("idUser", ldapId);
|
||||
SignupActivity.this.startActivity(walletIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private boolean isEmptyEdit(EditText etText) {
|
||||
return etText.getText().toString().trim().length() == 0;
|
||||
}
|
||||
//TODO VERIFY IF INPUTED USER ALREADY EXIST IN LDAP
|
||||
private boolean checkUser(Object mail){
|
||||
//Statement stmt = null;
|
||||
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail;
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class TransactionActivity extends AppCompatActivity {
|
||||
private String address;
|
||||
private EditText addressDestination;
|
||||
private EditText amount;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_transaction);
|
||||
addressDestination = findViewById(R.id.destination_address);
|
||||
amount = findViewById(R.id.amount);
|
||||
Button buttonCancel = findViewById(R.id.btn_cancel);
|
||||
Button buttonOk = findViewById(R.id.btn_send);
|
||||
|
||||
Intent intent = getIntent();
|
||||
address = intent.getStringExtra("WALLET_ADDRESS");
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
sendTransaction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendTransaction(){
|
||||
String adD = addressDestination.getText().toString();
|
||||
BigInteger amt = new BigInteger(amount.getText().toString());
|
||||
|
||||
if(AccessBlockchain.sendTransationTo(address, adD, amt)){
|
||||
Toast.makeText(this, "OK.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
/**
|
||||
* Created by Guillaume on 15/04/2018.
|
||||
*/
|
||||
|
||||
public class User {
|
||||
private String name;
|
||||
private String firstname;
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
public User(String name, String firstname, String email, String password) {
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
public void setFirstname(String firstname) {
|
||||
this.firstname = firstname;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class UserAccountActivity extends AppCompatActivity {
|
||||
private TextView solde;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_user_account);
|
||||
|
||||
solde = findViewById(R.id.viewSolde);
|
||||
Button buttonPayement = findViewById(R.id.buttonPayement);
|
||||
Button buttonReceive = findViewById(R.id.buttonReceive);
|
||||
Button buttonSettings = findViewById(R.id.buttonSettings);
|
||||
|
||||
//refreshSolde();
|
||||
|
||||
buttonPayement.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
sendPayement();
|
||||
}
|
||||
});
|
||||
buttonReceive.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
receivePayement();
|
||||
}
|
||||
});
|
||||
buttonSettings.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
settings();
|
||||
}
|
||||
});
|
||||
}
|
||||
public void sendPayement(){
|
||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void receivePayement(){
|
||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void settings(){
|
||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void refreshSolde(){
|
||||
solde.setText("0.00");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class WalletActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_wallet);
|
||||
|
||||
Button buttonCreate = findViewById(R.id.buttonCreateWallet);
|
||||
Button buttonRestore = findViewById(R.id.buttonRestoreWallet);
|
||||
Button buttonSkip = findViewById(R.id.buttonSkip);
|
||||
|
||||
buttonCreate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
createWallet();
|
||||
}
|
||||
});
|
||||
buttonRestore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
restoreWallet();
|
||||
}
|
||||
});
|
||||
buttonSkip.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
skip();
|
||||
}
|
||||
});
|
||||
}
|
||||
public void skip(){
|
||||
Intent userIntent = new Intent(WalletActivity.this, UserAccountActivity.class);
|
||||
WalletActivity.this.startActivity(userIntent);
|
||||
finish();
|
||||
}
|
||||
public void createWallet(){
|
||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void restoreWallet(){
|
||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.web3j.utils.Convert;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class WalletPresenterActivity extends AppCompatActivity {
|
||||
private EditText addressPublic;
|
||||
private TextView balance;
|
||||
private String address;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_wallet_presenter);
|
||||
addressPublic = findViewById(R.id.address_pub);
|
||||
balance = findViewById(R.id.balance);
|
||||
Button refreshBalance = findViewById(R.id.refreshBalance);
|
||||
Button buttonSendTransaction = findViewById(R.id.send_transaction);
|
||||
Intent intent = getIntent();
|
||||
address = intent.getStringExtra("WALLET_ADDRESS");
|
||||
|
||||
addressPublic.setText(address);
|
||||
|
||||
if(initiateBalance(address)==null){
|
||||
balance.setText("Error");
|
||||
}else{
|
||||
balance.setText(Convert.fromWei(initiateBalance(address).toString(), Convert.Unit.ETHER).toString());
|
||||
}
|
||||
|
||||
buttonSendTransaction.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
launchTransactionActivity();
|
||||
}
|
||||
});
|
||||
|
||||
refreshBalance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
initiateBalance(address);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void launchTransactionActivity(){
|
||||
Intent transactionIntent = new Intent(WalletPresenterActivity.this, TransactionActivity.class);
|
||||
transactionIntent.putExtra("WALLET_ADDRESS",address);
|
||||
WalletPresenterActivity.this.startActivity(transactionIntent);
|
||||
}
|
||||
|
||||
public String initiateBalance(String address){
|
||||
AccessBlockchain ab = new AccessBlockchain();
|
||||
System.out.println("addresse "+ address);
|
||||
String balanceIs = ab.getTheBalanceOfWallet(address).toString();
|
||||
return balanceIs;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package monnethic.mobile.database;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Transaction implements Serializable {
|
||||
private int transactionId;
|
||||
private long transactionDate;
|
||||
private String transactionFrom;
|
||||
private String transactionTo;
|
||||
private String transactionHash;
|
||||
private Double transactionAmount;
|
||||
private String transactionUnit;
|
||||
|
||||
//Constructors
|
||||
public Transaction(){
|
||||
|
||||
}
|
||||
|
||||
public Transaction(String transactionFrom, String transactionTo, String transactionHash, Double transactionAmount, String transactionUnit) {
|
||||
this.transactionFrom = transactionFrom;
|
||||
this.transactionTo = transactionTo;
|
||||
this.transactionHash = transactionHash;
|
||||
this.transactionAmount = transactionAmount;
|
||||
this.transactionUnit = transactionUnit;
|
||||
}
|
||||
|
||||
public Transaction(int transactionId, long transactionDate, String transactionFrom, String transactionTo, String transactionHash, Double transactionAmount, String transactionUnit) {
|
||||
this.transactionId = transactionId;
|
||||
this.transactionDate = transactionDate;
|
||||
this.transactionFrom = transactionFrom;
|
||||
this.transactionTo = transactionTo;
|
||||
this.transactionHash = transactionHash;
|
||||
this.transactionAmount = transactionAmount;
|
||||
this.transactionUnit = transactionUnit;
|
||||
}
|
||||
|
||||
//Getters and Setters
|
||||
public int getTransactionId() {
|
||||
return transactionId;
|
||||
}
|
||||
public void setTransactionId(int transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public long getTransactionDate() {
|
||||
return transactionDate;
|
||||
}
|
||||
public void setTransactionDate(long transactionDate) {
|
||||
this.transactionDate = transactionDate;
|
||||
}
|
||||
|
||||
public String getTransactionFrom() {
|
||||
return transactionFrom;
|
||||
}
|
||||
public void setTransactionFrom(String transactionFrom) {
|
||||
this.transactionFrom = transactionFrom;
|
||||
}
|
||||
|
||||
public String getTransactionTo() {
|
||||
return transactionTo;
|
||||
}
|
||||
public void setTransactionTo(String transactionTo) {
|
||||
this.transactionTo = transactionTo;
|
||||
}
|
||||
|
||||
public String getTransactionHash() {
|
||||
return transactionHash;
|
||||
}
|
||||
public void setTransactionHash(String transactionHash) {
|
||||
this.transactionHash = transactionHash;
|
||||
}
|
||||
|
||||
public Double getTransactionAmount() {
|
||||
return transactionAmount;
|
||||
}
|
||||
public void setTransactionAmount(Double transactionAmount) {
|
||||
this.transactionAmount = transactionAmount;
|
||||
}
|
||||
|
||||
public String getTransactionUnit() {
|
||||
return transactionUnit;
|
||||
}
|
||||
public void setTransactionUnit(String transactionUnit) {
|
||||
this.transactionUnit = transactionUnit;
|
||||
}
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
package monnethic.mobile.database;
|
||||
|
||||
//Class User which represent an User for api rest
|
||||
public class User {
|
||||
private int user_id;
|
||||
private String name;
|
||||
private String firstname;
|
||||
private String email;
|
||||
private String password;
|
||||
private long creation_date;
|
||||
private long modification_date;
|
||||
private String phone;
|
||||
private String association;
|
||||
private boolean verified;
|
||||
private boolean approved;
|
||||
private String user_hash;
|
||||
|
||||
//Constructors
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(String email, String password){
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public User(String name, String firstname, String email, String password, String association) {
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.association = association;
|
||||
}
|
||||
|
||||
public User(String name, String firstname, String email, String password, String phone, String association){
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.phone = phone;
|
||||
this.association = association;
|
||||
}
|
||||
|
||||
|
||||
public User(String name, String firstname,String user_hash, String email, String password, long creation_date, long modification_date, boolean verified, boolean approved) {
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.user_hash = user_hash;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.creation_date = creation_date;
|
||||
this.modification_date = modification_date;
|
||||
this.verified = verified;
|
||||
this.approved = approved;
|
||||
}
|
||||
|
||||
public User(String name, String firstname,String user_hash, String email, String password, long creation_date, long modification_date, String phone, String association, boolean verified, boolean approved) {
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.user_hash = user_hash;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.creation_date = creation_date;
|
||||
this.modification_date = modification_date;
|
||||
this.phone = phone;
|
||||
this.association = association;
|
||||
this.verified = verified;
|
||||
this.approved = approved;
|
||||
}
|
||||
|
||||
|
||||
//Getters and Setters
|
||||
public int getUserId() {
|
||||
return user_id;
|
||||
}
|
||||
public void setUserId(int userId) {this.user_id = userId;}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUser_hash(){return user_hash;}
|
||||
public void setUser_hash(String user_hash){this.user_hash = user_hash;}
|
||||
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
public void setFirstname(String firstname) {
|
||||
this.firstname = firstname;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public long getCreation_date() {
|
||||
return creation_date;
|
||||
}
|
||||
public void setCreation_date(long creation_date) {
|
||||
this.creation_date = creation_date;
|
||||
}
|
||||
|
||||
public long getModification_date() {
|
||||
return modification_date;
|
||||
}
|
||||
public void setModification_date(long modification_date) {
|
||||
this.modification_date = modification_date;
|
||||
}
|
||||
|
||||
public String getPhone(){return phone;}
|
||||
public void setPhone(String phone){this.phone=phone;}
|
||||
|
||||
public String getAssociation(){return association;}
|
||||
public void setAssociation(){this.association=association;}
|
||||
|
||||
public boolean isVerified() {
|
||||
return verified;
|
||||
}
|
||||
public void setVerified(boolean verified) {
|
||||
this.verified = verified;
|
||||
}
|
||||
|
||||
public boolean isApproved() {
|
||||
return approved;
|
||||
}
|
||||
public void setApproved(boolean approved) {
|
||||
this.approved = approved;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"userId=" + user_id +
|
||||
", name='" + name + '\'' +
|
||||
", firstname='" + firstname + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", creation_date=" + creation_date +
|
||||
", modification_date=" + modification_date +
|
||||
", phone= "+phone+
|
||||
", association= "+association+
|
||||
", verified=" + verified +
|
||||
", approved=" + approved +
|
||||
", user_hash='" + user_hash + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -1,313 +0,0 @@
|
|||
package monnethic.mobile.history;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import monnethic.mobile.database.Transaction;
|
||||
import monnethic.mobile.restApi.Config;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.TransactionApiHandler;
|
||||
import monnethic.mobile.transaction.TransactionAdapter;
|
||||
|
||||
public class HistoryActivity extends AppCompatActivity {
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
final Calendar calendar1 = Calendar.getInstance();
|
||||
final Calendar calendar2 = Calendar.getInstance();
|
||||
private Button btnSearchTransactions;
|
||||
private EditText inputSize;
|
||||
private EditText fromDate;
|
||||
private EditText toDate;
|
||||
private Spinner spinner;
|
||||
private Switch aSwitch;
|
||||
private ListView listView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_history);
|
||||
|
||||
getIntentValue();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void getIntentValue(){
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
inputSize = findViewById(R.id.inputSize);
|
||||
inputSize.setText(String.valueOf(10));
|
||||
dateInit();
|
||||
buttonInit();
|
||||
switchInit();
|
||||
spinnerInit();
|
||||
listViewHandler("0");
|
||||
}
|
||||
|
||||
public void dateInit(){
|
||||
DatePickerDialog.OnDateSetListener fromDatePicker = new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) {
|
||||
calendar1.set(Calendar.YEAR, year);
|
||||
calendar1.set(Calendar.MONTH, monthOfYear);
|
||||
calendar1.set(Calendar.DAY_OF_MONTH, dayOfMonth);
|
||||
updateLabel(0);
|
||||
}
|
||||
};
|
||||
fromDate = findViewById(R.id.fromDate);
|
||||
fromDate.setEnabled(false);
|
||||
fromDate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new DatePickerDialog(HistoryActivity.this, fromDatePicker, calendar1.get(Calendar.YEAR),
|
||||
calendar1.get(Calendar.MONTH), calendar1.get(Calendar.DAY_OF_MONTH)).show();
|
||||
//Toast.makeText(HistoryActivity.this,"Clicked fromDate",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
DatePickerDialog.OnDateSetListener toDatePicker = new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) {
|
||||
calendar2.set(Calendar.YEAR, year);
|
||||
calendar2.set(Calendar.MONTH, monthOfYear);
|
||||
calendar2.set(Calendar.DAY_OF_MONTH, dayOfMonth);
|
||||
updateLabel(1);
|
||||
}
|
||||
};
|
||||
toDate = findViewById(R.id.toDate);
|
||||
toDate.setEnabled(false);
|
||||
toDate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new DatePickerDialog(HistoryActivity.this, toDatePicker, calendar2.get(Calendar.YEAR),
|
||||
calendar2.get(Calendar.MONTH), calendar2.get(Calendar.DAY_OF_MONTH)).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateLabel(int idDate){
|
||||
try{
|
||||
String myFormat = "dd-MM-yyyy";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
if(idDate==0){
|
||||
fromDate.setText(sdf.format(calendar1.getTime()));
|
||||
}else {
|
||||
if(calendar2.getTime().before(calendar1.getTime())){
|
||||
toDate.setText(sdf.format(calendar1.getTime()));
|
||||
}else {
|
||||
toDate.setText(sdf.format(calendar2.getTime()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void buttonInit(){
|
||||
btnSearchTransactions = findViewById(R.id.buttonSearchTransaction);
|
||||
btnSearchTransactions.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(!aSwitch.isChecked()){
|
||||
switch (String.valueOf(spinner.getSelectedItem())){
|
||||
case "All":
|
||||
listViewHandler("1");
|
||||
break;
|
||||
case "Sent":
|
||||
listViewHandler("2");
|
||||
break;
|
||||
case "Received":
|
||||
listViewHandler("3");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (String.valueOf(spinner.getSelectedItem())){
|
||||
case "All":
|
||||
listViewHandler("4");
|
||||
break;
|
||||
case "Sent":
|
||||
listViewHandler("5");
|
||||
break;
|
||||
case "Received":
|
||||
listViewHandler("6");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void switchInit(){
|
||||
aSwitch = findViewById(R.id.switchDate);
|
||||
aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
if(aSwitch.isChecked()){
|
||||
fromDate.setEnabled(true);
|
||||
toDate.setEnabled(true);
|
||||
}else{
|
||||
fromDate.setEnabled(false);
|
||||
toDate.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void spinnerInit(){
|
||||
spinner = findViewById(R.id.spinner);
|
||||
|
||||
List<String> listOptions = new ArrayList<>();
|
||||
listOptions.add("All");
|
||||
listOptions.add("Received");
|
||||
listOptions.add("Sent");
|
||||
ArrayAdapter<String> adapterOptions = new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item,listOptions);
|
||||
adapterOptions.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spinner.setAdapter(adapterOptions);
|
||||
}
|
||||
|
||||
public void listViewHandler(String function){
|
||||
listView = findViewById(R.id.listViewTransactions);
|
||||
ArrayList<Transaction> transactions = new ArrayList<>();
|
||||
//function, wallet_hash, size, start_date, end_date
|
||||
try{
|
||||
String size = inputSize.getText().toString();
|
||||
if(Integer.parseInt(function)==0){
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash).get();
|
||||
} else if(Integer.parseInt(function)==1 || Integer.parseInt(function)==2 || Integer.parseInt(function)==3){
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash,size).get();
|
||||
} else {
|
||||
String myFormat = "dd-MM-yyyy";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
Date start_d = sdf.parse(fromDate.getText().toString());
|
||||
String start_date = String.valueOf(start_d.getTime());
|
||||
Date end_d = sdf.parse(toDate.getText().toString());
|
||||
String end_date = String.valueOf(end_d.getTime());
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash,size,start_date,end_date).get();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
TransactionAdapter adapter = new TransactionAdapter(this,transactions,wallet_hash);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Transaction t = (Transaction) listView.getItemAtPosition(i);
|
||||
Intent transactionDetailsIntent = new Intent(HistoryActivity.this, HistoryDetailsActivity.class);
|
||||
transactionDetailsIntent.putExtra("USER_HASH",user_hash);
|
||||
transactionDetailsIntent.putExtra("USER_PWD",user_password);
|
||||
transactionDetailsIntent.putExtra("SESSION_ID",session_id);
|
||||
transactionDetailsIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
transactionDetailsIntent.putExtra("TRANSACTION",t);
|
||||
HistoryActivity.this.startActivity(transactionDetailsIntent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private class getTransactionTask extends AsyncTask<String,ArrayList<Transaction>,ArrayList<Transaction>> {
|
||||
ProgressDialog progDailog = new ProgressDialog(HistoryActivity.this);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Transaction> t) {
|
||||
progDailog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<Transaction> doInBackground(String... strings) {
|
||||
ArrayList<Transaction> transactionsList = new ArrayList<>();
|
||||
try{
|
||||
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
|
||||
switch (Integer.parseInt(strings[0])){
|
||||
case 0:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_LATEST,strings[1],null,null,null);
|
||||
break;
|
||||
case 1:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_ALL,strings[1],strings[2],null,null);
|
||||
break;
|
||||
case 2:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_SENT,strings[1],strings[2],null,null);
|
||||
break;
|
||||
case 3:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_RECEIVED,strings[1],strings[2],null,null);
|
||||
break;
|
||||
case 4:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_ALL,strings[1],strings[2],strings[3],strings[4]);
|
||||
break;
|
||||
case 5:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_SENT,strings[1],strings[2],strings[3],strings[4]);
|
||||
break;
|
||||
case 6:
|
||||
transactionsList = transactionApiHandler.getTransactions(strings[0],Config.TRANSACTION_RECEIVED,strings[1],strings[2],strings[3],strings[4]);
|
||||
break;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return transactionsList;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
package monnethic.mobile.history;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import monnethic.mobile.database.Transaction;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
||||
public class HistoryDetailsActivity extends AppCompatActivity {
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private Transaction transaction;
|
||||
|
||||
private TextView txID;
|
||||
private TextView txDate;
|
||||
private TextView txFrom;
|
||||
private TextView txTo;
|
||||
private TextView txAmount;
|
||||
private TextView txUnit;
|
||||
private Button goToExplorer;
|
||||
private Button closeActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_history_details);
|
||||
getIntentValue();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void getIntentValue(){
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
transaction = (Transaction) intent.getSerializableExtra("TRANSACTION");
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
txID = findViewById(R.id.displayTxID);
|
||||
txID.setText(transaction.getTransactionHash());
|
||||
|
||||
Log.i("HistoryDetails","transaction : "+transaction.toString());
|
||||
Log.i("HistoryDetails","transaction Date : "+transaction.getTransactionDate());
|
||||
|
||||
txDate = findViewById(R.id.dateDisplay);
|
||||
String myFormat = "dd-MM-yyyy HH:mm:ss";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
Date dateTransaction = new Date(transaction.getTransactionDate());
|
||||
txDate.setText(sdf.format(dateTransaction));
|
||||
|
||||
txFrom = findViewById(R.id.fromDisplay);
|
||||
txFrom.setText(transaction.getTransactionFrom());
|
||||
|
||||
txTo = findViewById(R.id.toDisplay);
|
||||
txTo.setText(transaction.getTransactionTo());
|
||||
|
||||
txAmount = findViewById(R.id.amountDisplay);
|
||||
String amountDisplay = String.valueOf(transaction.getTransactionAmount())+" "+transaction.getTransactionUnit();
|
||||
txAmount.setText(amountDisplay);
|
||||
|
||||
goToExplorer = findViewById(R.id.btnGoToExplorer);
|
||||
closeActivity = findViewById(R.id.btnCloseDetails);
|
||||
|
||||
setButtonListener();
|
||||
}
|
||||
|
||||
private void setButtonListener(){
|
||||
goToExplorer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String url = "http://monitor.monnethic.fr:8080/#/transactions";
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(url));
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
closeActivity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.EditText;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
|
||||
public class InputController {
|
||||
private static Pattern pattern;
|
||||
private static Matcher matcher;
|
||||
private static final String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,20})";
|
||||
|
||||
public static boolean isEmptyEdit(EditText etText) {
|
||||
return etText.getText().toString().trim().length() == 0;
|
||||
}
|
||||
public static boolean validEmail(String email){
|
||||
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
|
||||
}
|
||||
public static boolean passwordValidator(String password){
|
||||
pattern = Pattern.compile(PASSWORD_PATTERN);
|
||||
matcher = pattern.matcher(password);
|
||||
return matcher.matches();
|
||||
}
|
||||
|
||||
|
||||
public static Boolean checkUser(String email){
|
||||
Boolean result = null;
|
||||
try{
|
||||
String[] params = new String[]{email};
|
||||
result = new CheckUserTask().execute(params).get();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static class CheckUserTask extends AsyncTask<String,String,Boolean> {
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(String... params) {
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
return userApiHandler.checkUser(params[0]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import org.json.JSONObject;
|
||||
import monnethic.mobile.database.User;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
import monnethic.mobile.wallet.HomeWalletActivity;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
private EditText email;
|
||||
private EditText password;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
email = findViewById(R.id.editTextEmail);
|
||||
password = findViewById(R.id.editTextPassword);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
Button buttonOk = findViewById(R.id.buttonOkLogin);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
validateInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onClickForgetPassword(View v){
|
||||
Toast.makeText(this, "Forget password", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void onClickForgetEmail(View v){
|
||||
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
private void validateInput(){
|
||||
if(InputController.isEmptyEdit(email)){
|
||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||
} else if(!InputController.validEmail(email.getText().toString())){
|
||||
Toast.makeText(this, "Your email is invalid", Toast.LENGTH_SHORT).show();
|
||||
} else if(InputController.isEmptyEdit(password)) {
|
||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
User user = new User(email.getText().toString(),password.getText().toString());
|
||||
new UserLoggerTask(this).execute(user);
|
||||
}
|
||||
}
|
||||
|
||||
//AsyncTask for login
|
||||
private class UserLoggerTask extends AsyncTask<User,String,JSONObject> {
|
||||
Context mContext;
|
||||
private UserLoggerTask(final Context context){
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
ProgressDialog progDailog = new ProgressDialog(LoginActivity.this);
|
||||
progDailog.setMessage("Login...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JSONObject jsonObject) {
|
||||
try{
|
||||
if(jsonObject!=null){
|
||||
if(jsonObject.getInt("status")==404){
|
||||
Toast.makeText(mContext, "User Not Found", Toast.LENGTH_SHORT).show();
|
||||
} else if(jsonObject.getInt("status")==403){
|
||||
Toast.makeText(mContext, "Wrong authentication", Toast.LENGTH_SHORT).show();
|
||||
} else if(jsonObject.getInt("status")==200){
|
||||
Intent walletHomeIntent = new Intent(LoginActivity.this, HomeWalletActivity.class);
|
||||
walletHomeIntent.putExtra("USER_HASH", jsonObject.getString("user_hash"));
|
||||
walletHomeIntent.putExtra("USER_PWD",password.getText().toString());
|
||||
walletHomeIntent.putExtra("SESSION_ID",jsonObject.getString("session_id"));
|
||||
LoginActivity.this.startActivity(walletHomeIntent);
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected JSONObject doInBackground(User... u) {
|
||||
try{
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
return userApiHandler.loginUser(u[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import org.json.JSONObject;
|
||||
import monnethic.mobile.database.User;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
import monnethic.mobile.wallet.HomeWalletActivity;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity {
|
||||
private EditText name;
|
||||
private EditText firstname;
|
||||
private EditText email;
|
||||
private EditText confirmEmail;
|
||||
private EditText password;
|
||||
private EditText confirmPassword;
|
||||
private EditText phone;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_signup);
|
||||
|
||||
name = findViewById(R.id.inputName);
|
||||
firstname = findViewById(R.id.inputPrenom);
|
||||
email = findViewById(R.id.inputEmail);
|
||||
confirmEmail = findViewById(R.id.inputConfEmail);
|
||||
password = findViewById(R.id.inputPassword);
|
||||
confirmPassword = findViewById(R.id.inputConfPassword);
|
||||
phone = findViewById(R.id.inputPhone);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
Button buttonOk = findViewById(R.id.buttonOk);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
validateInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void validateInput(){
|
||||
if(checkInputEmpty()){
|
||||
if(!InputController.passwordValidator(password.getText().toString())){
|
||||
Toast.makeText(this, "Password must contains 6 to 20 characters, one lowercase, one uppercase and one digit", Toast.LENGTH_LONG).show();
|
||||
}else if(InputController.validEmail(email.getText().toString())){
|
||||
Boolean userExist = InputController.checkUser(email.getText().toString());//checkUser
|
||||
Log.i("RegisterActivity-val","userExist : "+userExist);
|
||||
if(userExist != null){
|
||||
if(userExist){
|
||||
Toast.makeText(this, "User already exist", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString(),phone.getText().toString(),"gonette");
|
||||
new UserRegisterTask(this).execute(inputUser);
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this, "An error occured", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkInputEmpty(){
|
||||
Log.i("checkInputEmpty",name.getText().toString());
|
||||
Log.i("checkInputEmpty",firstname.getText().toString());
|
||||
Log.i("checkInputEmpty",email.getText().toString());
|
||||
Log.i("checkInputEmpty",confirmEmail.getText().toString());
|
||||
Log.i("checkInputEmpty",password.getText().toString());
|
||||
if(InputController.isEmptyEdit(name)){
|
||||
Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(firstname)){
|
||||
Toast.makeText(this, "You did not enter your firstname", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(email)){
|
||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(!InputController.validEmail(email.getText().toString())){
|
||||
Toast.makeText(this, "Your email is invalid", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(confirmEmail)){
|
||||
Toast.makeText(this, "You did not confirm your email", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(phone)){
|
||||
Toast.makeText(this, "You did not enter your phone number", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(password)){
|
||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(confirmPassword)){
|
||||
Toast.makeText(this, "You did not confirm your password", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}else {
|
||||
if (!(password.getText().toString().equals(confirmPassword.getText().toString()))) {
|
||||
Toast.makeText(this, "Password don't match confirmation password", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if (!(email.getText().toString().equals(confirmEmail.getText().toString()))) {
|
||||
Toast.makeText(this, "Email don't match confirmation email", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UserRegisterTask extends AsyncTask<User,Void,JSONObject> {
|
||||
Context mContext;
|
||||
private UserRegisterTask(final Context context){mContext=context;}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
ProgressDialog progDailog = new ProgressDialog(RegisterActivity.this);
|
||||
progDailog.setMessage("Register...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JSONObject jsonObject){
|
||||
try{
|
||||
if(jsonObject!=null){
|
||||
Intent walletHomeIntent = new Intent(RegisterActivity.this, HomeWalletActivity.class);
|
||||
walletHomeIntent.putExtra("USER_HASH", jsonObject.getString("user_hash"));
|
||||
walletHomeIntent.putExtra("USER_PWD",password.getText().toString());
|
||||
walletHomeIntent.putExtra("SESSION_ID",jsonObject.getString("session_id"));
|
||||
RegisterActivity.this.startActivity(walletHomeIntent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject doInBackground(User... users) {
|
||||
try{
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
return userApiHandler.registerUser(users[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package monnethic.mobile.qrcode;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.journeyapps.barcodescanner.BarcodeEncoder;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
||||
|
||||
public class QrCodeActivity extends AppCompatActivity {
|
||||
ImageView qrCode;
|
||||
Button closeButton;
|
||||
TextView adresseView;
|
||||
TextView amountView;
|
||||
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private String wallet_hash;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_qr_code);
|
||||
qrCode=findViewById(R.id.qrCodeViewer);
|
||||
closeButton=findViewById(R.id.buttonClose);
|
||||
adresseView=findViewById(R.id.textViewAdresseDisplay);
|
||||
amountView=findViewById(R.id.textViewAmountDisplay);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
String amount = intent.getStringExtra("AMOUNT");
|
||||
try{
|
||||
generateQrCode(wallet_hash,amount);
|
||||
}catch(Exception e){
|
||||
e.getMessage();
|
||||
}
|
||||
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void generateQrCode(String wallet_hash, String amount) throws WriterException {
|
||||
BitMatrix bitMatrix;
|
||||
String valueToEncode = wallet_hash+";"+amount;
|
||||
try{
|
||||
bitMatrix = new MultiFormatWriter().encode(valueToEncode, BarcodeFormat.QR_CODE,300,300);
|
||||
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
|
||||
Bitmap bitmap = barcodeEncoder.createBitmap(bitMatrix);
|
||||
qrCode.setImageBitmap(bitmap);
|
||||
adresseView.setText(wallet_hash);
|
||||
amountView.setText(amount);
|
||||
}catch (Exception e){
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package monnethic.mobile.qrcode;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.SparseArray;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import com.google.android.gms.vision.CameraSource;
|
||||
import com.google.android.gms.vision.Detector;
|
||||
import com.google.android.gms.vision.barcode.Barcode;
|
||||
import com.google.android.gms.vision.barcode.BarcodeDetector;
|
||||
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.transaction.ApprovePayementActivity;
|
||||
|
||||
public class QrCodeScannerActivity extends AppCompatActivity {
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
SurfaceView surfaceView;
|
||||
private BarcodeDetector barcodeDector;
|
||||
private CameraSource cameraSource;
|
||||
private static final int REQUEST_CAMERA_PERMISSION = 201;
|
||||
private String intentData = "";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_qr_code_scanner);
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
initViews();
|
||||
}
|
||||
|
||||
private void initViews(){
|
||||
surfaceView = findViewById(R.id.surfaceView);
|
||||
}
|
||||
|
||||
private void initialiseDetector(){
|
||||
Toast.makeText(getApplicationContext(), "QR code scanner started", Toast.LENGTH_SHORT).show();
|
||||
|
||||
barcodeDector = new BarcodeDetector.Builder(this).setBarcodeFormats(Barcode.ALL_FORMATS).build();
|
||||
cameraSource = new CameraSource.Builder(this, barcodeDector).setRequestedPreviewSize(1920,1080).setAutoFocusEnabled(true).build();
|
||||
|
||||
surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||
try{
|
||||
if(ActivityCompat.checkSelfPermission(QrCodeScannerActivity.this, Manifest.permission.CAMERA)== PackageManager.PERMISSION_GRANTED){
|
||||
cameraSource.start(surfaceView.getHolder());
|
||||
}else{
|
||||
ActivityCompat.requestPermissions(QrCodeScannerActivity.this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
|
||||
onResume();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||
cameraSource.stop();
|
||||
}
|
||||
});
|
||||
|
||||
barcodeDector.setProcessor(new Detector.Processor<Barcode>() {
|
||||
@Override
|
||||
public void release() {
|
||||
Toast.makeText(getApplicationContext(),"Barcode scanner has been stopped",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveDetections(Detector.Detections<Barcode> detections) {
|
||||
final SparseArray<Barcode> barcodes = detections.getDetectedItems();
|
||||
if(barcodes.size()!=0){
|
||||
intentData = barcodes.valueAt(0).displayValue;
|
||||
Intent scannedQrIntent = new Intent(QrCodeScannerActivity.this, ApprovePayementActivity.class);
|
||||
scannedQrIntent.putExtra("VALUE",intentData);
|
||||
scannedQrIntent.putExtra("USER_HASH",user_hash);
|
||||
scannedQrIntent.putExtra("USER_PWD",user_password);
|
||||
scannedQrIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
scannedQrIntent.putExtra("SESSION_ID",session_id);
|
||||
QrCodeScannerActivity.this.startActivity(scannedQrIntent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause(){
|
||||
super.onPause();
|
||||
cameraSource.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume(){
|
||||
super.onResume();
|
||||
initialiseDetector();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package monnethic.mobile.restApi;
|
||||
|
||||
public class Config {
|
||||
//BASE
|
||||
static private String BASE_URL = "http://37.187.101.44:10053/";
|
||||
//static private String BASE_URL = "http://10.0.2.2:10053/";
|
||||
//static private String BASE_URL = "http://localhost:10053/";
|
||||
static private String BASE_URL_USER = BASE_URL+"api/rest/user/";
|
||||
static private String BASE_URL_TRANSACTION = BASE_URL+"api/rest/transaction/";
|
||||
static private String BASE_URL_WALLET = BASE_URL+"api/rest/wallet/";
|
||||
static private String BASE_URL_SESSION = BASE_URL+"api/rest/session/";
|
||||
|
||||
//USER
|
||||
static public String USER_LOGIN = BASE_URL_USER+"login";
|
||||
static public String USER_REGISTER = BASE_URL_USER+"register";
|
||||
static public String USER_GET = BASE_URL_USER+"get";
|
||||
//Search
|
||||
static public String FIND_BY_EMAIL= BASE_URL_USER+"findByEmail";
|
||||
static public String FIND_BY_PHONE = BASE_URL_USER+"findByPhone";
|
||||
static public String FIND_BY_EMAIL_AND_PHONE = BASE_URL_USER+"findByEmailAndPhone";
|
||||
//Session
|
||||
static public String START_SESSION = BASE_URL_SESSION+"start";
|
||||
static public String END_SESSION = BASE_URL_SESSION+"end";
|
||||
|
||||
//TRANSACTION
|
||||
static public String TRANSACTION_SEND = BASE_URL_TRANSACTION+"send";
|
||||
static public String TRANSACTION_GET = BASE_URL_TRANSACTION+"get";
|
||||
static public String TRANSACTION_LATEST = BASE_URL_TRANSACTION+"get/latest";
|
||||
static public String TRANSACTION_ALL = BASE_URL_TRANSACTION+"getTransactions";
|
||||
static public String TRANSACTION_SENT = BASE_URL_TRANSACTION+"get/sent";
|
||||
static public String TRANSACTION_RECEIVED = BASE_URL_TRANSACTION+"get/received";
|
||||
|
||||
//WALLET
|
||||
static public String WALLET_CREATE = BASE_URL_WALLET+"create";
|
||||
static public String WALLET_GET_WALLET = BASE_URL_WALLET+"getWallet";
|
||||
static public String WALLET_GET_USER_WALLETS = BASE_URL_WALLET+"getUserWallets";
|
||||
static public String WALLET_DELETE = BASE_URL_WALLET+"delete";
|
||||
static public String WALLET_TRANSFER = BASE_URL_WALLET+"transfer";
|
||||
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
package monnethic.mobile.restApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpCallHandler {
|
||||
|
||||
public String getHttp(URL url) throws Exception {
|
||||
InputStream inputStream;
|
||||
BufferedReader bufferedReader = null;
|
||||
HttpURLConnection urlConnection = null;
|
||||
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
urlConnection.setRequestMethod("GET");
|
||||
urlConnection.connect();
|
||||
|
||||
int responseCode = urlConnection.getResponseCode();
|
||||
if(responseCode != 200){
|
||||
throw new Exception("ERROR != 200");
|
||||
}
|
||||
inputStream = urlConnection.getInputStream();
|
||||
if(inputStream == null){
|
||||
throw new Exception("ERROR inputStream");
|
||||
}
|
||||
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String line;
|
||||
|
||||
while ((line = bufferedReader.readLine())!=null){
|
||||
stringBuilder.append(line);
|
||||
}
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String postHttp(URL url, Map<String,String> params) throws Exception {
|
||||
String returnValue=null;
|
||||
HttpURLConnection urlConnection = null;
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
urlConnection.setRequestMethod("POST");
|
||||
urlConnection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
|
||||
urlConnection.setRequestProperty("Accept","application/json");
|
||||
urlConnection.setDoOutput(true);
|
||||
urlConnection.setDoInput(true);
|
||||
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
for(Map.Entry<String,String> pair : params.entrySet()){
|
||||
jsonParam.put(pair.getKey(),pair.getValue());
|
||||
}
|
||||
|
||||
DataOutputStream os = new DataOutputStream(urlConnection.getOutputStream());
|
||||
os.writeBytes(jsonParam.toString());
|
||||
|
||||
int statusCode = urlConnection.getResponseCode();
|
||||
if(statusCode != 200){
|
||||
JSONObject jsonReturn = new JSONObject();
|
||||
if(statusCode == 404){
|
||||
jsonReturn.put("status",404);
|
||||
jsonReturn.put("response","Not Found");
|
||||
returnValue = jsonReturn.toString();
|
||||
}else if(statusCode == 403){
|
||||
jsonReturn.put("status",403);
|
||||
jsonReturn.put("response","Forbidden");
|
||||
returnValue = jsonReturn.toString();
|
||||
}
|
||||
} else {
|
||||
BufferedReader bufferedReader = null;
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine())!=null){
|
||||
stringBuilder.append(line);
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject(stringBuilder.toString());
|
||||
json.put("status",200);
|
||||
returnValue = json.toString();
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public void postHttpSession(URL url, Map<String,Integer> params) throws Exception {
|
||||
HttpURLConnection urlConnection = null;
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
urlConnection.setRequestMethod("POST");
|
||||
urlConnection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
|
||||
urlConnection.setRequestProperty("Accept","application/json");
|
||||
urlConnection.setDoOutput(true);
|
||||
urlConnection.setDoInput(true);
|
||||
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
for(Map.Entry<String,Integer> pair : params.entrySet()){
|
||||
jsonParam.put(pair.getKey(),pair.getValue());
|
||||
}
|
||||
|
||||
DataOutputStream os = new DataOutputStream(urlConnection.getOutputStream());
|
||||
os.writeBytes(jsonParam.toString());
|
||||
urlConnection.getResponseCode();
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package monnethic.mobile.restApi;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SessionApiHandler {
|
||||
public void endSession(String session_id){
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try{
|
||||
String url = Config.END_SESSION;
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
map.put("session_id",Integer.parseInt(session_id));
|
||||
httpCallHandler.postHttpSession(new URL(url), map);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package monnethic.mobile.restApi;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import monnethic.mobile.database.Transaction;
|
||||
import monnethic.mobile.transaction.SendingTransaction;
|
||||
|
||||
public class TransactionApiHandler {
|
||||
|
||||
public String doTransaction(SendingTransaction sendingTransaction){
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try{
|
||||
String url = Config.TRANSACTION_SEND;
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("source_user_hash",sendingTransaction.getSource_user_hash());
|
||||
map.put("source_user_pwd",sendingTransaction.getSource_user_pwd());
|
||||
map.put("transaction_from",sendingTransaction.getTransaction_from());
|
||||
map.put("transaction_to",sendingTransaction.getTransaction_to());
|
||||
map.put("transaction_amount",sendingTransaction.getTransaction_amount());
|
||||
map.put("transaction_unit",sendingTransaction.getTransaction_unit());
|
||||
String response = httpCallHandler.postHttp(new URL(url),map);
|
||||
JSONObject jsonObject = new JSONObject(response);
|
||||
return jsonObject.getString("response");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public ArrayList<Transaction> getTransactions(String function, String url, String wallet_hash,
|
||||
String size, String start_date, String end_date){
|
||||
ArrayList<Transaction> transactionsList = new ArrayList<>();
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try{
|
||||
if(Integer.parseInt(function)==0){
|
||||
url = url+"?wallet_hash="+wallet_hash;
|
||||
} else if(Integer.parseInt(function)==1 || Integer.parseInt(function)==2 || Integer.parseInt(function)==3){
|
||||
url = url+"?size="+size+"&wallet_hash="+wallet_hash;
|
||||
} else {
|
||||
url = url+"?size="+size+"&wallet_hash="+wallet_hash+"&start_date="+start_date+"&end_date="+end_date;
|
||||
}
|
||||
|
||||
String response = httpCallHandler.getHttp(new URL(url));
|
||||
JSONArray jsonArray = new JSONArray(response);
|
||||
|
||||
for(int i=0; i<jsonArray.length(); i++){
|
||||
Transaction transaction = new Transaction();
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
|
||||
transaction.setTransactionDate(Long.parseLong(jsonObject.getString("transaction_date")));
|
||||
transaction.setTransactionFrom(jsonObject.getString("transaction_from"));
|
||||
transaction.setTransactionTo(jsonObject.getString("transaction_to"));
|
||||
transaction.setTransactionHash(jsonObject.getString("transaction_hash"));
|
||||
transaction.setTransactionAmount(jsonObject.getDouble("transaction_amount"));
|
||||
transaction.setTransactionUnit(jsonObject.getString("transaction_unit"));
|
||||
|
||||
transactionsList.add(transaction);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return transactionsList;
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
package monnethic.mobile.restApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import monnethic.mobile.database.User;
|
||||
|
||||
public class UserApiHandler {
|
||||
|
||||
public JSONObject registerUser(User u){ //return JSON with session ID
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try{
|
||||
String url = Config.USER_REGISTER;
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
map.put("name",u.getName());
|
||||
map.put("firstname",u.getFirstname());
|
||||
map.put("email",u.getEmail());
|
||||
map.put("phone",u.getPhone());
|
||||
map.put("association",u.getAssociation());
|
||||
map.put("password",u.getPassword());
|
||||
|
||||
String responseCall = httpCallHandler.postHttp(new URL(url), map);
|
||||
JSONObject jsonObject = new JSONObject(responseCall);
|
||||
u.setUser_hash(jsonObject.getString("user_hash"));
|
||||
|
||||
JSONObject jsonReturn = new JSONObject();
|
||||
jsonReturn.put("user_hash",u.getUser_hash());
|
||||
|
||||
String urlSession = Config.START_SESSION;
|
||||
Map<String, String> mapSession = new HashMap<>();
|
||||
mapSession.put("user_email",u.getEmail());
|
||||
mapSession.put("user_hash",u.getUser_hash());
|
||||
String responseCallSession = httpCallHandler.postHttp(new URL(urlSession), mapSession);
|
||||
JSONObject jsonObjectSession = new JSONObject(responseCallSession);
|
||||
jsonReturn.put("session_id",String.valueOf(jsonObjectSession.getInt("session_id")));
|
||||
|
||||
return jsonReturn;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public JSONObject loginUser(User u){ //return JSON with session ID
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try{
|
||||
String url = Config.USER_LOGIN;
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("email",u.getEmail());
|
||||
map.put("password",u.getPassword());
|
||||
|
||||
String responseCall = httpCallHandler.postHttp(new URL(url), map);
|
||||
JSONObject jsonObject = new JSONObject(responseCall);
|
||||
if(jsonObject.getInt("status")!=200){
|
||||
return jsonObject;
|
||||
} else {
|
||||
System.out.println("OUT OUT OUT / "+jsonObject.toString());
|
||||
u.setUser_hash(jsonObject.getString("user_hash"));
|
||||
JSONObject jsonReturn = new JSONObject();
|
||||
jsonReturn.put("status",200);
|
||||
jsonReturn.put("user_hash",u.getUser_hash());
|
||||
|
||||
String urlSession = Config.START_SESSION;
|
||||
Map<String, String> mapSession = new HashMap<>();
|
||||
mapSession.put("user_email",u.getEmail());
|
||||
mapSession.put("user_hash",u.getUser_hash());
|
||||
String responseCallSession = httpCallHandler.postHttp(new URL(urlSession), mapSession);
|
||||
JSONObject jsonObjectSession = new JSONObject(responseCallSession);
|
||||
jsonReturn.put("session_id",String.valueOf(jsonObjectSession.getInt("session_id")));
|
||||
|
||||
return jsonReturn;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean checkUser(String email){
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
Boolean response = null;
|
||||
try{
|
||||
String url = Config.USER_GET+"?user_email="+email;
|
||||
String responseCall = httpCallHandler.getHttp(new URL(url));
|
||||
response = new JSONObject(responseCall).getBoolean("response");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public User getUser(int method, String email, String phone){
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
User returnUser = new User();
|
||||
try{
|
||||
String responseCall="";
|
||||
if(method==1){
|
||||
String url = Config.FIND_BY_EMAIL+"?email="+email;
|
||||
responseCall = httpCallHandler.getHttp(new URL(url));
|
||||
}else if(method==2){
|
||||
String url = Config.FIND_BY_PHONE+"?phone="+phone;
|
||||
responseCall = httpCallHandler.getHttp(new URL(url));
|
||||
} else {
|
||||
String url = Config.FIND_BY_EMAIL_AND_PHONE+"?email="+email+"&phone="+phone;
|
||||
responseCall = httpCallHandler.getHttp(new URL(url));
|
||||
}
|
||||
|
||||
if(responseCall!=""){
|
||||
JSONObject jsonObject = new JSONObject(responseCall);
|
||||
returnUser.setName(jsonObject.getString("name"));
|
||||
returnUser.setFirstname(jsonObject.getString("firstname"));
|
||||
returnUser.setUser_hash(jsonObject.getString("user_hash"));
|
||||
|
||||
return returnUser;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package monnethic.mobile.restApi;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import monnethic.mobile.wallet.Wallet;
|
||||
|
||||
public class WalletApiHandler {
|
||||
|
||||
public ArrayList<Wallet> getUserWallets(String[] params){
|
||||
ArrayList<Wallet> walletList = new ArrayList<>();
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try {
|
||||
String url = Config.WALLET_GET_USER_WALLETS+"?user_hash="+params[0];
|
||||
String responseCall = httpCallHandler.getHttp(new URL(url));
|
||||
JSONArray jsonArray = new JSONArray(responseCall);
|
||||
|
||||
for(int i=0; i<jsonArray.length(); i++){
|
||||
Wallet wallet = new Wallet();
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
|
||||
wallet.setType(jsonObject.getJSONObject("Record").getJSONObject("walletType").getString("string"));
|
||||
wallet.setWallet_hash(jsonObject.getJSONObject("Record").getJSONObject("id").getString("string"));
|
||||
wallet.setUser_hash(jsonObject.getJSONObject("Record").getJSONObject("owner").getString("string"));
|
||||
|
||||
String urlGetWallet = Config.WALLET_GET_WALLET+"?wallet_hash="+wallet.getWallet_hash();
|
||||
String responseWallet = httpCallHandler.getHttp(new URL(urlGetWallet));
|
||||
JSONObject jsonWallet = new JSONObject(responseWallet);
|
||||
|
||||
wallet.setBalance(jsonWallet.getDouble("balance"));
|
||||
walletList.add(wallet);
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return walletList;
|
||||
}
|
||||
|
||||
public Double getWalletBalance(String [] params){
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try{
|
||||
String url = Config.WALLET_GET_WALLET+"?wallet_hash="+params[0];
|
||||
String responseCall = httpCallHandler.getHttp(new URL(url));
|
||||
JSONObject jsonObject = new JSONObject(responseCall);
|
||||
return jsonObject.getDouble("balance");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Wallet createWallet(Wallet wallet){
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
try {
|
||||
String url = Config.WALLET_CREATE;
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
map.put("user_hash",wallet.getUser_hash());
|
||||
map.put("type",wallet.getType());
|
||||
String responseCall = httpCallHandler.postHttp(new URL(url), map);
|
||||
|
||||
JSONObject jsonObject = new JSONObject(responseCall);
|
||||
wallet.setWallet_hash(jsonObject.getString("wallet_hash"));
|
||||
wallet.setBalance(jsonObject.getDouble("balance"));
|
||||
|
||||
return wallet;
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
public class DisplayWallet {
|
||||
private String user_name;
|
||||
private String user_firstname;
|
||||
private String wallet_hash;
|
||||
|
||||
public DisplayWallet() {
|
||||
}
|
||||
|
||||
public DisplayWallet(String user_name, String user_firstname, String wallet_hash) {
|
||||
this.user_name = user_name;
|
||||
this.user_firstname = user_firstname;
|
||||
this.wallet_hash = wallet_hash;
|
||||
}
|
||||
|
||||
public String getUser_name() {
|
||||
return user_name;
|
||||
}
|
||||
|
||||
public void setUser_name(String user_name) {
|
||||
this.user_name = user_name;
|
||||
}
|
||||
|
||||
public String getUser_firstname() {
|
||||
return user_firstname;
|
||||
}
|
||||
|
||||
public void setUser_firstname(String user_firstname) {
|
||||
this.user_firstname = user_firstname;
|
||||
}
|
||||
|
||||
public String getWallet_hash() {
|
||||
return wallet_hash;
|
||||
}
|
||||
|
||||
public void setWallet_hash(String wallet_hash) {
|
||||
this.wallet_hash = wallet_hash;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DisplayWalletAdapter extends ArrayAdapter<DisplayWallet> {
|
||||
public DisplayWalletAdapter(Context context, ArrayList<DisplayWallet> dWallets){
|
||||
super(context,0,dWallets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
DisplayWallet dWallet = getItem(position);
|
||||
|
||||
if(convertView == null){
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.wallet_search_template, parent, false);
|
||||
}
|
||||
|
||||
TextView user_name = convertView.findViewById(R.id.userNameSearch);
|
||||
TextView wallet_hash = convertView.findViewById(R.id.walletHashSearch);
|
||||
|
||||
ViewGroup.LayoutParams params = convertView.getLayoutParams();
|
||||
params.height = 300;
|
||||
convertView.setLayoutParams(params);
|
||||
|
||||
String userFullName = dWallet.getUser_name()+" "+dWallet.getUser_firstname();
|
||||
user_name.setText(userFullName);
|
||||
wallet_hash.setText(dWallet.getWallet_hash());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.util.ArrayList;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.wallet.Wallet;
|
||||
|
||||
public class DisplayWalletSearch extends AppCompatActivity {
|
||||
private ArrayList<Wallet> userWallets;
|
||||
private String session_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_display_wallet_search);
|
||||
|
||||
ListView listView = (ListView) findViewById(R.id.listViewWalletSearch);
|
||||
Intent intent = getIntent();
|
||||
String user_name = intent.getStringExtra("user_name");
|
||||
String user_firstname = intent.getStringExtra("user_firstname");
|
||||
String user_hash = intent.getStringExtra("user_hash");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
|
||||
try {
|
||||
userWallets = new SearchWalletTask().execute(user_hash).get();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ArrayList<DisplayWallet> displayWallets = new ArrayList<>();
|
||||
for(Wallet w : userWallets){
|
||||
displayWallets.add(new DisplayWallet(user_name,user_firstname,w.getWallet_hash()));
|
||||
}
|
||||
DisplayWalletAdapter adapter = new DisplayWalletAdapter(this,displayWallets);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
DisplayWallet dW = (DisplayWallet) listView.getItemAtPosition(i);
|
||||
Intent intent1 = new Intent();
|
||||
intent1.putExtra("walletHash",dW.getWallet_hash());
|
||||
setResult(1,intent1);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class SearchWalletTask extends AsyncTask<String,String,ArrayList<Wallet>> {
|
||||
ProgressDialog progDailog = new ProgressDialog(DisplayWalletSearch.this);
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching user wallets...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Wallet> listWallet) {
|
||||
progDailog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<Wallet> doInBackground(String... strings) {
|
||||
ArrayList<Wallet> walletsList = new ArrayList<>();
|
||||
try{
|
||||
WalletApiHandler walletApiHandler = new WalletApiHandler();
|
||||
walletsList = walletApiHandler.getUserWallets(strings);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return walletsList;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import monnethic.mobile.database.User;
|
||||
import monnethic.mobile.homepage.InputController;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
|
||||
public class SearchUser extends AppCompatActivity {
|
||||
EditText emailAddress;
|
||||
EditText phoneNumber;
|
||||
Button buttonCancel;
|
||||
Button buttonOk;
|
||||
private String session_id;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_search_user);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
emailAddress = findViewById(R.id.inputEmailSearch);
|
||||
phoneNumber = findViewById(R.id.inputPhoneSearch);
|
||||
buttonCancel = findViewById(R.id.buttonCancelSearch);
|
||||
buttonOk = findViewById(R.id.buttonOkSearch);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
setResult(2);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
search();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void search(){
|
||||
String uEmail = emailAddress.getText().toString();
|
||||
String uPhone = phoneNumber.getText().toString();
|
||||
|
||||
if(InputController.isEmptyEdit(emailAddress) && InputController.isEmptyEdit(phoneNumber)){
|
||||
Toast.makeText(this, "Enter an email or phone number", Toast.LENGTH_SHORT).show();
|
||||
} else if(InputController.isEmptyEdit(emailAddress)){
|
||||
new SearchUserTask(this).execute(null,uPhone);
|
||||
} else if(InputController.isEmptyEdit(phoneNumber)){
|
||||
new SearchUserTask(this).execute(uEmail,null);
|
||||
} else {
|
||||
new SearchUserTask(this).execute(uEmail,uPhone);
|
||||
}
|
||||
}
|
||||
|
||||
private class SearchUserTask extends AsyncTask<String,Void,User> {
|
||||
Context mContext;
|
||||
private SearchUserTask(final Context context){mContext=context;}
|
||||
ProgressDialog progDailog = new ProgressDialog(SearchUser.this);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching user...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(User user) {
|
||||
try{
|
||||
progDailog.dismiss();
|
||||
if(user!=null){
|
||||
Intent displayWalletIntent = new Intent(SearchUser.this, DisplayWalletSearch.class);
|
||||
displayWalletIntent.putExtra("user_name",user.getName());
|
||||
displayWalletIntent.putExtra("user_firstname",user.getFirstname());
|
||||
displayWalletIntent.putExtra("user_hash",user.getUser_hash());
|
||||
displayWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
displayWalletIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
SearchUser.this.startActivity(displayWalletIntent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(mContext,"User dosen't exist",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected User doInBackground(String... strings) {
|
||||
try {
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
User u = new User();
|
||||
if(strings[0]!=null && strings[1]==null){
|
||||
u = userApiHandler.getUser(1,strings[0],null);
|
||||
} else if(strings[0]==null && strings[1]!=null){
|
||||
u = userApiHandler.getUser(2,null,strings[1]);
|
||||
} else {
|
||||
u = userApiHandler.getUser(3,strings[0],strings[1]);
|
||||
}
|
||||
return u;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.TransactionApiHandler;
|
||||
|
||||
public class ApprovePayementActivity extends AppCompatActivity {
|
||||
TextView destAddress;
|
||||
TextView amountDisplay;
|
||||
Button buttonCancel;
|
||||
Button buttonVal;
|
||||
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
String wallet_dest;
|
||||
String amount;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_approve_payement);
|
||||
|
||||
Intent intent = getIntent();
|
||||
String[] value = intent.getStringExtra("VALUE").split(";");
|
||||
wallet_dest = value[0];
|
||||
amount = value[1];
|
||||
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
initViews();
|
||||
}
|
||||
|
||||
private void initViews(){
|
||||
destAddress = findViewById(R.id.destAddress);
|
||||
amountDisplay = findViewById(R.id.amountApprove);
|
||||
buttonCancel = findViewById(R.id.buttonCancel);
|
||||
buttonVal = findViewById(R.id.buttonValidate);
|
||||
|
||||
destAddress.setText(wallet_dest);
|
||||
amountDisplay.setText(amount);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
buttonVal.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
sendTransaction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendTransaction(){
|
||||
SendingTransaction sendingTransaction = new SendingTransaction(user_hash,user_password,wallet_hash,wallet_dest,amount,"gonette");
|
||||
try {
|
||||
|
||||
String transaction_hash = new TransactionTask().execute(sendingTransaction).get();
|
||||
if(transaction_hash!=null){
|
||||
Toast.makeText(this, "transaction id : "+transaction_hash, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(this, "couldn't get transaction id", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private class TransactionTask extends AsyncTask<SendingTransaction,String,String> {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
ProgressDialog progDailog = new ProgressDialog(ApprovePayementActivity.this);
|
||||
progDailog.setMessage("Sending transaction...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(SendingTransaction... sendingTransactions) {
|
||||
try{
|
||||
|
||||
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
|
||||
return transactionApiHandler.doTransaction(sendingTransactions[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import monnethic.mobile.qrcode.QrCodeScannerActivity;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
||||
public class MakePayementActivity extends AppCompatActivity {
|
||||
Button btnScanQr;
|
||||
Button btnSendWithAddress;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private String wallet_hash;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_make_payement);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
|
||||
|
||||
Log.i("UserAccountActivity", "user_hash : "+user_hash);
|
||||
Log.i("UserAccountActivity", "user_password : "+user_password);
|
||||
Log.i("UserAccountActivity", "session_id : "+session_id);
|
||||
Log.i("UserAccountActivity", "wallet_hash : "+wallet_hash);
|
||||
|
||||
initViews();
|
||||
}
|
||||
|
||||
private void initViews(){
|
||||
btnScanQr = findViewById(R.id.buttonScanQr);
|
||||
btnSendWithAddress = findViewById(R.id.buttonSendWithAddress);
|
||||
|
||||
btnScanQr.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent payementIntent = new Intent(MakePayementActivity.this, QrCodeScannerActivity.class);
|
||||
payementIntent.putExtra("USER_HASH",user_hash);
|
||||
payementIntent.putExtra("USER_PWD",user_password);
|
||||
payementIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
payementIntent.putExtra("SESSION_ID",session_id);
|
||||
MakePayementActivity.this.startActivity(payementIntent);
|
||||
}
|
||||
});
|
||||
|
||||
btnSendWithAddress.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent payementIntent = new Intent(MakePayementActivity.this, TransactionActivity.class);
|
||||
payementIntent.putExtra("USER_HASH",user_hash);
|
||||
payementIntent.putExtra("USER_PWD",user_password);
|
||||
payementIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
payementIntent.putExtra("SESSION_ID",session_id);
|
||||
MakePayementActivity.this.startActivity(payementIntent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import monnethic.mobile.qrcode.QrCodeActivity;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
||||
public class ReceivePayementActivity extends AppCompatActivity {
|
||||
Button cancelButton;
|
||||
Button validateButton;
|
||||
EditText amountValueEdit;
|
||||
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private String wallet_hash;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_receive_payement);
|
||||
cancelButton=findViewById(R.id.buttonCancel);
|
||||
validateButton=findViewById(R.id.buttonValidate);
|
||||
amountValueEdit=findViewById(R.id.amountValue);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
|
||||
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
validateButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
generateQrCodeWithValue(amountValueEdit.getText().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void generateQrCodeWithValue(String amount){
|
||||
Intent generateQrIntent = new Intent(ReceivePayementActivity.this, QrCodeActivity.class);
|
||||
generateQrIntent.putExtra("USER_HASH",user_hash);
|
||||
generateQrIntent.putExtra("USER_PDW",user_password);
|
||||
generateQrIntent.putExtra("SESSION_ID",session_id);
|
||||
generateQrIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
generateQrIntent.putExtra("AMOUNT",amount);
|
||||
ReceivePayementActivity.this.startActivity(generateQrIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
public class SendingTransaction {
|
||||
private String source_user_hash;
|
||||
private String source_user_pwd;
|
||||
private String transaction_from;
|
||||
private String transaction_to;
|
||||
private String transaction_amount;
|
||||
private String transaction_unit;
|
||||
|
||||
public SendingTransaction() {
|
||||
}
|
||||
|
||||
public SendingTransaction(String source_user_hash, String source_user_pwd, String transaction_from, String transaction_to, String transaction_amount, String transaction_unit) {
|
||||
this.source_user_hash = source_user_hash;
|
||||
this.source_user_pwd = source_user_pwd;
|
||||
this.transaction_from = transaction_from;
|
||||
this.transaction_to = transaction_to;
|
||||
this.transaction_amount = transaction_amount;
|
||||
this.transaction_unit = transaction_unit;
|
||||
}
|
||||
|
||||
|
||||
public String getSource_user_hash() {
|
||||
return source_user_hash;
|
||||
}
|
||||
|
||||
public void setSource_user_hash(String source_user_hash) {
|
||||
this.source_user_hash = source_user_hash;
|
||||
}
|
||||
|
||||
public String getSource_user_pwd() {
|
||||
return source_user_pwd;
|
||||
}
|
||||
|
||||
public void setSource_user_pwd(String source_user_pwd) {
|
||||
this.source_user_pwd = source_user_pwd;
|
||||
}
|
||||
|
||||
public String getTransaction_from() {
|
||||
return transaction_from;
|
||||
}
|
||||
|
||||
public void setTransaction_from(String transaction_from) {
|
||||
this.transaction_from = transaction_from;
|
||||
}
|
||||
|
||||
public String getTransaction_to() {
|
||||
return transaction_to;
|
||||
}
|
||||
|
||||
public void setTransaction_to(String transaction_to) {
|
||||
this.transaction_to = transaction_to;
|
||||
}
|
||||
|
||||
public String getTransaction_amount() {
|
||||
return transaction_amount;
|
||||
}
|
||||
|
||||
public void setTransaction_amount(String transaction_amount) {
|
||||
this.transaction_amount = transaction_amount;
|
||||
}
|
||||
|
||||
public String getTransaction_unit() {
|
||||
return transaction_unit;
|
||||
}
|
||||
|
||||
public void setTransaction_unit(String transaction_unit) {
|
||||
this.transaction_unit = transaction_unit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SendingTransaction{" +
|
||||
"source_user_hash='" + source_user_hash + '\'' +
|
||||
", source_user_pwd='" + source_user_pwd + '\'' +
|
||||
", transaction_from='" + transaction_from + '\'' +
|
||||
", transaction_to='" + transaction_to + '\'' +
|
||||
", transaction_amount='" + transaction_amount + '\'' +
|
||||
", transaction_unit='" + transaction_unit + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import monnethic.mobile.homepage.InputController;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.TransactionApiHandler;
|
||||
import monnethic.mobile.search.SearchUser;
|
||||
|
||||
public class TransactionActivity extends AppCompatActivity {
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private EditText addressDestination;
|
||||
private EditText amountEditText;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_transaction);
|
||||
addressDestination = findViewById(R.id.destination_address);
|
||||
amountEditText = findViewById(R.id.amount);
|
||||
Button buttonCancel = findViewById(R.id.btn_cancel);
|
||||
Button buttonOk = findViewById(R.id.btn_send);
|
||||
Button buttonSearch = findViewById(R.id.buttonSearch);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
sendTransaction();
|
||||
}
|
||||
});
|
||||
|
||||
buttonSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
launchSearchActivity();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void sendTransaction(){
|
||||
if(InputController.isEmptyEdit(addressDestination)){
|
||||
Toast.makeText(this, "No destination address", Toast.LENGTH_SHORT).show();
|
||||
} else if(InputController.isEmptyEdit(amountEditText)) {
|
||||
Toast.makeText(this, "No amount", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
System.out.println("HERE");
|
||||
String wallet_dest = addressDestination.getText().toString();
|
||||
System.out.println("wallet_dest : "+wallet_dest);
|
||||
String amount = amountEditText.getText().toString();
|
||||
System.out.println("amount : "+amount);
|
||||
System.out.println("user_hash : "+user_hash);
|
||||
System.out.println("user_password : "+user_password);
|
||||
System.out.println("wallet_hash : "+wallet_hash);
|
||||
SendingTransaction sendingTransaction = new SendingTransaction(user_hash,user_password,wallet_hash,wallet_dest,amount,"gonette");
|
||||
try {
|
||||
String transaction_hash = new TransactionTask().execute(sendingTransaction).get();
|
||||
if(transaction_hash!=null){
|
||||
Toast.makeText(this, "transaction id : "+transaction_hash, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(this, "couldn't get transaction id", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
finish();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void launchSearchActivity(){
|
||||
Intent searchIntent = new Intent(TransactionActivity.this, SearchUser.class);
|
||||
searchIntent.putExtra("USER_HASH",user_hash);
|
||||
searchIntent.putExtra("USER_PWD",user_password);
|
||||
searchIntent.putExtra("SESSION_ID",session_id);
|
||||
startActivityForResult(searchIntent,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data){
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if(requestCode==1){
|
||||
String walletHash = data.getStringExtra("walletHash");
|
||||
addressDestination.setText(walletHash);
|
||||
}
|
||||
}
|
||||
|
||||
private class TransactionTask extends AsyncTask<SendingTransaction,String,String> {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
ProgressDialog progDailog = new ProgressDialog(TransactionActivity.this);
|
||||
progDailog.setMessage("Sending transaction...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(SendingTransaction... sendingTransactions) {
|
||||
try{
|
||||
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
|
||||
System.out.println("SEND TRANSACTION");
|
||||
return transactionApiHandler.doTransaction(sendingTransactions[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import monnethic.mobile.database.Transaction;
|
||||
|
||||
public class TransactionAdapter extends ArrayAdapter<Transaction> {
|
||||
private String wallet_hash;
|
||||
|
||||
public TransactionAdapter(Context context, ArrayList<Transaction> transactions, String wallet_hash){
|
||||
super(context,0,transactions);
|
||||
this.wallet_hash = wallet_hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent){
|
||||
Transaction transaction = getItem(position);
|
||||
|
||||
if(convertView == null){
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.transaction_view_template, parent, false);
|
||||
}
|
||||
|
||||
TextView txID = convertView.findViewById(R.id.displayTxId);
|
||||
TextView date = convertView.findViewById(R.id.displayTxDate);
|
||||
TextView type = convertView.findViewById(R.id.displayTxType);
|
||||
TextView amount = convertView.findViewById(R.id.displayTxAmount);
|
||||
|
||||
|
||||
ViewGroup.LayoutParams params = convertView.getLayoutParams();
|
||||
params.height = 250;
|
||||
convertView.setLayoutParams(params);
|
||||
|
||||
String myFormat = "dd-MM-yyyy HH:mm:ss";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
Date dateTransaction = new Date(transaction.getTransactionDate());
|
||||
|
||||
String typeOfTransaction;
|
||||
if(transaction.getTransactionFrom().equals(wallet_hash)){
|
||||
typeOfTransaction="Sent";
|
||||
}else{
|
||||
typeOfTransaction="Received";
|
||||
}
|
||||
|
||||
txID.setText(transaction.getTransactionHash());
|
||||
date.setText(sdf.format(dateTransaction));
|
||||
type.setText(typeOfTransaction);
|
||||
amount.setText(String.valueOf(transaction.getTransactionAmount()));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
package monnethic.mobile.user;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.history.HistoryActivity;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.transaction.MakePayementActivity;
|
||||
import monnethic.mobile.transaction.ReceivePayementActivity;
|
||||
|
||||
public class UserAccountActivity extends AppCompatActivity {
|
||||
private TextView balance;
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_user_account);
|
||||
balance = findViewById(R.id.balanceView);
|
||||
TextView userHashView = findViewById(R.id.userHash);
|
||||
Button buttonPayement = findViewById(R.id.buttonPayement);
|
||||
Button buttonReceive = findViewById(R.id.buttonReceive);
|
||||
Button buttonSettings = findViewById(R.id.buttonSettings);
|
||||
Button buttonRefresh = findViewById(R.id.buttonRefreshBalance);
|
||||
Button buttonHistory = findViewById(R.id.goToHistory);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
String wallet_type = intent.getStringExtra("WALLET_TYPE");
|
||||
String wallet_balance = intent.getStringExtra("WALLET_BALANCE");
|
||||
|
||||
userHashView.setText(wallet_hash);
|
||||
balance.setText(wallet_balance);
|
||||
|
||||
buttonPayement.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
sendPayement();
|
||||
}
|
||||
});
|
||||
buttonReceive.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
receivePayement();
|
||||
}
|
||||
});
|
||||
buttonSettings.setVisibility(View.GONE);
|
||||
buttonSettings.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
settings();
|
||||
}
|
||||
});
|
||||
buttonRefresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new GetUserBalanceTask().execute(wallet_hash);
|
||||
}
|
||||
});
|
||||
buttonHistory.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
history();
|
||||
}
|
||||
});
|
||||
|
||||
String[] params = {wallet_hash};
|
||||
new GetUserBalanceTask().execute(params);
|
||||
}
|
||||
|
||||
public void sendPayement(){
|
||||
Intent payementIntent = new Intent(UserAccountActivity.this, MakePayementActivity.class);
|
||||
payementIntent.putExtra("USER_HASH",user_hash);
|
||||
payementIntent.putExtra("USER_PWD",user_password);
|
||||
payementIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
payementIntent.putExtra("SESSION_ID",session_id);
|
||||
UserAccountActivity.this.startActivity(payementIntent);
|
||||
}
|
||||
public void receivePayement(){
|
||||
Intent receivePayementIntent = new Intent(UserAccountActivity.this, ReceivePayementActivity.class);
|
||||
receivePayementIntent.putExtra("USER_HASH",user_hash);
|
||||
receivePayementIntent.putExtra("USER_PWD",user_password);
|
||||
receivePayementIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
receivePayementIntent.putExtra("SESSION_ID",session_id);
|
||||
UserAccountActivity.this.startActivity(receivePayementIntent);
|
||||
}
|
||||
public void settings(){
|
||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public void history(){
|
||||
Intent historyIntent = new Intent(UserAccountActivity.this, HistoryActivity.class);
|
||||
historyIntent.putExtra("USER_HASH",user_hash);
|
||||
historyIntent.putExtra("USER_PWD",user_password);
|
||||
historyIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
historyIntent.putExtra("SESSION_ID",session_id);
|
||||
UserAccountActivity.this.startActivity(historyIntent);
|
||||
}
|
||||
|
||||
public class GetUserBalanceTask extends AsyncTask<String,String,Double>
|
||||
{
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Double b) {
|
||||
if(b!=null){
|
||||
balance.setText(String.valueOf(b));
|
||||
}else{
|
||||
balance.setText("0");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Double doInBackground(String... params) {
|
||||
try{
|
||||
WalletApiHandler walletApiHandler = new WalletApiHandler();
|
||||
Double newBalance = walletApiHandler.getWalletBalance(params);
|
||||
if(newBalance!=null){
|
||||
return newBalance;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart(); // Always call the superclass method first
|
||||
new GetUserBalanceTask().execute(wallet_hash);
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.user.UserAccountActivity;
|
||||
|
||||
public class CreateWalletActivity extends AppCompatActivity {
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_create_wallet);
|
||||
|
||||
EditText wallet_type = findViewById(R.id.editTextWalletType);
|
||||
Button buttonValidate = findViewById(R.id.buttonValidate);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
|
||||
Context context = this;
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
|
||||
buttonValidate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//TODO ASYNC wallet_type
|
||||
Wallet wallet = new Wallet(wallet_type.getText().toString(),user_hash);
|
||||
new CreateWalletTask(context).execute(wallet);
|
||||
}
|
||||
});
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private class CreateWalletTask extends AsyncTask<Wallet,String,Wallet> {
|
||||
Context mContext;
|
||||
private CreateWalletTask(final Context context){
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
ProgressDialog progDailog = new ProgressDialog(CreateWalletActivity.this);
|
||||
progDailog.setMessage("Creating...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Wallet w) {
|
||||
try{
|
||||
Intent accountIntent = new Intent(CreateWalletActivity.this, UserAccountActivity.class);
|
||||
accountIntent.putExtra("USER_HASH", user_hash);
|
||||
accountIntent.putExtra("USER_PWD",user_password);
|
||||
accountIntent.putExtra("SESSION_ID",session_id);
|
||||
accountIntent.putExtra("WALLET_HASH",w.getWallet_hash());
|
||||
accountIntent.putExtra("WALLET_BALANCE",String.valueOf(w.getBalance()));
|
||||
accountIntent.putExtra("WALLET_TYPE",w.getType());
|
||||
CreateWalletActivity.this.startActivity(accountIntent);
|
||||
finish();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Wallet doInBackground(Wallet... w) {
|
||||
try{
|
||||
WalletApiHandler walletApiHandler = new WalletApiHandler();
|
||||
return walletApiHandler.createWallet(w[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
||||
public class HomeWalletActivity extends AppCompatActivity {
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_home_wallet);
|
||||
Button buttonCreateWallet = findViewById(R.id.buttonCreateWallet);
|
||||
Button buttonSelectWallet = findViewById(R.id.buttonSelectWallet);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
|
||||
buttonCreateWallet.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
launchCreateWalletActivity();
|
||||
}
|
||||
});
|
||||
|
||||
buttonSelectWallet.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
launchSelectWalletActivity();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void launchCreateWalletActivity() {
|
||||
Intent createWalletIntent = new Intent(HomeWalletActivity.this, CreateWalletActivity.class);
|
||||
createWalletIntent.putExtra("USER_HASH",user_hash);
|
||||
createWalletIntent.putExtra("USER_PWD",user_password);
|
||||
createWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
HomeWalletActivity.this.startActivity(createWalletIntent);
|
||||
}
|
||||
|
||||
public void launchSelectWalletActivity() {
|
||||
Intent selectWalletIntent = new Intent(HomeWalletActivity.this, SelectWalletActivity.class);
|
||||
selectWalletIntent.putExtra("USER_HASH",user_hash);
|
||||
selectWalletIntent.putExtra("USER_PWD",user_password);
|
||||
selectWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
HomeWalletActivity.this.startActivity(selectWalletIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.util.ArrayList;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.user.UserAccountActivity;
|
||||
|
||||
public class SelectWalletActivity extends AppCompatActivity {
|
||||
private ArrayList<Wallet> userWallets;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_select_wallet);
|
||||
|
||||
ListView listView = (ListView) findViewById(R.id.listViewWallet);
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
String[] params = {user_hash};
|
||||
|
||||
try {
|
||||
userWallets = new getUserWalletTask().execute(params).get();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
WalletAdapter adapter = new WalletAdapter(this,userWallets);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Wallet w = (Wallet) listView.getItemAtPosition(i);
|
||||
launchAcountActivity(w);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void launchAcountActivity(Wallet w) {
|
||||
Intent accountIntent = new Intent(SelectWalletActivity.this, UserAccountActivity.class);
|
||||
accountIntent.putExtra("USER_HASH",user_hash);
|
||||
accountIntent.putExtra("USER_PWD",user_password);
|
||||
accountIntent.putExtra("SESSION_ID",session_id);
|
||||
accountIntent.putExtra("WALLET_HASH",w.getWallet_hash());
|
||||
accountIntent.putExtra("WALLET_BALANCE",String.valueOf(w.getBalance()));
|
||||
accountIntent.putExtra("WALLET_TYPE",w.getType());
|
||||
SelectWalletActivity.this.startActivity(accountIntent);
|
||||
}
|
||||
|
||||
//AsyncTask to get user wallets
|
||||
private class getUserWalletTask extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
|
||||
ProgressDialog progDailog = new ProgressDialog(SelectWalletActivity.this);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<Wallet> doInBackground(String... params) {
|
||||
ArrayList<Wallet> walletsList = new ArrayList<>();
|
||||
try{
|
||||
WalletApiHandler walletApiHandler = new WalletApiHandler();
|
||||
walletsList = walletApiHandler.getUserWallets(params);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return walletsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Wallet> listWallet) {
|
||||
progDailog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
public class Wallet {
|
||||
private int wallet_id;
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String type;
|
||||
private Double balance;
|
||||
private long creation_date;
|
||||
private long modification_date;
|
||||
private boolean is_active;
|
||||
|
||||
//Constructors
|
||||
//Default constructor for ORMLite
|
||||
public Wallet() {
|
||||
}
|
||||
|
||||
public Wallet(String type,String user_hash){
|
||||
this.type=type;
|
||||
this.user_hash=user_hash;
|
||||
}
|
||||
|
||||
public Wallet(String wallet_hash, String user_hash, String type, boolean isActive) {
|
||||
this.wallet_hash = wallet_hash;
|
||||
this.user_hash = user_hash;
|
||||
this.type = type;
|
||||
this.is_active = isActive;
|
||||
}
|
||||
|
||||
public Wallet(String wallet_hash, String user_hash, String type, Double balance, boolean isActive) {
|
||||
this.wallet_hash = wallet_hash;
|
||||
this.user_hash = user_hash;
|
||||
this.type = type;
|
||||
this.balance = balance;
|
||||
this.is_active = isActive;
|
||||
}
|
||||
|
||||
public int getWallet_id() {
|
||||
return wallet_id;
|
||||
}
|
||||
|
||||
public void setWallet_id(int wallet_id) {
|
||||
this.wallet_id = wallet_id;
|
||||
}
|
||||
|
||||
public String getWallet_hash() {
|
||||
return wallet_hash;
|
||||
}
|
||||
public void setWallet_hash(String wallet_hash) {
|
||||
this.wallet_hash = wallet_hash;
|
||||
}
|
||||
|
||||
public String getUser_hash() {
|
||||
return user_hash;
|
||||
}
|
||||
public void setUser_hash(String user_hash) {
|
||||
this.user_hash = user_hash;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Double getBalance() {
|
||||
return balance;
|
||||
}
|
||||
public void setBalance(Double balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public boolean is_active() {
|
||||
return is_active;
|
||||
}
|
||||
|
||||
public void setIs_active(boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
public long getCreation_date() {
|
||||
return creation_date;
|
||||
}
|
||||
|
||||
public void setCreation_date(long creation_date) {
|
||||
this.creation_date = creation_date;
|
||||
}
|
||||
|
||||
public long getModification_date() {
|
||||
return modification_date;
|
||||
}
|
||||
|
||||
public void setModification_date(long modification_date) {
|
||||
this.modification_date = modification_date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{wallet_hash:"+wallet_hash+",user_hash:"+user_hash+",type:"+type+",balance:"+balance+"}";
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WalletAdapter extends ArrayAdapter<Wallet> {
|
||||
public WalletAdapter(Context context, ArrayList<Wallet> wallets){
|
||||
super(context,0,wallets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent){
|
||||
Wallet wallet = getItem(position);
|
||||
|
||||
if(convertView == null){
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.wallet_view_template, parent, false);
|
||||
}
|
||||
|
||||
TextView wallet_hash = convertView.findViewById(R.id.wallet_hash);
|
||||
TextView wallet_type = convertView.findViewById(R.id.wallet_type);
|
||||
TextView wallet_balance = convertView.findViewById(R.id.wallet_balance);
|
||||
|
||||
ViewGroup.LayoutParams params = convertView.getLayoutParams();
|
||||
params.height = 270;
|
||||
convertView.setLayoutParams(params);
|
||||
|
||||
wallet_hash.setText(wallet.getWallet_hash());
|
||||
wallet_type.setText(wallet.getType());
|
||||
wallet_balance.setText(String.valueOf(wallet.getBalance()));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable/logo.PNG
Normal file
BIN
app/src/main/res/drawable/logo.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
Binary file not shown.
Before Width: | Height: | Size: 152 KiB |
6
app/src/main/res/layout/activity_2fa.xml
Normal file
6
app/src/main/res/layout/activity_2fa.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,76 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.transaction.ApprovePayementActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewDestAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="150dp"
|
||||
android:text="TO :" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/destAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewAmount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="AMOUNT :" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amountApprove"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="40dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:text="CANCEL" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonValidate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="69dp"
|
||||
android:text="VALIDATE" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,58 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextWalletType"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:hint="Wallet name"
|
||||
android:inputType="text" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonValidate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:text="Validate" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Cancel" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
45
app/src/main/res/layout/activity_demo_wallet.xml
Normal file
45
app/src/main/res/layout/activity_demo_wallet.xml
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/walletA"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="WALLET A"
|
||||
app:layout_constraintBottom_toTopOf="@+id/walletB"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.782" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/walletB"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="192dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="WALLET B"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/presenter_Demo"
|
||||
android:layout_width="137dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginBottom="68dp"
|
||||
android:layout_marginEnd="120dp"
|
||||
android:text="WALLET FOR DEMO"
|
||||
app:layout_constraintBottom_toTopOf="@+id/walletA"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.search.DisplayWalletSearch">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true">
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listViewWalletSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dividerHeight="5dp" />
|
||||
</ScrollView>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,99 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.history.HistoryActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="3dp">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switchDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/fromDate"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_toEndOf="@+id/switchDate"
|
||||
android:clickable="true"
|
||||
android:editable="false"
|
||||
android:ems="10"
|
||||
android:hint="From"
|
||||
android:inputType="none"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/toDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_toEndOf="@+id/fromDate"
|
||||
android:clickable="true"
|
||||
android:editable="false"
|
||||
android:ems="10"
|
||||
android:hint="To"
|
||||
android:inputType="none"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputSize"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_toEndOf="@+id/spinner"
|
||||
android:ems="10"
|
||||
android:hint="Size"
|
||||
android:inputType="number"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonSearchTransaction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:text="Search"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listViewTransactions"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dividerHeight="5dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,165 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.history.HistoryDetailsActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="TxID: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayTxID"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textIsSelectable="true"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="Date: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dateDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView14"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="From: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fromDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView16"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.05"
|
||||
android:text="To: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView18"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="Amount: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amountDisplay"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGoToExplorer"
|
||||
android:layout_marginLeft="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Go to explorer" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCloseDetails"
|
||||
android:layout_marginLeft="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Close" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.wallet.HomeWalletActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCreateWallet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="CREATE WALLET"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonSelectWallet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="SELECT WALLET"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -6,14 +6,13 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/welcomeText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignStart="@+id/register"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="Bienvenue sur Monnethic !"
|
||||
android:textStyle="bold"/>
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="Bienvenue sur le wallet de Monnéthic" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/register"
|
||||
|
@ -22,26 +21,43 @@
|
|||
android:layout_above="@+id/login"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="Register" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/versionApp"
|
||||
android:layout_alignStart="@+id/register"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="-1dp"
|
||||
android:layout_marginBottom="99dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:text="LOGIN" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/versionApp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="version v0.1"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/demo"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/login"
|
||||
android:layout_below="@+id/register"
|
||||
android:layout_marginTop="53dp"
|
||||
android:text="DEMO" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="230dp"
|
||||
android:layout_height="210dp"
|
||||
android:layout_below="@+id/welcomeText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="51dp"
|
||||
app:srcCompat="@drawable/newlogo" />
|
||||
app:srcCompat="@drawable/logo" />
|
||||
</RelativeLayout>
|
|
@ -1,106 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true">
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="108dp"
|
||||
android:text="User Login" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
<EditText
|
||||
android:id="@+id/editTextEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="34dp"
|
||||
android:ems="10"
|
||||
android:hint="Email"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:text="LOGIN" />
|
||||
<EditText
|
||||
android:id="@+id/editTextPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/editTextEmail"
|
||||
android:layout_below="@+id/editTextEmail"
|
||||
android:layout_marginTop="69dp"
|
||||
android:ems="10"
|
||||
android:hint="Password"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextEmail"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:ems="10"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress" />
|
||||
<TextView
|
||||
android:id="@+id/forgetPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/editTextPassword"
|
||||
android:layout_below="@+id/editTextPassword"
|
||||
android:text="forget password?"
|
||||
android:onClick="onClickForgetPassword"
|
||||
android:clickable="true"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextPassword"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:ems="10"
|
||||
android:hint="Password"
|
||||
android:inputType="textPassword" />
|
||||
<TextView
|
||||
android:id="@+id/forgetEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/editTextPassword"
|
||||
android:layout_below="@+id/editTextPassword"
|
||||
android:textSize="10sp"
|
||||
android:onClick="onClickForgetEmail"
|
||||
android:clickable="true"
|
||||
android:text="forget email?" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/editTextPassword"
|
||||
android:layout_below="@+id/editTextPassword"
|
||||
android:layout_marginTop="43dp"
|
||||
android:text="Cancel" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/forgetPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="83dp"
|
||||
android:layout_marginTop="0dp"
|
||||
<Button
|
||||
android:id="@+id/buttonOk"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/forgetEmail"
|
||||
android:layout_alignTop="@+id/buttonCancel"
|
||||
android:text="OK" />
|
||||
|
||||
android:clickable="true"
|
||||
android:onClick="onClickForgetPassword"
|
||||
android:text="forget password?"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/forgetEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="84dp"
|
||||
android:clickable="true"
|
||||
android:onClick="onClickForgetEmail"
|
||||
android:text="forget email?"
|
||||
android:textSize="10sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="86dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Cancel" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonOkLogin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/buttonCancel"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="86dp"
|
||||
android:text="OK" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<TextView
|
||||
android:id="@+id/appVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="version v0.1" />
|
||||
</RelativeLayout>
|
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.transaction.MakePayementActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonSendWithAddress"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:text="SEND TO ADDRESS"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.50"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.50" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonScanQr"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:text="SCAN QR CODE"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.50"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/buttonSendWithAddress"
|
||||
app:layout_constraintVertical_bias="0.50" />
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,76 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.qrcode.QrCodeActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qrCodeViewer"
|
||||
android:layout_width="320dp"
|
||||
android:layout_height="307dp"
|
||||
android:layout_marginBottom="204dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="56dp"
|
||||
android:layout_marginEnd="148dp"
|
||||
android:text="CLOSE"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewAdresse"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="Address:"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textViewAmount"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textViewAdresseDisplay"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewAdresseDisplay"
|
||||
android:layout_width="268dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:textSize="9sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textViewAmountDisplay"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewAmount"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="140dp"
|
||||
android:text="Amount:"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textViewAmountDisplay"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewAmountDisplay"
|
||||
android:layout_width="172dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginEnd="112dp"
|
||||
android:layout_marginBottom="140dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.qrcode.QrCodeScannerActivity">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.transaction.ReceivePayementActivity">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/amountValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonValidate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="90dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="Validate"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/amountValue" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="90dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="Cancel"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/amountValue" />
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SEARCH"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmailSearch"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView9"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:ems="10"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:singleLine="false" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPhoneSearch"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputEmailSearch"
|
||||
android:layout_alignStart="@+id/inputEmailSearch"
|
||||
android:layout_marginTop="30dp"
|
||||
android:ems="10"
|
||||
android:hint="Phone"
|
||||
android:inputType="phone" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginBottom="40dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonOkSearch"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="65dp"
|
||||
android:text="OK" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancelSearch"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="65dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Cancel" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.wallet.SelectWalletActivity">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true">
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listViewWallet"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dividerHeight="5dp" />
|
||||
</ScrollView>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -3,134 +3,108 @@
|
|||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@+id/buttonOk"
|
||||
android:layout_alignBottom="@+id/buttonOk"
|
||||
android:layout_alignStart="@+id/inputConfPassword"
|
||||
android:text="Cancel" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonOk"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/inputConfPassword"
|
||||
android:layout_below="@+id/inputConfPassword"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="OK" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="version v0.1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputConfPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/inputPassword"
|
||||
android:layout_below="@+id/inputPassword"
|
||||
android:layout_marginTop="15dp"
|
||||
android:ems="10"
|
||||
android:hint="Confirm Password"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true">
|
||||
android:text="REGISTER"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
<EditText
|
||||
android:id="@+id/inputPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/inputConfEmail"
|
||||
android:layout_below="@+id/inputConfEmail"
|
||||
android:layout_marginTop="13dp"
|
||||
android:ems="10"
|
||||
android:hint="Password"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="REGISTER"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/inputPrenom"
|
||||
android:layout_below="@+id/inputPrenom"
|
||||
android:layout_marginTop="11dp"
|
||||
android:ems="10"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputName"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView9"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="25dp"
|
||||
<EditText
|
||||
android:id="@+id/inputConfEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/inputEmail"
|
||||
android:layout_below="@+id/inputEmail"
|
||||
android:layout_marginTop="11dp"
|
||||
android:ems="10"
|
||||
android:hint="Confirm Email"
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
android:ems="10"
|
||||
android:hint="Name"
|
||||
android:inputType="textPersonName"
|
||||
android:singleLine="false" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPrenom"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputName"
|
||||
android:layout_alignStart="@+id/inputName"
|
||||
android:layout_marginTop="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Firstname"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputPrenom"
|
||||
android:layout_alignStart="@+id/inputPrenom"
|
||||
android:layout_marginTop="11dp"
|
||||
android:ems="10"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputConfEmail"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputEmail"
|
||||
android:layout_alignStart="@+id/inputEmail"
|
||||
android:layout_marginTop="11dp"
|
||||
android:ems="10"
|
||||
android:hint="Confirm Email"
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPhone"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputConfEmail"
|
||||
android:layout_alignStart="@+id/inputConfEmail"
|
||||
android:layout_marginTop="11dp"
|
||||
android:ems="10"
|
||||
android:hint="Phone"
|
||||
android:inputType="phone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPassword"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputPhone"
|
||||
android:layout_alignStart="@+id/inputPhone"
|
||||
android:layout_marginTop="13dp"
|
||||
android:ems="10"
|
||||
android:hint="Password"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputConfPassword"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/inputPassword"
|
||||
android:layout_alignStart="@+id/inputPassword"
|
||||
android:layout_marginTop="15dp"
|
||||
android:ems="10"
|
||||
android:hint="Confirm Password"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="40dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonOk"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="65dp"
|
||||
android:text="OK" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="65dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Cancel" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<EditText
|
||||
android:id="@+id/inputPrenom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/inputName"
|
||||
android:layout_below="@+id/inputName"
|
||||
android:layout_marginTop="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Firstname"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView9"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="65dp"
|
||||
android:ems="10"
|
||||
android:hint="Name"
|
||||
android:inputType="textPersonName"
|
||||
android:singleLine="false" />
|
||||
</RelativeLayout>
|
|
@ -1,83 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<Button
|
||||
android:id="@+id/btn_send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
android:layout_alignEnd="@+id/amount"
|
||||
android:layout_below="@+id/amount"
|
||||
android:layout_marginTop="77dp"
|
||||
android:text="SEND"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_cancel"
|
||||
app:layout_constraintHorizontal_bias="0.543"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/destination_address"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/buttonSearch"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:hint="Destination address"
|
||||
android:singleLine="false"
|
||||
android:inputType="text" />
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@+id/btn_send"
|
||||
android:layout_alignBottom="@+id/btn_send"
|
||||
android:layout_alignStart="@+id/amount"
|
||||
android:text="CANCEL"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_above="@+id/amount"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Search" />
|
||||
<EditText
|
||||
android:id="@+id/amount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:ems="10"
|
||||
android:hint="Amount"
|
||||
android:inputType="numberDecimal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.503"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/destination_address" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/amount"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:ems="10"
|
||||
android:hint="Amount"
|
||||
android:inputType="numberDecimal" />
|
||||
<EditText
|
||||
android:id="@+id/destination_address"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/amount"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="67dp"
|
||||
android:ems="10"
|
||||
android:hint="Destination address"
|
||||
android:inputType="text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="40dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="67dp"
|
||||
android:text="SEND" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="67dp"
|
||||
android:text="CANCEL" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -3,10 +3,18 @@
|
|||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="version v0.1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonSettings"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="Settings" />
|
||||
|
@ -15,82 +23,34 @@
|
|||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/buttonSettings"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="70dp"
|
||||
android:text="WALLET"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="User account" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewSolde"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView4"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="48dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonPayement"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_above="@+id/buttonReceive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="Payement" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonReceive"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_above="@+id/buttonRefreshBalance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/buttonPayement"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginTop="38dp"
|
||||
android:text="Receive" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonRefreshBalance"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_above="@+id/goToHistory"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="Refresh" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/balanceView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textBalance"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="15dp"
|
||||
android:inputType="none"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textBalance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/userHash"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="BALANCE"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userHash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView4"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/goToHistory"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:text="History" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
49
app/src/main/res/layout/activity_wallet.xml
Normal file
49
app/src/main/res/layout/activity_wallet.xml
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="119dp"
|
||||
android:text="Generate or Restore wallet" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/versionApp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="version v0.1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCreateWallet"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView2"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="83dp"
|
||||
android:text="Create Wallet" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonRestoreWallet"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/buttonCreateWallet"
|
||||
android:layout_below="@+id/buttonCreateWallet"
|
||||
android:layout_marginTop="54dp"
|
||||
android:text="RESTORE WALLET" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonSkip"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignStart="@+id/buttonRestoreWallet"
|
||||
android:layout_below="@+id/buttonRestoreWallet"
|
||||
android:text="SKIP"
|
||||
android:textSize="8sp" />
|
||||
</RelativeLayout>
|
97
app/src/main/res/layout/activity_wallet_presenter.xml
Normal file
97
app/src/main/res/layout/activity_wallet_presenter.xml
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Balance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/balance"
|
||||
android:layout_alignStart="@+id/balance"
|
||||
android:text="BALANCE"
|
||||
app:layout_constraintBottom_toTopOf="@+id/balance"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.247"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/send_transaction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="114dp"
|
||||
android:text="SEND TRANSACTION"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/balance" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/publicAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/address_pub"
|
||||
android:layout_alignStart="@+id/address_pub"
|
||||
android:text="PUBLIC ADDRESS"
|
||||
app:layout_constraintBottom_toTopOf="@+id/address_pub"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.294"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/balance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/send_transaction"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:layout_toStartOf="@+id/refreshBalance"
|
||||
android:ems="10"
|
||||
android:inputType="none"
|
||||
android:editable="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.503"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/address_pub" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/refreshBalance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="REFRESH"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.971"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/address_pub"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/Balance"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="71dp"
|
||||
android:editable="false"
|
||||
android:ems="10"
|
||||
android:inputType="none"
|
||||
android:singleLine="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,109 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_weight="0.01"
|
||||
android:text="TxID:"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayTxId"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_weight="0.01"
|
||||
android:text="Date:"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayTxDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.01"
|
||||
android:text="Type:"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayTxType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.01"
|
||||
android:text="Amount:"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayTxAmount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,69 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/userNameSearch"
|
||||
android:layout_marginEnd="-85dp"
|
||||
android:layout_toStartOf="@+id/walletHashSearch"
|
||||
android:text="User :"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/textView"
|
||||
android:layout_alignTop="@+id/walletHashSearch"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Wallet :"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userNameSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/walletHashSearch"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="u_n"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/walletHashSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="100dp"
|
||||
android:layout_marginTop="39dp"
|
||||
android:singleLine="false"
|
||||
android:text="w_h"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,85 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_hash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Wallet Hash"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/wallet_type"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="28dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Wallet :"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/textView2"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="96dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Wallet Type"
|
||||
android:textSize="13sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_balance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="96dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Wallet Balance"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/wallet_balance"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="28dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Balance :"
|
||||
android:textSize="13sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,10 +0,0 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="monnethic.mobile.wallet.SelectWalletActivity">
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"name": "hlfv1",
|
||||
"x-type": "hlfv1",
|
||||
"x-commitTimeout": 300,
|
||||
"version": "1.0.0",
|
||||
"client": {
|
||||
"organization": "Org1",
|
||||
"connection": {
|
||||
"timeout": {
|
||||
"peer": {
|
||||
"endorser": "300",
|
||||
"eventHub": "300",
|
||||
"eventReg": "300"
|
||||
},
|
||||
"orderer": "300"
|
||||
}
|
||||
}
|
||||
},
|
||||
"channels": {
|
||||
"composerchannel": {
|
||||
"orderers": [
|
||||
"orderer.example.com"
|
||||
],
|
||||
"peers": {
|
||||
"peer0.org1.example.com": {
|
||||
"endorsingPeer": true,
|
||||
"chaincodeQuery": true,
|
||||
"ledgerQuery": true,
|
||||
"eventSource": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"organizations": {
|
||||
"Org1": {
|
||||
"mspid": "Org1MSP",
|
||||
"peers": [
|
||||
"peer0.org1.example.com"
|
||||
],
|
||||
"certificateAuthorities": [
|
||||
"ca.org1.example.com"
|
||||
]
|
||||
}
|
||||
},
|
||||
"orderers": {
|
||||
"orderer.example.com": {
|
||||
"url": "grpc://orderer.example.com:7050"
|
||||
}
|
||||
},
|
||||
"peers": {
|
||||
"peer0.org1.example.com": {
|
||||
"url": "grpc://peer0.org1.example.com:7051"
|
||||
}
|
||||
},
|
||||
"certificateAuthorities": {
|
||||
"ca.org1.example.com": {
|
||||
"url": "http://ca.org1.example.com:7054",
|
||||
"caName": "ca.org1.example.com"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,4 @@
|
|||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="app_bar_height">180dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="text_margin">16dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<resources>
|
||||
<string name="app_name">Monnethic Mobile</string>
|
||||
<string name="app_name">Monnéthic Mobile</string>
|
||||
<string name="title_activity_login">Sign in</string>
|
||||
|
||||
<!-- Strings related to login -->
|
||||
|
@ -14,95 +14,4 @@
|
|||
<string name="permission_rationale">"Contacts permissions are needed for providing email
|
||||
completions."
|
||||
</string>
|
||||
<string name="title_activity_select_wallet">SelectWalletActivity</string>
|
||||
<string name="large_text">
|
||||
"Material is the metaphor.\n\n"
|
||||
|
||||
"A material metaphor is the unifying theory of a rationalized space and a system of motion."
|
||||
"The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
|
||||
"technologically advanced and open to imagination and magic.\n"
|
||||
"Surfaces and edges of the material provide visual cues that are grounded in reality. The "
|
||||
"use of familiar tactile attributes helps users quickly understand affordances. Yet the "
|
||||
"flexibility of the material creates new affordances that supercede those in the physical "
|
||||
"world, without breaking the rules of physics.\n"
|
||||
"The fundamentals of light, surface, and movement are key to conveying how objects move, "
|
||||
"interact, and exist in space and in relation to each other. Realistic lighting shows "
|
||||
"seams, divides space, and indicates moving parts.\n\n"
|
||||
|
||||
"Bold, graphic, intentional.\n\n"
|
||||
|
||||
"The foundational elements of print based design typography, grids, space, scale, color, "
|
||||
"and use of imagery guide visual treatments. These elements do far more than please the "
|
||||
"eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
|
||||
"imagery, large scale typography, and intentional white space create a bold and graphic "
|
||||
"interface that immerse the user in the experience.\n"
|
||||
"An emphasis on user actions makes core functionality immediately apparent and provides "
|
||||
"waypoints for the user.\n\n"
|
||||
|
||||
"Motion provides meaning.\n\n"
|
||||
|
||||
"Motion respects and reinforces the user as the prime mover. Primary user actions are "
|
||||
"inflection points that initiate motion, transforming the whole design.\n"
|
||||
"All action takes place in a single environment. Objects are presented to the user without "
|
||||
"breaking the continuity of experience even as they transform and reorganize.\n"
|
||||
"Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
|
||||
"Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
|
||||
|
||||
"3D world.\n\n"
|
||||
|
||||
"The material environment is a 3D space, which means all objects have x, y, and z "
|
||||
"dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
|
||||
"positive z-axis extending towards the viewer. Every sheet of material occupies a single "
|
||||
"position along the z-axis and has a standard 1dp thickness.\n"
|
||||
"On the web, the z-axis is used for layering and not for perspective. The 3D world is "
|
||||
"emulated by manipulating the y-axis.\n\n"
|
||||
|
||||
"Light and shadow.\n\n"
|
||||
|
||||
"Within the material environment, virtual lights illuminate the scene. Key lights create "
|
||||
"directional shadows, while ambient light creates soft shadows from all angles.\n"
|
||||
"Shadows in the material environment are cast by these two light sources. In Android "
|
||||
"development, shadows occur when light sources are blocked by sheets of material at "
|
||||
"various positions along the z-axis. On the web, shadows are depicted by manipulating the "
|
||||
"y-axis only. The following example shows the card with a height of 6dp.\n\n"
|
||||
|
||||
"Resting elevation.\n\n"
|
||||
|
||||
"All material objects, regardless of size, have a resting elevation, or default elevation "
|
||||
"that does not change. If an object changes elevation, it should return to its resting "
|
||||
"elevation as soon as possible.\n\n"
|
||||
|
||||
"Component elevations.\n\n"
|
||||
|
||||
"The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
|
||||
"does not vary from 6dp in one app to 16dp in another app).\n"
|
||||
"Components may have different resting elevations across platforms, depending on the depth "
|
||||
"of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
|
||||
|
||||
"Responsive elevation and dynamic elevation offsets.\n\n"
|
||||
|
||||
"Some component types have responsive elevation, meaning they change elevation in response "
|
||||
"to user input (e.g., normal, focused, and pressed) or system events. These elevation "
|
||||
"changes are consistently implemented using dynamic elevation offsets.\n"
|
||||
"Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
|
||||
"to the component’s resting state. They ensure that elevation changes are consistent "
|
||||
"across actions and component types. For example, all components that lift on press have "
|
||||
"the same elevation change relative to their resting elevation.\n"
|
||||
"Once the input event is completed or cancelled, the component will return to its resting "
|
||||
"elevation.\n\n"
|
||||
|
||||
"Avoiding elevation interference.\n\n"
|
||||
|
||||
"Components with responsive elevations may encounter other components as they move between "
|
||||
"their resting elevations and dynamic elevation offsets. Because material cannot pass "
|
||||
"through other material, components avoid interfering with one another any number of ways, "
|
||||
"whether on a per component basis or using the entire app layout.\n"
|
||||
"On a component level, components can move or be removed before they cause interference. "
|
||||
"For example, a floating action button (FAB) can disappear or move off screen before a "
|
||||
"user picks up a card, or it can move if a snackbar appears.\n"
|
||||
"On the layout level, design your app layout to minimize opportunities for interference. "
|
||||
"For example, position the FAB to one side of stream of a cards so the FAB won’t interfere "
|
||||
"when a user tries to pick up one of cards.\n\n"
|
||||
</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
</resources>
|
||||
|
|
|
@ -8,8 +8,4 @@
|
|||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package monnethic.mobile.test;
|
||||
package com.example.monnthic.monnthicmobile;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package monnethic.mobile.test.blockchainApi;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Test;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import monnethic.mobile.restApi.Config;
|
||||
import monnethic.mobile.restApi.HttpCallHandler;
|
||||
import monnethic.mobile.wallet.Wallet;
|
||||
|
||||
public class walletTest {
|
||||
|
||||
@Test
|
||||
public void getUsersWallet(){
|
||||
ArrayList<Wallet> walletList = new ArrayList<>();
|
||||
try {
|
||||
String url = Config.WALLET_GET_USER_WALLETS+"?userHash="+"$2a$10$GzyMhD3n05Z2lwCnoGi2dusjKrNAmHhtn5fw1xLpes5.cEV5T7lve";
|
||||
System.out.println("call : "+url);
|
||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||
String response = httpCallHandler.getHttp(new URL(url));
|
||||
|
||||
System.out.println("RESPONSE IS : "+response);
|
||||
|
||||
JSONArray jsonArray = new JSONArray(response);
|
||||
|
||||
for(int i=0; i<jsonArray.length(); i++){
|
||||
Wallet wallet = new Wallet();
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
|
||||
wallet.setType(jsonObject.getJSONObject("Record").getJSONObject("walletType").getString("string"));
|
||||
wallet.setWallet_hash(jsonObject.getJSONObject("Record").getJSONObject("id").getString("string"));
|
||||
wallet.setUser_hash(jsonObject.getJSONObject("Record").getJSONObject("owner").getString("string"));
|
||||
|
||||
String urlGetWallet = Config.WALLET_GET_WALLET+"?walletHash="+wallet.getWallet_hash();
|
||||
String responseWallet = httpCallHandler.getHttp(new URL(urlGetWallet));
|
||||
JSONObject jsonWallet = new JSONObject(responseWallet);
|
||||
|
||||
wallet.setBalance(jsonWallet.getDouble("balance"));
|
||||
walletList.add(wallet);
|
||||
}
|
||||
|
||||
for (Wallet w : walletList){
|
||||
System.out.println("wallet : "+w.toString());
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sun Oct 14 15:18:06 CEST 2018
|
||||
#Wed Apr 04 16:52:57 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
|
|
Loading…
Reference in a new issue