Compare commits

..

No commits in common. "demo" and "master" have entirely different histories.
demo ... master

95 changed files with 1408 additions and 7353 deletions
.idea
app
build.gradle
src
androidTest/java
com/example/monnthic/monnthicmobile
monnethic/mobile/test
main
AndroidManifest.xml
java
res
test/java
com/example/monnthic/monnthicmobile
monnethic/mobile/test
blockchainApi
restAPI
build.gradle
gradle/wrapper

View file

@ -5,26 +5,22 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables"> <option name="myNullables">
<value> <value>
<list size="7"> <list size="5">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> <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="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> <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="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="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> </list>
</value> </value>
</option> </option>
<option name="myNotNulls"> <option name="myNotNulls">
<value> <value>
<list size="6"> <list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> <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="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="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="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> </list>
</value> </value>
</option> </option>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View file

@ -1,45 +1,32 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 27 compileSdkVersion 26
defaultConfig { defaultConfig {
applicationId 'com.monnethic.appmobile' applicationId "com.example.monnthic.monnthicmobile"
multiDexEnabled true multiDexEnabled true
minSdkVersion 21 minSdkVersion 19
targetSdkVersion 27 targetSdkVersion 26
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
buildToolsVersion '28.0.3'
productFlavors {
}
} }
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.json:json:20140107' androidTestImplementation 'com.android.support.test:runner:1.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2' compile ('org.web3j:core:3.3.1-android')
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' compile ('com.j256.ormlite:ormlite-android:4.48')
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'
} }

View file

@ -1,4 +1,4 @@
package monnethic.mobile.test; package com.example.monnthic.monnthicmobile;
import android.content.Context; import android.content.Context;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;

View file

@ -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"));
*/
}
}

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <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 --> <!-- 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.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" /> <uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" /> <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 <application
android:allowBackup="true" android:allowBackup="true"
@ -17,35 +17,20 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<meta-data <activity android:name=".HomepageActivity">
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode" />
<activity android:name="monnethic.mobile.homepage.HomepageActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="monnethic.mobile.homepage.RegisterActivity" /> <activity android:name=".SignupActivity" />
<activity android:name="monnethic.mobile.homepage.LoginActivity" /> <activity android:name=".LoginActivity" />
<activity android:name="monnethic.mobile.user.UserAccountActivity" /> <activity android:name=".WalletActivity" />
<activity android:name="monnethic.mobile.transaction.TransactionActivity" /> <activity android:name=".UserAccountActivity" />
<activity android:name="monnethic.mobile.qrcode.QrCodeActivity" /> <activity android:name=".DemoActivity" />
<activity android:name="monnethic.mobile.transaction.ReceivePayementActivity" /> <activity android:name=".WalletPresenterActivity" />
<activity android:name="monnethic.mobile.transaction.MakePayementActivity" /> <activity android:name=".TransactionActivity"></activity>
<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 android:name="monnethic.mobile.demoConfig.DemoConfig" />
<activity android:name="monnethic.mobile.settings.SettingsActivity"></activity>
</application> </application>
</manifest> </manifest>

View file

@ -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();
}
}

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}
}

View file

@ -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;
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) {
super.onCreate(savedInstanceState);
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
public void onClick(View view) {
launchRegisterActivity();
}
});
bLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchLoginActivity();
}
});
bDemo.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
launchDemoActivity();
}
});
}
public void launchRegisterActivity(){
Intent registerIntent = new Intent(HomepageActivity.this, SignupActivity.class);
HomepageActivity.this.startActivity(registerIntent);
}
public void launchLoginActivity(){
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);
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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");
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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 + '\'' +
'}';
}
}

View file

@ -1,190 +0,0 @@
package monnethic.mobile.demoConfig;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.Toast;
import com.example.monnthic.monnethicmobile.R;
import java.util.ArrayList;
import java.util.List;
import monnethic.mobile.history.HistoryActivity;
import monnethic.mobile.restApi.Config;
import monnethic.mobile.restApi.ConfigApiHandler;
public class DemoConfig extends AppCompatActivity {
private Spinner cSpinner;
private Switch cSwitch;
private Switch apiSwitch;
private Button btnValidateConf;
private Button btnCloseConf;
private Button btnCheckConf;
private String ENV;
private String API;
private String CHAINCODE;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo_config);
initView();
}
private void initView(){
buttonInit();
switchEnvInit();
switchApiInit();
spinnerInit();
}
public void switchEnvInit(){
cSwitch = findViewById(R.id.switchEnv);
cSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(cSwitch.isChecked()){
ENV = "1";
}else{
ENV = "0";
}
}
});
}
public void switchApiInit(){
apiSwitch = findViewById(R.id.switchApi);
apiSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(apiSwitch.isChecked()){
API = "1";
}else{
API = "0";
}
}
});
}
public void spinnerInit(){
cSpinner = findViewById(R.id.spinnerConfig);
List<String> listOptions = new ArrayList<>();
listOptions.add("CHAINCODE - PROD");
listOptions.add("CHAINCODE - QA");
listOptions.add("CHAINCODE - TEST");
ArrayAdapter<String> adapterOptions = new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item,listOptions);
adapterOptions.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
cSpinner.setAdapter(adapterOptions);
}
public void buttonInit(){
btnValidateConf = findViewById(R.id.buttonValidateConfig);
btnValidateConf.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
switch (String.valueOf(cSpinner.getSelectedItem())){
case "CHAINCODE - PROD":
CHAINCODE = "0";
break;
case "CHAINCODE - QA":
CHAINCODE = "1";
break;
case "CHAINCODE - TEST":
CHAINCODE = "2";
break;
}
new updateConfigTask().execute(ENV,CHAINCODE);
}
});
btnCheckConf = findViewById(R.id.buttonCheckConfig);
btnCheckConf.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new checkConfigTask().execute();
}
});
btnCloseConf = findViewById(R.id.buttonCloseConfig);
btnCloseConf.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
private class updateConfigTask extends AsyncTask<String,String,String> {
ProgressDialog progDailog = new ProgressDialog(DemoConfig.this);
@Override
protected void onPreExecute() {
super.onPreExecute();
progDailog.setMessage("Updating Config...");
progDailog.setIndeterminate(false);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
}
@Override
protected String doInBackground(String... strings) {
try{
String e = strings[0];
String c = strings[1];
ConfigApiHandler configApiHandler = new ConfigApiHandler();
configApiHandler.updateEnvironment(e);
configApiHandler.updateChaincode(c);
Config.setAPI(API);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
progDailog.dismiss();
}
}
private class checkConfigTask extends AsyncTask<String,String,String>{
ProgressDialog progDailog = new ProgressDialog(DemoConfig.this);
@Override
protected void onPreExecute() {
super.onPreExecute();
progDailog.setMessage("Check Config...");
progDailog.setIndeterminate(false);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
}
@Override
protected String doInBackground(String... strings) {
try{
ConfigApiHandler configApiHandler = new ConfigApiHandler();
String r = configApiHandler.getConfiguration();
return r;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String result) {
progDailog.dismiss();
Toast.makeText(DemoConfig.this, result+" - "+Config.getAPI(),Toast.LENGTH_SHORT).show();
}
}
}

View file

@ -1,347 +0,0 @@
package monnethic.mobile.history;
import android.app.Activity;
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.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
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.RelativeLayout;
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 ArrayList<Transaction> receivedT;
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 Button fromDate;
private Button 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");
receivedT = (ArrayList<Transaction>) intent.getSerializableExtra("data");
}
private void initView(){
inputSize = findViewById(R.id.inputSize);
listView = findViewById(R.id.listViewTransactions);
inputSize.setText(String.valueOf(10));
dateInit();
buttonInit();
switchInit();
spinnerInit();
initListView();
}
private void initListView(){
TransactionAdapter adapter = new TransactionAdapter(HistoryActivity.this,receivedT,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);
}
});
}
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) {
InputMethodManager inputMethodManager = (InputMethodManager) HistoryActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(HistoryActivity.this.getCurrentFocus().getWindowToken(),0);
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);
//function, wallet_hash, size, start_date, end_date
try{
String size = inputSize.getText().toString();
if(Integer.parseInt(function)==0){
new getTransactionTask().execute(function,wallet_hash);
} else if(Integer.parseInt(function)==1 || Integer.parseInt(function)==2 || Integer.parseInt(function)==3){
new getTransactionTask().execute(function,wallet_hash,size);
} 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());
new getTransactionTask().execute(function,wallet_hash,size,start_date,end_date);
}
}catch (Exception e){
e.printStackTrace();
}
}
private class getTransactionTask extends AsyncTask<String,ArrayList<Transaction>,ArrayList<Transaction>> {
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
btnSearchTransactions.setEnabled(false);
inputSize.setEnabled(false);
spinner.setEnabled(false);
aSwitch.setEnabled(false);
listView.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(ArrayList<Transaction> t) {
TransactionAdapter adapter = new TransactionAdapter(HistoryActivity.this,t,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);
}
});
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
btnSearchTransactions.setEnabled(true);
inputSize.setEnabled(true);
spinner.setEnabled(true);
aSwitch.setEnabled(true);
listView.setEnabled(true);
}
@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;
}
}
}

View file

@ -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;
}
}
}

View file

@ -1,83 +0,0 @@
package monnethic.mobile.homepage;
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 android.widget.Toast;
import com.example.monnthic.monnethicmobile.R;
import monnethic.mobile.demoConfig.DemoConfig;
public class HomepageActivity extends AppCompatActivity {
private int clickIterator = 0;
Button bConfig;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_homepage);
Button bRegister = findViewById(R.id.register);
Button bLogin = findViewById(R.id.login);
bConfig = findViewById(R.id.buttonConfig);
bRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchRegisterActivity();
}
});
bLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchLoginActivity();
}
});
bConfig.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchConfActivity();
}
});
bConfig.setVisibility(View.INVISIBLE);
}
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);
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 launchConfActivity(){
Intent confIntent = new Intent(HomepageActivity.this, DemoConfig.class);
HomepageActivity.this.startActivity(confIntent);
}
public void displayConf(View v){
clickIterator++;
int clickForDisplay = 6;
if(clickIterator>=clickForDisplay){
bConfig.setVisibility(View.VISIBLE);
}else if(clickIterator>=3){
int clickLeft = clickForDisplay-clickIterator;
Toast.makeText(HomepageActivity.this, clickLeft+" click left for config", Toast.LENGTH_SHORT).show();
}
}
}

View file

@ -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]);
}
}
}

View file

@ -1,182 +0,0 @@
package monnethic.mobile.homepage;
import android.app.Activity;
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.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
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;
private Button buttonCancel;
private Button buttonOk;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
email = findViewById(R.id.editTextEmail);
password = findViewById(R.id.editTextPassword);
buttonCancel = findViewById(R.id.buttonCancel);
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(){
InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),0);
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;
RelativeLayout progress = findViewById(R.id.progressLayout);
private UserLoggerTask(final Context context){
mContext = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
email.setEnabled(false);
password.setEnabled(false);
buttonCancel.setEnabled(false);
buttonOk.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@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();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
email.setEnabled(true);
password.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
} else if(jsonObject.getInt("status")==403){
Toast.makeText(mContext, "Wrong authentication", Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
email.setEnabled(true);
password.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
} 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"));
walletHomeIntent.putExtra("email",email.getText().toString());
Boolean approved = new CheckApprovalTask().execute(jsonObject.getString("user_hash"),email.getText().toString()).get();
walletHomeIntent.putExtra("approved", approved.toString());
LoginActivity.this.startActivity(walletHomeIntent);
finish();
} else {
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
email.setEnabled(true);
password.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
}
}else{
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
email.setEnabled(true);
password.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
}
}catch (Exception e){
e.printStackTrace();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
email.setEnabled(true);
password.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
}
}
@Override
protected JSONObject doInBackground(User... u) {
try{
UserApiHandler userApiHandler = new UserApiHandler();
return userApiHandler.loginUser(u[0]);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
}
private class CheckApprovalTask extends AsyncTask<String,Boolean,Boolean>{
@Override
protected Boolean doInBackground(String... strings) {
try{
UserApiHandler userApiHandler = new UserApiHandler();
return userApiHandler.checkApproval(strings[0],strings[1]);
}catch (Exception e){
return null;
}
}
}
}

View file

@ -1,195 +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.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
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;
private Button buttonCancel;
private Button buttonOk;
@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);
buttonCancel = findViewById(R.id.buttonCancel);
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(){
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 (!(email.getText().toString().equals(confirmEmail.getText().toString()))) {
Toast.makeText(this, "Email don't match confirmation email", 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{
return true;
}
}
}
private class UserRegisterTask extends AsyncTask<User,Void,JSONObject> {
Context mContext;
private UserRegisterTask(final Context context){mContext=context;}
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
name.setEnabled(false);
firstname.setEnabled(false);
email.setEnabled(false);
confirmEmail.setEnabled(false);
phone.setEnabled(false);
password.setEnabled(false);
confirmPassword.setEnabled(false);
buttonCancel.setEnabled(false);
buttonOk.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@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"));
walletHomeIntent.putExtra("email",email.getText().toString());
walletHomeIntent.putExtra("approved","false");
RegisterActivity.this.startActivity(walletHomeIntent);
finish();
}else{
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
name.setEnabled(true);
firstname.setEnabled(true);
email.setEnabled(true);
confirmEmail.setEnabled(true);
phone.setEnabled(true);
password.setEnabled(true);
confirmPassword.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
}
}catch (Exception e){
e.printStackTrace();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
name.setEnabled(true);
firstname.setEnabled(true);
email.setEnabled(true);
confirmEmail.setEnabled(true);
phone.setEnabled(true);
password.setEnabled(true);
confirmPassword.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
}
}
@Override
protected JSONObject doInBackground(User... users) {
try{
UserApiHandler userApiHandler = new UserApiHandler();
return userApiHandler.registerUser(users[0]);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
}
}

View file

@ -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;
}
}
}

View file

@ -1,140 +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);
onRestart();
}
}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;
}
}
}

View file

@ -1,110 +0,0 @@
package monnethic.mobile.restApi;
public class Config {
static private int API = 0;
/*
static private String getBaseURl(){
if(API==0){
return "http://5.39.76.139:10053/";
} else {
return "http://37.187.101.44:10053/";
}
}
*/
static private String getBaseUrlUser(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/user/";
//return "http://10.0.2.2:10053/api/rest/user/";
//return "http://localhost:10053/api/rest/user/";
} else {
return "http://37.187.101.44:10053/api/rest/user/";
}
}
static private String getBaseUrlTransaction(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/transaction/";
//return "http://10.0.2.2:10053/api/rest/transaction/";
//return "http://localhost:10053/api/rest/transaction/";
} else {
return "http://37.187.101.44:10053/api/rest/transaction/";
}
}
static private String getBaseUrlWallet(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/wallet/";
//return "http://10.0.2.2:10053/api/rest/wallet/";
//return "http://localhost:10053/api/rest/wallet/";
} else {
return "http://37.187.101.44:10053/api/rest/wallet/";
}
}
static private String getBaseUrlSession(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/session/";
//return "http://10.0.2.2:10053/api/rest/session/";
//return "http://localhost:10053/api/rest/session/";
} else {
return "http://37.187.101.44:10053/api/rest/session/";
}
}
static private String getConfigBaseUrl(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/demo/conf/";
//return "http://10.0.2.2:10053/api/rest/demo/conf/";
//return "http://localhost:10053/api/rest/demo/conf/";
} else {
return "http://37.187.101.44:10053/api/rest/demo/conf/";
}
}
static private String getSettingBaseUrl(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/settings/";
//return "http://10.0.2.2:10053/api/rest/settings/";
//return "http://localhost:10053/api/rest/settings/";
} else {
return "http://37.187.101.44:10053/api/rest/settings/";
}
}
//USER
static public String USER_LOGIN = getBaseUrlUser()+"login";
static public String USER_REGISTER = getBaseUrlUser()+"register";
static public String USER_GET = getBaseUrlUser()+"get";
static public String USER_APPROVAL = getBaseUrlUser()+"getApproval";
static public String USER_APPROVE = getBaseUrlUser()+"approve";
static public String UPDATE_PASSWORD = getBaseUrlUser()+"update/password";
//Search
static public String FIND_BY_EMAIL= getBaseUrlUser()+"findByEmail";
static public String FIND_BY_PHONE = getBaseUrlUser()+"findByPhone";
static public String FIND_BY_EMAIL_AND_PHONE = getBaseUrlUser()+"findByEmailAndPhone";
//Session
static public String START_SESSION = getBaseUrlSession()+"start";
static public String END_SESSION = getBaseUrlSession()+"end";
//Config
static public String CONFIG_ENVIRONMENT = getConfigBaseUrl()+"env";
static public String CONFIG_CHAINCODE = getConfigBaseUrl()+"chaincode";
static public String CONFIG_DB = getConfigBaseUrl()+"db";
//TRANSACTION
static public String TRANSACTION_SEND = getBaseUrlTransaction()+"send";
static public String TRANSACTION_GET = getBaseUrlTransaction()+"get";
static public String TRANSACTION_LATEST = getBaseUrlTransaction()+"get/latest";
static public String TRANSACTION_ALL = getBaseUrlTransaction()+"getTransactions";
static public String TRANSACTION_SENT = getBaseUrlTransaction()+"get/sent";
static public String TRANSACTION_RECEIVED = getBaseUrlTransaction()+"get/received";
//WALLET
static public String WALLET_CREATE = getBaseUrlWallet()+"create";
static public String WALLET_GET_WALLET = getBaseUrlWallet()+"getWallet";
static public String WALLET_GET_USER_WALLETS = getBaseUrlWallet()+"getUserWallets";
static public String WALLET_DELETE = getBaseUrlWallet()+"delete";
static public String WALLET_TRANSFER = getBaseUrlWallet()+"transfer";
static public void setAPI(String newApi){ API = Integer.parseInt(newApi); }
static public String getAPI(){ return String.valueOf(API); }
}

View file

@ -1,48 +0,0 @@
package monnethic.mobile.restApi;
import org.json.JSONObject;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class ConfigApiHandler {
public void updateEnvironment(String environment){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String url = Config.CONFIG_ENVIRONMENT;
Map<String, String> map = new HashMap<>();
map.put("env",environment);
httpCallHandler.postHttp(new URL(url), map);
}catch (Exception e){
e.printStackTrace();
}
}
public void updateChaincode(String chaincode){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String url = Config.CONFIG_CHAINCODE;
Map<String, String> map = new HashMap<>();
map.put("chaincode",chaincode);
httpCallHandler.postHttp(new URL(url), map);
}catch (Exception e){
e.printStackTrace();
}
}
public String getConfiguration(){
HttpCallHandler httpCallHandler = new HttpCallHandler();
String result="";
try{
String chaincode = new JSONObject(httpCallHandler.getHttp(new URL(Config.CONFIG_CHAINCODE))).getString("chaincode");
String environment = new JSONObject(httpCallHandler.getHttp(new URL(Config.CONFIG_ENVIRONMENT))).getString("env");
String db = new JSONObject(httpCallHandler.getHttp(new URL(Config.CONFIG_DB))).getString("db");
result = environment+" - "+chaincode+" - "+db;
}catch (Exception e){
e.printStackTrace();
}
return result;
}
}

View file

@ -1,116 +0,0 @@
package monnethic.mobile.restApi;
import org.json.JSONObject;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
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.write(jsonParam.toString().getBytes("UTF-8"));
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.write(jsonParam.toString().getBytes("UTF-8"));
urlConnection.getResponseCode();
}
}

View file

@ -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();
}
}
}

View file

@ -1,26 +0,0 @@
package monnethic.mobile.restApi;
import org.json.JSONObject;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class SettingsApiHandler {
public String updatePassword(String[] params){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String url = Config.UPDATE_PASSWORD;
Map<String, String> map = new HashMap<>();
map.put("user_email",params[0]);
map.put("current_password",params[1]);
map.put("new_password",params[2]);
String responseCall = httpCallHandler.postHttp(new URL(url), map);
JSONObject jsonObject = new JSONObject(responseCall);
return jsonObject.getString("response");
}catch (Exception e){
e.printStackTrace();
return "false";
}
}
}

View file

@ -1,71 +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);
System.out.println("TRANSACTION: "+response);
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;
}
}

View file

@ -1,152 +0,0 @@
package monnethic.mobile.restApi;
import android.util.Log;
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 {
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 Boolean checkApproval(String user_hash, String email){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String responseCall = httpCallHandler.getHttp(new URL(Config.USER_APPROVAL+"?user_hash="+user_hash+"&user_email="+email));
return new JSONObject(responseCall).getBoolean("approval");
}catch (Exception e){
e.printStackTrace();
return null;
}
}
public void approveUser(String user_hash, String email){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
Map<String, String> map = new HashMap<>();
map.put("user_hash",user_hash);
map.put("email",email);
httpCallHandler.postHttp(new URL(Config.USER_APPROVE),map);
}catch (Exception e){
e.printStackTrace();
}
}
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"));
returnUser.setApproved(jsonObject.getBoolean("approved"));
return returnUser;
}else{
return null;
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}

View file

@ -1,94 +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;
}
public String deleteWallet(String[] params){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String url = Config.WALLET_DELETE;
Map<String, String> map = new HashMap<>();
map.put("user_email",params[0]);
map.put("user_hash",params[1]);
map.put("user_password",params[2]);
map.put("wallet_hash_source",params[3]);
map.put("wallet_hash_dest",params[4]);
String responseCall = httpCallHandler.postHttp(new URL(url), map);
JSONObject jsonObject = new JSONObject(responseCall);
return jsonObject.getString("response");
} catch (Exception e){
e.printStackTrace();
return "false";
}
}
}

View file

@ -1,53 +0,0 @@
package monnethic.mobile.search;
import java.io.Serializable;
public class DisplayWallet implements Serializable {
private String user_name;
private String user_firstname;
private String wallet_hash;
private String wallet_id;
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 DisplayWallet(String user_name, String user_firstname, String wallet_hash, String wallet_id) {
this.user_name = user_name;
this.user_firstname = user_firstname;
this.wallet_hash = wallet_hash;
this.wallet_id = wallet_id;
}
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;
}
public String getWallet_id(){return wallet_id;}
public void setWallet_id(String wallet_id){this.wallet_id=wallet_id;}
}

View file

@ -1,42 +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);
TextView wallet_id = convertView.findViewById(R.id.walletIdSearch);
ViewGroup.LayoutParams params = convertView.getLayoutParams();
//params.height = 400;
convertView.setLayoutParams(params);
String userFullName = dWallet.getUser_name()+" "+dWallet.getUser_firstname();
user_name.setText(userFullName);
wallet_hash.setText(dWallet.getWallet_hash());
wallet_id.setText(dWallet.getWallet_id());
return convertView;
}
}

View file

@ -1,67 +0,0 @@
package monnethic.mobile.search;
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;
public class DisplayWalletSearch extends AppCompatActivity {
private ArrayList<DisplayWallet> displayWallets;
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();
session_id = intent.getStringExtra("SESSION_ID");
try {
displayWallets = (ArrayList<DisplayWallet>) intent.getSerializableExtra("data");
} catch (Exception e){
e.printStackTrace();
}
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();
}
});
}
@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;
}
}
}

View file

@ -1,194 +0,0 @@
package monnethic.mobile.search;
import android.app.Activity;
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.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.example.monnthic.monnethicmobile.R;
import java.util.ArrayList;
import monnethic.mobile.database.User;
import monnethic.mobile.homepage.InputController;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.UserApiHandler;
import monnethic.mobile.restApi.WalletApiHandler;
import monnethic.mobile.wallet.Wallet;
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;
private String u_dest_n;
private String u_dest_fn;
@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(){
InputMethodManager inputMethodManager = (InputMethodManager) SearchUser.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(SearchUser.this.getCurrentFocus().getWindowToken(),0);
String uEmail = emailAddress.getText().toString();
String uPhone = phoneNumber.getText().toString();
if(InputController.isEmptyEdit(emailAddress) && InputController.isEmptyEdit(phoneNumber)){
Toast.makeText(this, "Enter an email or a phone number", Toast.LENGTH_SHORT).show();
} else if(InputController.isEmptyEdit(emailAddress)){
new SearchUserTask().execute(null,uPhone);
} else if(InputController.isEmptyEdit(phoneNumber)){
if(!InputController.validEmail(emailAddress.getText().toString())){
Toast.makeText(SearchUser.this, "Invalid format for email", Toast.LENGTH_SHORT).show();
}else{
new SearchUserTask().execute(uEmail,null);
}
} else {
new SearchUserTask().execute(uEmail,uPhone);
}
}
private class SearchUserTask extends AsyncTask<String,Void,ArrayList<Wallet>> {
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
emailAddress.setEnabled(false);
phoneNumber.setEnabled(false);
buttonCancel.setEnabled(false);
buttonOk.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(ArrayList<Wallet> wallets) {
try{
if(wallets!=null && !wallets.isEmpty()){
ArrayList<DisplayWallet> displayWallets = new ArrayList<>();
for(Wallet w : wallets){
displayWallets.add(new DisplayWallet(u_dest_n,u_dest_fn,w.getWallet_hash(),w.getType()));
}
Intent displayWalletIntent = new Intent(SearchUser.this, DisplayWalletSearch.class);
displayWalletIntent.putExtra("data",displayWallets);
displayWalletIntent.putExtra("SESSION_ID",session_id);
displayWalletIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
SearchUser.this.startActivity(displayWalletIntent);
finish();
}else{
Toast.makeText(SearchUser.this,"User doesn't exist or don't have a wallet",Toast.LENGTH_SHORT).show();
emailAddress.setEnabled(true);
phoneNumber.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
}
}catch (Exception e){
e.printStackTrace();
emailAddress.setEnabled(true);
phoneNumber.setEnabled(true);
buttonCancel.setEnabled(true);
buttonOk.setEnabled(true);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
}
}
@Override
protected ArrayList<Wallet> doInBackground(String... strings) {
WalletApiHandler walletApiHandler = new WalletApiHandler();
ArrayList<Wallet> walletsList = new ArrayList<>();
try {
UserApiHandler userApiHandler = new UserApiHandler();
User u;
if(strings[0]!=null && strings[1]==null){
u = userApiHandler.getUser(1,strings[0],null);
u_dest_n = u.getName();
u_dest_fn = u.getFirstname();
walletsList = walletApiHandler.getUserWallets(new String[]{u.getUser_hash()});
} else if(strings[0]==null && strings[1]!=null){
u = userApiHandler.getUser(2,null,strings[1]);
u_dest_n = u.getName();
u_dest_fn = u.getFirstname();
walletsList = walletApiHandler.getUserWallets(new String[]{u.getUser_hash()});
} else {
u = userApiHandler.getUser(3,strings[0],strings[1]);
u_dest_n = u.getName();
u_dest_fn = u.getFirstname();
walletsList = walletApiHandler.getUserWallets(new String[]{u.getUser_hash()});
}
}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;
}
}
}

View file

@ -1,491 +0,0 @@
package monnethic.mobile.settings;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import com.example.monnthic.monnethicmobile.R;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import monnethic.mobile.homepage.InputController;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.SettingsApiHandler;
import monnethic.mobile.restApi.WalletApiHandler;
import monnethic.mobile.wallet.Wallet;
public class SettingsActivity extends AppCompatActivity {
private Context context = SettingsActivity.this;
private ArrayList<Wallet> userWallets;
private String user_hash;
private String user_email;
private String user_password;
private String session_id;
private EditText currentPassword;
private EditText newPassword;
private EditText confirmedNewPassword;
private Button buttonConfirm;
private Button buttonCancel;
private Switch enableDeleteWallet;
private Switch enableChangePassword;
private Spinner walletToDelete;
private Spinner walletToTransfer;
private EditText confirmWalletToDelete;
private LinearLayout l1;
private LinearLayout l2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Intent intent = getIntent();
user_hash = intent.getStringExtra("USER_HASH");
user_email = intent.getStringExtra("USER_EMAIL");
user_password = intent.getStringExtra("USER_PWD");
session_id = intent.getStringExtra("SESSION_ID");
try{
userWallets = (ArrayList<Wallet>) intent.getSerializableExtra("data");
}catch (Exception e){
e.printStackTrace();
userWallets=null;
}
initView();
}
private void initView(){
l1 = (LinearLayout) findViewById(R.id.l1);
l2 = (LinearLayout) findViewById(R.id.l2);
currentPassword = findViewById(R.id.currentPwd);
newPassword = findViewById(R.id.newPwd1);
confirmedNewPassword = findViewById(R.id.newPwd2);
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
walletToDelete = findViewById(R.id.spinnerWalletToDelete);
walletToTransfer = findViewById(R.id.spinnerWalletToMoveFund);
confirmWalletToDelete = findViewById(R.id.editTextConfirmDeleteWallet);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
enableChangePassword = findViewById(R.id.switchChangePassword);
enableChangePassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(enableChangePassword.isChecked()){
l1.setBackgroundResource(R.color.zxing_transparent);
currentPassword.setEnabled(true);
newPassword.setEnabled(true);
confirmedNewPassword.setEnabled(true);
}else{
l1.setBackgroundResource(R.color.darker_gray);
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
}
}
});
if(!userWallets.isEmpty()){
List<String> listOptions = new ArrayList<>();
for(Wallet w : userWallets){
listOptions.add(w.getType());
}
ArrayAdapter<String> adapterOptions = new ArrayAdapter<>(SettingsActivity.this,android.R.layout.simple_spinner_dropdown_item,listOptions);
adapterOptions.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
walletToDelete.setAdapter(adapterOptions);
walletToTransfer.setAdapter(adapterOptions);
if(userWallets.size()>1 && walletToDelete.getSelectedItemId()==walletToTransfer.getSelectedItemId()){
walletToTransfer.setSelection((int) walletToDelete.getSelectedItemId()+1);
}
}
walletToDelete.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if(userWallets.size()>1 && walletToTransfer.getSelectedItemId()==(int)l){
if(walletToTransfer.getSelectedItemId()+1==userWallets.size()){
walletToTransfer.setSelection(0);
}else{
walletToTransfer.setSelection((int) walletToDelete.getSelectedItemId()+1);
}
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
enableDeleteWallet = findViewById(R.id.switchDeleteWallet);
enableDeleteWallet.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(userWallets.size()<=1){
Toast.makeText(SettingsActivity.this,"You can't delete a wallet with one or less wallet",Toast.LENGTH_LONG).show();
enableDeleteWallet.setChecked(false);
}else{
if(enableDeleteWallet.isChecked()){
l2.setBackgroundResource(R.color.zxing_transparent);
walletToTransfer.setEnabled(true);
confirmWalletToDelete.setEnabled(true);
walletToDelete.setEnabled(true);
}else{
l2.setBackgroundResource(R.color.darker_gray);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
}
}
}
});
buttonConfirm = findViewById(R.id.buttonConfirmSettings);
buttonConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!enableDeleteWallet.isChecked() && !enableChangePassword.isChecked()){
Intent intent = new Intent();
intent.putExtra("new_password",user_password);
setResult(1,intent);
finish();
}
else if (!enableDeleteWallet.isChecked() && enableChangePassword.isChecked()){
InputMethodManager inputMethodManager = (InputMethodManager) SettingsActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(SettingsActivity.this.getCurrentFocus().getWindowToken(),0);
changePwd();
}
else if (enableDeleteWallet.isChecked() && !enableChangePassword.isChecked()){
InputMethodManager inputMethodManager = (InputMethodManager) SettingsActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(SettingsActivity.this.getCurrentFocus().getWindowToken(),0);
deleteWallet();
}
else {
InputMethodManager inputMethodManager = (InputMethodManager) SettingsActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(SettingsActivity.this.getCurrentFocus().getWindowToken(),0);
changePwdAndDeleteWallet();
}
}
});
buttonCancel = findViewById(R.id.buttonCancelSettings);
buttonCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent3 = new Intent();
intent3.putExtra("new_password",user_password);
setResult(1,intent3);
finish();
}
});
}
private void changePwd(){
if(checkInputEmptyPassword()){
if(currentPassword.getText().toString().equals(user_password)){
String[] p = {user_email,user_password,newPassword.getText().toString()};
new changeUserPasswordTask().execute(p);
}else{
Toast.makeText(SettingsActivity.this,"Current password don't match actual password",Toast.LENGTH_SHORT).show();
}
}
}
private void deleteWallet(){
if(checkInputEmptyWallet()){
String[] p = {user_email,user_hash,user_password,
userWallets.get((int) walletToDelete.getSelectedItemId()).getWallet_hash(),
userWallets.get((int) walletToTransfer.getSelectedItemId()).getWallet_hash()};
new deleteWalletTask().execute(p);
}
}
private void changePwdAndDeleteWallet(){
if(checkInputEmptyPassword()){
if(!currentPassword.getText().toString().equals(user_password)){
Toast.makeText(SettingsActivity.this,"Current password don't match actual password",Toast.LENGTH_SHORT).show();
}else{
if(checkInputEmptyWallet()){
String[] p = {user_email,user_password,newPassword.getText().toString(),user_hash,
userWallets.get((int) walletToDelete.getSelectedItemId()).getWallet_hash(),
userWallets.get((int) walletToTransfer.getSelectedItemId()).getWallet_hash()};
new updatePwdAndDeleteWalletTask().execute(p);
}
}
}
}
private boolean checkInputEmptyPassword(){
if(InputController.isEmptyEdit(currentPassword)){
Toast.makeText(this, "You didn't enter current password", Toast.LENGTH_SHORT).show();
return false;
} else if(InputController.isEmptyEdit(newPassword)){
Toast.makeText(this, "You didn't enter new password", Toast.LENGTH_SHORT).show();
return false;
} else if(InputController.isEmptyEdit(confirmedNewPassword)){
Toast.makeText(this, "You didn't enter confirmation password", Toast.LENGTH_SHORT).show();
return false;
} else {
if(!InputController.passwordValidator(newPassword.getText().toString())){
Toast.makeText(this, "Password must contains 6 to 20 characters, one lowercase, one uppercase and one digit", Toast.LENGTH_LONG).show();
return false;
} else if (!(newPassword.getText().toString().equals(confirmedNewPassword.getText().toString()))) {
Toast.makeText(this, "New Password don't match Confirmation Password", Toast.LENGTH_SHORT).show();
return false;
} else{
return true;
}
}
}
private boolean checkInputEmptyWallet(){
if(InputController.isEmptyEdit(confirmWalletToDelete)){
Toast.makeText(this, "You didn't confirm wallet deletion", Toast.LENGTH_SHORT).show();
return false;
}else{
if(!confirmWalletToDelete.getText().toString().equals(userWallets.get((int) walletToDelete.getSelectedItemId()).getType())){
Toast.makeText(this, "Confirmation wallet don't match wallet to delete", Toast.LENGTH_SHORT).show();
return false;
} else if(walletToDelete.getSelectedItemId()==walletToTransfer.getSelectedItemId()) {
Toast.makeText(this, "Delete wallet and Wallet to transfer fund can't be the same", Toast.LENGTH_SHORT).show();
return false;
} else {
return true;
}
}
}
//AsyncTask to change userPassword
private class changeUserPasswordTask extends AsyncTask<String,String,String> {
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
buttonCancel.setEnabled(false);
buttonConfirm.setEnabled(false);
enableChangePassword.setEnabled(false);
enableDeleteWallet.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected String doInBackground(String... params) {
try{
SettingsApiHandler settingsApiHandler = new SettingsApiHandler();
return settingsApiHandler.updatePassword(params);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String v) {
if(Boolean.parseBoolean(v)){
Toast.makeText(SettingsActivity.this,"Password updated",Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("new_password",newPassword.getText().toString());
setResult(1,intent);
finish();
}else{
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
currentPassword.setEnabled(true);
newPassword.setEnabled(true);
confirmedNewPassword.setEnabled(true);
buttonCancel.setEnabled(true);
buttonConfirm.setEnabled(true);
enableChangePassword.setEnabled(true);
enableChangePassword.setChecked(false);
}
}
}
private class deleteWalletTask extends AsyncTask<String,String,String> {
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
buttonCancel.setEnabled(false);
buttonConfirm.setEnabled(false);
enableChangePassword.setEnabled(false);
enableDeleteWallet.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected String doInBackground(String... params) {
try{
WalletApiHandler walletApiHandler = new WalletApiHandler();
return walletApiHandler.deleteWallet(params);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String v) {
if(Boolean.parseBoolean(v)){
Toast.makeText(SettingsActivity.this,"Wallet has been deleted",Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("new_password",user_password);
setResult(1,intent);
finish();
}else{
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
walletToDelete.setEnabled(true);
walletToTransfer.setEnabled(true);
confirmWalletToDelete.setEnabled(true);
buttonCancel.setEnabled(true);
buttonConfirm.setEnabled(true);
enableDeleteWallet.setEnabled(true);
enableDeleteWallet.setChecked(false);
}
}
}
private class updatePwdAndDeleteWalletTask extends AsyncTask<String,String,String>{
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
buttonCancel.setEnabled(false);
buttonConfirm.setEnabled(false);
enableChangePassword.setEnabled(false);
enableDeleteWallet.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected String doInBackground(String... params) {
try{
SettingsApiHandler settingsApiHandler = new SettingsApiHandler();
WalletApiHandler walletApiHandler = new WalletApiHandler();
if(Boolean.parseBoolean(settingsApiHandler.updatePassword(new String[]{params[0],params[1],params[2]}))){
if(Boolean.parseBoolean(walletApiHandler.deleteWallet(new String[]{params[0],params[3],params[2],params[4],params[5]}))){
return "true";
}
}
}catch (Exception e){
e.printStackTrace();
return null;
}
return "false";
}
@Override
protected void onPostExecute(String v) {
if(Boolean.parseBoolean(v)){
Toast.makeText(SettingsActivity.this,"Password updated & Wallet deleted",Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("new_password",newPassword.getText().toString());
setResult(1,intent);
finish();
}else{
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
currentPassword.setEnabled(true);
newPassword.setEnabled(true);
confirmedNewPassword.setEnabled(true);
buttonCancel.setEnabled(true);
buttonConfirm.setEnabled(true);
enableChangePassword.setEnabled(true);
enableChangePassword.setChecked(false);
walletToDelete.setEnabled(true);
walletToTransfer.setEnabled(true);
confirmWalletToDelete.setEnabled(true);
buttonCancel.setEnabled(true);
buttonConfirm.setEnabled(true);
enableDeleteWallet.setEnabled(true);
enableDeleteWallet.setChecked(false);
}
}
}
@Override
public void onBackPressed() {
Intent intent = new Intent();
intent.putExtra("new_password",user_password);
setResult(1,intent);
super.onBackPressed();
}
@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;
}
}
}

View file

@ -1,137 +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.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
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 {
new TransactionTask().execute(sendingTransaction);
} catch (Exception e){
e.printStackTrace();
}
}
private class TransactionTask extends AsyncTask<SendingTransaction,String,String> {
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
buttonCancel.setEnabled(false);
buttonVal.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(String s) {
if(s!=null){
Toast.makeText(ApprovePayementActivity.this, "TxID : "+s, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(ApprovePayementActivity.this, "Couldn't get transaction id", Toast.LENGTH_SHORT).show();
}
finish();
}
@Override
protected String doInBackground(SendingTransaction... sendingTransactions) {
try{
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
return transactionApiHandler.doTransaction(sendingTransactions[0]);
}catch (Exception e){
e.printStackTrace();
buttonCancel.setEnabled(true);
buttonVal.setEnabled(true);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
}
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;
}
}
}

View file

@ -1,91 +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;
}
}
}

View file

@ -1,81 +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);
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;
}
}
}

View file

@ -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 + '\'' +
'}';
}
}

View file

@ -1,170 +0,0 @@
package monnethic.mobile.transaction;
import android.app.Activity;
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.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.example.monnthic.monnethicmobile.R;
import monnethic.mobile.database.Transaction;
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;
private Button buttonCancel;
private Button buttonOk;
private Button buttonSearch;
@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);
buttonCancel = findViewById(R.id.btn_cancel);
buttonOk = findViewById(R.id.btn_send);
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) {
InputMethodManager inputMethodManager = (InputMethodManager) TransactionActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(TransactionActivity.this.getCurrentFocus().getWindowToken(),0);
sendTransaction();
}
});
buttonSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager inputMethodManager = (InputMethodManager) TransactionActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(TransactionActivity.this.getCurrentFocus().getWindowToken(),0);
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 {
String wallet_dest = addressDestination.getText().toString();
String amount = amountEditText.getText().toString();
try {
new TransactionTask().execute(new SendingTransaction(user_hash,user_password,wallet_hash,wallet_dest,amount,"gonette"));
} 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> {
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
buttonCancel.setEnabled(false);
buttonOk.setEnabled(false);
buttonSearch.setEnabled(false);
amountEditText.setEnabled(false);
addressDestination.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected String doInBackground(SendingTransaction... sendingTransactions) {
try{
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
System.out.println("TRANSACTION: "+sendingTransactions[0].toString());
return transactionApiHandler.doTransaction(sendingTransactions[0]);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String s) {
if(s!=null){
Toast.makeText(TransactionActivity.this, "TxID : "+s, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(TransactionActivity.this, "Couldn't get transaction id", Toast.LENGTH_SHORT).show();
}
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;
}
}
}

View file

@ -1,63 +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();
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;
}
}

View file

@ -1,218 +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.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.monnthic.monnethicmobile.R;
import java.util.ArrayList;
import monnethic.mobile.database.Transaction;
import monnethic.mobile.history.HistoryActivity;
import monnethic.mobile.restApi.Config;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.TransactionApiHandler;
import monnethic.mobile.restApi.WalletApiHandler;
import monnethic.mobile.settings.SettingsActivity;
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;
private Button buttonPayement;
private Button buttonReceive;
private Button buttonRefresh;
private Button buttonHistory;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_account);
balance = findViewById(R.id.balanceView);
TextView walletHashView = findViewById(R.id.walletHash);
buttonPayement = findViewById(R.id.buttonPayement);
buttonReceive = findViewById(R.id.buttonReceive);
buttonRefresh = findViewById(R.id.buttonRefreshBalance);
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");
walletHashView.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();
}
});
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 history(){
new GetUserHistoryTask().execute();
}
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;
}
}
}
public class GetUserHistoryTask extends AsyncTask<String,Void,ArrayList<Transaction>>{
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
buttonPayement.setEnabled(false);
buttonReceive.setEnabled(false);
buttonRefresh.setEnabled(false);
buttonHistory.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(ArrayList<Transaction> transactions) {
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);
historyIntent.putExtra("data",transactions);
UserAccountActivity.this.startActivity(historyIntent);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonPayement.setEnabled(true);
buttonReceive.setEnabled(true);
buttonRefresh.setEnabled(true);
buttonHistory.setEnabled(true);
}
@Override
protected ArrayList<Transaction> doInBackground(String... strings) {
ArrayList<Transaction> transactionsList = new ArrayList<>();
try{
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
transactionsList = transactionApiHandler.getTransactions("0",Config.TRANSACTION_LATEST,wallet_hash,null,null,null);
System.out.println("RECEIVED_T "+transactionsList.toString());
}catch (Exception e){
e.printStackTrace();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonPayement.setEnabled(true);
buttonReceive.setEnabled(true);
buttonRefresh.setEnabled(true);
buttonHistory.setEnabled(true);
}
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;
}
}
@Override
protected void onRestart() {
super.onRestart(); // Always call the superclass method first
new GetUserBalanceTask().execute(wallet_hash);
}
}

View file

@ -1,134 +0,0 @@
package monnethic.mobile.wallet;
import android.app.Activity;
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.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
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;
private Button buttonValidate;
private Button buttonCancel;
private EditText wallet_type;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_wallet);
wallet_type = findViewById(R.id.editTextWalletType);
buttonValidate = findViewById(R.id.buttonValidate);
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) {
InputMethodManager inputMethodManager = (InputMethodManager) CreateWalletActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(CreateWalletActivity.this.getCurrentFocus().getWindowToken(),0);
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;
}
RelativeLayout progress = findViewById(R.id.progressLayout);
@Override
protected void onPreExecute() {
super.onPreExecute();
buttonValidate.setEnabled(false);
buttonCancel.setEnabled(false);
wallet_type.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@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();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonValidate.setEnabled(true);
buttonCancel.setEnabled(true);
wallet_type.setEnabled(true);
}
}
@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;
}
}
}

View file

@ -1,355 +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.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.example.monnthic.monnethicmobile.R;
import org.json.JSONObject;
import java.util.ArrayList;
import monnethic.mobile.database.User;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.UserApiHandler;
import monnethic.mobile.restApi.WalletApiHandler;
import monnethic.mobile.settings.SettingsActivity;
public class HomeWalletActivity extends AppCompatActivity {
private String user_hash;
private String user_password;
private String session_id;
private String email;
private Boolean approved;
private Button buttonApproveUser;
private Button buttonCreateWallet;
private Button buttonSelectWallet;
private Button buttonSettings;
private RelativeLayout progress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_wallet);
buttonCreateWallet = findViewById(R.id.buttonCreateWallet);
buttonSelectWallet = findViewById(R.id.buttonSelectWallet);
buttonApproveUser = findViewById(R.id.buttonApproveUser);
buttonSettings = findViewById(R.id.buttonSettings);
Intent intent = getIntent();
user_hash = intent.getStringExtra("USER_HASH");
user_password = intent.getStringExtra("USER_PWD");
System.out.println("USER_PWD: "+user_password);
session_id = intent.getStringExtra("SESSION_ID");
email = intent.getStringExtra("email");
approved = Boolean.parseBoolean(intent.getStringExtra("approved"));
buttonCreateWallet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchCreateWalletActivity();
}
});
buttonSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
settings();
}
});
buttonSelectWallet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchSelectWalletActivity();
}
});
if(approved){
buttonApproveUser.setVisibility(View.INVISIBLE);
}else{
buttonApproveUser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
approveUser();
approved = true;
}
});
}
}
public void launchCreateWalletActivity() {
try{
if(approved){
Intent createWalletIntent = new Intent(HomeWalletActivity.this, CreateWalletActivity.class);
createWalletIntent.putExtra("USER_EMAIL",email);
createWalletIntent.putExtra("USER_HASH",user_hash);
createWalletIntent.putExtra("USER_PWD",user_password);
createWalletIntent.putExtra("SESSION_ID",session_id);
HomeWalletActivity.this.startActivity(createWalletIntent);
}else{
Toast.makeText(HomeWalletActivity.this,"You are not approved",Toast.LENGTH_SHORT).show();
}
} catch (Exception e){
e.printStackTrace();
}
}
public void launchSelectWalletActivity() {
try{
if(approved){
String[] params = {user_hash};
new getUserWalletTaskA().execute(params);
}else {
Toast.makeText(HomeWalletActivity.this,"You are not approved",Toast.LENGTH_SHORT).show();
}
}catch (Exception e){
e.printStackTrace();
}
}
public void settings(){
try{
if(approved){
String[] params = {user_hash};
new getUserWalletTaskB().execute(params);
}else {
Toast.makeText(HomeWalletActivity.this,"You are not approved",Toast.LENGTH_SHORT).show();
}
}catch (Exception e){
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
user_password = data.getStringExtra("new_password");
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
System.out.println("USER_PWD: "+user_password);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}
public void approveUser(){
new ApproveTask().execute(user_hash,email);
}
@Override
protected void onResume() {
super.onResume();
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
}
//AsyncTask to get user wallets
private class getUserWalletTaskA extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progress = findViewById(R.id.progressLayoutSelect);
buttonCreateWallet.setEnabled(false);
buttonSelectWallet.setEnabled(false);
buttonSettings.setEnabled(false);
buttonApproveUser.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@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();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}
return walletsList;
}
@Override
protected void onPostExecute(ArrayList<Wallet> listWallet) {
if(listWallet!=null && !listWallet.isEmpty()){
Intent selectWalletIntent = new Intent(HomeWalletActivity.this, SelectWalletActivity.class);
selectWalletIntent.putExtra("USER_HASH",user_hash);
selectWalletIntent.putExtra("USER_EMAIL",email);
selectWalletIntent.putExtra("USER_PWD",user_password);
selectWalletIntent.putExtra("SESSION_ID",session_id);
selectWalletIntent.putExtra("data",listWallet);
HomeWalletActivity.this.startActivity(selectWalletIntent);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}else {
Toast.makeText(HomeWalletActivity.this,"You don't have wallets",Toast.LENGTH_SHORT).show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}
}
}
private class getUserWalletTaskB extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progress = findViewById(R.id.progressLayoutSettings);
buttonCreateWallet.setEnabled(false);
buttonSelectWallet.setEnabled(false);
buttonSettings.setEnabled(false);
buttonApproveUser.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@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();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}
return walletsList;
}
@Override
protected void onPostExecute(ArrayList<Wallet> listWallet) {
Intent settingsIntent = new Intent(HomeWalletActivity.this, SettingsActivity.class);
settingsIntent.putExtra("USER_HASH",user_hash);
settingsIntent.putExtra("USER_EMAIL",email);
settingsIntent.putExtra("USER_PWD",user_password);
settingsIntent.putExtra("SESSION_ID",session_id);
settingsIntent.putExtra("data",listWallet);
HomeWalletActivity.this.startActivityForResult(settingsIntent,1);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}
}
private class ApproveTask extends AsyncTask<String,String,String>{
@Override
protected void onPreExecute() {
super.onPreExecute();
progress = findViewById(R.id.progressLayoutSettings);
buttonCreateWallet.setEnabled(false);
buttonSelectWallet.setEnabled(false);
buttonSettings.setEnabled(false);
buttonApproveUser.setEnabled(false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(String result) {
buttonApproveUser.setVisibility(View.INVISIBLE);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
progress.setVisibility(View.GONE);
buttonCreateWallet.setEnabled(true);
buttonSelectWallet.setEnabled(true);
buttonSettings.setEnabled(true);
buttonApproveUser.setEnabled(true);
}
@Override
protected String doInBackground(String... strings) {
try{
UserApiHandler userApiHandler = new UserApiHandler();
userApiHandler.approveUser(strings[0],strings[1]);
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;
}
}
/*
private class CheckApprovalTask extends AsyncTask<String,Boolean,Boolean>{
ProgressDialog progDailog = new ProgressDialog(HomeWalletActivity.this);
@Override
protected void onPreExecute() {
super.onPreExecute();
progDailog.setMessage("Loading...");
progDailog.setIndeterminate(false);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
}
@Override
protected Boolean doInBackground(String... strings) {
try{
UserApiHandler userApiHandler = new UserApiHandler();
return userApiHandler.checkApproval(strings[0],strings[1]);
}catch (Exception e){
return null;
}
}
@Override
protected void onPostExecute(Boolean result) {
progDailog.dismiss();
}
}
*/
}

View file

@ -1,126 +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;
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_wallet);
Intent intent = getIntent();
user_hash = intent.getStringExtra("USER_HASH");
user_password = intent.getStringExtra("USER_PWD");
session_id = intent.getStringExtra("SESSION_ID");
listView = (ListView) findViewById(R.id.listViewWallet);
try{
userWallets = (ArrayList<Wallet>) intent.getSerializableExtra("data");
}catch (Exception e){
e.printStackTrace();
userWallets=null;
}
setupWallet();
}
public void setupWallet(){
ListView listView = (ListView) findViewById(R.id.listViewWallet);
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);
}
});
}
private void updateWalletList(){
new getUserWalletTask().execute(user_hash);
}
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>> {
@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) {
if(listWallet!=null && !listWallet.isEmpty()){
WalletAdapter adapter = new WalletAdapter(SelectWalletActivity.this,listWallet);
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);
}
});
}
}
}
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 onStop() {
super.onStop(); // Always call the superclass method first
new EndSessionTask().execute(session_id);
}
@Override
protected void onResume() {
super.onResume();
updateWalletList();
}
}

View file

@ -1,104 +0,0 @@
package monnethic.mobile.wallet;
import java.io.Serializable;
public class Wallet implements Serializable {
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+"}";
}
}

View file

@ -1,38 +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();
convertView.setLayoutParams(params);
wallet_hash.setText(wallet.getWallet_hash());
wallet_type.setText(wallet.getType());
wallet_balance.setText(String.valueOf(wallet.getBalance()));
return convertView;
}
}

Binary file not shown.

After

(image error) Size: 67 KiB

Binary file not shown.

Before

(image error) Size: 207 KiB

View 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>

View file

@ -1,115 +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">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/gray_transparent"
android:gravity="center"
android:elevation="1dp"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Sending transaction..."
android:textSize="20dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="116dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
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:layout_marginStart="25dp"
android:textStyle="bold"
android:text="TO :" />
<TextView
android:id="@+id/destAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:layout_marginTop="15dp" />
<TextView
android:id="@+id/textViewAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginStart="25dp"
android:textStyle="bold"
android:text="AMOUNT :" />
<TextView
android:id="@+id/amountApprove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
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>

View file

@ -1,91 +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">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:background="@color/gray_transparent"
android:elevation="1dp"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Creating wallet..."
android:textSize="20dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<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="50dp"
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>

View file

@ -1,178 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
tools:context="monnethic.mobile.demoConfig.DemoConfig">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="3dp"
android:layout_marginRight="3dp">
<TextView
android:id="@+id/prodEnv"
android:layout_width="130dp"
android:layout_height="35dp"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_marginStart="25dp"
android:layout_marginTop="0dp"
android:clickable="true"
android:editable="false"
android:ems="10"
android:hint="From"
android:inputType="none"
android:text="PROD ENVIRONMENT"
android:textSize="14sp" />
<Switch
android:id="@+id/switchEnv"
android:layout_width="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_height="match_parent"
android:layout_toEndOf="@+id/prodEnv" />
<TextView
android:id="@+id/bckpEnv"
android:layout_width="match_parent"
android:layout_height="35dp"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="0dp"
android:layout_marginEnd="25dp"
android:layout_toEndOf="@+id/switchEnv"
android:clickable="true"
android:editable="false"
android:ems="10"
android:hint="To"
android:inputType="none"
android:text="BACKPUP ENVIRONMENT"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="3dp"
android:layout_marginRight="3dp">
<TextView
android:id="@+id/apiProd"
android:layout_width="130dp"
android:layout_height="35dp"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_marginStart="25dp"
android:layout_marginTop="0dp"
android:clickable="true"
android:editable="false"
android:ems="10"
android:hint="From"
android:inputType="none"
android:text="PROD API"
android:textSize="14sp" />
<Switch
android:id="@+id/switchApi"
android:layout_width="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_height="match_parent"
android:layout_toEndOf="@+id/apiProd" />
<TextView
android:id="@+id/bckpApi"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="0dp"
android:layout_marginEnd="25dp"
android:layout_toEndOf="@+id/switchApi"
android:clickable="true"
android:editable="false"
android:ems="10"
android:hint="To"
android:inputType="none"
android:text="BACKPUP API"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="40dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp">
<Spinner
android:id="@+id/spinnerConfig"
android:layout_width="match_parent"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_height="40dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_height="40dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp">
<Button
android:id="@+id/buttonValidateConfig"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="VALIDATE"
android:textSize="12sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_height="40dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp">
<Button
android:id="@+id/buttonCheckConfig"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="CHECK"
android:textSize="12sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_height="40dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp">
<Button
android:id="@+id/buttonCloseConfig"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="CLOSE"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>

View 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>

View file

@ -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>

View file

@ -1,139 +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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="monnethic.mobile.history.HistoryActivity">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:background="@color/gray_transparent"
android:elevation="1dp"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Please wait, Collecting history..."
android:textSize="18dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginTop="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Switch
android:id="@+id/switchDate"
android:layout_marginStart="5dp"
android:layout_width="wrap_content"
android:layout_height="35dp" />
<Button
android:id="@+id/fromDate"
android:layout_width="140dp"
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:hint="From"
android:inputType="none"
android:textSize="14sp" />
<Button
android:id="@+id/toDate"
android:layout_width="140dp"
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:hint="To"
android:inputType="none"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout2">
<Spinner
android:id="@+id/spinner"
android:layout_marginStart="5dp"
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_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:dividerHeight="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout" />
</android.support.constraint.ConstraintLayout>

View file

@ -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>

View file

@ -1,131 +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">
<RelativeLayout
android:id="@+id/progressLayoutSelect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:background="@color/gray_transparent"
android:elevation="1dp"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Please wait, searching your wallets..."
android:textSize="18dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/progressLayoutSettings"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:background="@color/gray_transparent"
android:elevation="1dp"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBarSetting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBarSetting"
android:text="Please wait, this may take a moment..."
android:textSize="18dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/buttonApproveUser"
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_alignParentStart="true"
android:layout_marginStart="20dp"
android:text="Approve" />
<Button
android:id="@+id/buttonSettings"
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp"
android:text="Settings" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
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="200dp"
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="200dp"
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>

View file

@ -6,54 +6,58 @@
<TextView <TextView
android:id="@+id/welcomeText" android:id="@+id/welcomeText"
android:layout_width="wrap_content" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="50dp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_alignStart="@+id/register"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="120dp" android:layout_marginTop="40dp"
android:fontFamily="sans-serif-smallcaps" android:text="Bienvenue sur le wallet de Monnéthic" />
android:text="WELCOME ON"
android:textColor="@color/colorPrimaryDark"
android:textSize="18sp"
android:textStyle="bold" />
<Button <Button
android:id="@+id/register" android:id="@+id/register"
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/imageView" android:layout_above="@+id/login"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="80dp" android:layout_marginBottom="5dp"
android:text="Register" /> android:text="Register" />
<Button <Button
android:id="@+id/login" android:id="@+id/login"
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/register" android:layout_above="@+id/versionApp"
android:layout_alignStart="@+id/register" android:layout_alignStart="@+id/register"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="-1dp" android:layout_marginBottom="150dp"
android:layout_marginTop="30dp"
android:text="LOGIN" /> 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 <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="230dp" android:layout_width="230dp"
android:layout_height="210dp" android:layout_height="210dp"
android:layout_below="@+id/welcomeText" android:layout_below="@+id/welcomeText"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="5dp" app:srcCompat="@drawable/logo" />
android:onClick="displayConf"
app:srcCompat="@drawable/newlogo" />
<Button
android:id="@+id/buttonConfig"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="CONF" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,143 +1,84 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/gray_transparent"
android:gravity="center"
android:elevation="1dp"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/progressBar"
android:text="Login..."
android:textSize="20dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<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:gravity="center"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps" android:layout_alignParentTop="true"
android:text="LOGIN" android:layout_centerHorizontal="true"
android:textAlignment="center" android:layout_marginTop="108dp"
android:textColor="@color/colorPrimaryDark" android:text="User Login" />
android:textSize="18sp"
android:textStyle="bold" />
<EditText <EditText
android:id="@+id/editTextEmail" android:id="@+id/editTextEmail"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="50dp" android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:ems="10" android:ems="10"
android:hint="Email" android:hint="Email"
android:inputType="textEmailAddress" /> android:inputType="textPersonName" />
<EditText <EditText
android:id="@+id/editTextPassword" android:id="@+id/editTextPassword"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="50dp" android:layout_alignStart="@+id/editTextEmail"
android:layout_below="@+id/editTextEmail"
android:layout_marginTop="69dp"
android:ems="10" android:ems="10"
android:hint="Password" android:hint="Password"
android:inputType="textPassword" /> android:inputType="textPersonName" />
<!--
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/forgetPassword" android:id="@+id/forgetPassword"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignStart="@+id/editTextPassword"
android:layout_alignParentTop="true" android:layout_below="@+id/editTextPassword"
android:layout_marginStart="83dp"
android:layout_marginTop="0dp"
android:clickable="true"
android:onClick="onClickForgetPassword"
android:text="forget password?" android:text="forget password?"
android:onClick="onClickForgetPassword"
android:clickable="true"
android:textSize="10sp" /> android:textSize="10sp" />
<TextView <TextView
android:id="@+id/forgetEmail" android:id="@+id/forgetEmail"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignEnd="@+id/editTextPassword"
android:layout_alignParentEnd="true" android:layout_below="@+id/editTextPassword"
android:layout_marginTop="0dp" android:textSize="10sp"
android:layout_marginEnd="84dp"
android:clickable="true"
android:onClick="onClickForgetEmail" android:onClick="onClickForgetEmail"
android:text="forget email?" android:clickable="true"
android:textSize="10sp" /> android:text="forget email?" />
</RelativeLayout>
-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp">
<Button <Button
android:id="@+id/buttonCancel" android:id="@+id/buttonCancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignStart="@+id/editTextPassword"
android:layout_alignParentTop="true" android:layout_below="@+id/editTextPassword"
android:layout_marginStart="86dp" android:layout_marginTop="43dp"
android:layout_marginTop="0dp"
android:text="Cancel" /> android:text="Cancel" />
<Button <Button
android:id="@+id/buttonOkLogin" android:id="@+id/buttonOk"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignEnd="@+id/forgetEmail"
android:layout_alignTop="@+id/buttonCancel" android:layout_alignTop="@+id/buttonCancel"
android:layout_alignParentEnd="true"
android:layout_marginTop="0dp"
android:layout_marginEnd="86dp"
android:text="OK" /> android:text="OK" />
</RelativeLayout>
</LinearLayout> <TextView
</ScrollView> 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> </RelativeLayout>

View file

@ -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>

View file

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
tools:context="monnethic.mobile.qrcode.QrCodeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/qrCodeViewer"
android:layout_width="320dp"
android:layout_height="300dp"
android:layout_marginBottom="50dp"
android:layout_gravity="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewAdresse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:text="Address: "
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewAdresseDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:text="Amount: "
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewAmountDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/buttonClose"
android:layout_width="200dp"
android:layout_height="45dp"
android:text="CLOSE" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -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>

View file

@ -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>

View file

@ -1,114 +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">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/gray_transparent"
android:gravity="center"
android:elevation="1dp"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Searching user..."
android:textSize="20dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<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:fontFamily="sans-serif-smallcaps"
android:text="SEARCH"
android:textAlignment="center"
android:textColor="@color/colorPrimaryDark"
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>

View file

@ -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>

View file

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/gray_transparent"
android:gravity="center"
android:elevation="1dp"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Please wait, this may take a moment..."
android:textSize="18dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<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">
<LinearLayout
android:id="@+id/l1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="90dp"
android:background="@android:color/darker_gray"
android:orientation="vertical">
<Switch
android:id="@+id/switchChangePassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change Password : "
android:textSize="18sp"
android:textStyle="bold" />
<EditText
android:id="@+id/currentPwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="Current Password"
android:inputType="textPassword" />
<EditText
android:id="@+id/newPwd1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="New Password"
android:inputType="textPassword" />
<EditText
android:id="@+id/newPwd2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="Confirm New Password"
android:inputType="textPassword" />
</LinearLayout>
<LinearLayout
android:id="@+id/l2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/l1"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:layout_marginTop="20dp"
android:background="@android:color/darker_gray"
android:orientation="vertical">
<Switch
android:id="@+id/switchDeleteWallet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete Wallet : "
android:textColor="@android:color/holo_red_light"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Wallet to delete :"
android:textSize="18sp"
android:textStyle="bold" />
<Spinner
android:id="@+id/spinnerWalletToDelete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" />
<EditText
android:id="@+id/editTextConfirmDeleteWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="Confirm wallet to delete"
android:inputType="textPersonName"
android:textColor="@android:color/holo_red_light" />
<TextView
android:id="@+id/textView17"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Wallet to transfer fund :"
android:textSize="18sp"
android:textStyle="bold" />
<Spinner
android:id="@+id/spinnerWalletToMoveFund"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/l2"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:layout_marginTop="25dp"
android:orientation="horizontal">
<Button
android:id="@+id/buttonCancelSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel" />
<Button
android:id="@+id/buttonConfirmSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Confirm" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

View file

@ -3,93 +3,72 @@
android:orientation="vertical" android:layout_width="match_parent" android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout <Button
android:id="@+id/progressLayout" android:id="@+id/buttonCancel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:background="@color/gray_transparent"
android:elevation="1dp"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_alignBaseline="@+id/buttonOk"
android:layout_marginEnd="10dp" android:layout_alignBottom="@+id/buttonOk"
android:indeterminate="true" android:layout_alignStart="@+id/inputConfPassword"
android:max="100" android:text="Cancel" />
android:visibility="visible" />
<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 <TextView
android:id="@+id/appVersion"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_alignParentBottom="true"
android:layout_marginStart="2dp" android:layout_centerHorizontal="true"
android:layout_toEndOf="@+id/progressBar" android:text="version v0.1" />
android:text="Creating account..."
android:textSize="20dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<ScrollView <EditText
android:layout_width="match_parent" android:id="@+id/inputConfPassword"
android:layout_height="match_parent" android:layout_width="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_alignStart="@+id/inputPassword"
android:gravity="center"> android:layout_below="@+id/inputPassword"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="Confirm Password"
android:inputType="textPassword" />
<TextView <TextView
android:id="@+id/textView9" android:id="@+id/textView9"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps" android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="REGISTER" android:text="REGISTER"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/colorPrimaryDark"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<EditText <EditText
android:id="@+id/inputName" android:id="@+id/inputPassword"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/textView9" android:layout_alignStart="@+id/inputConfEmail"
android:layout_centerHorizontal="true" android:layout_below="@+id/inputConfEmail"
android:layout_marginTop="25dp" android:layout_marginTop="13dp"
android:ems="10" android:ems="10"
android:hint="Name" android:hint="Password"
android:inputType="textPersonName" android:inputType="textPassword" />
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 <EditText
android:id="@+id/inputEmail" android:id="@+id/inputEmail"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/inputPrenom"
android:layout_alignStart="@+id/inputPrenom" android:layout_alignStart="@+id/inputPrenom"
android:layout_below="@+id/inputPrenom"
android:layout_marginTop="11dp" android:layout_marginTop="11dp"
android:ems="10" android:ems="10"
android:hint="Email" android:hint="Email"
@ -97,75 +76,35 @@
<EditText <EditText
android:id="@+id/inputConfEmail" android:id="@+id/inputConfEmail"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/inputEmail"
android:layout_alignStart="@+id/inputEmail" android:layout_alignStart="@+id/inputEmail"
android:layout_below="@+id/inputEmail"
android:layout_marginTop="11dp" android:layout_marginTop="11dp"
android:ems="10" android:ems="10"
android:hint="Confirm Email" android:hint="Confirm Email"
android:inputType="textEmailAddress" /> android:inputType="textEmailAddress" />
<EditText <EditText
android:id="@+id/inputPhone" android:id="@+id/inputPrenom"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/inputConfEmail" android:layout_alignStart="@+id/inputName"
android:layout_alignStart="@+id/inputConfEmail" android:layout_below="@+id/inputName"
android:layout_marginTop="11dp" android:layout_marginTop="12dp"
android:ems="10" android:ems="10"
android:hint="Phone" android:hint="Firstname"
android:inputType="phone" /> android:inputType="textPersonName" />
<EditText <EditText
android:id="@+id/inputPassword" android:id="@+id/inputName"
android:layout_width="250dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/inputPhone" android:layout_below="@+id/textView9"
android:layout_alignStart="@+id/inputPhone" android:layout_centerHorizontal="true"
android:layout_marginTop="13dp" android:layout_marginTop="65dp"
android:ems="10" android:ems="10"
android:hint="Password" android:hint="Name"
android:inputType="textPassword" /> android:inputType="textPersonName"
android:singleLine="false" />
<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>
</RelativeLayout> </RelativeLayout>

View file

@ -1,115 +1,67 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout <RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/gray_transparent"
android:gravity="center"
android:elevation="1dp"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:layout_toEndOf="@+id/progressBar"
android:text="Sending transaction..."
android:textSize="20dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<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">
<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/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="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" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="40dp">
<Button <Button
android:id="@+id/btn_send" android:id="@+id/btn_send"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignEnd="@+id/amount"
android:layout_alignParentEnd="true" android:layout_below="@+id/amount"
android:layout_marginEnd="67dp" android:layout_marginTop="77dp"
android:text="SEND" /> 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" />
<Button <Button
android:id="@+id/btn_cancel" android:id="@+id/btn_cancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignBaseline="@+id/btn_send"
android:layout_alignParentTop="true" android:layout_alignBottom="@+id/btn_send"
android:layout_marginStart="67dp" android:layout_alignStart="@+id/amount"
android:text="CANCEL" /> android:text="CANCEL"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<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/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.support.constraint.ConstraintLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

View file

@ -1,149 +1,56 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:background="@color/gray_transparent"
android:elevation="1dp"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:indeterminate="true"
android:max="100"
android:visibility="visible" />
<TextView <TextView
android:id="@+id/textView3"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_alignParentBottom="true"
android:layout_marginStart="2dp" android:layout_centerHorizontal="true"
android:layout_toEndOf="@+id/progressBar" android:text="version v0.1" />
android:text="Please wait, Collecting history..."
android:textSize="18dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<Button
<LinearLayout android:id="@+id/buttonSettings"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="50dp" android:layout_alignParentEnd="true"
android:layout_marginBottom="50dp" android:layout_alignParentTop="true"
android:orientation="vertical" android:text="Settings" />
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_marginBottom="40dp"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/textView4" android:id="@+id/textView4"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_below="@+id/buttonSettings"
android:fontFamily="sans-serif-smallcaps" android:layout_centerHorizontal="true"
android:text="WALLET" android:layout_marginTop="24dp"
android:textColor="@color/colorPrimaryDark" android:text="User account" />
android:textSize="18sp"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/walletHash" android:id="@+id/viewSolde"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="2dp"
android:textIsSelectable="true"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:orientation="vertical">
<TextView
android:id="@+id/textBalance"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_below="@+id/textView4"
android:fontFamily="sans-serif-smallcaps" android:layout_centerHorizontal="true"
android:text="BALANCE" android:layout_marginTop="48dp" />
android:textColor="@color/colorPrimaryDark"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/balanceView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:inputType="none"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<Button <Button
android:id="@+id/buttonPayement" android:id="@+id/buttonPayement"
android:layout_width="200dp" android:layout_width="wrap_content"
android:layout_height="45dp" android:layout_height="wrap_content"
android:layout_marginTop="15dp" android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Payement" /> android:text="Payement" />
<Button <Button
android:id="@+id/buttonReceive" android:id="@+id/buttonReceive"
android:layout_width="200dp" android:layout_width="wrap_content"
android:layout_height="45dp" android:layout_height="wrap_content"
android:layout_marginTop="20dp" android:layout_below="@+id/buttonPayement"
android:layout_centerHorizontal="true"
android:layout_marginTop="38dp"
android:text="Receive" /> android:text="Receive" />
<Button </RelativeLayout>
android:id="@+id/buttonRefreshBalance"
android:layout_width="200dp"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:text="Refresh" />
<Button
android:id="@+id/goToHistory"
android:layout_width="200dp"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp"
android:text="History" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View 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>

View 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>

View file

@ -1,28 +0,0 @@
<?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_gravity="center"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="20dp">
<ProgressBar
android:id="@+id/indeterminateBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<TextView
android:id="@+id/textViewLoading"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:gravity="center"
android:text="Please wait! This may take a moment..." />
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -1,130 +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_marginStart="3dp"
android:layout_marginRight="5dp"
android:text="TxID: "
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/displayTxId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="0.01"
android:text="Date:"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/displayTxDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="0.01"
android:text="Type:"
android:textSize="15sp"
android:textStyle="bold" />
<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="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="0.01"
android:text="Amount:"
android:textSize="15sp"
android:textStyle="bold" />
<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="16sp" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -1,97 +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_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:text="User :"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/userNameSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="u_n"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:text="Wallet :"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/walletHashSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:singleLine="false"
android:text="w_h"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:text="Wallet type :"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/walletIdSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_marginStart="10dp"
android:text="w_id"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -1,84 +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:orientation="horizontal">
<TextView
android:id="@+id/wallet_hash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wallet Hash"
android:textSize="18sp"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:text="Wallet :"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/wallet_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="Wallet Type"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:text="Balance :"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/wallet_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="Wallet Balance"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -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>

View file

@ -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"
}
}
}

View file

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#3f51b5</color> <color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#0579b8</color> <color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color> <color name="colorAccent">#FF4081</color>
<color name="darker_gray">#aaa</color>
<color name="gray_transparent">#D2616161</color>
</resources> </resources>

View file

@ -2,7 +2,4 @@
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_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> </resources>

View file

@ -1,5 +1,5 @@
<resources> <resources>
<string name="app_name">Monnethic Mobile</string> <string name="app_name">Monnéthic Mobile</string>
<string name="title_activity_login">Sign in</string> <string name="title_activity_login">Sign in</string>
<!-- Strings related to login --> <!-- Strings related to login -->
@ -14,95 +14,4 @@
<string name="permission_rationale">"Contacts permissions are needed for providing email <string name="permission_rationale">"Contacts permissions are needed for providing email
completions." completions."
</string> </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 components 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 wont interfere "
"when a user tries to pick up one of cards.\n\n"
</string>
<string name="action_settings">Settings</string>
</resources> </resources>

View file

@ -1,18 +1,11 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="colorControlNormal">#c5c5c5</item>
<item name="colorControlActivated">@color/colorPrimaryDark</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
</style> </style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources> </resources>

View file

@ -1,4 +1,4 @@
package monnethic.mobile.test; package com.example.monnthic.monnthicmobile;
import org.junit.Test; import org.junit.Test;

View file

@ -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();
}
}
}

View file

@ -1,53 +0,0 @@
package monnethic.mobile.test.restAPI;
import org.json.JSONObject;
import org.junit.Test;
import monnethic.mobile.database.User;
import monnethic.mobile.restApi.UserApiHandler;
public class testLogin {
/*
@Test
public void registerUser(){
String name = "Georges";
String firstname = "Patrick";
String phone = "0724812479";
String association = "gonette";
String email = "patrick.g@mail.com";
String password = "Gpatr014<*ù";
try{
User u = new User(name,firstname,email,password,phone,association);
UserApiHandler userApiHandler = new UserApiHandler();
JSONObject userReturn= userApiHandler.registerUser(u);
System.out.println(userReturn.toString());
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void loginUser(){
String email = "patrick.g@mail.com";
String password = "Gpatr014<*ù";
try{
User u = new User(email,password);
UserApiHandler userApiHandler = new UserApiHandler();
JSONObject userReturn= userApiHandler.loginUser(u);
System.out.println(userReturn.toString());
}catch (Exception e){
e.printStackTrace();
}
}
*/
}

View file

@ -7,7 +7,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { 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 // NOTE: Do not place your application dependencies here; they belong

View file

@ -1,6 +1,6 @@
#Sun Oct 14 15:18:06 CEST 2018 #Wed Apr 04 16:52:57 CEST 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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