Android Open Source - SecNote Password Preference






From Project

Back to project page SecNote.

License

The source code is released under:

Apache License

If you think the Android project SecNote 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.baraccasoftware.securenotes.object;
/* w  w  w .j a v a  2s  .com*/
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by angelo on 24/02/14.
 */
public class PasswordPreference {
    public static final String KEY_PREFS_PASSWORD = "password_key";
    public static final String KEY_PREFS_LOCKED_APP="lockedapp";
    public static final String KEY_PREFS_SETTED_PASSWORD = "setted_password";
    private static final String APP_SHARED_PREFS = "passwordpreference"; //  Name of the file -.xml
    private SharedPreferences _sharedPrefs;
    private SharedPreferences.Editor _prefsEditor;

    public PasswordPreference(Context context){
        this._sharedPrefs = context.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_PRIVATE);
        this._prefsEditor = _sharedPrefs.edit();
    }

    public String getPassword(){
        return _sharedPrefs.getString(KEY_PREFS_PASSWORD,"");
    }

    public void savePassword(String password){
        _prefsEditor.putString(KEY_PREFS_PASSWORD,password);
        _prefsEditor.commit();
        setKeyPrefsSettedPassword(true);
    }

    public void setLockedApp(boolean locked){
        _prefsEditor.putBoolean(KEY_PREFS_LOCKED_APP,locked);
        _prefsEditor.commit();
    }

    public boolean isAppLocked(){
        return _sharedPrefs.getBoolean(KEY_PREFS_LOCKED_APP,true);
    }

    public void setKeyPrefsSettedPassword(boolean setted){
        _prefsEditor.putBoolean(KEY_PREFS_SETTED_PASSWORD,setted);
        _prefsEditor.commit();
    }

    public boolean isSettedPassword(){
        return _sharedPrefs.getBoolean(KEY_PREFS_SETTED_PASSWORD,false);
    }
}




Java Source Code List

com.baraccasoftware.securenotes.app.ExportDialogFragment.java
com.baraccasoftware.securenotes.app.ImportDialogFragment.java
com.baraccasoftware.securenotes.app.InfoActivity.java
com.baraccasoftware.securenotes.app.InfoFragment.java
com.baraccasoftware.securenotes.app.LockedAppFragment.java
com.baraccasoftware.securenotes.app.LogInFragment.java
com.baraccasoftware.securenotes.app.MainActivity.java
com.baraccasoftware.securenotes.app.NoteDetailActivity.java
com.baraccasoftware.securenotes.app.NoteDetailFragment.java
com.baraccasoftware.securenotes.app.NoteListActivity.java
com.baraccasoftware.securenotes.app.NoteListFragment.java
com.baraccasoftware.securenotes.app.RegisterFragment.java
com.baraccasoftware.securenotes.app.SetPasswordFragment.java
com.baraccasoftware.securenotes.app.SettingsActivity.java
com.baraccasoftware.securenotes.app.SettingsFragment.java
com.baraccasoftware.securenotes.exception.LoadBitmapException.java
com.baraccasoftware.securenotes.object.ActivityUtilityInterface.java
com.baraccasoftware.securenotes.object.BitmapUtility.java
com.baraccasoftware.securenotes.object.Crypto.java
com.baraccasoftware.securenotes.object.DAO.java
com.baraccasoftware.securenotes.object.Encryptor.java
com.baraccasoftware.securenotes.object.ImageLoader.java
com.baraccasoftware.securenotes.object.NoteUtility.java
com.baraccasoftware.securenotes.object.Note.java
com.baraccasoftware.securenotes.object.PBKDF2Encryptor.java
com.baraccasoftware.securenotes.object.PasswordPreference.java
com.baraccasoftware.securenotes.object.SecureDatabaseHelper.java
com.baraccasoftware.securenotes.widget.NoteAdapter.java
com.baraccasoftware.securenotes.widget.SlidingDrawer.java
com.baraccasoftware.securenotes.widget.SwipeDismissListViewTouchListener.java
com.baraccasoftware.securenotes.widget.UndoBarController.java