Skip to content

Commit

Permalink
New buttons for AddUserActivity.java (back and save)
Browse files Browse the repository at this point in the history
Resized buttons in PickUsername.java
Reset username when clicking on back button in PickUsername.java
New image for "New user" icon in PickUsername.java
New binary.
  • Loading branch information
Donnerbart committed Oct 30, 2013
1 parent 31c8492 commit 2a047dc
Show file tree
Hide file tree
Showing 29 changed files with 135 additions and 108 deletions.
Binary file added gfx/add_person.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/add_person.xcf
Binary file not shown.
Binary file modified meteroid/meteroid-meteroid.apk
Binary file not shown.
24 changes: 12 additions & 12 deletions meteroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.chaosdorf.meteroid"
android:versionCode="3"
android:versionName="1.2">
package="de.chaosdorf.meteroid"
android:versionCode="4"
android:versionName="1.3">

<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
android:targetSdkVersion="18"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:allowBackup="true"
Expand All @@ -21,26 +21,26 @@
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity
android:name=".SetHostname"
android:label="@string/set_hostname_label" />
android:label="@string/set_hostname_label"/>

<activity
android:name=".PickUsername"
android:label="@string/pick_username_label" />
android:label="@string/pick_username_label"/>

<activity
android:name=".BuyDrink"
android:label="@string/app_name" />
android:label="@string/buy_drink_label"/>

<activity
android:name=".AddUserActivity"
android:label="@string/app_name" />
android:label="@string/add_user_label"/>

</application>

Expand Down
15 changes: 13 additions & 2 deletions meteroid/src/main/java/de/chaosdorf/meteroid/AddUserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import java.util.Date;
Expand All @@ -28,13 +28,24 @@ protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
activity = this;
setContentView(R.layout.activity_add_user);
Button addButton = (Button) findViewById(R.id.button_add_user);

final TextView usernameText = (TextView) findViewById(R.id.username);
final TextView emailText = (TextView) findViewById(R.id.email);
final TextView balanceText = (TextView) findViewById(R.id.balance);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

final ImageButton backButton = (ImageButton) findViewById(R.id.button_back);
backButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
Intent intent = new Intent(activity, PickUsername.class);
startActivity(intent);
finish();
}
});

final ImageButton addButton = (ImageButton) findViewById(R.id.button_add_user);
addButton.setOnClickListener(new View.OnClickListener()
{
@Override
Expand Down
1 change: 1 addition & 0 deletions meteroid/src/main/java/de/chaosdorf/meteroid/BuyDrink.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected void onCreate(Bundle savedInstanceState)
{
public void onClick(View view)
{
Utility.resetUsername(activity);
Intent intent = new Intent(activity, PickUsername.class);
startActivity(intent);
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ public View getView(int position, View convertView, ViewGroup parent)
icon.setContentDescription(user.getName());
label.setText(user.getName());

if (user.getId() == NEW_USER_ID)
{
icon.setImageDrawable(getResources().getDrawable(R.drawable.add_person));
}

return view;
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added meteroid/src/main/res/drawable/add_person.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added meteroid/src/main/res/drawable/button_save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 34 additions & 23 deletions meteroid/src/main/res/layout/activity_add_user.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".AddUserActivity">

<TextView
android:id="@+id/text"
android:text="@string/add_user_label"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".AddUserActivity">

<EditText
android:id="@+id/username"
android:hint="@string/add_user_username"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:password="false"
android:phoneNumber="false" />
android:phoneNumber="false"/>

<EditText
android:id="@+id/email"
Expand All @@ -32,7 +26,7 @@
android:layout_width="fill_parent"
android:password="false"
android:phoneNumber="false"
android:inputType="textEmailAddress" />
android:inputType="textEmailAddress"/>

<EditText
android:id="@+id/balance"
Expand All @@ -41,13 +35,30 @@
android:layout_width="fill_parent"
android:password="false"
android:phoneNumber="false"
android:numeric="decimal" />
android:numeric="decimal"/>

<Button
android:layout_width="wrap_content"
<LinearLayout
android:layout_height="wrap_content"
android:text="@string/button_add"
android:id="@+id/button_add_user"
android:layout_gravity="center" />
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_gravity="right"
>

<ImageButton
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/button_back"
android:contentDescription="@string/button_back"/>

<ImageButton
android:id="@+id/button_add_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/button_save"
android:contentDescription="@string/button_save"/>

</LinearLayout>

</LinearLayout>
44 changes: 22 additions & 22 deletions meteroid/src/main/res/layout/activity_buy_drink.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".BuyDrink">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".BuyDrink">

<!-- Display user data -->
<LinearLayout
Expand All @@ -21,7 +21,7 @@
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name" />
android:contentDescription="@string/app_name"/>

<LinearLayout
android:orientation="vertical"
Expand All @@ -34,32 +34,32 @@
android:layout_width="200dp"
android:paddingLeft="9dip"
android:layout_height="wrap_content"
android:textSize="16sp" />
android:textSize="16sp"/>

<TextView
android:id="@+id/balance"
android:layout_width="200dp"
android:paddingLeft="9dip"
android:layout_height="wrap_content"
android:textSize="16sp" />
android:textSize="16sp"/>

</LinearLayout>

<ImageButton
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="right"
android:src="@drawable/navigation_back"
android:contentDescription="@string/button_back" />
android:src="@drawable/button_back"
android:contentDescription="@string/button_back"/>

<ImageButton
android:id="@+id/button_reload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="right"
android:src="@drawable/navigation_reload"
android:contentDescription="@string/button_reload" />
android:src="@drawable/button_reload"
android:contentDescription="@string/button_reload"/>

</LinearLayout>

Expand All @@ -69,14 +69,14 @@
android:layout_height="fill_parent"
android:textSize="16sp"
android:visibility="gone"
android:text="@string/buy_drink_error" />
android:text="@string/buy_drink_error"/>

<!-- Display drinks -->
<ListView
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:drawSelectorOnTop="false" />
android:drawSelectorOnTop="false"/>

</LinearLayout>
12 changes: 6 additions & 6 deletions meteroid/src/main/res/layout/activity_buy_drink_item.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="80dip"
android:gravity="center_vertical"
android:ignoreGravity="@+id/icon">
android:layout_width="fill_parent"
android:layout_height="80dip"
android:gravity="center_vertical"
android:ignoreGravity="@+id/icon">

<ImageView
android:id="@+id/icon"
Expand All @@ -13,14 +13,14 @@
android:layout_alignParentBottom="true"
android:layout_width="70dp"
android:layout_height="70dp"
android:contentDescription="@string/app_name" />
android:contentDescription="@string/app_name"/>

<TextView
android:id="@+id/label"
android:paddingLeft="9dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/icon"
android:textSize="16sp" />
android:textSize="16sp"/>

</RelativeLayout>
30 changes: 15 additions & 15 deletions meteroid/src/main/res/layout/activity_pick_username.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".PickUsername">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".PickUsername">

<LinearLayout
android:id="@+id/pick_username_error"
Expand All @@ -21,7 +21,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="@string/pick_username_error" />
android:text="@string/pick_username_error"/>

<LinearLayout
android:layout_height="wrap_content"
Expand All @@ -34,16 +34,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/navigation_back"
android:contentDescription="@string/button_back" />
android:src="@drawable/button_back"
android:contentDescription="@string/button_back"/>

<ImageButton
android:id="@+id/button_reload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/navigation_reload"
android:contentDescription="@string/button_reload" />
android:src="@drawable/button_reload"
android:contentDescription="@string/button_reload"/>

</LinearLayout>
</LinearLayout>
Expand All @@ -56,9 +56,9 @@
android:layout_height="fill_parent"
android:columnWidth="100dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:verticalSpacing="12dp"
android:horizontalSpacing="5dp"
android:stretchMode="columnWidth"
android:gravity="center" />
android:gravity="center"/>

</RelativeLayout>
Loading

0 comments on commit 2a047dc

Please sign in to comment.