Android Open Source - InfoSecProj Home Activity






From Project

Back to project page InfoSecProj.

License

The source code is released under:

MIT License

If you think the Android project InfoSecProj 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.infosec.gesturelock;
//from   w  w w. ja v a2 s  . c  o  m
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.StreamCorruptedException;

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.Window;
import android.widget.Toast;

import com.infosec.gesturedata.GestureData;
import com.infosec.gesturelock.util.SystemUiHider;

/**
 * An example full-screen activity that shows and hides the system UI (i.e.
 * status bar and navigation/system bar) with user interaction.
 * 
 * @see SystemUiHider
 */
public class HomeActivity extends Activity {

    public static GestureData userPassword;
    
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        
    setContentView(R.layout.activity_home);
        
        // Check for first run
        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
        SharedPreferences.Editor prefEditor = sharedPref.edit();
        if (!sharedPref.contains("FirstRun")) {
          prefEditor.putBoolean("FirstRun", false);
          prefEditor.commit();

            Intent tutIntent = new Intent(this, TutActivity.class);
            this.startActivity(tutIntent);
        }
        
        userPassword = null;
    
    try {
      FileInputStream fis = this.openFileInput("userPass");
      ObjectInputStream is = new ObjectInputStream(fis);
      userPassword = (GestureData) is.readObject();
//      Toast.makeText(this, Integer.toString(userPassword.data.size()), Toast.LENGTH_SHORT).show();
      is.close();
      fis.close();
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      Toast.makeText(this, "Password not detected", Toast.LENGTH_SHORT).show();
      e.printStackTrace();
    } catch (StreamCorruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  
  public void lockDeviceBtnPress(View view) {
    Intent lockDeviceIntent = new Intent(this, LockActivity.class);
    this.startActivity(lockDeviceIntent);
  }

  public void setPassBtnPress(View view) {
    Intent setLockIntent = new Intent(this, SetPasswordActivity.class);
    this.startActivity(setLockIntent);
  }
  
  public void instructionBtnPress(View view) {
    Intent tutIntent = new Intent(this, TutActivity.class);
    this.startActivity(tutIntent);
  }
}




Java Source Code List

com.infosec.gesturedata.AccelEvent.java
com.infosec.gesturedata.GestureData.java
com.infosec.gesturedata.Point.java
com.infosec.gesturelock.HomeActivity.java
com.infosec.gesturelock.LockActivity.java
com.infosec.gesturelock.LockSuccessScreen.java
com.infosec.gesturelock.SetPasswordActivity.java
com.infosec.gesturelock.StartTestActivity.java
com.infosec.gesturelock.TutActivityFrag.java
com.infosec.gesturelock.TutActivity.java
com.infosec.gesturelock.util.SystemUiHiderBase.java
com.infosec.gesturelock.util.SystemUiHiderHoneycomb.java
com.infosec.gesturelock.util.SystemUiHider.java