gestion des formats de tickets!
This commit is contained in:
@@ -6,13 +6,18 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.quiz.databinding.FragmentLoginBinding;
|
||||
import com.example.quiz.utils.AuthNavigator;
|
||||
import com.example.quiz.utils.SessionManager;
|
||||
import com.example.quiz.utils.SharedPrefsHelper;
|
||||
import com.example.quiz.viewModel.LoginViewModel;
|
||||
import com.example.quiz.viewModel.LogsViewModel;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -21,6 +26,8 @@ import com.example.quiz.utils.SharedPrefsHelper;
|
||||
*/
|
||||
public class Login extends Fragment {
|
||||
|
||||
|
||||
private AuthNavigator authNavigator;
|
||||
private SharedPrefsHelper prefsHelper;
|
||||
public Login() {
|
||||
// Required empty public constructor
|
||||
@@ -51,6 +58,9 @@ public class Login extends Fragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
SessionManager sessionManager = SessionManager.newInstance(getContext());
|
||||
FragmentManager fragmentManager = getParentFragmentManager();
|
||||
authNavigator = new AuthNavigator(getContext(), fragmentManager, sessionManager, new ViewModelProvider(requireActivity()).get(LoginViewModel.class), new ViewModelProvider(requireActivity()).get(LogsViewModel.class));
|
||||
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.getSupportActionBar().hide();
|
||||
@@ -63,14 +73,9 @@ public class Login extends Fragment {
|
||||
binding.loginButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
prefsHelper = SharedPrefsHelper.getInstance(getContext());
|
||||
FragmentManager fragmentManager = getParentFragmentManager();
|
||||
ListOfReunions reunions = ListOfReunions.newInstance("");
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.nav_host_fragment_content_main, reunions)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
ListOFBets bets = ListOFBets.newInstance();
|
||||
authNavigator.navigate(bets);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,9 +83,17 @@ public class Login extends Fragment {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Caisse caisse = Caisse.newInstance();
|
||||
authNavigator.navigate(caisse);
|
||||
}
|
||||
});
|
||||
|
||||
binding.settings.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Settings settings = Settings.newInstance();
|
||||
FragmentManager fragmentManager = getParentFragmentManager();
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.nav_host_fragment_content_main, caisse)
|
||||
.replace(R.id.nav_host_fragment_content_main, settings)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user