mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Change education for entries screens
This commit is contained in:
1 parent
2e5ddd80ff
commit
54dbcc95ab
8 files changed
+231
-181
No files matched your search
@@ -23,22 +23,20 @@ package com.kunzisoft.keepass.activities;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.os.Handler;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.getkeepsafe.taptargetview.TapTarget;
|
||||
import com.getkeepsafe.taptargetview.TapTargetSequence;
|
||||
import com.getkeepsafe.taptargetview.TapTargetView;
|
||||
import com.kunzisoft.keepass.R;
|
||||
import com.kunzisoft.keepass.app.App;
|
||||
import com.kunzisoft.keepass.database.Database;
|
||||
@@ -70,7 +68,7 @@ public class EntryActivity extends LockingHideActivity {
|
||||
private ImageView titleIconView;
|
||||
private TextView titleView;
|
||||
private EntryContentsView entryContentsView;
|
||||
private View editView;
|
||||
private Toolbar toolbar;
|
||||
|
||||
protected PwEntry mEntry;
|
||||
private boolean mShowPassword;
|
||||
@@ -93,7 +91,7 @@ public class EntryActivity extends LockingHideActivity {
|
||||
|
||||
setContentView(R.layout.entry_view);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
assert getSupportActionBar() != null;
|
||||
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
|
||||
@@ -206,51 +204,55 @@ public class EntryActivity extends LockingHideActivity {
|
||||
mEntry.endToManageFieldReferences();
|
||||
}
|
||||
firstLaunchOfActivity = false;
|
||||
|
||||
checkAndPerformedEducation();
|
||||
}
|
||||
|
||||
private void checkAndPerformedEducation() {
|
||||
if (!PreferencesUtil.isEducationEntryPerformed(this)) {
|
||||
private void checkAndPerformedEducation(Menu menu) {
|
||||
|
||||
TapTarget copyTapTarget = TapTarget.forView(findViewById(R.id.entry_user_name_action_image),
|
||||
getString(R.string.education_field_copy_title),
|
||||
getString(R.string.education_field_copy_summary));
|
||||
// Construct the drawable if not visible
|
||||
if (!entryContentsView.isUserNamePresent()) {
|
||||
Drawable copyDrawable = ContextCompat.getDrawable(this, R.drawable.ic_content_copy_black_24dp);
|
||||
copyTapTarget = copyTapTarget.icon(copyDrawable);
|
||||
if (entryContentsView != null && entryContentsView.isUserNamePresent()
|
||||
&& !PreferencesUtil.isEducationCopyUsernamePerformed(this)) {
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forView(findViewById(R.id.entry_user_name_action_image),
|
||||
getString(R.string.education_field_copy_title),
|
||||
getString(R.string.education_field_copy_summary))
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
clipboardHelper.timeoutCopyToClipboard(mEntry.getUsername(),
|
||||
getString(R.string.copy_field, getString(R.string.entry_user_name)));
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_copy_username_key);
|
||||
|
||||
} else if (!PreferencesUtil.isEducationEntryEditPerformed(this)) {
|
||||
|
||||
try {
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forToolbarMenuItem(toolbar, R.id.menu_edit,
|
||||
getString(R.string.education_entry_edit_title),
|
||||
getString(R.string.education_entry_edit_summary))
|
||||
.tintTarget(true)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
MenuItem editItem = menu.findItem(R.id.menu_edit);
|
||||
onOptionsItemSelected(editItem);
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_entry_edit_key);
|
||||
} catch (Exception e) {
|
||||
// If icon not visible
|
||||
Log.w(TAG, "Can't performed education for entry's edition");
|
||||
}
|
||||
|
||||
new TapTargetSequence(this)
|
||||
.target(copyTapTarget)
|
||||
// TODO .targets(TapTarget.forView(editView,
|
||||
// getString(R.string.education_entry_edit_title),
|
||||
// getString(R.string.education_entry_edit_summary))
|
||||
// .tintTarget(false)
|
||||
//)
|
||||
.listener(new TapTargetSequence.Listener() {
|
||||
@Override
|
||||
public void onSequenceFinish() {
|
||||
saveEducationPreference();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) {}
|
||||
|
||||
@Override
|
||||
public void onSequenceCanceled(TapTarget lastTarget) {}
|
||||
}).continueOnCancel(true).start();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveEducationPreference() {
|
||||
SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean(getString(R.string.education_entry_key), true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void populateTitle(Drawable drawIcon, String text) {
|
||||
titleIconView.setImageDrawable(drawIcon);
|
||||
titleView.setText(text);
|
||||
@@ -372,6 +374,9 @@ public class EntryActivity extends LockingHideActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show education views
|
||||
new Handler().post(() -> checkAndPerformedEducation(menu));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.kunzisoft.keepass.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@@ -38,7 +37,7 @@ import android.widget.ScrollView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.getkeepsafe.taptargetview.TapTarget;
|
||||
import com.getkeepsafe.taptargetview.TapTargetSequence;
|
||||
import com.getkeepsafe.taptargetview.TapTargetView;
|
||||
import com.kunzisoft.keepass.R;
|
||||
import com.kunzisoft.keepass.app.App;
|
||||
import com.kunzisoft.keepass.database.Database;
|
||||
@@ -63,8 +62,6 @@ import com.kunzisoft.keepass.utils.Types;
|
||||
import com.kunzisoft.keepass.utils.Util;
|
||||
import com.kunzisoft.keepass.view.EntryEditCustomField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EntryEditActivity extends LockingHideActivity
|
||||
@@ -180,130 +177,160 @@ public class EntryEditActivity extends LockingHideActivity
|
||||
// Generate password button
|
||||
generatePasswordView = findViewById(R.id.generate_button);
|
||||
generatePasswordView.setOnClickListener(v -> {
|
||||
GeneratePasswordDialogFragment generatePasswordDialogFragment = new GeneratePasswordDialogFragment();
|
||||
generatePasswordDialogFragment.show(getSupportFragmentManager(), "PasswordGeneratorFragment");
|
||||
openPasswordGenerator();
|
||||
});
|
||||
|
||||
// Save button
|
||||
saveView = findViewById(R.id.entry_save);
|
||||
saveView.setOnClickListener(v -> {
|
||||
if (!validateBeforeSaving()) {
|
||||
return;
|
||||
}
|
||||
mCallbackNewEntry = populateNewEntry();
|
||||
|
||||
OnFinish onFinish = new AfterSave();
|
||||
EntryEditActivity act = EntryEditActivity.this;
|
||||
RunnableOnFinish task;
|
||||
if ( mIsNew ) {
|
||||
task = new AddEntry(act, App.getDB(), mCallbackNewEntry, onFinish);
|
||||
} else {
|
||||
task = new UpdateEntry(act, App.getDB(), mEntry, mCallbackNewEntry, onFinish);
|
||||
}
|
||||
ProgressTask pt = new ProgressTask(act, task, R.string.saving_database);
|
||||
pt.run();
|
||||
saveEntry();
|
||||
});
|
||||
|
||||
|
||||
if (mEntry.allowExtraFields()) {
|
||||
addNewFieldView = findViewById(R.id.add_new_field);
|
||||
addNewFieldView.setVisibility(View.VISIBLE);
|
||||
addNewFieldView.setOnClickListener(v -> {
|
||||
EntryEditCustomField ees = new EntryEditCustomField(EntryEditActivity.this);
|
||||
ees.setData("", new ProtectedString(false, ""));
|
||||
entryExtraFieldsContainer.addView(ees);
|
||||
|
||||
// Scroll bottom
|
||||
scrollView.post(() -> scrollView.fullScroll(ScrollView.FOCUS_DOWN));
|
||||
});
|
||||
addNewFieldView.setOnClickListener(v -> addNewCustomField());
|
||||
}
|
||||
|
||||
// Verify the education views
|
||||
checkAndPerformedEducation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
/**
|
||||
* Open the password generator fragment
|
||||
*/
|
||||
private void openPasswordGenerator() {
|
||||
GeneratePasswordDialogFragment generatePasswordDialogFragment = new GeneratePasswordDialogFragment();
|
||||
generatePasswordDialogFragment.show(getSupportFragmentManager(), "PasswordGeneratorFragment");
|
||||
}
|
||||
|
||||
checkAndPerformedEducation();
|
||||
/**
|
||||
* Add a new view to fill in the information of the customized field
|
||||
*/
|
||||
private void addNewCustomField() {
|
||||
EntryEditCustomField ees = new EntryEditCustomField(EntryEditActivity.this);
|
||||
ees.setData("", new ProtectedString(false, ""));
|
||||
entryExtraFieldsContainer.addView(ees);
|
||||
|
||||
// Scroll bottom
|
||||
scrollView.post(() -> scrollView.fullScroll(ScrollView.FOCUS_DOWN));
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the new entry or update an existing entry in the database
|
||||
*/
|
||||
private void saveEntry() {
|
||||
if (!validateBeforeSaving()) {
|
||||
return;
|
||||
}
|
||||
mCallbackNewEntry = populateNewEntry();
|
||||
|
||||
OnFinish onFinish = new AfterSave();
|
||||
EntryEditActivity act = EntryEditActivity.this;
|
||||
RunnableOnFinish task;
|
||||
if ( mIsNew ) {
|
||||
task = new AddEntry(act, App.getDB(), mCallbackNewEntry, onFinish);
|
||||
} else {
|
||||
task = new UpdateEntry(act, App.getDB(), mEntry, mCallbackNewEntry, onFinish);
|
||||
}
|
||||
ProgressTask pt = new ProgressTask(act, task, R.string.saving_database);
|
||||
pt.run();
|
||||
}
|
||||
|
||||
private void checkAndPerformedEducation() {
|
||||
// For the first time show the tuto
|
||||
if (!PreferencesUtil.isEducationEntryEditPerformed(this)) {
|
||||
|
||||
List<TapTarget> tapTargets = new ArrayList<>();
|
||||
// TODO Show icon
|
||||
|
||||
TapTarget generatePasswordTapTarget = TapTarget.forView(generatePasswordView,
|
||||
getString(R.string.education_generate_password_title),
|
||||
getString(R.string.education_generate_password_summary))
|
||||
.tintTarget(false);
|
||||
tapTargets.add(generatePasswordTapTarget);
|
||||
if (!PreferencesUtil.isEducationPasswordGeneratorPerformed(this)) {
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forView(generatePasswordView,
|
||||
getString(R.string.education_generate_password_title),
|
||||
getString(R.string.education_generate_password_summary))
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
openPasswordGenerator();
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_password_generator_key);
|
||||
}
|
||||
|
||||
if (mEntry.allowExtraFields()) {
|
||||
TapTarget newCustomFieldTapTarget = TapTarget.forView(addNewFieldView,
|
||||
getString(R.string.education_entry_new_field_title),
|
||||
getString(R.string.education_entry_new_field_summary))
|
||||
.tintTarget(false);
|
||||
tapTargets.add(newCustomFieldTapTarget);
|
||||
}
|
||||
|
||||
TapTarget saveTapTarget = TapTarget.forView(saveView,
|
||||
getString(R.string.education_entry_save_title),
|
||||
getString(R.string.education_entry_save_summary))
|
||||
.tintTarget(false);
|
||||
tapTargets.add(saveTapTarget);
|
||||
|
||||
new TapTargetSequence(this)
|
||||
.targets(tapTargets).listener(new TapTargetSequence.Listener() {
|
||||
@Override
|
||||
public void onSequenceFinish() {
|
||||
saveEducationPreference();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) {}
|
||||
|
||||
@Override
|
||||
public void onSequenceCanceled(TapTarget lastTarget) {}
|
||||
}).continueOnCancel(true).start();
|
||||
else if (mEntry.allowExtraFields()
|
||||
&& !mEntry.containsCustomFields()
|
||||
&& !PreferencesUtil.isEducationEntryNewFieldPerformed(this)) {
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forView(addNewFieldView,
|
||||
getString(R.string.education_entry_new_field_title),
|
||||
getString(R.string.education_entry_new_field_summary))
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
addNewCustomField();
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_entry_new_field_key);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveEducationPreference() {
|
||||
SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean(getString(R.string.education_entry_edit_key), true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
protected boolean validateBeforeSaving() {
|
||||
// Require title
|
||||
String title = entryTitleView.getText().toString();
|
||||
if ( title.length() == 0 ) {
|
||||
Toast.makeText(this, R.string.error_title_required, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate password
|
||||
String pass = entryPasswordView.getText().toString();
|
||||
String conf = entryConfirmationPasswordView.getText().toString();
|
||||
if ( ! pass.equals(conf) ) {
|
||||
Toast.makeText(this, R.string.error_pass_match, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
private class ErrorValidation {
|
||||
static final int unknownMessage = -1;
|
||||
|
||||
// Validate extra fields
|
||||
boolean isValidate = false;
|
||||
int messageId = unknownMessage;
|
||||
|
||||
void showValidationErrorIfNeeded() {
|
||||
if (!isValidate && messageId != unknownMessage)
|
||||
Toast.makeText(EntryEditActivity.this, messageId, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
protected ErrorValidation validate() {
|
||||
ErrorValidation errorValidation = new ErrorValidation();
|
||||
|
||||
// Require title
|
||||
String title = entryTitleView.getText().toString();
|
||||
if ( title.length() == 0 ) {
|
||||
errorValidation.messageId = R.string.error_title_required;
|
||||
return errorValidation;
|
||||
}
|
||||
|
||||
// Validate password
|
||||
String pass = entryPasswordView.getText().toString();
|
||||
String conf = entryConfirmationPasswordView.getText().toString();
|
||||
if ( ! pass.equals(conf) ) {
|
||||
errorValidation.messageId = R.string.error_pass_match;
|
||||
return errorValidation;
|
||||
}
|
||||
|
||||
// Validate extra fields
|
||||
if (mEntry.allowExtraFields()) {
|
||||
for (int i = 0; i < entryExtraFieldsContainer.getChildCount(); i++) {
|
||||
EntryEditCustomField entryEditCustomField = (EntryEditCustomField) entryExtraFieldsContainer.getChildAt(i);
|
||||
String key = entryEditCustomField.getLabel();
|
||||
if (key == null || key.length() == 0) {
|
||||
Toast.makeText(this, R.string.error_string_key, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
errorValidation.messageId = R.string.error_string_key;
|
||||
return errorValidation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
errorValidation.isValidate = true;
|
||||
return errorValidation;
|
||||
}
|
||||
|
||||
protected boolean validateBeforeSaving() {
|
||||
ErrorValidation errorValidation = validate();
|
||||
errorValidation.showValidationErrorIfNeeded();
|
||||
return errorValidation.isValidate;
|
||||
}
|
||||
|
||||
protected PwEntry populateNewEntry() {
|
||||
@@ -423,6 +450,8 @@ public class EntryEditActivity extends LockingHideActivity
|
||||
String generatedPassword = bundle.getString(GeneratePasswordDialogFragment.KEY_PASSWORD_ID);
|
||||
entryPasswordView.setText(generatedPassword);
|
||||
entryConfirmationPasswordView.setText(generatedPassword);
|
||||
|
||||
checkAndPerformedEducation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -290,22 +290,27 @@ public class GroupActivity extends ListNodesActivity
|
||||
// Else show the search education
|
||||
} else if (!PreferencesUtil.isEducationSearchPerformed(this)) {
|
||||
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forToolbarMenuItem(toolbar, R.id.menu_search,
|
||||
getString(R.string.education_search_title),
|
||||
getString(R.string.education_search_summary))
|
||||
.tintTarget(true)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
MenuItem searchItem = menu.findItem(R.id.menu_search);
|
||||
searchItem.expandActionView();
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_search_key);
|
||||
try {
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forToolbarMenuItem(toolbar, R.id.menu_search,
|
||||
getString(R.string.education_search_title),
|
||||
getString(R.string.education_search_summary))
|
||||
.tintTarget(true)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
MenuItem searchItem = menu.findItem(R.id.menu_search);
|
||||
searchItem.expandActionView();
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_search_key);
|
||||
} catch (Exception e) {
|
||||
// If icon not visible
|
||||
Log.w(TAG, "Can't performed education for search");
|
||||
}
|
||||
|
||||
// Else show the sort education
|
||||
} else if (!PreferencesUtil.isEducationSortPerformed(this)) {
|
||||
@@ -328,7 +333,6 @@ public class GroupActivity extends ListNodesActivity
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_sort_key);
|
||||
} catch (Exception e) {
|
||||
// If icon not visible
|
||||
Log.w(TAG, "Can't performed education for sort");
|
||||
}
|
||||
|
||||
@@ -353,7 +357,6 @@ public class GroupActivity extends ListNodesActivity
|
||||
PreferencesUtil.saveEducationPreference(this,
|
||||
R.string.education_lock_key);
|
||||
} catch (Exception e) {
|
||||
// If icon not visible
|
||||
Log.w(TAG, "Can't performed education for lock");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ public class PasswordActivity extends StylishActivity
|
||||
}
|
||||
|
||||
private void checkAndPerformedEducation(Bundle savedInstanceState) {
|
||||
if (!PreferencesUtil.isEducationPasswordPerformed(this)) {
|
||||
if (!PreferencesUtil.isEducationUnlockPerformed(this)) {
|
||||
|
||||
List<TapTarget> targets = new ArrayList<>();
|
||||
|
||||
@@ -352,7 +352,7 @@ public class PasswordActivity extends StylishActivity
|
||||
.targets(targets).continueOnCancel(true).start();
|
||||
}
|
||||
|
||||
PreferencesUtil.saveEducationPreference(PasswordActivity.this, R.string.education_password_key);
|
||||
PreferencesUtil.saveEducationPreference(PasswordActivity.this, R.string.education_unlock_key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,20 +146,21 @@ public class PreferencesUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Education Preferences
|
||||
* All preference keys associated with education
|
||||
*/
|
||||
|
||||
public static int[] educationResourceKeys = new int[] {
|
||||
R.string.education_create_db_key,
|
||||
R.string.education_select_db_key,
|
||||
R.string.education_open_link_db_key,
|
||||
R.string.education_unlock_key,
|
||||
R.string.education_search_key,
|
||||
R.string.education_new_node_key,
|
||||
R.string.education_sort_key,
|
||||
R.string.education_lock_key,
|
||||
R.string.education_entry_key,
|
||||
R.string.education_password_key,
|
||||
R.string.education_entry_edit_key
|
||||
R.string.education_copy_username_key,
|
||||
R.string.education_entry_edit_key,
|
||||
R.string.education_password_generator_key,
|
||||
R.string.education_entry_new_field_key
|
||||
};
|
||||
|
||||
public static void saveEducationPreference(Context context, int... educationKeys) {
|
||||
@@ -189,6 +190,12 @@ public class PreferencesUtil {
|
||||
context.getResources().getBoolean(R.bool.education_open_link_db_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationUnlockPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_unlock_key),
|
||||
context.getResources().getBoolean(R.bool.education_unlock_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationSearchPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_search_key),
|
||||
@@ -213,21 +220,27 @@ public class PreferencesUtil {
|
||||
context.getResources().getBoolean(R.bool.education_lock_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationEntryPerformed(Context context) {
|
||||
public static boolean isEducationCopyUsernamePerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_entry_key),
|
||||
context.getResources().getBoolean(R.bool.education_entry_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationPasswordPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_password_key),
|
||||
context.getResources().getBoolean(R.bool.education_password_default));
|
||||
return prefs.getBoolean(context.getString(R.string.education_copy_username_key),
|
||||
context.getResources().getBoolean(R.bool.education_copy_username_key));
|
||||
}
|
||||
|
||||
public static boolean isEducationEntryEditPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_entry_edit_key),
|
||||
context.getResources().getBoolean(R.bool.education_entry_default));
|
||||
context.getResources().getBoolean(R.bool.education_entry_edit_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationPasswordGeneratorPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_password_generator_key),
|
||||
context.getResources().getBoolean(R.bool.education_password_generator_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationEntryNewFieldPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_entry_new_field_key),
|
||||
context.getResources().getBoolean(R.bool.education_entry_new_field_default));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user