@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.inbox_row, null); } SMILMessageProxy o = inbox.get(position); // Log.w("getView", "o name: " + o.getName()); wtf is this if (o != null) { TextView ttl = (TextView) v.findViewById(R.id.topinboxtextL), ttr = (TextView) v.findViewById(R.id.topinboxtextR), middle = (TextView) v.findViewById(R.id.middleinboxtext), bottom = (TextView) v.findViewById(R.id.bottominboxtext); // btr = (TextView) v.findViewById(R.id.bottomtextright), if (ttl != null) { ttl.setText("Name: " + o.getFilename()); } if (ttr != null) { if (o.getModified() != null) { ttr.setText( "Date: " + String.valueOf(o.getModified().getDay()) + "/" + String.valueOf(o.getModified().getMonth())); } else { ttr.setText("Date: ##/##"); } } if (middle != null) { middle.setText("Sender: " + o.getSender()); } if (bottom != null) { bottom.setText("Subject: " + o.getMessage()); } if (!o.isRead()) { ttl.setTypeface(null, Typeface.BOLD); ttr.setTypeface(null, Typeface.BOLD); middle.setTypeface(null, Typeface.BOLD); bottom.setTypeface(null, Typeface.BOLD); } } return v; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); state = savedInstanceState; data = getIntent().getExtras(); // Mark as read SMILMessageProxy sm = SMILActivity.inbox.get(data.getInt("index")); AsyncFetchSMILMessage async = new AsyncFetchSMILMessage(this); sm = async.editMessage(sm); sm.setRead(true); async.updateMessage(sm); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.message_view); SharedPreferences myPrefs = this.getSharedPreferences("username", MODE_WORLD_READABLE); autoPlay = myPrefs.getBoolean("autoPlay", true); alertAutoPlay = new AlertDialog.Builder(this).create(); alertAutoPlay.setTitle("Did you know?"); alertAutoPlay.setMessage( "If you turn your phone into landscape mode the message will automatically play. Turn your phone back up to return to the message screen."); alertAutoPlay.setButton( "Let me try!", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertAutoPlay.setButton2( "Not for me! (disable feature)", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor myPrefEdit = ViewMessageActivity.this .getSharedPreferences("username", MODE_WORLD_READABLE) .edit(); myPrefEdit.putBoolean("autoPlay", false); myPrefEdit.commit(); ViewMessageActivity.autoPlay = false; playMessage(true); return; } }); _actionBar = (ActionBar) findViewById(R.id.actionBar); _actionBar.setTitle("Message Details"); _actionBar.setHomeListener( new OnClickListener() { public void onClick(View v) { ViewMessageActivity.this.finish(); } }); workingDir += "/" + data.getString("title"); items = new ScrollItemManager(findViewById(R.id.scrollHolder)); items.addItem(getApplicationContext(), true); items.setTitle(data.getString("title")); items.setIcon(R.drawable.ic_home); items.setListener(this, 1); TextView item1Text1 = new TextView(this); item1Text1.setText( "From: " + data.getString("Sender") + " on " + data.getString("date")); item1Text1.setTextColor(Color.BLACK); items.addToLinear(item1Text1); items.addItem(getApplicationContext(), true); TextView item2Text1 = new TextView(this); item2Text1.setText("Subject:"); item2Text1.setTextColor(Color.BLACK); TextView item2Text2 = new TextView(this); item2Text2.setText(data.getString("message")); item2Text2.setTextColor(Color.BLACK); items.addToLinear(item2Text1); items.addLine(getApplicationContext()); items.addToLinear(item2Text2); items.addItem(getApplicationContext()); items.setTitle("Play Message"); items.setListener(this, 1); items.addItem(getApplicationContext()); items.setTitle("Reply"); // items.setListener(this, 1); items.addItem(getApplicationContext()); items.setTitle("Forward"); items.setListener(this, 2); items.addItem(getApplicationContext()); items.setTitle("Reset Preference"); items.setListener(this, 3); }