Commit 782884a9 authored by Tristan's avatar Tristan
Browse files

Final Version

parent 9ea73cdd
......@@ -30,6 +30,7 @@ android {
dependencies {
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.+'
......
......@@ -9,13 +9,14 @@ import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.Button;
public class LoginActivity extends AppCompatActivity {
private EditText edEmail;
private EditText edPassword;
private EditText btnLogin;
private EditText btnSignin;
private Button btnLogin;
private Button btnSignin;
private final String CREDENTIAL_SHARED_PREF = "our_shared_pref";
......@@ -33,8 +34,9 @@ public class LoginActivity extends AppCompatActivity {
btnSignin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent( LoginActivity.this, SignupActivity.class);
startActivity(intent);
Intent otherActivity = new Intent(getApplicationContext(), SignupActivity.class);
startActivity(otherActivity);
finish();
}
});
btnLogin.setOnClickListener(new View.OnClickListener() {
......@@ -46,14 +48,19 @@ public class LoginActivity extends AppCompatActivity {
String email_from_ed = edEmail.getText().toString();
String password_from_ed = edPassword.getText().toString();
if (strEmail != null && email_from_ed != null && strEmail.equalsIgnoreCase(email_from_ed)) {
if (strPassword != null && password_from_ed != null && strPassword.equalsIgnoreCase(password_from_ed)) {
if (strEmail != null && strEmail.equalsIgnoreCase(email_from_ed)) {
if (strPassword != null && strPassword.equalsIgnoreCase(password_from_ed)) {
Toast.makeText(LoginActivity.this, "Login Successful", Toast.LENGTH_SHORT).show();
Intent otherActivity = new Intent(getApplicationContext(), MainActivity.class);
startActivity(otherActivity);
finish();
} else {
Toast.makeText(LoginActivity.this, "Login Failed", Toast.LENGTH_SHORT).show();
Toast.makeText(LoginActivity.this, "Login Failed1", Toast.LENGTH_SHORT).show();
}
} else{
Toast.makeText(LoginActivity.this, "Login Failed", Toast.LENGTH_SHORT).show();
Toast.makeText(LoginActivity.this, "Login Failed2", Toast.LENGTH_SHORT).show();
}
}
});
......
......@@ -5,24 +5,33 @@ import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private Button Frigo;
private Button ConsulterRecette;
private static boolean Var=true;
@Override
protected void onCreate(Bundle savedInstanceState) {
if(Var==true){
Var=false;
Intent otherActivity = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(otherActivity);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.Frigo = findViewById(R.id.Frigo);
Frigo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent otherActivity = new Intent(getApplicationContext(), MonFrigo.class);
startActivity(otherActivity);
finish();
}
});
......@@ -32,7 +41,6 @@ public class MainActivity extends AppCompatActivity {
public void onClick(View view) {
Intent otherActivity = new Intent(getApplicationContext(), Recettes.class);
startActivity(otherActivity);
finish();
}
});
......
......@@ -2,10 +2,12 @@ package com.example.wastedfood;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class SignupActivity extends AppCompatActivity {
......@@ -13,7 +15,7 @@ public class SignupActivity extends AppCompatActivity {
private EditText edEmail;
private EditText edPassword;
private EditText edConfPassword;
private EditText btnConfirm;
private Button btnConfirm;
private final String CREDENTIAL_SHARED_PREF = "our_shared_pref";
......@@ -23,8 +25,8 @@ public class SignupActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
edEmail = findViewById(R.id.ed_email);
edPassword = findViewById(R.id.ed_password);
edEmail = findViewById(R.id.ed_email2);
edPassword = findViewById(R.id.ed_password2);
edConfPassword = findViewById(R.id.ed_conf_password2);
btnConfirm = findViewById(R.id.btn_confirm);
......@@ -41,6 +43,9 @@ public class SignupActivity extends AppCompatActivity {
editor.putString("Password", strPassword);
editor.putString("Email", strEmail);
editor.commit();
Intent otherActivity = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(otherActivity);
finish();
SignupActivity.this.finish();
}
......
......@@ -46,6 +46,7 @@ public class new_ingredient extends AppCompatActivity {
otherActivity.putExtra("ingrédient",textView.getText().toString());
otherActivity.putExtra("date",textViewDate.getText().toString());
startActivity(otherActivity);
finish();
}
});
//Date de péremption
......
......@@ -8,8 +8,8 @@
<ImageView
android:id="@+id/imageView2"
android:layout_width="409dp"
android:layout_height="172dp"
android:layout_width="362dp"
android:layout_height="118dp"
android:layout_marginTop="62dp"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
......@@ -21,9 +21,9 @@
android:id="@+id/btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="58dp"
android:layout_marginEnd="115dp"
android:layout_marginRight="115dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="88dp"
android:layout_marginRight="88dp"
android:background="@drawable/button"
android:text="Log In"
app:layout_constraintEnd_toEndOf="parent"
......@@ -33,9 +33,9 @@
android:id="@+id/btn_signin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="21dp"
android:layout_marginEnd="115dp"
android:layout_marginRight="115dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="88dp"
android:layout_marginRight="88dp"
android:background="@drawable/button"
android:text="Sig In"
app:layout_constraintEnd_toEndOf="parent"
......@@ -97,9 +97,9 @@
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="188dp"
android:layout_marginRight="188dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="160dp"
android:layout_marginRight="160dp"
android:text="- Or --"
android:textColor="@android:color/holo_green_dark"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -43,9 +43,9 @@
android:id="@+id/ed_email2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="97dp"
android:layout_marginEnd="184dp"
android:layout_marginRight="184dp"
android:layout_marginTop="52dp"
android:layout_marginEnd="96dp"
android:layout_marginRight="96dp"
android:ems="10"
android:hint="Email"
android:inputType="textEmailAddress"
......@@ -56,9 +56,9 @@
android:id="@+id/ed_password2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="31dp"
android:layout_marginEnd="184dp"
android:layout_marginRight="184dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="96dp"
android:layout_marginRight="96dp"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
......@@ -69,9 +69,9 @@
android:id="@+id/ed_conf_password2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:layout_marginEnd="184dp"
android:layout_marginRight="184dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="96dp"
android:layout_marginRight="96dp"
android:ems="10"
android:hint="Confirm Password"
android:inputType="textPassword"
......
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.android.tools.build:gradle:4.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment