Skip to content

Commit

Permalink
here is the todo list for the summer
Browse files Browse the repository at this point in the history
  • Loading branch information
calebgomer committed Apr 28, 2012
1 parent fb6ec15 commit 33cdef2
Show file tree
Hide file tree
Showing 16 changed files with 237 additions and 110 deletions.
Binary file modified bin/TimeCapsule.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleActivity$1.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleActivity$2.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleActivity$3.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleActivity$4.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleActivity.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleMapActivity$1.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleMapActivity$2.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/map/CapsuleMapActivity.class
Binary file not shown.
Binary file modified bin/classes/com/gvsu/socnet/user/LoginActivity.class
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
89 changes: 63 additions & 26 deletions src/com/gvsu/socnet/map/CapsuleActivity.java
Expand Up @@ -25,7 +25,8 @@
import com.gvsu.socnet.user.SettingsActivity; import com.gvsu.socnet.user.SettingsActivity;
import com.gvsu.socnet.views.NavigationMenu; import com.gvsu.socnet.views.NavigationMenu;


public class CapsuleActivity extends NavigationMenu implements OnClickListener public class CapsuleActivity extends NavigationMenu implements
OnClickListener
{ {


/** String YOUTUBE */ /** String YOUTUBE */
Expand All @@ -34,6 +35,8 @@ public class CapsuleActivity extends NavigationMenu implements OnClickListener
/** String TAB */ /** String TAB */
private final String TAB = "\t"; private final String TAB = "\t";


private String creatorID;

@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
{ {
Expand All @@ -44,7 +47,9 @@ public void onCreate(Bundle savedInstanceState)


refresh(); refresh();


this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); this.getWindow()
.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
} }


/**************************************************************** /****************************************************************
Expand All @@ -56,6 +61,7 @@ protected void refresh()
{ {
Intent intent = this.getIntent(); Intent intent = this.getIntent();
final String cId = intent.getStringExtra("cID"); final String cId = intent.getStringExtra("cID");
Log.d("debug", "capid=" + cId);
setCapsuleInfo(cId); setCapsuleInfo(cId);
setComments(cId); setComments(cId);
setupAddComments(cId); setupAddComments(cId);
Expand All @@ -74,7 +80,8 @@ public void onClick(View v)
{ {
case R.id.play_button: case R.id.play_button:
Log.println(3, "debug", "playButtonClicked"); Log.println(3, "debug", "playButtonClicked");
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(YOUTUBE + "RCUBxgdKZ_Y"))); startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(YOUTUBE + "RCUBxgdKZ_Y")));
break; break;
default: default:
super.onClick(v); super.onClick(v);
Expand All @@ -88,16 +95,20 @@ private void setCapsuleInfo(String capsuleId)


TextView title = (TextView) findViewById(R.id.capsule_title); TextView title = (TextView) findViewById(R.id.capsule_title);
TextView description = (TextView) findViewById(R.id.description); TextView description = (TextView) findViewById(R.id.description);
TextView creator = (TextView) findViewById(R.id.capsule_creator);
TextView leftOn = (TextView) findViewById(R.id.left_on); TextView leftOn = (TextView) findViewById(R.id.left_on);
RatingBar rating = (RatingBar) findViewById(R.id.capsule_rating_bar); RatingBar rating = (RatingBar) findViewById(R.id.capsule_rating_bar);


// TODO make this increment the number of view on the server // TODO make this increment the number of view on the server
String[] capsuleInfo = Server.getCapsule(capsuleId).split(TAB); String strCapInfo = Server.getCapsule(capsuleId);
String[] capsuleInfo = strCapInfo.split(TAB);
Log.d("debug", "capsuleinfo: " + strCapInfo);
title.setText(capsuleInfo[0]); title.setText(capsuleInfo[0]);
description.setText(capsuleInfo[3]); description.setText(capsuleInfo[3]);


// gets the date capsule was left // gets the date capsule was left
leftOn.setText("Left on " + capsuleInfo[4].split(" ")[0] + " at " + capsuleInfo[4].split(" ")[1]); leftOn.setText("Left on " + capsuleInfo[4].split(" ")[0]
+ " at " + capsuleInfo[4].split(" ")[1]);


String strRating = Server.getRating(capsuleId); String strRating = Server.getRating(capsuleId);
if (!strRating.equals("")) if (!strRating.equals(""))
Expand All @@ -108,6 +119,18 @@ private void setCapsuleInfo(String capsuleId)
{ {
rating.setRating(0); rating.setRating(0);
} }
creatorID = capsuleInfo[5];
creator.setText(capsuleInfo[6]);
creator.setOnClickListener(new OnClickListener()
{

public void onClick(View v)
{
Toast.makeText(getApplicationContext(),
"User Id= " + creatorID, Toast.LENGTH_SHORT)
.show();
}
});
} }


private void setComments(final String capsuleId) private void setComments(final String capsuleId)
Expand All @@ -116,7 +139,8 @@ private void setComments(final String capsuleId)
commentList.removeAllViews(); commentList.removeAllViews();
String commentsFromServer = Server.getComments(capsuleId); String commentsFromServer = Server.getComments(capsuleId);


Log.d("debug", "Comments on capsule number " + capsuleId + "\n" + commentsFromServer); Log.d("debug", "Comments on capsule number " + capsuleId
+ "\n" + commentsFromServer);
String[] strArrayComments = commentsFromServer.split("\n"); String[] strArrayComments = commentsFromServer.split("\n");
if (!strArrayComments[0].equals("")) if (!strArrayComments[0].equals(""))
{ {
Expand All @@ -125,11 +149,13 @@ private void setComments(final String capsuleId)
if (!s.equals("")) if (!s.equals(""))
{ {
String[] strArrayComment = s.split("\t"); String[] strArrayComment = s.split("\t");
String[] strArrayUser = Server.getUser(strArrayComment[0]).split("\t"); String[] strArrayUser = Server.getUser(
strArrayComment[0]).split("\t");
TextView t = new TextView(this); TextView t = new TextView(this);
String user = strArrayUser[8]; String user = strArrayUser[8];
t.setId(Integer.parseInt(strArrayComment[0])); t.setId(Integer.parseInt(strArrayComment[0]));
t.setText(new Comment(user, strArrayComment[2], strArrayComment[1]).toString()); t.setText(new Comment(user, strArrayComment[2],
strArrayComment[1]).toString());
t.setPadding(0, 10, 0, 0); t.setPadding(0, 10, 0, 0);
commentList.addView(t); commentList.addView(t);
} }
Expand All @@ -145,18 +171,22 @@ private void setComments(final String capsuleId)
// //
private void setupAddComments(final String capsuleId) private void setupAddComments(final String capsuleId)
{ {
((Button) findViewById(R.id.button_add_comment)).setOnClickListener(new OnClickListener() ((Button) findViewById(R.id.button_add_comment))
{ .setOnClickListener(new OnClickListener()

{
@Override
public void onClick(View v) @Override
{ public void onClick(View v)
EditText newComment = (EditText) findViewById(R.id.edit_text_new_comment); {
Server.addComment(getSharedPreferences("profile", 0).getString("player_id", "0"), capsuleId, fixSpaces(newComment.getText().toString())); EditText newComment = (EditText) findViewById(R.id.edit_text_new_comment);
newComment.setText(""); Server.addComment(
refresh(); getSharedPreferences("profile", 0).getString(
} "player_id", "0"), capsuleId,
}); fixSpaces(newComment.getText().toString()));
newComment.setText("");
refresh();
}
});
} }


private void setupAddRating(final String capsuleId) private void setupAddRating(final String capsuleId)
Expand All @@ -167,7 +197,8 @@ private void setupAddRating(final String capsuleId)
final Button submitButton = ((Button) findViewById(R.id.capsule_rating_submit)); final Button submitButton = ((Button) findViewById(R.id.capsule_rating_submit));
final Button cancelButton = ((Button) findViewById(R.id.capsule_rating_cancel)); final Button cancelButton = ((Button) findViewById(R.id.capsule_rating_cancel));


final float ratingBeforeUserMessedWithIt = ratingBar.getRating(); final float ratingBeforeUserMessedWithIt = ratingBar
.getRating();


// listens for ratingbar to be changed // listens for ratingbar to be changed
ratingBar.setOnTouchListener(new OnTouchListener() ratingBar.setOnTouchListener(new OnTouchListener()
Expand All @@ -189,9 +220,12 @@ public boolean onTouch(View v, MotionEvent event)
public void onClick(View v) public void onClick(View v)
{ {
submitLayout.setVisibility(View.GONE); submitLayout.setVisibility(View.GONE);
Server.addRating(getSharedPreferences("profile", 0).getString("player_id", "0"), capsuleId, Float.toString(ratingBar.getRating())); Server.addRating(getSharedPreferences("profile", 0)
.getString("player_id", "0"), capsuleId, Float
.toString(ratingBar.getRating()));
refresh(); refresh();
Toast.makeText(getApplicationContext(), "Rating Submitted", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),
"Rating Submitted", Toast.LENGTH_SHORT).show();
} }
}); });
cancelButton.setOnClickListener(new OnClickListener() cancelButton.setOnClickListener(new OnClickListener()
Expand All @@ -209,15 +243,17 @@ public void onClick(View v)
@Override @Override
protected boolean gotoMenu() protected boolean gotoMenu()
{ {
Intent i = new Intent(getApplicationContext(), SettingsActivity.class); Intent i = new Intent(getApplicationContext(),
SettingsActivity.class);
startActivity(i); startActivity(i);
return true; return true;
} }


@Override @Override
protected boolean gotoProfile() protected boolean gotoProfile()
{ {
Intent myIntent = new Intent(getBaseContext(), ProfileActivity.class); Intent myIntent = new Intent(getBaseContext(),
ProfileActivity.class);
// TODO profile button from a capsule takes you to the user // TODO profile button from a capsule takes you to the user
// who left that capsule's profile // who left that capsule's profile
// myIntent.putExtra("player_id", // myIntent.putExtra("player_id",
Expand All @@ -229,7 +265,8 @@ protected boolean gotoProfile()
@Override @Override
protected boolean gotoMap() protected boolean gotoMap()
{ {
Intent myIntent = new Intent(getBaseContext(), CapsuleMapActivity.class); Intent myIntent = new Intent(getBaseContext(),
CapsuleMapActivity.class);
startActivity(myIntent); startActivity(myIntent);
finish(); finish();
return true; return true;
Expand Down

0 comments on commit 33cdef2

Please sign in to comment.