in progress!
This commit is contained in:
@@ -1,25 +1,15 @@
|
||||
package com.example.quiz;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import android.provider.Settings;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import com.example.quiz.databinding.FragmentLoginBinding;
|
||||
import com.example.quiz.utils.SharedPrefsHelper;
|
||||
@@ -73,27 +63,25 @@ public class Login extends Fragment {
|
||||
binding.loginButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(binding.userNameInput.getText().toString().isEmpty()){
|
||||
binding.userNameInput.setError("Le nom d'utilisateur est obligatoire");
|
||||
binding.userNameInput.requestFocus();
|
||||
return;
|
||||
}
|
||||
if(binding.passwordInput.getText().toString().isEmpty()){
|
||||
binding.passwordInput.setError("Le mot de passe est obligatoire");
|
||||
binding.passwordInput.requestFocus();
|
||||
return;
|
||||
}
|
||||
if(binding.passwordInput.getText().toString().length() < 6){
|
||||
binding.passwordInput.setError("Le mot de passe doit contenir au moins 6 caractères ");
|
||||
binding.passwordInput.requestFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
prefsHelper = SharedPrefsHelper.getInstance(getContext());
|
||||
prefsHelper.save("username", binding.userNameInput.getText().toString());
|
||||
FragmentManager fragmentManager = getParentFragmentManager();
|
||||
ListOfReunions reunions = ListOfReunions.newInstance(binding.userNameInput.getText().toString());
|
||||
ListOfReunions reunions = ListOfReunions.newInstance("");
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.nav_host_fragment_content_main, reunions)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
}
|
||||
});
|
||||
|
||||
binding.caisse.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Caisse caisse = Caisse.newInstance();
|
||||
FragmentManager fragmentManager = getParentFragmentManager();
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.nav_host_fragment_content_main, caisse)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user