Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of github.com:canoo/HackergartenApp

  • Loading branch information...
commit ef243b21951dd438a797b19bfa2e0433d2fd641f 2 parents 2d45ef0 + 3380f73
HamletDRC HamletDRC authored
11 AndroidManifest.xml
@@ -2,9 +2,13 @@
2 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3 package="net.hackergarten.android.app" android:versionCode="1"
4 4 android:versionName="1.0">
5   - <uses-sdk android:minSdkVersion="10" />
  5 + <uses-sdk android:targetSdkVersion="10" />
6 6
7   - <application android:icon="@drawable/icon" android:label="@string/app_name">
  7 + <application
  8 + android:icon="@drawable/icon"
  9 + android:label="@string/app_name"
  10 + android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
  11 +
8 12 <activity android:name=".MainActivity"
9 13 android:label="@string/app_name">
10 14 <intent-filter>
@@ -13,10 +17,11 @@
13 17 </intent-filter>
14 18 </activity>
15 19 <activity android:name=".RegisterActivity" />
  20 + <activity android:name=".EventDetailActivity" />
16 21
17 22 </application>
18 23 <uses-permission android:name="android.permission.INTERNET" />
19 24 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
20 25 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
21 26 <uses-permission android:name="android.permission.GET_ACCOUNTS" />
22   -</manifest>
  27 +</manifest>
BIN  res/drawable/icon.png
65 res/layout/event_detail.xml
... ... @@ -0,0 +1,65 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:orientation="vertical"
  4 + android:layout_width="fill_parent"
  5 + android:layout_height="fill_parent"
  6 + >
  7 +<TextView
  8 + android:id="@+id/eventDetailSubject"
  9 + android:layout_width="fill_parent"
  10 + android:layout_height="wrap_content"
  11 + android:text="@string/test_event_detail"
  12 + android:textSize="20dp"
  13 + />
  14 +
  15 +<TableLayout android:id="@+id/eventDetailTable" android:layout_width="fill_parent" android:layout_height="wrap_content">
  16 + <TableRow android:id="@+id/tableRow1" android:layout_width="fill_parent" android:layout_height="wrap_content">
  17 + <TextView
  18 + android:layout_height="wrap_content"
  19 + android:text="@string/event_detail_location"
  20 + android:textAppearance="?android:attr/textAppearanceMedium"
  21 + android:layout_width="match_parent" />
  22 + <EditText
  23 + android:id="@+id/eventDetailLocation"
  24 + android:layout_height="wrap_content"
  25 + android:layout_width="200dp"
  26 + android:editable="false" />
  27 + </TableRow>
  28 + <TableRow android:id="@+id/tableRow2" android:layout_width="fill_parent" android:layout_height="wrap_content">
  29 + <TextView
  30 + android:layout_height="wrap_content"
  31 + android:text="@string/event_detail_description"
  32 + android:textAppearance="?android:attr/textAppearanceMedium"
  33 + android:layout_width="match_parent" />
  34 + <EditText
  35 + android:id="@+id/eventDetailDescription"
  36 + android:layout_height="wrap_content"
  37 + android:layout_width="fill_parent"
  38 + android:editable="false" />
  39 + </TableRow>
  40 + <TableRow android:id="@+id/tableRow3" android:layout_width="fill_parent" android:layout_height="wrap_content">
  41 + <TextView
  42 + android:layout_height="wrap_content"
  43 + android:text="@string/event_detail_time"
  44 + android:textAppearance="?android:attr/textAppearanceMedium"
  45 + android:layout_width="match_parent" />
  46 + <EditText
  47 + android:id="@+id/eventDetailTime"
  48 + android:layout_height="wrap_content"
  49 + android:layout_width="fill_parent"
  50 + android:editable="false" />
  51 + </TableRow>
  52 + <TableRow android:id="@+id/tableRow4" android:layout_width="fill_parent" android:layout_height="wrap_content">
  53 + <TextView
  54 + android:layout_height="wrap_content"
  55 + android:text="@string/event_detail_initiator"
  56 + android:textAppearance="?android:attr/textAppearanceMedium"
  57 + android:layout_width="match_parent" />
  58 + <EditText
  59 + android:id="@+id/eventDetailInitiator"
  60 + android:layout_height="wrap_content"
  61 + android:layout_width="fill_parent"
  62 + android:editable="false" />
  63 + </TableRow>
  64 +</TableLayout>
  65 +</LinearLayout>
8 res/values/strings.xml
@@ -16,8 +16,16 @@
16 16 <string name="register_success">Look at you, Hacker, we got you registered.</string>
17 17 <string name="checkin">Check In!</string>
18 18
  19 + <string name="event_detail_location">Location</string>
  20 + <string name="event_detail_description">Description</string>
  21 + <string name="event_detail_time">Time</string>
  22 + <string name="event_detail_initiator">Initiator</string>
  23 +
19 24 <string name="test_event_subject">Android Hackergarten @Canoo</string>
20 25 <string name="test_event_description">The goal of this Hackergarten is to write a base Android Hackergarten app.</string>
21 26 <string name="test_event_date">28.9.2011</string>
22 27
  28 + <string name="test_event_detail">Android Hackergarten</string>
  29 +
  30 +
23 31 </resources>
4 src/net/hackergarten/android/app/EventArrayListAdapter.java
@@ -52,6 +52,10 @@ public void setEntries(List<Event> entries) {
52 52 this.entries = entries;
53 53 notifyObserversChanged();
54 54 }
  55 +
  56 + public List<Event> getEntries() {
  57 + return entries;
  58 + }
55 59
56 60 // Adapter impl.
57 61
25 src/net/hackergarten/android/app/EventDetailActivity.java
... ... @@ -1,13 +1,32 @@
1 1 package net.hackergarten.android.app;
2 2
  3 +import net.hackergarten.android.app.model.Event;
3 4 import android.app.Activity;
4 5 import android.os.Bundle;
  6 +import android.view.View;
  7 +import android.widget.TextView;
5 8
6 9 public class EventDetailActivity extends Activity {
7   - /** Called when the activity is first created. */
8   - @Override
  10 +
  11 + @Override
9 12 public void onCreate(Bundle savedInstanceState) {
10 13 super.onCreate(savedInstanceState);
11   - setContentView(R.layout.main);
  14 +
  15 + Event event = (Event) getIntent().getExtras().get("event");
  16 +
  17 + View detailView = getLayoutInflater().inflate(R.layout.event_detail, null);
  18 + TextView subjectView = (TextView) detailView.findViewById(R.id.eventDetailSubject);
  19 + subjectView.setText(event.getSubject());
  20 + TextView locationView = (TextView) detailView.findViewById(R.id.eventDetailLocation);
  21 + locationView.setText(event.getLocation());
  22 + TextView descriptionView = (TextView) detailView.findViewById(R.id.eventDetailDescription);
  23 + descriptionView.setText(event.getDescription());
  24 + TextView timeView = (TextView) detailView.findViewById(R.id.eventDetailTime);
  25 + timeView.setText(event.getTimeUST().toLocaleString());
  26 + TextView initiatorView = (TextView) detailView.findViewById(R.id.eventDetailInitiator);
  27 + initiatorView.setText(event.getInitiator());
  28 +
  29 + setContentView(detailView);
12 30 }
  31 +
13 32 }
16 src/net/hackergarten/android/app/MainActivity.java
@@ -11,6 +11,8 @@
11 11 import android.util.Log;
12 12 import android.view.View;
13 13 import android.view.View.OnClickListener;
  14 +import android.widget.AdapterView;
  15 +import android.widget.AdapterView.OnItemClickListener;
14 16 import android.widget.Button;
15 17 import android.widget.LinearLayout;
16 18 import android.widget.ListView;
@@ -30,6 +32,16 @@ public void onCreate(Bundle savedInstanceState) {
30 32 LinearLayout listLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.main, null);
31 33 ListView listView = (ListView) listLayout.findViewById(R.id.eventListView);
32 34 fEventAdapter = new EventArrayListAdapter(this, getLayoutInflater());
  35 + listView.setOnItemClickListener(new OnItemClickListener() {
  36 +
  37 + public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  38 + Event event = fEventAdapter.getEntries().get(position);
  39 + Intent intent = new Intent(MainActivity.this, EventDetailActivity.class);
  40 + intent.putExtra("event", event);
  41 + startActivity(intent);
  42 + }
  43 +
  44 + });
33 45 listView.setAdapter(fEventAdapter);
34 46
35 47
@@ -73,7 +85,7 @@ public void onFailure(final Throwable t) {
73 85 runOnUiThread(new Runnable() {
74 86
75 87 public void run() {
76   - Toast.makeText(MainActivity.this, "Failed to query server.", Toast.LENGTH_LONG);
  88 + Toast.makeText(MainActivity.this, "Failed to contact server.", Toast.LENGTH_LONG).show();
77 89 Log.e(MainActivity.class.getName(), "Failed to contact server.", t);
78 90 }
79 91 });
@@ -83,4 +95,4 @@ public void run() {
83 95 });
84 96 }
85 97
86   -}
  98 +}
3  src/net/hackergarten/android/app/model/Event.java
... ... @@ -1,8 +1,9 @@
1 1 package net.hackergarten.android.app.model;
2 2
  3 +import java.io.Serializable;
3 4 import java.util.Date;
4 5
5   -public class Event {
  6 +public class Event implements Serializable {
6 7
7 8 private String id;
8 9 private String location;

0 comments on commit ef243b2

Please sign in to comment.
Something went wrong with that request. Please try again.