Skip to content

Commit dcf48de

Browse files
committed
+ Reportes subidos por usuario
Nueva sección para ver una tabla con los reportes subidos
1 parent 2a41d0b commit dcf48de

File tree

3 files changed

+55
-44
lines changed

3 files changed

+55
-44
lines changed

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

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import android.app.ProgressDialog;
66
import android.content.Intent;
77
import android.os.Bundle;
8+
import android.widget.ImageView;
89
import android.widget.TableLayout;
910
import android.widget.TableRow;
11+
import android.widget.TextView;
1012
import android.widget.Toast;
1113

1214
import com.android.volley.AuthFailureError;
@@ -21,6 +23,7 @@
2123
import org.json.JSONArray;
2224
import org.json.JSONException;
2325
import org.json.JSONObject;
26+
import org.w3c.dom.Text;
2427

2528
import java.util.ArrayList;
2629
import java.util.HashMap;
@@ -29,6 +32,7 @@
2932
public class ReportsActivity extends AppCompatActivity {
3033
private Intent intent; //Intent que lanza esta actividad
3134
private String user_id;
35+
private TableLayout tablaReportes;
3236
RequestQueue colaSolicitud;
3337
@Override
3438
protected void onCreate(Bundle savedInstanceState) {
@@ -41,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
4145

4246
if(!user_id.isEmpty())
4347
{
44-
TableLayout tablaReportes = findViewById(R.id.tablaReportes);
48+
tablaReportes = findViewById(R.id.tablaReportes);
4549

4650
// TableRow[] rows = new TableRow[productsList.length()];
4751
getReportes(user_id);
@@ -70,12 +74,36 @@ public void onResponse(JSONObject response) {
7074
{
7175
JSONObject reporte = jsonArray.getJSONObject(i);
7276
int id = reporte.getInt("id");
73-
String foto = reporte.getString("foto");
77+
//String foto = reporte.getString("foto");
7478
String descripcion = reporte.getString("descripcion");
7579
String estado = reporte.getString("estado");
7680

81+
TextView viewId = new TextView(ReportsActivity.this);
82+
viewId.setText(String.valueOf(id));
83+
84+
TextView viewDescripcion = new TextView(ReportsActivity.this);
85+
viewDescripcion.setText(descripcion);
86+
87+
TextView viewEstado = new TextView(ReportsActivity.this);
88+
viewEstado.setText(estado);
89+
90+
// ImageView viewEstado= new ImageView(ReportsActivity.this);
91+
// viewFoto.setImageResource(R.drawable.person);
92+
7793
Toast.makeText(ReportsActivity.this,"REPORTE "+id+" - "+descripcion+" - "+ estado,Toast.LENGTH_LONG).show();
7894

95+
96+
/* Create a new row to be added. */
97+
TableRow tr = new TableRow(ReportsActivity.this);
98+
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
99+
100+
tr.addView(viewId);
101+
tr.addView(viewDescripcion);
102+
tr.addView(viewEstado);
103+
/* Add row to TableLayout. */
104+
//tr.setBackgroundResource(R.drawable.sf_gradient_03);
105+
tablaReportes.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
106+
79107
}
80108
} catch (JSONException e) {
81109
e.printStackTrace();

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

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@
77
tools:context=".ReportsActivity">
88

99
<ScrollView
10-
android:layout_width="fill_parent"
11-
android:layout_height="fill_parent"
12-
android:layout_marginTop="48dp"
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:layout_marginTop="32dp"
1313
app:layout_constraintEnd_toEndOf="parent"
14-
app:layout_constraintHorizontal_bias="0.0"
14+
app:layout_constraintHorizontal_bias="1.0"
1515
app:layout_constraintStart_toStartOf="parent"
1616
app:layout_constraintTop_toTopOf="parent">
1717

1818
<LinearLayout
19-
android:layout_width="match_parent"
19+
android:layout_width="wrap_content"
2020
android:layout_height="wrap_content"
21-
android:orientation="vertical">
21+
android:orientation="horizontal">
2222

2323
<TableLayout
2424
android:id="@+id/tablaReportes"
25-
android:layout_width="fill_parent"
26-
android:layout_height="fill_parent"
27-
android:layout_marginStart="32dp"
28-
android:layout_marginTop="32dp"
29-
android:layout_marginEnd="32dp">
25+
android:layout_width="wrap_content"
26+
android:layout_height="wrap_content"
27+
android:layout_marginStart="8dp"
28+
android:layout_marginTop="8dp"
29+
android:layout_marginEnd="8dp"
30+
android:shrinkColumns="*"
31+
android:stretchColumns="*">
3032

3133
<TableRow
3234
android:id="@+id/cabecera"
@@ -39,47 +41,28 @@
3941
android:layout_height="match_parent"
4042
android:background="@color/cr_icon_background"
4143
android:gravity="center"
42-
android:text="FOTO" />
44+
android:shadowColor="#636363"
45+
android:text="ID"
46+
android:textColor="#FFFFFF" />
4347

4448
<TextView
4549
android:id="@+id/textoDesc"
46-
android:layout_width="146dp"
50+
android:layout_width="213dp"
4751
android:layout_height="match_parent"
4852
android:background="@color/cr_icon_background"
4953
android:gravity="center"
50-
android:text="DESCRIPCIÓN" />
54+
android:text="DESCRIPCIÓN"
55+
android:textColor="#FFFFFF" />
5156

5257
<TextView
5358
android:id="@+id/textoEstado"
54-
android:layout_width="68dp"
55-
android:layout_height="wrap_content"
59+
android:layout_width="91dp"
60+
android:layout_height="match_parent"
5661
android:background="@color/cr_icon_background"
5762
android:gravity="center"
58-
android:text="ESTADO" />
59-
60-
</TableRow>
61-
62-
<TableRow
63-
android:layout_width="match_parent"
64-
android:layout_height="match_parent">
63+
android:text="ESTADO"
64+
android:textColor="#FFFFFF" />
6565

66-
<ImageView
67-
android:id="@+id/imageView5"
68-
android:layout_width="wrap_content"
69-
android:layout_height="wrap_content"
70-
tools:srcCompat="@tools:sample/avatars" />
71-
72-
<TextView
73-
android:id="@+id/textView7"
74-
android:layout_width="113dp"
75-
android:layout_height="match_parent"
76-
android:text="TextView" />
77-
78-
<TextView
79-
android:id="@+id/textView8"
80-
android:layout_width="wrap_content"
81-
android:layout_height="match_parent"
82-
android:text="TextView" />
8366
</TableRow>
8467

8568
</TableLayout>

app/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Fri Mar 13 09:18:16 CET 2020
1+
#Thu Aug 27 17:50:44 CEST 2020
22
VERSION_NUMBER=1
3-
VERSION_BUILD=88
3+
VERSION_BUILD=101
44
VERSION_PATCH=0

0 commit comments

Comments
 (0)