Change to SignUp (Register)
Modified project structure and added features
This commit is contained in:
parent
d74218fb29
commit
4d1ff7da1f
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -23,10 +23,14 @@ 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'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
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')
|
||||
compile ('com.j256.ormlite:ormlite-android:4.48')
|
||||
androidTestImplementation 'com.android.support.test:rules:1.0.1'
|
||||
androidTestImplementation 'com.android.support:support-annotations:26.1.0'
|
||||
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
implementation 'org.web3j:core:3.3.1-android'
|
||||
implementation 'com.j256.ormlite:ormlite-android:4.48'
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.monnthic.monnthicmobile">
|
||||
package="com.example.monnthic.monnethicmobile">
|
||||
|
||||
<!-- To auto-complete the email text field in the login form with Useruser's emails -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
@ -17,20 +17,19 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".HomepageActivity">
|
||||
<activity android:name="monnethic.mobile.homepage.HomepageActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".SignupActivity" />
|
||||
<activity android:name=".LoginActivity" />
|
||||
<activity android:name=".WalletActivity" />
|
||||
<activity android:name=".UserAccountActivity" />
|
||||
<activity android:name=".DemoActivity" />
|
||||
<activity android:name=".WalletPresenterActivity" />
|
||||
<activity android:name=".TransactionActivity"></activity>
|
||||
<activity android:name="monnethic.mobile.homepage.RegisterActivity" />
|
||||
<activity android:name="monnethic.mobile.homepage.LoginActivity" />
|
||||
<activity android:name="monnethic.mobile.wallet.WalletActivity" />
|
||||
<activity android:name="monnethic.mobile.user.UserAccountActivity" />
|
||||
<activity android:name="monnethic.mobile.demo.DemoActivity" />
|
||||
<activity android:name="monnethic.mobile.wallet.WalletPresenterActivity" />
|
||||
<activity android:name="monnethic.mobile.transaction.TransactionActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,20 +1,17 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.blockchain;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
import monnethic.mobile.transaction.DbTransaction;
|
||||
|
||||
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.database;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -10,6 +10,8 @@ import com.j256.ormlite.dao.Dao;
|
|||
import com.j256.ormlite.support.ConnectionSource;
|
||||
import com.j256.ormlite.table.TableUtils;
|
||||
|
||||
import monnethic.mobile.transaction.DbTransaction;
|
||||
|
||||
public class DatabaseManager extends OrmLiteSqliteOpenHelper{
|
||||
private static final String DATABASE_NAME = "WalletTransaction.db";
|
||||
private static final int DATABASE_VERSION = 1;
|
|
@ -0,0 +1,4 @@
|
|||
package monnethic.mobile.database;
|
||||
|
||||
public class DatabaseUserDao {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.demo;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -6,6 +6,10 @@ import android.os.Bundle;
|
|||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.wallet.WalletPresenterActivity;
|
||||
|
||||
public class DemoActivity extends AppCompatActivity {
|
||||
private static final String WALLET_A = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e";
|
||||
private static final String WALLET_B = "";
|
|
@ -1,11 +1,14 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.homepage;
|
||||
|
||||
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 com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.demo.DemoActivity;
|
||||
|
||||
public class HomepageActivity extends AppCompatActivity {
|
||||
//TODO MOVE TO LOGIN ACTIVITY
|
||||
|
@ -41,7 +44,7 @@ public class HomepageActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void launchRegisterActivity(){
|
||||
Intent registerIntent = new Intent(HomepageActivity.this, SignupActivity.class);
|
||||
Intent registerIntent = new Intent(HomepageActivity.this, RegisterActivity.class);
|
||||
HomepageActivity.this.startActivity(registerIntent);
|
||||
}
|
||||
public void launchLoginActivity(){
|
|
@ -0,0 +1,30 @@
|
|||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class InputController {
|
||||
private static Pattern pattern;
|
||||
private static Matcher matcher;
|
||||
private static final String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,20})";
|
||||
private static final String NAME_PATTERN = "((?=.*[a-z]).{4,30})";
|
||||
|
||||
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 nameValidator(String name){
|
||||
pattern = Pattern.compile(NAME_PATTERN);
|
||||
matcher = pattern.matcher(name);
|
||||
return matcher.matches();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -8,6 +8,10 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.wallet.WalletActivity;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private EditText email;
|
||||
|
@ -44,9 +48,9 @@ public class LoginActivity extends AppCompatActivity {
|
|||
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
public void validateInput(){
|
||||
if(isEmptyEdit(email)){
|
||||
if(InputController.isEmptyEdit(email)){
|
||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||
} else if(isEmptyEdit(password)) {
|
||||
} else if(InputController.isEmptyEdit(password)) {
|
||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
if(checkUser(email.getText().toString(),password.getText().toString())){
|
||||
|
@ -56,13 +60,12 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
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);
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -8,7 +8,12 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class SignupActivity extends AppCompatActivity {
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.user.User;
|
||||
import monnethic.mobile.wallet.WalletActivity;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity {
|
||||
|
||||
private EditText name;
|
||||
private EditText firstname;
|
||||
|
@ -48,24 +53,10 @@ public class SignupActivity extends AppCompatActivity {
|
|||
|
||||
//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{
|
||||
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())){
|
||||
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString());
|
||||
insertUserLdap(inputUser);
|
||||
}
|
||||
|
@ -92,21 +83,55 @@ public class SignupActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
//TODO LAUNCH WALLET ACTIVITY
|
||||
public void launchWalletActivity(int ldapId){;
|
||||
public void launchWalletActivity(int ldapId){
|
||||
//LAUNCH APP WALLET WITH ID USER
|
||||
Intent walletIntent = new Intent(SignupActivity.this, WalletActivity.class);
|
||||
Intent walletIntent = new Intent(RegisterActivity.this, WalletActivity.class);
|
||||
walletIntent.putExtra("idUser", ldapId);
|
||||
SignupActivity.this.startActivity(walletIntent);
|
||||
RegisterActivity.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;
|
||||
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail+";";
|
||||
return false;
|
||||
}
|
||||
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.nameValidator(name.getText().toString())){
|
||||
Toast.makeText(this, "Name must be 4 to 30 character long", 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(password)){
|
||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if(InputController.isEmptyEdit(confirmPassword)){
|
||||
Toast.makeText(this, "You did not confirm your password", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}else {
|
||||
if (!(password.getText().toString().equals(confirmPassword.getText().toString()))) {
|
||||
Toast.makeText(this, "Password don't match confirmation password", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else if (!(email.getText().toString().equals(confirmEmail.getText().toString()))) {
|
||||
Toast.makeText(this, "Email don't match confirmation email", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.transaction;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -8,6 +8,8 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class TransactionActivity extends AppCompatActivity {
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.user;
|
||||
|
||||
/**
|
||||
* Created by Guillaume on 15/04/2018.
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.user;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
@ -7,6 +7,8 @@ import android.widget.Button;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
public class UserAccountActivity extends AppCompatActivity {
|
||||
private TextView solde;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -7,6 +7,10 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.user.UserAccountActivity;
|
||||
|
||||
public class WalletActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -8,9 +8,12 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import org.web3j.utils.Convert;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import monnethic.mobile.blockchain.AccessBlockchain;
|
||||
import monnethic.mobile.transaction.TransactionActivity;
|
||||
|
||||
public class WalletPresenterActivity extends AppCompatActivity {
|
||||
private EditText addressPublic;
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.monnthic.monnthicmobile;
|
||||
package monnethic.mobile.test;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Wed Apr 04 16:52:57 CEST 2018
|
||||
#Mon Sep 24 08:37:23 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
|
|
Loading…
Reference in a new issue