Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.96 KB | None | 0 0
  1. package com.example.voleycoach;
  2. import android.content.Intent;
  3. import android.database.Cursor;
  4. import android.os.Bundle;
  5. import android.support.design.widget.FloatingActionButton;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.support.v7.widget.Toolbar;
  8. import android.view.View;
  9. import android.widget.AdapterView;
  10. import android.widget.ListView;
  11. import android.widget.SimpleCursorAdapter;
  12. import android.widget.TextView;
  13.  
  14. public class MisGrupos extends AppCompatActivity {
  15.  
  16. ListView lista;
  17. public static final String EXTRA_GRUPO_ID = "extra_grupo_id";
  18. GruposSQLiteHelper dbGrupos;
  19.  
  20. TextView elem_Nombre, elem_Club, elem_Categoria, elem_Sexo, elem_Dias, elem_Horas;
  21.  
  22. @Override
  23. protected void onCreate(Bundle savedInstanceState) {
  24. super.onCreate(savedInstanceState);
  25. setContentView(R.layout.activity_mis_grupos);
  26. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  27. setSupportActionBar(toolbar);
  28.  
  29. elem_Nombre = (TextView)findViewById(R.id.nombre_grupo);
  30. elem_Club = (TextView)findViewById(R.id.nombre_club);
  31. elem_Categoria = (TextView)findViewById(R.id.nombre_categoria);
  32. elem_Sexo = (TextView)findViewById(R.id.nombre_sexo);
  33. elem_Dias = (TextView)findViewById(R.id.nombre_dias);
  34. elem_Horas = (TextView)findViewById(R.id.nombre_horas);
  35.  
  36. lista = (ListView) findViewById(R.id.listViewGrupos);
  37.  
  38. dbGrupos = new GruposSQLiteHelper(this);
  39. Cursor cursor = dbGrupos.leerDatos();
  40.  
  41. String[] from = new String[]{
  42. dbGrupos.COLUMNA_NOMBRE,
  43. dbGrupos.COLUMNA_CLUB, dbGrupos.COLUMNA_CATEGORIA,
  44. dbGrupos.COLUMNA_SEXO, dbGrupos.COLUMNA_DIAS, dbGrupos.COLUMNA_HORARIOS};
  45.  
  46. int[] to = new int[]{R.id.nombre_grupo,
  47. R.id.nombre_club, R.id.nombre_categoria,
  48. R.id.nombre_sexo, R.id.nombre_dias, R.id.nombre_horas};
  49.  
  50. SimpleCursorAdapter adapter = new SimpleCursorAdapter(MisGrupos.this,
  51. R.layout.elemento_lista, cursor, from, to, 0);
  52.  
  53. adapter.notifyDataSetChanged();
  54.  
  55. lista.setAdapter(adapter);
  56. lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  57. @Override
  58. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  59.  
  60. String aux_nombre = elem_Nombre.getText().toString();
  61. String aux_club = elem_Club.getText().toString();
  62. String aux_categoria = elem_Categoria.getText().toString();
  63. String aux_sexo = elem_Sexo.getText().toString();
  64. String aux_dias = elem_Dias.getText().toString();
  65. String aux_horas = elem_Horas.getText().toString();
  66.  
  67. Intent modify_intent = new Intent(MisGrupos.this, VistaMisGrupos.class);
  68. modify_intent.putExtra("grupoNombre", aux_nombre);
  69. modify_intent.putExtra("grupoClub", aux_club);
  70. modify_intent.putExtra("grupoCategoria", aux_categoria);
  71. modify_intent.putExtra("grupoSexo", aux_sexo);
  72. modify_intent.putExtra("grupoDias", aux_dias);
  73. modify_intent.putExtra("grupoHoras", aux_horas);
  74.  
  75. startActivity(modify_intent);
  76. }
  77. });
  78.  
  79. FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
  80. fab.setOnClickListener(new View.OnClickListener() {
  81. @Override
  82. public void onClick(View view) {
  83. startActivity(new Intent(view.getContext(), Crear_Grupo.class));
  84. }
  85. });
  86.  
  87. }
  88.  
  89. }
  90.  
  91. package com.example.voleycoach;
  92.  
  93. public class VistaMisGrupos extends AppCompatActivity {
  94.  
  95. private Grupo grupo;
  96. private ImageView imageView;
  97. final static int RESULTADO_EDITAR= 1;
  98. final static int RESULTADO_GALERIA= 2;
  99. final static int RESULTADO_FOTO= 3;
  100. private Uri uriFoto;
  101.  
  102. TextView vistaGrupo, vistaClub, vistaCategoria, vistaSexo, vistaDias, vistaHoras;
  103.  
  104. @Override
  105. protected void onCreate(Bundle savedInstanceState) {
  106. super.onCreate(savedInstanceState);
  107. setContentView(R.layout.activity_vista_mis_grupos);
  108.  
  109. vistaGrupo = (TextView)findViewById(R.id.nMisGrupo);
  110. vistaClub = (TextView)findViewById(R.id.nMisClub);
  111. vistaCategoria = (TextView)findViewById(R.id.nMisCategoria);
  112. vistaSexo = (TextView)findViewById(R.id.nMisSexo);
  113. vistaDias = (TextView)findViewById(R.id.nMisHorarios);
  114. vistaHoras = (TextView)findViewById(R.id.nMisHoras);
  115.  
  116. Intent i = getIntent();
  117. Bundle extras = i.getExtras();
  118.  
  119. String vistaAux_Grupo = (String) extras.get("grupoNombre");
  120. String vistaAux_Club = (String) extras.get("grupoClub");
  121. String vistaAux_Categoria = (String) extras.get("grupoCategoria");
  122. String vistaAux_Sexo = (String) extras.get("grupoSexo");
  123. String vistaAux_Dias = (String) extras.get("grupoDias");
  124. String vistaAux_Horas = (String) extras.get("grupoHoras");
  125.  
  126.  
  127. vistaGrupo.setText(vistaAux_Grupo);
  128. vistaClub.setText(vistaAux_Club);
  129. vistaCategoria.setText(vistaAux_Categoria);
  130. vistaSexo.setText(vistaAux_Sexo);
  131. vistaDias.setText(vistaAux_Dias);
  132. vistaHoras.setText(vistaAux_Horas);
  133.  
  134. }
  135.  
  136. @Override
  137. public boolean onCreateOptionsMenu(Menu menu) {
  138. getMenuInflater().inflate(R.menu.vista_grupo, menu);
  139. return true;
  140. }
  141.  
  142. @Override
  143. public boolean onSupportNavigateUp() {
  144. onBackPressed();
  145. return true;
  146. }
  147.  
  148. <?xml version="1.0" encoding="utf-8"?>
  149. <android.support.design.widget.CoordinatorLayout
  150. xmlns:android="http://schemas.android.com/apk/res/android"
  151. xmlns:app="http://schemas.android.com/apk/res-auto"
  152. xmlns:tools="http://schemas.android.com/tools"
  153. android:layout_width="match_parent"
  154. android:layout_height="match_parent"
  155. android:fitsSystemWindows="true"
  156. tools:context="com.example.voleycoach.MisGrupos">
  157.  
  158. <android.support.design.widget.AppBarLayout
  159. android:layout_width="match_parent"
  160. android:layout_height="wrap_content"
  161. android:theme="@style/AppTheme.AppBarOverlay">
  162.  
  163. <android.support.v7.widget.Toolbar
  164. android:id="@+id/toolbar"
  165. android:layout_width="match_parent"
  166. android:layout_height="?attr/actionBarSize"
  167. android:background="?attr/colorPrimary"
  168. app:popupTheme="@style/AppTheme.PopupOverlay" />
  169.  
  170. </android.support.design.widget.AppBarLayout>
  171.  
  172.  
  173. <android.support.design.widget.FloatingActionButton
  174. android:id="@+id/fab"
  175. android:layout_width="wrap_content"
  176. android:layout_height="wrap_content"
  177. android:layout_gravity="bottom|end"
  178. android:layout_margin="@dimen/fab_margin"
  179. app:srcCompat="@android:drawable/ic_input_add" />
  180.  
  181. <ListView
  182. android:id="@+id/listViewGrupos"
  183. android:layout_width="match_parent"
  184. android:layout_height="match_parent"
  185. android:layout_marginTop="55dp"
  186. android:dividerHeight="2dp"></ListView>
  187.  
  188. </android.support.design.widget.CoordinatorLayout>
  189.  
  190. <?xml version="1.0" encoding="utf-8"?>
  191. <android.support.constraint.ConstraintLayout
  192. xmlns:android="http://schemas.android.com/apk/res/android"
  193. xmlns:app="http://schemas.android.com/apk/res-auto"
  194. xmlns:tools="http://schemas.android.com/tools"
  195. android:layout_width="match_parent"
  196. android:layout_height="match_parent"
  197. tools:context="com.example.voleycoach.VistaMisGrupos">
  198.  
  199. <LinearLayout
  200. android:layout_width="368dp"
  201. android:layout_height="495dp"
  202. android:orientation="vertical"
  203. tools:layout_editor_absoluteY="8dp"
  204. tools:layout_editor_absoluteX="8dp">
  205.  
  206. <ScrollView
  207. android:id="@+id/scrollView1"
  208. android:layout_width="match_parent"
  209. android:layout_height="match_parent"
  210. tools:layout_editor_absoluteX="8dp"
  211. tools:layout_editor_absoluteY="8dp">
  212.  
  213. <LinearLayout
  214. android:layout_width="match_parent"
  215. android:layout_height="wrap_content"
  216. android:orientation="vertical">
  217.  
  218. <LinearLayout
  219. android:layout_width="match_parent"
  220. android:layout_height="match_parent"
  221. android:orientation="horizontal">
  222.  
  223. <ImageView
  224. android:id="@+id/imageGrupo"
  225. android:layout_width="match_parent"
  226. android:layout_height="match_parent"
  227. android:layout_weight="1"
  228. app:srcCompat="@android:drawable/ic_menu_report_image"
  229. />
  230.  
  231. <ImageView
  232. android:id="@+id/imageView4"
  233. android:layout_width="match_parent"
  234. android:layout_height="match_parent"
  235. android:layout_gravity="center_vertical"
  236. android:layout_weight="1"
  237. android:contentDescription="logo galeria"
  238. android:onClick="galeria"
  239. app:srcCompat="@android:drawable/ic_menu_camera" />
  240.  
  241. <ImageView
  242. android:id="@+id/imageView2"
  243. android:layout_width="match_parent"
  244. android:layout_height="match_parent"
  245. android:layout_gravity="center_vertical"
  246. android:layout_weight="1"
  247. android:contentDescription="logo galeria"
  248. android:onClick="galeria"
  249. app:srcCompat="@android:drawable/ic_menu_gallery" />
  250.  
  251. <ImageView
  252. android:id="@+id/imageView3"
  253. android:layout_width="match_parent"
  254. android:layout_height="70dp"
  255. android:layout_gravity="center_vertical"
  256. android:layout_weight="1"
  257. android:contentDescription="Eliminar foto"
  258. android:onClick="eliminarFoto"
  259.  
  260. android:src="@android:drawable/ic_menu_close_clear_cancel" />
  261.  
  262. </LinearLayout>
  263.  
  264. <LinearLayout
  265. android:layout_width="match_parent"
  266. android:layout_height="match_parent"
  267. android:layout_margin="5dp"
  268. android:layout_marginBottom="10dp"
  269. android:layout_marginTop="10dp"
  270. android:orientation="horizontal">
  271.  
  272. <TextView
  273. android:id="@+id/t_MisGrupo"
  274. android:layout_width="185dp"
  275. android:layout_height="wrap_content"
  276. android:text="Nombre del Grupo:"
  277. android:textSize="18sp" />
  278.  
  279. <TextView
  280. android:id="@+id/nMisGrupo"
  281. android:layout_width="wrap_content"
  282. android:layout_height="wrap_content"
  283. android:layout_weight="1"
  284. android:text="Grupo"
  285. android:textAlignment="center"
  286. android:textSize="18sp" />
  287.  
  288. </LinearLayout>
  289.  
  290. <LinearLayout
  291. android:layout_width="match_parent"
  292. android:layout_height="match_parent"
  293. android:layout_marginBottom="20dp"
  294. android:layout_marginTop="20dp"
  295. android:orientation="horizontal">
  296.  
  297. <TextView
  298. android:id="@+id/t_MisClub"
  299. android:layout_width="wrap_content"
  300. android:layout_height="wrap_content"
  301. android:layout_weight="1"
  302. android:text="Club: "
  303. android:textSize="18sp" />
  304.  
  305. <TextView
  306. android:id="@+id/nMisClub"
  307. android:layout_width="wrap_content"
  308. android:layout_height="wrap_content"
  309. android:layout_weight="1"
  310. android:text="Club"
  311. android:textAlignment="center"
  312. android:textSize="18sp" />
  313.  
  314. </LinearLayout>
  315.  
  316. <LinearLayout
  317. android:layout_width="match_parent"
  318. android:layout_height="match_parent"
  319. android:orientation="horizontal">
  320.  
  321. <TextView
  322. android:id="@+id/t_MisCategoria"
  323. android:layout_width="105dp"
  324. android:layout_height="wrap_content"
  325. android:text="Categoría: "
  326. android:textSize="18sp" />
  327.  
  328. <TextView
  329. android:id="@+id/nMisCategoria"
  330. android:layout_width="wrap_content"
  331. android:layout_height="wrap_content"
  332. android:layout_weight="1"
  333. android:text="Categoria"
  334. android:textAlignment="center"
  335. android:textSize="18sp" />
  336.  
  337. </LinearLayout>
  338.  
  339. <LinearLayout
  340. android:layout_width="match_parent"
  341. android:layout_height="match_parent"
  342. android:layout_marginBottom="20dp"
  343. android:layout_marginTop="20dp"
  344. android:orientation="horizontal">
  345.  
  346. <TextView
  347. android:id="@+id/t_MisSexo"
  348. android:layout_width="108dp"
  349. android:layout_height="wrap_content"
  350. android:text="Sexo:"
  351. android:textSize="18sp" />
  352.  
  353. <TextView
  354. android:id="@+id/nMisSexo"
  355. android:layout_width="wrap_content"
  356. android:layout_height="wrap_content"
  357. android:layout_weight="1"
  358. android:text="Sexo"
  359. android:textAlignment="center"
  360. android:textSize="18sp" />
  361.  
  362. </LinearLayout>
  363.  
  364. <LinearLayout
  365. android:layout_width="match_parent"
  366. android:layout_height="match_parent"
  367. android:layout_marginBottom="20dp"
  368. android:layout_marginTop="20dp"
  369. android:orientation="horizontal">
  370.  
  371. <TextView
  372. android:id="@+id/n_MisEntrenos"
  373. android:layout_width="144dp"
  374. android:layout_height="wrap_content"
  375. android:text="Entrenamientos:"
  376. android:textSize="18sp" />
  377.  
  378. <LinearLayout
  379. android:layout_width="match_parent"
  380. android:layout_height="wrap_content"
  381. android:layout_weight="1"
  382. android:orientation="vertical">
  383.  
  384. <TextView
  385. android:id="@+id/nMisHorarios"
  386. android:layout_width="match_parent"
  387. android:layout_height="wrap_content"
  388. android:layout_marginBottom="10dp"
  389. android:layout_marginTop="10dp"
  390. android:layout_weight="1"
  391. android:text="Dias"
  392. android:textAlignment="center"
  393. android:textSize="18sp" />
  394.  
  395. <TextView
  396. android:id="@+id/nMisHoras"
  397. android:layout_width="match_parent"
  398. android:layout_height="wrap_content"
  399. android:layout_marginBottom="10dp"
  400. android:layout_weight="1"
  401. android:text="Horas"
  402. android:textAlignment="center"
  403. android:textSize="18sp" />
  404.  
  405. </LinearLayout>
  406.  
  407. </LinearLayout>
  408.  
  409. <LinearLayout
  410. android:layout_width="match_parent"
  411. android:layout_height="match_parent"
  412. android:orientation="horizontal">
  413.  
  414. <Button
  415. android:id="@+id/btAsistencia"
  416. style="@android:style/Widget.Button.Inset"
  417. android:layout_width="match_parent"
  418. android:layout_height="wrap_content"
  419. android:layout_weight="1"
  420. android:text="Asistencia" />
  421.  
  422. <Button
  423. android:id="@+id/btJugadoras"
  424. style="@android:style/Widget.Button.Inset"
  425. android:layout_width="match_parent"
  426. android:layout_height="wrap_content"
  427. android:layout_weight="1"
  428. android:text="Jugadoras" />
  429. </LinearLayout>
  430.  
  431. <LinearLayout
  432. android:layout_width="match_parent"
  433. android:layout_height="match_parent"
  434. android:orientation="horizontal">
  435.  
  436. <Button
  437. android:id="@+id/btFisico"
  438. style="@android:style/Widget.Button.Inset"
  439. android:layout_width="wrap_content"
  440. android:layout_height="wrap_content"
  441. android:layout_weight="0.90"
  442. android:text="Datos Físicos" />
  443.  
  444. <Button
  445. android:id="@+id/btCalendario"
  446. style="@android:style/Widget.Button.Inset"
  447. android:layout_width="wrap_content"
  448. android:layout_height="wrap_content"
  449. android:layout_weight="1"
  450. android:text="Calendario" />
  451. </LinearLayout>
  452.  
  453. </LinearLayout>
  454. </ScrollView>
  455. </LinearLayout>
  456.  
  457. <include layout="@layout/content_vista_mis_grupos"/>
  458. </android.support.constraint.ConstraintLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement