Skip to content

Commit

Permalink
Errores integracion solucionados
Browse files Browse the repository at this point in the history
  • Loading branch information
“blantu904” committed Oct 18, 2024
1 parent 74bf788 commit 247293b
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 80 deletions.
2 changes: 1 addition & 1 deletion AndroidProject/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:name=".activities.RegistrarRepostajeMenu.RegistrarView"
android:exported="false" />
<activity
android:name=".activities.ConsultarRepostajeMenu.ConsultarView"
android:name=".activities.ConsultarRepostaje.ConsultarRepostaje"
android:exported="false" />
<activity
android:name=".activities.details.DetailsView"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package es.unican.gasolineras.activities.ConsultarRepostaje;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;
Expand All @@ -17,7 +20,9 @@

import es.unican.gasolineras.GasolinerasApp;
import es.unican.gasolineras.R;

import es.unican.gasolineras.activities.main.IMainContract;
import es.unican.gasolineras.activities.main.MainView;
import es.unican.gasolineras.model.Repostaje;
import es.unican.gasolineras.repository.AppDatabase;
import es.unican.gasolineras.repository.RepostajeDAO;
Expand All @@ -31,14 +36,30 @@ public class ConsultarRepostaje extends AppCompatActivity implements IConsultar
@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_consulta_repostaje_view);
try {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_consulta_repostaje_view);
} catch (Exception e) {
// Si ocurre una excepción, muestra el mensaje de error
new AlertDialog.Builder(ConsultarRepostaje.this)
.setTitle("Error")
.setMessage(getString(R.string.error_acceso_bbdd))
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Puedes agregar alguna acción adicional si es necesario
Intent intent = new Intent(ConsultarRepostaje.this, MainView.class);
startActivity(intent);
}
})
.show();
}

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
assert bar != null; // to avoid warning in the line below
bar.setDisplayHomeAsUpEnabled(true); // show back button in action bar
//assert bar != null; // to avoid warning in the line below
//bar.setDisplayHomeAsUpEnabled(true); // show back button in action bar

TextView repostajesMes = findViewById(R.id.tvRepostajesMes);
TextView precioMedioLitro = findViewById(R.id.tvPrecioMedioLitro);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public View getView(int position, View convertView, ViewGroup parent) {

if (convertView == null) {
convertView = LayoutInflater.from(context)
.inflate(R.layout.activity_consultar_list_item, parent, false);
.inflate(R.layout.activity_consulta_repostaje_list_item_view, parent, false);
}

//fecha
Expand All @@ -66,19 +66,19 @@ public View getView(int position, View convertView, ViewGroup parent) {
//precio por litro
{

TextView tv = convertView.findViewById(R.id.tvPreciolitro);
TextView tv = convertView.findViewById(R.id.tvPrecioPorLitroNum);
tv.setText(String.valueOf(repostaje.getPrecioTotal() / repostaje.getLitros()));
}

//litros
{
TextView tv = convertView.findViewById(R.id.tvLitros);
TextView tv = convertView.findViewById(R.id.tvLitrosNum);
tv.setText(String.valueOf(repostaje.getLitros()));
}

//precio total
{
TextView tv = convertView.findViewById(R.id.tvPrecioTotal);
TextView tv = convertView.findViewById(R.id.tvPrecioTotalNum);
tv.setText(String.valueOf(repostaje.getPrecioTotal()));
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package es.unican.gasolineras.activities.main;

import static java.util.Collections.emptyList;

import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
Expand Down Expand Up @@ -92,7 +89,7 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup

// name
{
TextView tv = convertView.findViewById(R.id.tvName);
TextView tv = convertView.findViewById(R.id.tvFecha);
tv.setText(gasolinera.getRotulo());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@

import dagger.hilt.android.AndroidEntryPoint;
import es.unican.gasolineras.R;
import es.unican.gasolineras.activities.ConsultarRepostajeMenu.ConsultarView;
import es.unican.gasolineras.activities.ConsultarRepostaje.ConsultarRepostaje;
import es.unican.gasolineras.activities.RegistrarRepostajeMenu.RegistrarView;
import es.unican.gasolineras.activities.info.InfoView;
import es.unican.gasolineras.activities.details.DetailsView;
import es.unican.gasolineras.model.Gasolinera;
import es.unican.gasolineras.repository.IGasolinerasRepository;


/**
* The main view of the application. It shows a list of gas stations.
*/
Expand Down Expand Up @@ -183,7 +184,7 @@ public void showRegistrarActivity() {
*/
@Override
public void showConsultarActivity() {
Intent intent = new Intent(this, ConsultarView.class);
Intent intent = new Intent(this, ConsultarRepostaje.class);
startActivity(intent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class Repostaje {
public int uid;

@ColumnInfo(name = "fecha_repostaje")
protected String fechaRepostaje;
public String fechaRepostaje;

@ColumnInfo(name = "precio_total")
protected double precioTotal;
public double precioTotal;

@ColumnInfo(name = "litros")
protected double litros;
public double litros;

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@
android:layout_height="128dp">

<TextView
android:id="@+id/litrosNum"
android:id="@+id/tvLitrosNum"
android:layout_width="79dp"
android:layout_height="22dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="30dp"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvName"
app:layout_constraintTop_toBottomOf="@+id/tvFecha"
tools:text="40" />

<TextView
android:id="@+id/precioTotalNum"
android:id="@+id/tvPrecioTotalNum"
android:layout_width="79dp"
android:layout_height="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="30dp"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/precioPorLitroNum"
app:layout_constraintTop_toBottomOf="@+id/tvPrecioPorLitroNum"
tools:text="60" />

<TextView
android:id="@+id/precioPorLitroNum"
android:id="@+id/tvPrecioPorLitroNum"
android:layout_width="79dp"
android:layout_height="26dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="30dp"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/litrosNum"
app:layout_constraintTop_toBottomOf="@+id/tvLitrosNum"
tools:text="1,432" />

<TextView
Expand All @@ -46,11 +46,11 @@
android:layout_marginTop="10dp"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@+id/logoGasolinera"
app:layout_constraintTop_toBottomOf="@+id/tvName"
app:layout_constraintTop_toBottomOf="@+id/tvFecha"
tools:text="Litros:" />

<TextView
android:id="@+id/precioPorLitro"
android:id="@+id/tvPrecioLitro"
android:layout_width="145dp"
android:layout_height="26dp"
android:layout_marginStart="20dp"
Expand All @@ -68,7 +68,7 @@
android:layout_marginTop="10dp"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@+id/logoGasolinera"
app:layout_constraintTop_toBottomOf="@+id/precioPorLitro"
app:layout_constraintTop_toBottomOf="@+id/tvPrecioLitro"
tools:text="Precio total:" />

<ImageView
Expand All @@ -85,7 +85,7 @@
tools:srcCompat="@tools:sample/avatars" />

<TextView
android:id="@+id/tvName"
android:id="@+id/tvFecha"
android:layout_width="113dp"
android:layout_height="22dp"
android:layout_marginTop="2dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@
android:layout_width="331dp"
android:layout_height="34dp"
android:layout_marginStart="32dp"
android:gravity="center"
android:text="Historico de Repostajes"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="348dp" />

<TextView
android:id="@+id/numImporteMes"
android:id="@+id/tvAcumuladoMes"
android:layout_width="99dp"
android:layout_height="35dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="48dp"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/numPrecioMedio"
app:layout_constraintTop_toBottomOf="@+id/tvPrecioMedioLitro"
tools:text="242" />

<TextView
Expand All @@ -50,14 +52,14 @@
app:layout_constraintTop_toBottomOf="@+id/resumenMes" />

<TextView
android:id="@+id/numPrecioMedio"
android:id="@+id/tvPrecioMedioLitro"
android:layout_width="99dp"
android:layout_height="35dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="48dp"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/numRepostajes"
app:layout_constraintTop_toBottomOf="@+id/tvRepostajesMes"
tools:text="1,534" />

<TextView
Expand All @@ -66,13 +68,15 @@
android:layout_height="30dp"
android:layout_marginStart="32dp"
android:layout_marginTop="88dp"
android:text="Resumen de Octubre"
android:textSize="24sp"
android:gravity="start"
android:text="Este mes "
android:textSize="28sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/numRepostajes"
android:id="@+id/tvRepostajesMes"
android:layout_width="99dp"
android:layout_height="35dp"
android:layout_marginTop="28dp"
Expand All @@ -94,7 +98,7 @@
app:layout_constraintTop_toBottomOf="@+id/repostajes" />

<ListView
android:id="@+id/historicoRepostajes"
android:id="@+id/lvRepostajes"
android:layout_width="409dp"
android:layout_height="0dp"
android:layout_marginTop="400dp"
Expand All @@ -106,8 +110,8 @@

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar2"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_width="431dp"
android:layout_height="58dp"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
tools:srcCompat="@tools:sample/avatars" />

<TextView
android:id="@+id/tvName"
android:id="@+id/tvFecha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
Expand All @@ -34,7 +34,7 @@
tools:text="Direccion"
app:layout_constraintBottom_toTopOf="@+id/tv95"
app:layout_constraintStart_toEndOf="@+id/ivLogo"
app:layout_constraintTop_toBottomOf="@+id/tvName" />
app:layout_constraintTop_toBottomOf="@+id/tvFecha" />

<TextView
android:id="@+id/tv95Label"
Expand Down
4 changes: 2 additions & 2 deletions AndroidProject/app/src/main/res/menu/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
android:id="@+id/RegistrarRepostajeItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:title="Registrar repostaje" />
android:title="@string/registrarRepostaje" />

<item
android:id="@+id/ConsultarRepostajeItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:title="Historial repostajes" />
android:title="@string/historialRepostaje" />
</menu>
2 changes: 2 additions & 0 deletions AndroidProject/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<string name="dieselAlabel">Diesel</string>
<string name="refresh">Recargar</string>
<string name="info">Info</string>
<string name="registrarRepostaje">Registrar repostaje</string>
<string name="historialRepostaje">Historial repostajes</string>
<string name="loadCorrect">Se han cargado %d gasolineras</string>
<string name="loadError">Ha habido un error cargando las gasolineras</string>
<string name="info_text">Aplicación creada para el Proyecto Integrado Curso 2024-2025</string>
Expand Down

0 comments on commit 247293b

Please sign in to comment.