Guest User

Untitled

a guest
Jul 9th, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.66 KB | None | 0 0
  1. package Bartilizer.data;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.os.Message;
  6. import android.view.View;
  7. import android.widget.ArrayAdapter;
  8. import android.widget.AutoCompleteTextView;
  9. import android.widget.Button;
  10. import android.widget.EditText;
  11. import java.util.ArrayList;
  12. import java.util.Calendar;
  13.  
  14. public class MainActivity extends Activity {
  15.  
  16.     private ArrayList<FuifMens> fuifmensen = new ArrayList<FuifMens>();
  17.     private ArrayList<Fuif> fuiven = new ArrayList<Fuif>();
  18.     private Boolean ingelogd = false;
  19.  
  20.     /**
  21.      * Called when the activity is first created.
  22.      */
  23.     @Override
  24.     public void onCreate(Bundle savedInstanceState) {
  25.         super.onCreate(savedInstanceState);
  26.         //setContentView(R.layout.hoofdscherm);
  27.         setContentView(R.layout.login);
  28.         //setContentView(R.layout.orderscherm);
  29.         //setContentView(R.layout.productscherm);
  30.         //setContentView(R.layout.signupscherm);
  31.         Calendar c1 = Calendar.getInstance();
  32.         Functie f1 = new Functie("organisator", 123);
  33.         Functie f2 = new Functie("barman", 126);
  34.         Mens mens1 = new Mens("Peire", "Thomas", "login1", "abc123", c1, "email1@mail.com", f1, 123);
  35.         Mens mens2 = new Mens("Schaemelhout", "Mathias", "login2", "123abc", c1, "email2@mail.com", f2, 124);
  36.         Mens mens3 = new Mens("Decrossmol", "Pol", "login3", "1a2b3c", c1, "email3@mail.com", f2, 125);
  37.        
  38.  
  39.         Fuif fuif1 = new Fuif("fuif1", c1, c1, c1, 1.5, 5612321);
  40.         Fuif fuif2 = new Fuif("fuif2", c1, c1, c1, 1.5, 5612846);
  41.         Fuif fuif3 = new Fuif("fuif3", c1, c1, c1, 1.5, 5612498);
  42.  
  43.         fuiven.add(fuif1);
  44.         fuiven.add(fuif2);
  45.         fuiven.add(fuif3);
  46.  
  47.         FuifMens fmens1 = new FuifMens(1234, fuif1, mens1, 5);
  48.         FuifMens fmens2 = new FuifMens(1234, fuif3, mens2, 5);
  49.         FuifMens fmens3 = new FuifMens(1234, fuif2, mens3, 5);
  50.  
  51.         fuifmensen.add(fmens1);
  52.         fuifmensen.add(fmens2);
  53.         fuifmensen.add(fmens3);
  54.        
  55.        
  56.         Button btnSignUp = (Button) findViewById(R.id.btnSignUp);
  57.         btnSignUp.setOnClickListener(new View.OnClickListener() {
  58.  
  59.             public void onClick(View arg0) {
  60.                 setContentView(R.layout.signupscherm);
  61.             }
  62.         });
  63.        
  64.         Button btnLogin = (Button) findViewById(R.id.btnLogin);
  65.         btnLogin.setOnClickListener(new View.OnClickListener() {
  66.  
  67.             public void onClick(View arg0) {
  68.                 controleerLogin();
  69.             }
  70.         });
  71.        
  72.         //AutoCompleteTextView  txtFuif = (AutoCompleteTextView) findViewById(R.id.txtFuif);
  73.         //ArrayAdapter<Fuif> adapter = new ArrayAdapter<Fuif>(this, android.R.layout.simple_dropdown_item_1line, fuiven);
  74.         //txtFuif.setThreshold(2);
  75.         //txtFuif.setAdapter(adapter);
  76.        
  77.        
  78.  
  79.     }
  80.     @Override
  81.     public void onBackPressed(){
  82.         if(ingelogd == false){
  83.            setContentView(R.layout.login);
  84.         }
  85.         else{
  86.            setContentView(R.layout.hoofdscherm);
  87.         }
  88.        
  89.     }
  90.  
  91.     public void controleerLogin() {
  92.         EditText txtLogin = (EditText) findViewById(R.id.txtLogin);
  93.         EditText txtPassword = (EditText) findViewById(R.id.txtPassword);
  94.         //EditText txtFuif = (EditText) findViewById(R.id.txtFuif);
  95.        
  96.         for (FuifMens m : fuifmensen) {
  97.             if (m.getMens().getLogin().equals(txtLogin.getText().toString()) && m.getMens().getPassword().equals(txtPassword.getText().toString())) {
  98.                 setContentView(R.layout.hoofdscherm);
  99.                 ingelogd = true;
  100.             }
  101.            
  102.         }
  103.     }
  104. }
Add Comment
Please, Sign In to add comment