Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent Nguyen committed Dec 12, 2013
2 parents b32eaff + cd2db2c commit 1482b6c
Show file tree
Hide file tree
Showing 221 changed files with 223 additions and 59 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 @@ -554,7 +554,7 @@ public static final class styleable {
public static final int MenuItem_android_titleCondensed = 8;
public static final int MenuItem_android_visible = 4;
public static final int MenuItem_showAsAction = 13;
public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x0101040c };
public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x01010435 };
public static final int MenuView_android_headerBackground = 4;
public static final int MenuView_android_horizontalDivider = 2;
public static final int MenuView_android_itemBackground = 5;
Expand Down
50 changes: 34 additions & 16 deletions PenPal/gen/edu/berkeley/cs160/off_by_1/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,8 @@ public static final class drawable {
}
public static final class id {
public static final int RelativeLayout1=0x7f06004b;
public static final int actionBack=0x7f06006b;
public static final int actionHome=0x7f06006c;
public static final int actionBack=0x7f06006d;
public static final int actionHome=0x7f06006e;
public static final int action_bar=0x7f06001c;
public static final int action_bar_activity_content=0x7f060015;
public static final int action_bar_container=0x7f06001b;
Expand All @@ -1022,7 +1022,7 @@ public static final class id {
public static final int action_menu_divider=0x7f060016;
public static final int action_menu_presenter=0x7f060017;
public static final int action_mode_close_button=0x7f060024;
public static final int action_settings=0x7f06006a;
public static final int action_settings=0x7f06006c;
public static final int activity_chooser_view_content=0x7f060025;
public static final int always=0x7f06000b;
public static final int beginning=0x7f060011;
Expand All @@ -1037,7 +1037,7 @@ public static final class id {
public static final int disableHome=0x7f060008;
public static final int drawMessageButton=0x7f060063;
public static final int dropdown=0x7f06000f;
public static final int editTextMessage=0x7f060065;
public static final int editTextMessage=0x7f060067;
public static final int edit_query=0x7f060030;
public static final int end=0x7f060013;
public static final int expand_activities_button=0x7f060026;
Expand All @@ -1055,13 +1055,15 @@ public static final class id {
public static final int homeAsUp=0x7f060005;
public static final int icon=0x7f06002a;
public static final int ifRoom=0x7f06000a;
public static final int im=0x7f060065;
public static final int image=0x7f060027;
public static final int imageView1=0x7f06004a;
public static final int kk=0x7f060064;
public static final int language=0x7f06005a;
public static final int listMode=0x7f060001;
public static final int list_item=0x7f060029;
public static final int location=0x7f06005c;
public static final int mainSpinner1=0x7f060064;
public static final int mainSpinner1=0x7f060066;
public static final int meetPenPalText=0x7f060053;
public static final int messageSent=0x7f060057;
public static final int middle=0x7f060012;
Expand All @@ -1070,16 +1072,16 @@ public static final class id {
public static final int none=0x7f060010;
public static final int normal=0x7f060000;
public static final int penPalDetailsText=0x7f060054;
public static final int playButton=0x7f060069;
public static final int playButton=0x7f06006b;
public static final int profileName=0x7f060059;
public static final int progress_circular=0x7f060018;
public static final int progress_horizontal=0x7f060019;
public static final int questionButton=0x7f06004d;
public static final int radio=0x7f06002f;
public static final int receivedMessage=0x7f06005f;
public static final int recordButton=0x7f060066;
public static final int recordTimer=0x7f060068;
public static final int recordTimerBar=0x7f060067;
public static final int recordButton=0x7f060068;
public static final int recordTimer=0x7f06006a;
public static final int recordTimerBar=0x7f060069;
public static final int reply=0x7f06005e;
public static final int research=0x7f060055;
public static final int search_badge=0x7f060032;
Expand Down Expand Up @@ -1240,25 +1242,40 @@ public static final class string {
public static final int action_settings=0x7f0b0015;
public static final int app_name=0x7f0b000d;
public static final int back_button=0x7f0b0017;
public static final int black=0x7f0b002c;
public static final int blue=0x7f0b002d;
public static final int clear_button=0x7f0b0027;
public static final int color=0x7f0b002f;
public static final int cyan=0x7f0b0031;
public static final int draw_message=0x7f0b0022;
public static final int eraseall=0x7f0b0034;
public static final int eraselast=0x7f0b0033;
public static final int eraser=0x7f0b0032;
public static final int erasers=0x7f0b0039;
public static final int friend_list_button=0x7f0b001b;
public static final int friend_list_text=0x7f0b001c;
public static final int from_user=0x7f0b0024;
public static final int get_question_button=0x7f0b002d;
public static final int get_question_button=0x7f0b003d;
public static final int green=0x7f0b0030;
public static final int hello_user=0x7f0b001a;
public static final int home_button=0x7f0b0016;
public static final int language=0x7f0b002c;
public static final int location=0x7f0b002b;
public static final int language=0x7f0b003c;
public static final int largesize=0x7f0b0038;
public static final int location=0x7f0b003b;
public static final int medsize=0x7f0b0037;
public static final int message_sent_text=0x7f0b0020;
public static final int new_pen_pal_button=0x7f0b001d;
public static final int new_pen_pal_text=0x7f0b001e;
public static final int received_message=0x7f0b002e;
public static final int next=0x7f0b0035;
public static final int received_message=0x7f0b003e;
public static final int red=0x7f0b002b;
public static final int reply_button=0x7f0b0026;
public static final int research_pen_pal=0x7f0b0028;
public static final int send_another=0x7f0b002f;
public static final int send_another=0x7f0b003f;
public static final int send_message_button=0x7f0b0029;
public static final int send_message_text=0x7f0b001f;
public static final int smallsize=0x7f0b0036;
public static final int stroke=0x7f0b003a;
public static final int text_message=0x7f0b0021;
public static final int title_activity_friend_list=0x7f0b000e;
public static final int title_activity_make_message=0x7f0b0014;
Expand All @@ -1268,9 +1285,10 @@ public static final class string {
public static final int title_activity_receive_message=0x7f0b0011;
public static final int title_activity_send_message=0x7f0b0013;
public static final int to_user=0x7f0b0025;
public static final int undo=0x7f0b0030;
public static final int undo=0x7f0b0040;
public static final int user_profile=0x7f0b002a;
public static final int voice_message=0x7f0b0023;
public static final int yellow=0x7f0b002e;
}
public static final class style {
/**
Expand Down Expand Up @@ -2524,7 +2542,7 @@ <p>Must be one or more (separated by '|') of the following constant values.</p>
*/
public static final int[] MenuView = {
0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e,
0x0101012f, 0x01010130, 0x01010131, 0x0101040c
0x0101012f, 0x01010130, 0x01010131, 0x01010435
};
/**
<p>
Expand Down
3 changes: 2 additions & 1 deletion PenPal/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
target=android-19
android.library.reference.1=../appcompat
android.library=false
24 changes: 11 additions & 13 deletions PenPal/res/layout/draw_message.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?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:id="@+id/kk"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#ffffff" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/sun"

android:contentDescription="A filler image" />

android:id="@+id/im"
android:layout_width="400px"
android:layout_height="400px"
android:layout_marginTop="200px"
android:adjustViewBounds="true"
/>
</RelativeLayout>
19 changes: 17 additions & 2 deletions PenPal/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,26 @@
<string name="research_pen_pal">Search Again</string>
<string name="send_message_button">Send Message!</string>
<string name="user_profile">%1$s</string>
<string name="red">Red</string>
<string name="black">Black</string>
<string name="blue">Blue</string>
<string name="yellow">Yellow</string>
<string name="color">Color</string>
<string name="green">Green</string>
<string name="cyan">Cyan</string>
<string name="eraser">Eraser</string>
<string name="eraselast">Undo</string>
<string name="eraseall">Erase All</string>
<string name="next">Start!</string>
<string name="smallsize">Small stroke</string>
<string name="medsize">Medium stroke</string>
<string name="largesize">Large stroke</string>
<string name="erasers">Eraser</string>
<string name="stroke">Stroke</string>
<string name="location">Location From: %1$s</string>
<string name="language">Language: %1$s</string>
<string name="get_question_button"> Get a Question</string>
<string name="received_message"> Hi Jack Jack,\n How are you doing today?</string>

<string-array name="suggested_questions">
<item>What are you learning in school? </item>
<item>What did you eat for breakfast? </item>
Expand All @@ -50,4 +65,4 @@
<string name="send_another">Send Another</string>
<string name="undo">undo</string>

</resources>
</resources>
151 changes: 131 additions & 20 deletions PenPal/src/edu/berkeley/cs160/off_by_1/DrawMessageFragment.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,143 @@
package edu.berkeley.cs160.off_by_1;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class DrawMessageFragment extends MessageFragment {
CustomView CusView;
public Context context;
CustomView first = null;
CustomView Second = null;
CustomView Third = null;
OnTouchListener touchListener;
int color = Color.BLACK;
RelativeLayout layout;
private Paint paint = new Paint();
private Path path = new Path();
ImageView image;
ArrayList<View> views;
Map<Path, Paint> pathMap;
Context act;

public class CustomView extends View {
public CustomView(Context context) {
super(context);
Log.d("debug", "crashed?");
paint.setAntiAlias(true);
paint.setColor(color);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(12);
}

@Override
protected void onDraw(Canvas canvas) {
canvas.drawPath(path, paint);
super.onDraw(canvas);
for (Map.Entry<Path, Paint> p : pathMap.entrySet()) {
canvas.drawPath(p.getKey(), p.getValue());
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.draw_message, container, false);
}

Intent getIntent() {
Intent i = new Intent();
//i.putExtra("msg", msg);
return i;

}

void clear() {

}


}

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
act = activity;
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("debug", "before view");
Log.d("debug", "here");
if (act == null) {
Log.d("debug", "it's nulllllllllllllllllllllllllllllllll");
} else {
Log.d("debug", "itllll");
}
CusView = new CustomView(act);
View v = inflater.inflate(R.layout.draw_message, container, false);
layout = (RelativeLayout) v.findViewById(R.id.kk);
views = new ArrayList<View>();
pathMap = new HashMap<Path, Paint>();
Log.d("debug", "generated view");
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
CusView.setLayoutParams(params);
layout.addView(CusView);
touchListener = new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
CusView.setDrawingCacheEnabled(true);
float eventX = event.getX();
float eventY = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
path = new Path();
path.reset();
path.moveTo(eventX, eventY);
break;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_UP:
Paint newPaint = new Paint();
newPaint.set(paint);
pathMap.put(path, newPaint);
path.lineTo(eventX, eventY);
break;
} // ends switch statement
CusView.invalidate();
return true;
}
};
CusView.setOnTouchListener(touchListener);
return v;
}

public void clear() {
for (Map.Entry<Path, Paint> p : pathMap.entrySet()) {
p.getKey().rewind();
CusView.invalidate();
CusView.setDrawingCacheEnabled(false);
}
}


Intent getIntent() {
String msg = "";
Intent i = new Intent();
i.putExtra("msg", msg);
return i;
}
}
Loading

0 comments on commit 1482b6c

Please sign in to comment.