Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.voleycoach;
- import android.content.Intent;
- import android.database.Cursor;
- import android.os.Bundle;
- import android.support.design.widget.FloatingActionButton;
- import android.support.v7.app.AppCompatActivity;
- import android.support.v7.widget.Toolbar;
- import android.view.View;
- import android.widget.AdapterView;
- import android.widget.ListView;
- import android.widget.SimpleCursorAdapter;
- import android.widget.TextView;
- public class MisGrupos extends AppCompatActivity {
- ListView lista;
- public static final String EXTRA_GRUPO_ID = "extra_grupo_id";
- GruposSQLiteHelper dbGrupos;
- TextView elem_Nombre, elem_Club, elem_Categoria, elem_Sexo, elem_Dias, elem_Horas;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_mis_grupos);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- elem_Nombre = (TextView)findViewById(R.id.nombre_grupo);
- elem_Club = (TextView)findViewById(R.id.nombre_club);
- elem_Categoria = (TextView)findViewById(R.id.nombre_categoria);
- elem_Sexo = (TextView)findViewById(R.id.nombre_sexo);
- elem_Dias = (TextView)findViewById(R.id.nombre_dias);
- elem_Horas = (TextView)findViewById(R.id.nombre_horas);
- lista = (ListView) findViewById(R.id.listViewGrupos);
- dbGrupos = new GruposSQLiteHelper(this);
- Cursor cursor = dbGrupos.leerDatos();
- String[] from = new String[]{
- dbGrupos.COLUMNA_NOMBRE,
- dbGrupos.COLUMNA_CLUB, dbGrupos.COLUMNA_CATEGORIA,
- dbGrupos.COLUMNA_SEXO, dbGrupos.COLUMNA_DIAS, dbGrupos.COLUMNA_HORARIOS};
- int[] to = new int[]{R.id.nombre_grupo,
- R.id.nombre_club, R.id.nombre_categoria,
- R.id.nombre_sexo, R.id.nombre_dias, R.id.nombre_horas};
- SimpleCursorAdapter adapter = new SimpleCursorAdapter(MisGrupos.this,
- R.layout.elemento_lista, cursor, from, to, 0);
- adapter.notifyDataSetChanged();
- lista.setAdapter(adapter);
- lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- String aux_nombre = elem_Nombre.getText().toString();
- String aux_club = elem_Club.getText().toString();
- String aux_categoria = elem_Categoria.getText().toString();
- String aux_sexo = elem_Sexo.getText().toString();
- String aux_dias = elem_Dias.getText().toString();
- String aux_horas = elem_Horas.getText().toString();
- Intent modify_intent = new Intent(MisGrupos.this, VistaMisGrupos.class);
- modify_intent.putExtra("grupoNombre", aux_nombre);
- modify_intent.putExtra("grupoClub", aux_club);
- modify_intent.putExtra("grupoCategoria", aux_categoria);
- modify_intent.putExtra("grupoSexo", aux_sexo);
- modify_intent.putExtra("grupoDias", aux_dias);
- modify_intent.putExtra("grupoHoras", aux_horas);
- startActivity(modify_intent);
- }
- });
- FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
- fab.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- startActivity(new Intent(view.getContext(), Crear_Grupo.class));
- }
- });
- }
- }
- package com.example.voleycoach;
- public class VistaMisGrupos extends AppCompatActivity {
- private Grupo grupo;
- private ImageView imageView;
- final static int RESULTADO_EDITAR= 1;
- final static int RESULTADO_GALERIA= 2;
- final static int RESULTADO_FOTO= 3;
- private Uri uriFoto;
- TextView vistaGrupo, vistaClub, vistaCategoria, vistaSexo, vistaDias, vistaHoras;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_vista_mis_grupos);
- vistaGrupo = (TextView)findViewById(R.id.nMisGrupo);
- vistaClub = (TextView)findViewById(R.id.nMisClub);
- vistaCategoria = (TextView)findViewById(R.id.nMisCategoria);
- vistaSexo = (TextView)findViewById(R.id.nMisSexo);
- vistaDias = (TextView)findViewById(R.id.nMisHorarios);
- vistaHoras = (TextView)findViewById(R.id.nMisHoras);
- Intent i = getIntent();
- Bundle extras = i.getExtras();
- String vistaAux_Grupo = (String) extras.get("grupoNombre");
- String vistaAux_Club = (String) extras.get("grupoClub");
- String vistaAux_Categoria = (String) extras.get("grupoCategoria");
- String vistaAux_Sexo = (String) extras.get("grupoSexo");
- String vistaAux_Dias = (String) extras.get("grupoDias");
- String vistaAux_Horas = (String) extras.get("grupoHoras");
- vistaGrupo.setText(vistaAux_Grupo);
- vistaClub.setText(vistaAux_Club);
- vistaCategoria.setText(vistaAux_Categoria);
- vistaSexo.setText(vistaAux_Sexo);
- vistaDias.setText(vistaAux_Dias);
- vistaHoras.setText(vistaAux_Horas);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.vista_grupo, menu);
- return true;
- }
- @Override
- public boolean onSupportNavigateUp() {
- onBackPressed();
- return true;
- }
- <?xml version="1.0" encoding="utf-8"?>
- <android.support.design.widget.CoordinatorLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true"
- tools:context="com.example.voleycoach.MisGrupos">
- <android.support.design.widget.AppBarLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:theme="@style/AppTheme.AppBarOverlay">
- <android.support.v7.widget.Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- android:background="?attr/colorPrimary"
- app:popupTheme="@style/AppTheme.PopupOverlay" />
- </android.support.design.widget.AppBarLayout>
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/fab"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|end"
- android:layout_margin="@dimen/fab_margin"
- app:srcCompat="@android:drawable/ic_input_add" />
- <ListView
- android:id="@+id/listViewGrupos"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="55dp"
- android:dividerHeight="2dp"></ListView>
- </android.support.design.widget.CoordinatorLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <android.support.constraint.ConstraintLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context="com.example.voleycoach.VistaMisGrupos">
- <LinearLayout
- android:layout_width="368dp"
- android:layout_height="495dp"
- android:orientation="vertical"
- tools:layout_editor_absoluteY="8dp"
- tools:layout_editor_absoluteX="8dp">
- <ScrollView
- android:id="@+id/scrollView1"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:layout_editor_absoluteX="8dp"
- tools:layout_editor_absoluteY="8dp">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <ImageView
- android:id="@+id/imageGrupo"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- app:srcCompat="@android:drawable/ic_menu_report_image"
- />
- <ImageView
- android:id="@+id/imageView4"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:contentDescription="logo galeria"
- android:onClick="galeria"
- app:srcCompat="@android:drawable/ic_menu_camera" />
- <ImageView
- android:id="@+id/imageView2"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:contentDescription="logo galeria"
- android:onClick="galeria"
- app:srcCompat="@android:drawable/ic_menu_gallery" />
- <ImageView
- android:id="@+id/imageView3"
- android:layout_width="match_parent"
- android:layout_height="70dp"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:contentDescription="Eliminar foto"
- android:onClick="eliminarFoto"
- android:src="@android:drawable/ic_menu_close_clear_cancel" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_margin="5dp"
- android:layout_marginBottom="10dp"
- android:layout_marginTop="10dp"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/t_MisGrupo"
- android:layout_width="185dp"
- android:layout_height="wrap_content"
- android:text="Nombre del Grupo:"
- android:textSize="18sp" />
- <TextView
- android:id="@+id/nMisGrupo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Grupo"
- android:textAlignment="center"
- android:textSize="18sp" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="20dp"
- android:layout_marginTop="20dp"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/t_MisClub"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Club: "
- android:textSize="18sp" />
- <TextView
- android:id="@+id/nMisClub"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Club"
- android:textAlignment="center"
- android:textSize="18sp" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/t_MisCategoria"
- android:layout_width="105dp"
- android:layout_height="wrap_content"
- android:text="Categoría: "
- android:textSize="18sp" />
- <TextView
- android:id="@+id/nMisCategoria"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Categoria"
- android:textAlignment="center"
- android:textSize="18sp" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="20dp"
- android:layout_marginTop="20dp"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/t_MisSexo"
- android:layout_width="108dp"
- android:layout_height="wrap_content"
- android:text="Sexo:"
- android:textSize="18sp" />
- <TextView
- android:id="@+id/nMisSexo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Sexo"
- android:textAlignment="center"
- android:textSize="18sp" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="20dp"
- android:layout_marginTop="20dp"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/n_MisEntrenos"
- android:layout_width="144dp"
- android:layout_height="wrap_content"
- android:text="Entrenamientos:"
- android:textSize="18sp" />
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical">
- <TextView
- android:id="@+id/nMisHorarios"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="10dp"
- android:layout_marginTop="10dp"
- android:layout_weight="1"
- android:text="Dias"
- android:textAlignment="center"
- android:textSize="18sp" />
- <TextView
- android:id="@+id/nMisHoras"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="10dp"
- android:layout_weight="1"
- android:text="Horas"
- android:textAlignment="center"
- android:textSize="18sp" />
- </LinearLayout>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <Button
- android:id="@+id/btAsistencia"
- style="@android:style/Widget.Button.Inset"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Asistencia" />
- <Button
- android:id="@+id/btJugadoras"
- style="@android:style/Widget.Button.Inset"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Jugadoras" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <Button
- android:id="@+id/btFisico"
- style="@android:style/Widget.Button.Inset"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0.90"
- android:text="Datos Físicos" />
- <Button
- android:id="@+id/btCalendario"
- style="@android:style/Widget.Button.Inset"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Calendario" />
- </LinearLayout>
- </LinearLayout>
- </ScrollView>
- </LinearLayout>
- <include layout="@layout/content_vista_mis_grupos"/>
- </android.support.constraint.ConstraintLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement