Android Open Source - GroupSmart-Android Settings






From Project

Back to project page GroupSmart-Android.

License

The source code is released under:

Copyright (C) <2014> <Derek Argueta - Hunter Kehoe> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ...

If you think the Android project GroupSmart-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dargueta.groupsmart;
/*from w ww  .  j a va 2  s . co  m*/
/**
 * 
 * @author Hunter Kehoe
 * 
 * Creates the Activity where the user can browse the settings of this app.
 * 
 */
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.google.analytics.tracking.android.EasyTracker;

public class Settings extends Activity {
  
  Button btnUpdateProfile, btnChangePassword, btnFeedback, btnLogout;
  
  // Navigation tabs
  Button btnHome, btnProfile, btnGroups, btnNewGroup;
  
  public void onCreate(Bundle savedInstanceState) {
    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings);
    
    btnUpdateProfile = (Button) findViewById(R.id.btnUpdateProfile);
    btnChangePassword = (Button) findViewById(R.id.btnChangePassword);
    btnFeedback = (Button) findViewById(R.id.btnFeedback);
    btnLogout = (Button) findViewById(R.id.btnLogout);
    
    btnUpdateProfile.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), UpdateProfile.class);
        startActivity(i);
      }
    });
    
    btnChangePassword.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), ChangePassword.class);
        startActivity(i);
      }
    });
    
    btnFeedback.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), Feedback.class);
        startActivity(i);
      }
    });
    
    btnLogout.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            SharedPreferences.Editor editor = prefs.edit();
            editor.clear();
            editor.commit();
            Intent i = new Intent(getApplicationContext(), Login.class);
            i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(i);
            finish();
      }
    });
    
    // navigation tabs
    btnProfile = (Button) findViewById(R.id.btnProfile);
    btnHome = (Button) findViewById(R.id.btnHome);
    btnGroups = (Button) findViewById(R.id.btnGroups);
    btnNewGroup = (Button) findViewById(R.id.btnNewGroup);
    
    btnProfile.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), Profile.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
        overridePendingTransition(0, 0);
      }
    });
    
    btnHome.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), Main.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
        overridePendingTransition(0, 0);
      }
    });
    
    btnGroups.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), FindGroup.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
        overridePendingTransition(0, 0);
      }
    });
    
    btnNewGroup.setOnClickListener(new OnClickListener() {
      
      public void onClick(View v) {
        
        Intent i = new Intent(getApplicationContext(), CreateGroup.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
        overridePendingTransition(0, 0);
      }
    });
  }
  
  public void onBackPressed() {
    
    super.onBackPressed();
    this.overridePendingTransition(0, 0);
  }
  
  // Google Analytics
  public void onStart() {
    
    super.onStart();
    EasyTracker.getInstance(this).activityStart(this);
  }
  
  public void onStop() {
    
    super.onStop();
    EasyTracker.getInstance(this).activityStop(this);
  }
}




Java Source Code List

com.dargueta.groupsmart.ChangePassword.java
com.dargueta.groupsmart.Constants.java
com.dargueta.groupsmart.CourseSelect.java
com.dargueta.groupsmart.CreateGroup.java
com.dargueta.groupsmart.Feedback.java
com.dargueta.groupsmart.FindGroup.java
com.dargueta.groupsmart.GroupInfo.java
com.dargueta.groupsmart.Login.java
com.dargueta.groupsmart.Main.java
com.dargueta.groupsmart.MajorSelect.java
com.dargueta.groupsmart.Profile.java
com.dargueta.groupsmart.Register.java
com.dargueta.groupsmart.ServiceHandler.java
com.dargueta.groupsmart.Settings.java
com.dargueta.groupsmart.UpdateGroup.java
com.dargueta.groupsmart.UpdateProfile.java