@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete) { dbhelper.deleteMarkByID(ChalkmarkID); Context context = getApplicationContext(); AlertDialog.Builder alertbox = new AlertDialog.Builder(context); alertbox.setMessage("The Mark Was Deleted"); SharedPreferences.Editor editor = mPreferences.edit(); editor.putInt("DefaultTab", 1); editor.commit(); Intent intent = new Intent().setClass(MessageDetails.this, ChalkMarkTabHost.class); startActivity(intent); finish(); } else if (item.getItemId() == R.id.map) { Intent i = new Intent(MessageDetails.this, MarkInfoMap.class); c = dbhelper.getByID(ChalkmarkID); c.moveToFirst(); Double latitude = dbhelper.getLat(c); Double longitude = dbhelper.getLon(c); i.putExtra(MarkInfoMap.EXTRA_LATITUDE, latitude); i.putExtra(MarkInfoMap.EXTRA_LONGITUDE, longitude); i.putExtra(MarkInfoMap.EXTRA_NAME, dbhelper.getFromName(c)); i.putExtra(MarkInfoMap.EXTRA_SUBJECT, dbhelper.getSubject(c)); dbhelper.close(); startActivity(i); } else if (item.getItemId() == R.id.unread) { // Make the Chalkmark unread c = dbhelper.getByID(ChalkmarkID); c.moveToFirst(); dbhelper.updateStatus(ChalkmarkID, "unread"); } else if (item.getItemId() == R.id.unread) { // Make the Chalkmark unread c = dbhelper.getByID(ChalkmarkID); c.moveToFirst(); dbhelper.updateStatus(ChalkmarkID, "unread"); } else if (item.getItemId() == R.id.repost) { c = dbhelper.getByID(ChalkmarkID); c.moveToFirst(); SharedPreferences.Editor editor = mPreferences.edit(); editor.putString("SavedSubject", dbhelper.getSubject(c)); editor.putString("SavedBody", dbhelper.getBody(c)); editor.putInt("SavedExpiration", 25); editor.putInt("SavedRadius", 1000); editor.putBoolean("SavedImageFlag", imageflag); editor.putString("RandomString", dbhelper.getImagePair(c)); editor.putFloat("MarkLat", (float) dbhelper.getLat(c)); editor.putFloat("MarkLon", (float) dbhelper.getLon(c)); editor.commit(); Intent i = new Intent(MessageDetails.this, MakeMark.class); startActivity(i); finish(); } return (super.onOptionsItemSelected(item)); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPreferences = getSharedPreferences("CurrentUser", MODE_PRIVATE); ChalkmarkID = getIntent().getStringExtra(ChalkBoard.ID_EXTRA); dbhelper = new MarksDataBaseHelper(this); c = dbhelper.getByID(ChalkmarkID); c.moveToFirst(); String imageURL = dbhelper.getImage(c); String[] temp; temp = imageURL.split("="); imageflag = false; if (temp.length > 1) { imageflag = true; setContentView(R.layout.mark_details_image); imageURL = imageHeader + "<p><img src=\"" + imageURL + "\" width=\"300\"/>" + imageTail; WebView imageView = (WebView) findViewById(R.id.webkit); imageView.getSettings().setSupportZoom(true); // Zoom Control on web (You don't need this imageView.getSettings().setBuiltInZoomControls(true); // if ROM supports Multi-Touch imageView.loadData(imageURL, MIMEType, Encoding); } else { setContentView(R.layout.mark_details); } String from_name = dbhelper.getFromName(c); TextView bodyView = (TextView) findViewById(R.id.body); bodyView.setMovementMethod(new ScrollingMovementMethod()); TextView subjectView = (TextView) findViewById(R.id.subject); subjectView.setText(" " + dbhelper.getSubject(c)); String bodytext = "Date Dropped: " + dbhelper.getTimeDropped(c); bodytext = bodytext + "\nFrom: " + from_name; bodytext = bodytext + "\n\n" + dbhelper.getBody(c); bodyView.setText(bodytext); dbhelper.updateStatus(ChalkmarkID, "read"); }