Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
KomelT committed May 20, 2023
1 parent 09b1d53 commit d39377b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/com/avtosola/pici/miki/Kandidat.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ public boolean getOpravljenCppTecaj() {
return this.opravljenCppTecaj;
}

public boolean isPrijavljenNaCPPIzpit() { return prijavljenNaCPPIzpit; }
public boolean getPrijavljenNaCPPIzpit() { return prijavljenNaCPPIzpit; }

public void setPrijavljenNaCPPIzpit(boolean state) { prijavljenNaCPPIzpit = state; }

public int getSteviloNeopravljenihCppIzpitov() {
return steviloNeopravljenihCppIzpitov;
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/avtosola/pici/miki/UserProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ protected void onCreate(Bundle savedInstanceState) {
((TextView) findViewById(R.id.prijava_cpp_izpit)).setEnabled(false);
}

if (prijavljenUporabnik.getPrijavljenNaCPPIzpit()) {
((TextView) findViewById(R.id.prijava_cpp_izpit)).setBackgroundColor(Color.argb(36,103, 80, 164));
((TextView) findViewById(R.id.prijava_cpp_izpit)).setEnabled(false);
((TextView) findViewById(R.id.prijava_cpp_izpit)).setText("Prijavi se na CPP izpit (prijavljen)");
}

if (prijavljenUporabnik.getOpravljeneUreVoznje() >= 20) {
((TextView) findViewById(R.id.voznja_tecaj_text)).setTextColor(Color.rgb(73, 73, 73));
((TextView) findViewById(R.id.voznja_tecaj_bool)).setTextColor(Color.rgb(73, 73, 73));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.avtosola.pici.miki;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.*;
import android.widget.*;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.textfield.TextInputEditText;

import java.util.ArrayList;

@RequiresApi(api = Build.VERSION_CODES.Q)
public class ZmKandidatPrijaviSeNaCPPIzpit extends AppCompatActivity {

public KPrijaviSeNaCPPIzpit kPrijaviSeNaCPPIzpit;
Expand All @@ -23,9 +27,12 @@ public class ZmKandidatPrijaviSeNaCPPIzpit extends AppCompatActivity {

Termini izbranTermin;

Kandidat prijavljenUporabnik;



public void zacniPrijavo() {
prijavljenUporabnik = KPrijaviSeNaCPPIzpit.kandidat;
KPrijaviSeNaCPPIzpit.vrniSeznamLokacij();
prikaziSeznamLokacij();
}
Expand All @@ -38,21 +45,23 @@ public void prikaziSeznamLokacij() {
Button btnTag = new Button(this);
btnTag.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
btnTag.setText(lokacija.getNaziv());
btnTag.setOnClickListener(new View.OnClickListener(){
btnTag.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
izberiLokacijo(lokacija);
}
});
lokacijeButton.add(btnTag);
layout.addView(btnTag);
}

}


public void izberiLokacijo(Lokacija lokacija) {
for (Button button : lokacijeButton) {
((ViewManager) button.getParent()).removeView(button);
}
lokacijeButton.clear();
izbranaLokacija = lokacija;
KPrijaviSeNaCPPIzpit.vrniSeznamProstihTerminov();
prikaziProsteTermineZaIzbranoLokacijo();
Expand Down Expand Up @@ -82,6 +91,7 @@ public void izberiTermin(Termini termin) {
for (Button button : terminiButton) {
((ViewManager) button.getParent()).removeView(button);
}
terminiButton.clear();
izbranTermin = termin;
prikaziPovzetekPrijave();
}
Expand Down Expand Up @@ -227,12 +237,45 @@ public void vnesiPodatkeKreditneKartice(String lastnik, String stKartice, String


public void prikaziSporociloOUspesnemPlacilu() {
prijavljenUporabnik.setPrijavljenNaCPPIzpit(true);
((TextView) findViewById(R.id.heading2)).setText("Uspeh! Prijava je bila uspešno zabeležena.");

LinearLayout layout = findViewById(R.id.llayout);

Button gumbNazaj = new Button(this);
gumbNazaj.setText("Nazaj");
gumbNazaj.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));

gumbNazaj.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
((ViewManager) gumbNazaj.getParent()).removeView(gumbNazaj);
Intent intent = new Intent(ZmKandidatPrijaviSeNaCPPIzpit.this, UserProfile.class);
startActivity(intent);
}
});

layout.addView(gumbNazaj);
}


public void prikaziSporociloONapaki() {
((TextView) findViewById(R.id.heading2)).setText("Opps! Prišlo je do napake pri plačilu. Prosim poskusite ponovno.");

LinearLayout layout = findViewById(R.id.llayout);

Button gumbNazaj = new Button(this);
gumbNazaj.setText("Nazaj");
gumbNazaj.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));

gumbNazaj.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
((ViewManager) gumbNazaj.getParent()).removeView(gumbNazaj);
Intent intent = new Intent(ZmKandidatPrijaviSeNaCPPIzpit.this, UserProfile.class);
startActivity(intent);
}
});

layout.addView(gumbNazaj);
}

protected void onCreate(Bundle savedInstanceState) {
Expand Down

0 comments on commit d39377b

Please sign in to comment.