@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); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); final String ID = intent.getStringExtra("ID"); final String name = intent.getStringExtra("Name"); final ActionBar actionBar = getSupportActionBar(); setContentView(R.layout.individual_colour_change_layout); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); ColH = settings.getInt("houCol" + ID, getResources().getColor(R.color.clokH)); ColM = settings.getInt("minCol" + ID, getResources().getColor(R.color.clokM)); ColS = settings.getInt("secCol" + ID, getResources().getColor(R.color.clokS)); String currentTitle = name + ": " + getString(R.string.chsColour); if (actionBar != null) { actionBar.setTitle(currentTitle); actionBar.setDisplayUseLogoEnabled(false); } draw(); Button reset = (Button) findViewById(R.id.reset); reset.setOnClickListener( v -> { Editor editor = settings.edit(); ColH = IndividualColourChange.this.getResources().getColor(R.color.clokH); ColM = IndividualColourChange.this.getResources().getColor(R.color.clokM); ColS = IndividualColourChange.this.getResources().getColor(R.color.clokS); editor.putInt("houCol" + ID, ColH); editor.putInt("minCol" + ID, ColM); editor.putInt("secCol" + ID, ColS); editor.apply(); IndividualColourChange.this.draw(); }); ImageView colPickH = (ImageView) findViewById(R.id.colorHou); colPickH.setClickable(true); colPickH.setOnClickListener( v -> { ColorSelectorDialog dlg = new ColorSelectorDialog( context, color -> { ColH = color; Editor editor = settings.edit(); editor.putInt("houCol" + ID, ColH); editor.apply(); draw(); }, ColH); dlg.setTitle(IndividualColourChange.this.getString(R.string.hHandCol)); dlg.show(); }); ImageView colPickM = (ImageView) findViewById(R.id.colorMin); colPickM.setClickable(true); colPickM.setOnClickListener( v -> { ColorSelectorDialog dlg = new ColorSelectorDialog( context, color -> { ColM = color; Editor editor = settings.edit(); editor.putInt("minCol" + ID, ColM); editor.apply(); draw(); }, ColM); dlg.setTitle(IndividualColourChange.this.getString(R.string.mHandCol)); dlg.show(); }); ImageView colPickS = (ImageView) findViewById(R.id.colorSec); colPickS.setClickable(true); colPickS.setOnClickListener( v -> { ColorSelectorDialog dlg = new ColorSelectorDialog( context, color -> { ColS = color; Editor editor = settings.edit(); editor.putInt("minCol" + ID, ColS); editor.apply(); draw(); }, ColS); dlg.setTitle(IndividualColourChange.this.getString(R.string.sHandCol)); dlg.show(); }); }