Skip to content

Commit

Permalink
unopened message and more dynamic profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent Nguyen committed Dec 12, 2013
1 parent b3b9401 commit b32eaff
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 22 deletions.
2 changes: 1 addition & 1 deletion PenPal/gen/android/support/v7/appcompat/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static final class bool {
public static final int abc_split_action_bar_is_narrow = 0x7f070002;
}
public static final class color {
public static final int abc_search_url_text_holo = 0x7f080006;
public static final int abc_search_url_text_holo = 0x7f080007;
public static final int abc_search_url_text_normal = 0x7f080000;
public static final int abc_search_url_text_pressed = 0x7f080002;
public static final int abc_search_url_text_selected = 0x7f080001;
Expand Down
27 changes: 15 additions & 12 deletions PenPal/gen/edu/berkeley/cs160/off_by_1/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -797,10 +797,11 @@ public static final class bool {
public static final int abc_split_action_bar_is_narrow=0x7f070002;
}
public static final class color {
public static final int abc_search_url_text_holo=0x7f080006;
public static final int abc_search_url_text_holo=0x7f080007;
public static final int abc_search_url_text_normal=0x7f080000;
public static final int abc_search_url_text_pressed=0x7f080002;
public static final int abc_search_url_text_selected=0x7f080001;
public static final int black=0x7f080006;
public static final int light_blue=0x7f080003;
public static final int tan=0x7f080004;
public static final int white=0x7f080005;
Expand Down Expand Up @@ -992,17 +993,19 @@ public static final class drawable {
public static final int list_view_button=0x7f02005a;
public static final int list_view_green_button=0x7f02005b;
public static final int list_view_green_button_click=0x7f02005c;
public static final int pen_pal_icon=0x7f02005d;
public static final int pen_pal_text=0x7f02005e;
public static final int profile_icon=0x7f02005f;
public static final int red_button=0x7f020060;
public static final int stamp1=0x7f020061;
public static final int stamp2=0x7f020062;
public static final int stamp3=0x7f020063;
public static final int stamp4=0x7f020064;
public static final int stamp5=0x7f020065;
public static final int sun=0x7f020066;
public static final int top_bar=0x7f020067;
public static final int opened_message=0x7f02005d;
public static final int pen_pal_icon=0x7f02005e;
public static final int pen_pal_text=0x7f02005f;
public static final int profile_icon=0x7f020060;
public static final int red_button=0x7f020061;
public static final int stamp1=0x7f020062;
public static final int stamp2=0x7f020063;
public static final int stamp3=0x7f020064;
public static final int stamp4=0x7f020065;
public static final int stamp5=0x7f020066;
public static final int sun=0x7f020067;
public static final int top_bar=0x7f020068;
public static final int unopened_message=0x7f020069;
}
public static final class id {
public static final int RelativeLayout1=0x7f06004b;
Expand Down
Binary file added PenPal/res/drawable-hdpi/opened_message.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 PenPal/res/drawable-hdpi/unopened_message.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 PenPal/res/drawable-ldpi/opened_message.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 PenPal/res/drawable-ldpi/unopened_message.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 PenPal/res/drawable-mdpi/opened_message.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 PenPal/res/drawable-mdpi/unopened_message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions PenPal/res/layout/activity_friend_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
android:layout_height="wrap_content"
android:background="@color/light_blue"
android:drawableBottom="@drawable/stamp2"
android:text="Natalie"
android:text="Annie"
android:layout_marginTop="42dp"
android:layout_centerHorizontal="true"
android:src="@drawable/stamp2"
Expand All @@ -49,7 +49,7 @@
android:layout_height="wrap_content"
android:background="@color/light_blue"
android:drawableBottom="@drawable/stamp3"
android:text="Lizzet"
android:text="Angus"

android:layout_marginTop="42dp"
android:layout_alignParentRight="true"
Expand Down Expand Up @@ -77,7 +77,7 @@
android:background="@color/light_blue"
android:drawableBottom="@drawable/stamp5"
android:onClick="goToProfile"
android:text="Kevin" />
android:text="Natalie" />

<ImageView
android:id="@+id/sun"
Expand Down
5 changes: 5 additions & 0 deletions PenPal/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,20 @@
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:onClick="goToReceiveMessage"
android:drawableRight="@drawable/stamp1"
android:drawableLeft="@drawable/unopened_message"
android:text="Timmy" />

<Button
android:id="@+id/button2"
style="@style/ListViewButton"
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:drawableLeft="@drawable/unopened_message"
android:drawableRight="@drawable/stamp2"
android:onClick="goToReceiveMessage"
android:text="Annie" />

</LinearLayout>

<ImageView
Expand Down
4 changes: 2 additions & 2 deletions PenPal/res/layout/text_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
android:layout_alignParentBottom="true"
android:scrollHorizontally="false"
android:scrollbars="vertical"
android:background="#FFFFFF"
android:background="@color/white"
android:inputType="textMultiLine"
android:imeOptions="actionDone"
android:minLines="3"
android:maxLength="250"
android:textColor="#000000" />
android:textColor="@color/black" />

</RelativeLayout>
4 changes: 2 additions & 2 deletions PenPal/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<resources>
<color name="light_blue">#00B2EE</color>
<color name="tan">#E5ECE6</color>
<color name="white">#000000</color>

<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
</resources>
3 changes: 2 additions & 1 deletion PenPal/src/edu/berkeley/cs160/off_by_1/FriendList.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ public void goToProfile(View v) {
Button buttonV = (Button) v;
Object[] data = getUserData(buttonV);
//Log.d("debug", "data" + data[0] + data[1] + data[2]);
String profileName = buttonV.getText().toString();
byte[] compressStamp = getUserStamp(buttonV);
i.putExtra("name", data);
i.putExtra("name", profileName);
i.putExtra("image", compressStamp);
startActivityForResult(i, 0);

Expand Down
49 changes: 49 additions & 0 deletions PenPal/src/edu/berkeley/cs160/off_by_1/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.Menu;
import android.view.View;
Expand All @@ -26,6 +29,52 @@ protected void onCreate(Bundle savedInstanceState) {
}


public static String[] getUserData(String name) {
String[] data = new String[3];

if (name.equals("Timmy")){
data[0] = "Timmy";
data[1] = "English, Spanish";
data[2] = "Spain";
} else if (name.equals("Annie")) {
data[0] = "Annie";
data[1] = "English, French";
data[2] = "France";
} else if (name.equals("Angus")) {
data[0] = "Angus";
data[1] = "English, Vietnamese";
data[2] = "CA, United States";
} else if (name.equals("Mike")) {
data[0] = "Mike";
data[1] = "English";
data[2] = "New York, United States";
} else if (name.equals("Natalie")) {
data[0] = "Natalie";
data[1] = "German";
data[2] = "Germany";
} else {
data[0] = "A random alien";
data[1] = "Unknown";
data[2] = "Unknown";
}
return data;


}

public Bitmap getStamp(String name) {
Drawable stamp = null;
if (name.equals("Timmy")) {
stamp = getResources().getDrawable(R.drawable.stamp1);
} else if (name.equals("Annie")) {
stamp = getResources().getDrawable(R.drawable.stamp2);
}
else {
stamp = getResources().getDrawable(R.drawable.stamp5);
}
return ((BitmapDrawable) stamp).getBitmap();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
Expand Down
3 changes: 2 additions & 1 deletion PenPal/src/edu/berkeley/cs160/off_by_1/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_profile);

Intent i = getIntent();
String[] data = i.getStringArrayExtra("name");
//String[] data = i.getStringArrayExtra("name");
String[] data = Home.getUserData("name");
byte[] compressStamp = i.getByteArrayExtra("image");
Bitmap stampBitmap = BitmapFactory.decodeByteArray(compressStamp, 0, compressStamp.length);

Expand Down
Binary file modified appcompat/bin/android-support-v7-appcompat.jar
Binary file not shown.

0 comments on commit b32eaff

Please sign in to comment.