Skip to content

Commit 35de757

Browse files
committed
+ Rediseño 'Mis Reportes', iconos según estado del reporte y nuevo diseño de la tabla.
1 parent dcf48de commit 35de757

File tree

9 files changed

+87
-30
lines changed

9 files changed

+87
-30
lines changed

app/src/main/java/com/example/cityreport/ReportsActivity.java

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.example.cityreport;
22

33
import androidx.appcompat.app.AppCompatActivity;
4+
import androidx.core.content.ContextCompat;
45

56
import android.app.ProgressDialog;
67
import android.content.Intent;
78
import android.os.Bundle;
9+
import android.view.Gravity;
10+
import android.view.View;
11+
import android.view.ViewGroup;
812
import android.widget.ImageView;
913
import android.widget.TableLayout;
1014
import android.widget.TableRow;
@@ -78,31 +82,63 @@ public void onResponse(JSONObject response) {
7882
String descripcion = reporte.getString("descripcion");
7983
String estado = reporte.getString("estado");
8084

85+
TableRow.LayoutParams lP = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
86+
lP.setMargins(20,5,10,5);
87+
lP.gravity = Gravity.CENTER_VERTICAL;
88+
8189
TextView viewId = new TextView(ReportsActivity.this);
8290
viewId.setText(String.valueOf(id));
91+
viewId.setLayoutParams(lP);
92+
8393

8494
TextView viewDescripcion = new TextView(ReportsActivity.this);
8595
viewDescripcion.setText(descripcion);
96+
viewDescripcion.setLayoutParams(lP);
97+
viewDescripcion.setMaxLines(20); //Saltos de linea en la descripcion
98+
99+
100+
//TextView viewEstado = new TextView(ReportsActivity.this);
101+
//viewEstado.setText(estado);
86102

87-
TextView viewEstado = new TextView(ReportsActivity.this);
88-
viewEstado.setText(estado);
89103

90-
// ImageView viewEstado= new ImageView(ReportsActivity.this);
91-
// viewFoto.setImageResource(R.drawable.person);
92104

93-
Toast.makeText(ReportsActivity.this,"REPORTE "+id+" - "+descripcion+" - "+ estado,Toast.LENGTH_LONG).show();
105+
final ImageView viewEstado = new ImageView(ReportsActivity.this);
106+
viewEstado.setLayoutParams(lP);
107+
viewEstado.setContentDescription(id +" - "+ estado); //almacenamos el estado del reporte para el onClick
108+
if(estado.equals("pendiente"))
109+
viewEstado.setImageResource(R.drawable.ic_exclamation_red);
110+
else if (estado.equals("revisado"))
111+
viewEstado.setImageResource(R.drawable.ic_exclamation_orange);
112+
else if(estado.equals("finalizado"))
113+
viewEstado.setImageResource(R.drawable.ic_exclamation_green);
114+
else
115+
viewEstado.setImageResource(R.drawable.ic_exclamation);
116+
117+
viewEstado.setOnClickListener(new View.OnClickListener() {
118+
@Override
119+
public void onClick(View v) {
120+
Toast.makeText(ReportsActivity.this,
121+
viewEstado.getContentDescription(),
122+
Toast.LENGTH_SHORT).show();
123+
}
124+
});
125+
126+
//Toast.makeText(ReportsActivity.this,"REPORTE "+id+" - "+descripcion+" - "+ estado,Toast.LENGTH_LONG).show();
94127

95128

96129
/* Create a new row to be added. */
97130
TableRow tr = new TableRow(ReportsActivity.this);
98-
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
131+
tr.setBackground(ContextCompat.getDrawable(ReportsActivity.this, R.drawable.border));
132+
133+
//tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
134+
99135

100136
tr.addView(viewId);
101137
tr.addView(viewDescripcion);
102138
tr.addView(viewEstado);
103139
/* Add row to TableLayout. */
104140
//tr.setBackgroundResource(R.drawable.sf_gradient_03);
105-
tablaReportes.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
141+
tablaReportes.addView(tr);
106142

107143
}
108144
} catch (JSONException e) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:shape= "rectangle">
5+
<padding android:bottom="0dp" android:top="0dp" ></padding>
6+
<stroke android:width="1px" android:color="#2196f3"/>
7+
</shape>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<vector android:height="50dp" android:viewportHeight="512"
2+
android:viewportWidth="512" android:width="50dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="@android:color/holo_green_light" android:pathData="M504,256c0,136.997 -111.043,248 -248,248S8,392.997 8,256C8,119.083 119.043,8 256,8s248,111.083 248,248zM256,306c-25.405,0 -46,20.595 -46,46s20.595,46 46,46 46,-20.595 46,-46 -20.595,-46 -46,-46zM212.327,140.654l7.418,136c0.347,6.364 5.609,11.346 11.982,11.346h48.546c6.373,0 11.635,-4.982 11.982,-11.346l7.418,-136c0.375,-6.874 -5.098,-12.654 -11.982,-12.654h-63.383c-6.884,0 -12.356,5.78 -11.981,12.654z"/>
4+
</vector>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<vector android:height="50dp" android:viewportHeight="512"
2+
android:viewportWidth="512" android:width="50dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="@android:color/holo_orange_light" android:pathData="M504,256c0,136.997 -111.043,248 -248,248S8,392.997 8,256C8,119.083 119.043,8 256,8s248,111.083 248,248zM256,306c-25.405,0 -46,20.595 -46,46s20.595,46 46,46 46,-20.595 46,-46 -20.595,-46 -46,-46zM212.327,140.654l7.418,136c0.347,6.364 5.609,11.346 11.982,11.346h48.546c6.373,0 11.635,-4.982 11.982,-11.346l7.418,-136c0.375,-6.874 -5.098,-12.654 -11.982,-12.654h-63.383c-6.884,0 -12.356,5.78 -11.981,12.654z"/>
4+
</vector>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<vector android:height="50dp" android:viewportHeight="512"
2+
android:viewportWidth="512" android:width="50dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="@android:color/holo_red_light" android:pathData="M504,256c0,136.997 -111.043,248 -248,248S8,392.997 8,256C8,119.083 119.043,8 256,8s248,111.083 248,248zM256,306c-25.405,0 -46,20.595 -46,46s20.595,46 46,46 46,-20.595 46,-46 -20.595,-46 -46,-46zM212.327,140.654l7.418,136c0.347,6.364 5.609,11.346 11.982,11.346h48.546c6.373,0 11.635,-4.982 11.982,-11.346l7.418,-136c0.375,-6.874 -5.098,-12.654 -11.982,-12.654h-63.383c-6.884,0 -12.356,5.78 -11.981,12.654z"/>
4+
</vector>

app/src/main/res/layout/activity_reports.xml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
app:layout_constraintStart_toStartOf="parent"
1616
app:layout_constraintTop_toTopOf="parent">
1717

18-
<LinearLayout
19-
android:layout_width="wrap_content"
20-
android:layout_height="wrap_content"
21-
android:orientation="horizontal">
2218

2319
<TableLayout
2420
android:id="@+id/tablaReportes"
@@ -27,37 +23,44 @@
2723
android:layout_marginStart="8dp"
2824
android:layout_marginTop="8dp"
2925
android:layout_marginEnd="8dp"
30-
android:shrinkColumns="*"
31-
android:stretchColumns="*">
26+
android:weightSum="1"
27+
android:stretchColumns="1"
28+
android:shrinkColumns="1">
3229

3330
<TableRow
3431
android:id="@+id/cabecera"
3532
android:layout_width="match_parent"
3633
android:layout_height="match_parent">
3734

35+
3836
<TextView
39-
android:id="@+id/textoFoto"
40-
android:layout_width="102dp"
41-
android:layout_height="match_parent"
37+
android:id="@+id/CabeceraID"
38+
android:layout_width="0dp"
39+
android:layout_column="0"
40+
android:paddingStart="10dp"
41+
android:layout_weight="0.2"
4242
android:background="@color/cr_icon_background"
43-
android:gravity="center"
43+
android:gravity="left"
4444
android:shadowColor="#636363"
4545
android:text="ID"
4646
android:textColor="#FFFFFF" />
4747

48+
4849
<TextView
49-
android:id="@+id/textoDesc"
50-
android:layout_width="213dp"
51-
android:layout_height="match_parent"
52-
android:background="@color/cr_icon_background"
50+
android:id="@+id/cabeceraDesc"
5351
android:gravity="center"
52+
android:layout_width="0dp"
53+
android:layout_column="1"
54+
android:layout_weight="0.6"
55+
android:background="@color/cr_icon_background"
5456
android:text="DESCRIPCIÓN"
5557
android:textColor="#FFFFFF" />
5658

5759
<TextView
58-
android:id="@+id/textoEstado"
59-
android:layout_width="91dp"
60-
android:layout_height="match_parent"
60+
android:id="@+id/cabeceraEstado"
61+
android:layout_width="0dp"
62+
android:layout_column="2"
63+
android:layout_weight="0.2"
6164
android:background="@color/cr_icon_background"
6265
android:gravity="center"
6366
android:text="ESTADO"
@@ -67,7 +70,6 @@
6770

6871
</TableLayout>
6972

70-
</LinearLayout>
7173
</ScrollView>
7274

7375
</androidx.constraintlayout.widget.ConstraintLayout>

app/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Thu Aug 27 17:50:44 CEST 2020
1+
#Sun Aug 30 16:26:14 CEST 2020
22
VERSION_NUMBER=1
3-
VERSION_BUILD=101
3+
VERSION_BUILD=225
44
VERSION_PATCH=0

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77

88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.6.1'
10+
classpath 'com.android.tools.build:gradle:4.0.1'
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Mar 02 18:53:42 CET 2020
1+
#Thu Aug 13 22:09:44 CEST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

0 commit comments

Comments
 (0)