Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.CreaLeParole;
- import android.app.Activity;
- import android.app.AlertDialog;
- import android.app.ProgressDialog;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuInflater;
- import android.view.View;
- import android.view.Window;
- import android.widget.Button;
- import android.widget.TextView;
- import com.CreaLeParole.library.DatabaseHandler;
- import com.CreaLeParole.library.UserFunctions;
- import com.learn2crack.R;
- import java.util.HashMap;
- public class menu_principale extends Activity {
- // Button btnLogout;
- // Button changepas;
- Button buttonImpostazioniMenuPrincipale;
- UserFunctions userFunctions;
- /**
- * Called when the activity is first created.
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // Con questi 2 imposto l'activity a schermo intero (FULL SCREEN)
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- /**
- * MENU PRINCIPALE ACTIVITY Screen for the application
- * */
- // Check login status in database
- userFunctions = new UserFunctions();
- if(userFunctions.isUserLoggedIn(getApplicationContext())){
- setContentView(R.layout.activity_menu_principale);
- }else{
- // user is not logged in show login screen
- Intent login = new Intent(getApplicationContext(), Login.class);
- login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(login);
- // Closing dashboard screen
- finish();
- }
- //bottoni
- buttonImpostazioniMenuPrincipale = (Button) findViewById(R.id.buttonImpostazioniMenuPrincipale);
- /**
- *
- **/
- buttonImpostazioniMenuPrincipale.setOnClickListener(new View.OnClickListener(){
- public void onClick(View view){
- Intent imp = new Intent(getApplicationContext(), com.CreaLeParole.Impostazioni.class);
- startActivity(imp);
- }
- });
- // changepas = (Button) findViewById(R.id.btchangepass);
- // btnLogout = (Button) findViewById(R.id.logout);
- //
- //
- // DatabaseHandler db = new DatabaseHandler(getApplicationContext());
- //
- // /**
- // * Hashmap to load data from the Sqlite database
- // **/
- // HashMap<String,String> user = new HashMap<String, String>();
- // user = db.getUserDetails();
- //
- //
- // /**
- // * Change Password Activity Started
- // **/
- // changepas.setOnClickListener(new View.OnClickListener(){
- // public void onClick(View arg0){
- //
- // Intent chgpass = new Intent(getApplicationContext(), ChangePassword.class);
- //
- // startActivity(chgpass);
- // }
- //
- // });
- //
- // /**
- // *Logout from the User Panel which clears the data in Sqlite database
- // **/
- // btnLogout.setOnClickListener(new View.OnClickListener() {
- //
- // public void onClick(View arg0) {
- //
- // UserFunctions logout = new UserFunctions();
- // logout.logoutUser(getApplicationContext());
- // Intent login = new Intent(getApplicationContext(), Login.class);
- // login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- // startActivity(login);
- // finish();
- // }
- // });
- //
- // /**
- // * Sets user first name and last name in text view.
- // **/
- // final TextView login = (TextView) findViewById(R.id.textwelcome);
- // login.setText("Welcome "+user.get("fname"));
- // final TextView lname = (TextView) findViewById(R.id.lname);
- // lname.setText(user.get("lname"));
- }
- //
- // @Override
- // public boolean onCreateOptionsMenu(Menu menu) {
- // // Inflate the menu items for use in the action bar
- // MenuInflater inflater = getMenuInflater();
- // inflater.inflate(R.menu.menu_principale, menu);
- // return super.onCreateOptionsMenu(menu);
- // }
- /**
- * Individua l'Activity nella quale andare quando si preme il pulsante "back"
- */
- @Override
- public void onBackPressed() {
- DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- switch (which){
- case DialogInterface.BUTTON_POSITIVE:
- //Inserire modo per uscire correttamente -------------- COMPLETARE!!!!!
- break;
- case DialogInterface.BUTTON_NEGATIVE:
- //No button clicked
- break;
- }
- }
- };
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("Vuoi uscire dal gioco").setPositiveButton("Si", dialogClickListener)
- .setNegativeButton("No", dialogClickListener).show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement