import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class Landing extends Activity {
private String tag = "XXX";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.landing);
}
private void showEula() {
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.eula);
dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
//there are a lot of settings, for dialog, check them all out!
//set uptext
TextView text = (TextView) dialog.findViewById(R.id.TextView01);
text.setText("HELLO");
//set up image view
ImageView img = (ImageView) dialog.findViewById(R.id.ImageView01);
img.setImageResource(R.drawable.icon);
//set up button
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//now that the dialog is set up, it's time to show it
dialog.show();
}
// Called first time user clicks on the menu button
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater(); //
inflater.inflate(R.menu.menu, menu); //
return true; //
}
// Called when an options item is clicked
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.i(tag,item.toString()+" "+item.getItemId());
Log.i(tag,"PrefsID: "+R.id.itemPrefs);
switch (item.getItemId()) {
case R.id.itemPrefs:
startActivity(new Intent(this, PrefsActivity.class));
Log.i("Mgamerz Productions Cryptographer", "User chose Preferences");
break;
case R.id.itemSensors:
startActivity(new Intent(this, SensorsActivity.class));
break;
case R.id.itemDecrypt:
showEula();
break;
default:
Log.e(tag,"User didn't choose anything?");
}
return true; //
}
Comments