commit 72af83215661445f490fdeab7654650f487b2a17 Author: GME Date: Sun Jun 10 12:45:41 2018 +0200 modif repertoire app mobile et ajout modif diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..11de578 --- /dev/null +++ b/.gitignore @@ -0,0 +1,72 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/dictionaries +.idea/libraries + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..3963879 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d23da21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..77a3af4 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +Mobile Directory : +Directory which will contains files related to the mobile application. \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..729e9db --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.example.monnthic.monnthicmobile" + multiDexEnabled true + minSdkVersion 19 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support:design:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + compile ('org.web3j:core:3.3.1-android') +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/example/monnthic/monnthicmobile/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/monnthic/monnthicmobile/ExampleInstrumentedTest.java new file mode 100644 index 0000000..4461184 --- /dev/null +++ b/app/src/androidTest/java/com/example/monnthic/monnthicmobile/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.monnthic.monnthicmobile; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.monnthic.monnthicmobile", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..58c5e1c --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/AccessBlockchain.java b/app/src/main/java/com/example/monnthic/monnthicmobile/AccessBlockchain.java new file mode 100644 index 0000000..dd129db --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/AccessBlockchain.java @@ -0,0 +1,70 @@ +package com.example.monnthic.monnthicmobile; + +import org.web3j.protocol.Web3j; +import org.web3j.protocol.Web3jFactory; +import org.web3j.protocol.core.methods.response.EthGetBalance; +import org.web3j.protocol.http.HttpService; +import org.web3j.protocol.core.DefaultBlockParameterName; +import java.math.BigInteger; + + + + +/** + * Created by Guillaume on 28/05/2018. + */ + +public class AccessBlockchain { + 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 = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e"; + //Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2)); + + public static void main(String [ ] args) + { + try{ + //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("*************************************************"); + //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(); + } + + } + + + 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; + } + + public boolean sendTransationTo(String addressDestination, BigInteger amountToSend){ + return false; + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/DemoActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/DemoActivity.java new file mode 100644 index 0000000..77bb752 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/DemoActivity.java @@ -0,0 +1,43 @@ +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"; + + @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); + } + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/HomepageActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/HomepageActivity.java new file mode 100644 index 0000000..9c868e7 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/HomepageActivity.java @@ -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); + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/LoginActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/LoginActivity.java new file mode 100644 index 0000000..0f34dea --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/LoginActivity.java @@ -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(); + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/SignupActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/SignupActivity.java new file mode 100644 index 0000000..825cb35 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/SignupActivity.java @@ -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; + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/TransactionActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/TransactionActivity.java new file mode 100644 index 0000000..be0a8c7 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/TransactionActivity.java @@ -0,0 +1,43 @@ +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.EditText; +import android.widget.Toast; + +public class TransactionActivity extends AppCompatActivity { + + private EditText addressDestination; + private EditText Amout; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_transaction); + addressDestination = findViewById(R.id.destination_address); + Amout = findViewById(R.id.amount); + Button buttonCancel = findViewById(R.id.btn_cancel); + Button buttonOk = findViewById(R.id.btn_send); + + 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(){ + Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show(); + } + +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/User.java b/app/src/main/java/com/example/monnthic/monnthicmobile/User.java new file mode 100644 index 0000000..465b625 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/User.java @@ -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; + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/UserAccountActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/UserAccountActivity.java new file mode 100644 index 0000000..5f35ec4 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/UserAccountActivity.java @@ -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"); + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/WalletActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/WalletActivity.java new file mode 100644 index 0000000..bdeb872 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/WalletActivity.java @@ -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(); + } +} diff --git a/app/src/main/java/com/example/monnthic/monnthicmobile/WalletPresenterActivity.java b/app/src/main/java/com/example/monnthic/monnthicmobile/WalletPresenterActivity.java new file mode 100644 index 0000000..b1bf438 --- /dev/null +++ b/app/src/main/java/com/example/monnthic/monnthicmobile/WalletPresenterActivity.java @@ -0,0 +1,63 @@ +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 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(initiateBalance(address).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); + WalletPresenterActivity.this.startActivity(transactionIntent); + } + + public BigInteger initiateBalance(String address){ + AccessBlockchain ab = new AccessBlockchain(); + System.out.println("addresse "+ address); + BigInteger balanceIs = ab.getTheBalanceOfWallet(address); + return balanceIs; + } +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/logo.PNG b/app/src/main/res/drawable/logo.PNG new file mode 100644 index 0000000..788c8a2 Binary files /dev/null and b/app/src/main/res/drawable/logo.PNG differ diff --git a/app/src/main/res/layout/activity_2fa.xml b/app/src/main/res/layout/activity_2fa.xml new file mode 100644 index 0000000..d8fb324 --- /dev/null +++ b/app/src/main/res/layout/activity_2fa.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_demo_wallet.xml b/app/src/main/res/layout/activity_demo_wallet.xml new file mode 100644 index 0000000..76604c8 --- /dev/null +++ b/app/src/main/res/layout/activity_demo_wallet.xml @@ -0,0 +1,45 @@ + + + +