diff --git "a/2.An\303\241lise/2.1.Modelo de Caso de Uso - MCU/~$scri\303\247\303\243o casos de uso - PS-2017-2-ES-LocacaoVeiculo.docx" "b/2.An\303\241lise/2.1.Modelo de Caso de Uso - MCU/~$scri\303\247\303\243o casos de uso - PS-2017-2-ES-LocacaoVeiculo.docx"
new file mode 100644
index 0000000..609a008
Binary files /dev/null and "b/2.An\303\241lise/2.1.Modelo de Caso de Uso - MCU/~$scri\303\247\303\243o casos de uso - PS-2017-2-ES-LocacaoVeiculo.docx" differ
diff --git a/4.Sistema/LOCCARR/app/build.gradle b/4.Sistema/LOCCARR/app/build.gradle
index 9a0f2ba..7fc69a0 100644
--- a/4.Sistema/LOCCARR/app/build.gradle
+++ b/4.Sistema/LOCCARR/app/build.gradle
@@ -22,6 +22,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-auth:9.6.1'
+ implementation 'com.google.firebase:firebase-database:9.6.1'
+ implementation 'com.firebaseui:firebase-ui-database:0.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
@@ -31,3 +33,6 @@ dependencies {
apply plugin: 'com.google.gms.google-services'
+
+
+
diff --git a/4.Sistema/LOCCARR/app/src/main/AndroidManifest.xml b/4.Sistema/LOCCARR/app/src/main/AndroidManifest.xml
index 442b340..67a4c94 100644
--- a/4.Sistema/LOCCARR/app/src/main/AndroidManifest.xml
+++ b/4.Sistema/LOCCARR/app/src/main/AndroidManifest.xml
@@ -17,7 +17,10 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Cadastrar.java b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Cadastrar.java
index 7cce146..483169d 100644
--- a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Cadastrar.java
+++ b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Cadastrar.java
@@ -81,19 +81,19 @@ public void onComplete(@NonNull Task task) {
}
});
- firebaseUser = firebaseAuth.getCurrentUser();
-
- firebaseUser.sendEmailVerification()
- .addOnCompleteListener(this, new OnCompleteListener() {
- @Override
- public void onComplete(@NonNull Task task) {
- if (task.isSuccessful()){
- Toast.makeText(Cadastrar.this, "E-mail de confirmação enviado para "+firebaseUser.getEmail()+".", Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(Cadastrar.this, "Não foi possível enviar o e-mail de confirmação.", Toast.LENGTH_SHORT).show();
- }
- }
- });
+ //firebaseUser = firebaseAuth.getCurrentUser();
+
+ //firebaseUser.sendEmailVerification()
+ // .addOnCompleteListener(this, new OnCompleteListener() {
+ // @Override
+ // public void onComplete(@NonNull Task task) {
+ // if (task.isSuccessful()){
+ // Toast.makeText(Cadastrar.this, "E-mail de confirmação enviado para "+firebaseUser.getEmail()+".", Toast.LENGTH_SHORT).show();
+ // } else {
+ // Toast.makeText(Cadastrar.this, "Não foi possível enviar o e-mail de confirmação.", Toast.LENGTH_SHORT).show();
+ // }
+ // }
+ //});
}
}
diff --git a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/CadastroMotorista.java b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/CadastroMotorista.java
new file mode 100644
index 0000000..2b8d000
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/CadastroMotorista.java
@@ -0,0 +1,57 @@
+package br.com.flores.marcio.loccarr;
+
+import android.provider.Settings;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import br.com.flores.marcio.loccarr.Modelos.Motorista;
+
+public class CadastroMotorista extends AppCompatActivity {
+ EditText editNome, editCnh, editData;
+ String nome, cnh, data;
+ DatabaseReference databaseReference;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_cadastro_motorista);
+
+ editNome = findViewById(R.id.editNome);
+ editCnh = findViewById(R.id.editCnh);
+ editData = findViewById(R.id.editData);
+ }
+
+ public void cadastrar (View view){
+ nome = editNome.getText().toString().trim();
+ cnh = editCnh.getText().toString().trim();
+ String matricula = nome+cnh;
+ data = editData.getText().toString().trim();
+
+ if(TextUtils.isEmpty(nome)){
+ Toast.makeText(this, "O nome não pode estar em branco.", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if(TextUtils.isEmpty(cnh)){
+ Toast.makeText(this, "A CNH não pode estar em branco..", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ databaseReference = FirebaseDatabase.getInstance().getReference("Motorista");
+
+ Motorista motorista = new Motorista(nome, cnh, matricula, data);
+ databaseReference.child(cnh).setValue(motorista);
+ Toast.makeText(this, "Motorista cadastrado.", Toast.LENGTH_SHORT).show();
+ finish();
+ }
+}
diff --git a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Dashboard.java b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Dashboard.java
new file mode 100644
index 0000000..29fb6d6
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Dashboard.java
@@ -0,0 +1,19 @@
+package br.com.flores.marcio.loccarr;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+
+public class Dashboard extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_dashboard);
+ }
+
+ public void manterMotorista (View view){
+ startActivity(new Intent(getApplicationContext(), ManterMotorista.class));
+ }
+}
diff --git a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ExclusaoMotorista.java b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ExclusaoMotorista.java
new file mode 100644
index 0000000..c27a1db
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ExclusaoMotorista.java
@@ -0,0 +1,59 @@
+package br.com.flores.marcio.loccarr;
+
+import android.support.annotation.NonNull;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.Query;
+import com.google.firebase.database.ValueEventListener;
+
+public class ExclusaoMotorista extends AppCompatActivity {
+ EditText editCnh;
+ String cnh;
+ DatabaseReference databaseReference;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_exclusao_motorista);
+
+ editCnh = findViewById(R.id.editCnh);
+ }
+
+ public void excluir (View view){
+
+ databaseReference = FirebaseDatabase.getInstance().getReference("Motorista");
+
+ //String nome = databaseReference.
+
+ cnh = editCnh.getText().toString().trim();
+
+ Query query = databaseReference.orderByChild("Motorista").equalTo(cnh);
+ query.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+ if (dataSnapshot.exists()){
+ databaseReference.removeValue();
+ Toast.makeText(ExclusaoMotorista.this, "Motorista excluído.", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(ExclusaoMotorista.this, "Não foi possível excluir o motorista. Confira a CNH.", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError) {
+
+ }
+ });
+ }
+}
diff --git a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ManterMotorista.java b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ManterMotorista.java
new file mode 100644
index 0000000..1054027
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ManterMotorista.java
@@ -0,0 +1,23 @@
+package br.com.flores.marcio.loccarr;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+
+public class ManterMotorista extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_manter_motorista);
+ }
+
+ public void cadastrarMotorista (View view){
+ startActivity(new Intent(getApplicationContext(), CadastroMotorista.class));
+ }
+
+ public void excluirMotorista (View view){
+ startActivity(new Intent(getApplicationContext(), ExclusaoMotorista.class));
+ }
+}
diff --git a/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Modelos/Motorista.java b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Modelos/Motorista.java
new file mode 100644
index 0000000..fcab60f
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Modelos/Motorista.java
@@ -0,0 +1,34 @@
+package br.com.flores.marcio.loccarr.Modelos;
+
+import java.util.Date;
+
+/**
+ * Created by marci on 24/11/2017.
+ */
+
+public class Motorista {
+ public String nome, matricula, cnh, dataIngresso;
+
+ public Motorista(String nome, String matricula, String cnh, String dataIngresso) {
+ this.nome = nome;
+ this.matricula = matricula;
+ this.cnh = cnh;
+ this.dataIngresso = dataIngresso;
+ }
+
+ public String getNome() {
+ return nome;
+ }
+
+ public String getMatricula() {
+ return matricula;
+ }
+
+ public String getCnh() {
+ return cnh;
+ }
+
+ public String getDataIngresso() {
+ return dataIngresso;
+ }
+}
diff --git a/4.Sistema/LOCCARR/app/src/main/res/layout/activity_cadastro_motorista.xml b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_cadastro_motorista.xml
new file mode 100644
index 0000000..92fceeb
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_cadastro_motorista.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/4.Sistema/LOCCARR/app/src/main/res/layout/activity_dashboard.xml b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_dashboard.xml
new file mode 100644
index 0000000..e788242
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_dashboard.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/4.Sistema/LOCCARR/app/src/main/res/layout/activity_exclusao_motorista.xml b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_exclusao_motorista.xml
new file mode 100644
index 0000000..701976a
--- /dev/null
+++ b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_exclusao_motorista.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
diff --git a/4.Sistema/LOCCARR/app/src/main/res/layout/activity_main.xml b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_main.xml
index 6f494a8..6f12841 100644
--- a/4.Sistema/LOCCARR/app/src/main/res/layout/activity_main.xml
+++ b/4.Sistema/LOCCARR/app/src/main/res/layout/activity_main.xml
@@ -30,16 +30,6 @@
android:hint="Senha"
android:inputType="textPassword" />
-
-