Android Open Source - InfoSecProj Lock 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  a 2  s  .c  o m
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;

public class LockActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    
    setContentView(R.layout.activity_test_lock);
  }
  
  @Override
  protected void onResume() {
    super.onResume();
  }
   
  @Override
  protected void onPause() {
      super.onPause();
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
      return true;
    }
    return super.onOptionsItemSelected(item);
  }
  
  @Override
  public void onBackPressed() {
        NavUtils.navigateUpFromSameTask(this);
        this.finish();

      super.onBackPressed();
  }

  public void startTestBtn(View view) {
    if(existingPass()){
      Intent lockIntent = new Intent(this, StartTestActivity.class);
      this.startActivity(lockIntent);
      this.finish();
    }else{
      noPassAlert();
    }
  }
  
  private boolean existingPass(){
    // Check for existing password
    if(HomeActivity.userPassword == null){
      return false;
    }else{
      return true;
    }
  }
  
  private void noPassAlert(){
        AlertDialog.Builder alert = new AlertDialog.Builder(this);
//        submitQuery.setCancelable(true);
        alert.setTitle("No Password Set");
        alert.setInverseBackgroundForced(true);
        alert.setMessage("You have not yet set a gesture password. Would you like to set a new password?");
        alert.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                setPassActivity();
            }
        });

        alert.setNegativeButton("No", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              onBackPressed();
                dialog.dismiss();
            }
        });
        
        alert.show();
  }
  
  private void setPassActivity(){
    Intent setLockIntent = new Intent(this, SetPasswordActivity.class);
    this.startActivity(setLockIntent);
//    this.finish();
  }
}




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