mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Change education for database selection
This commit is contained in:
1 parent
2c8e3e9c8e
commit
f8561222d5
3 files changed
+104
-40
No files matched your search
@@ -43,7 +43,7 @@ import android.widget.EditText;
|
||||
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.activities.GroupActivity;
|
||||
import com.kunzisoft.keepass.app.App;
|
||||
@@ -217,6 +217,10 @@ public class FileSelectActivity extends StylishActivity implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// For the first time show the tuto
|
||||
checkAndPerformedEducation(savedInstanceState);
|
||||
}
|
||||
|
||||
private void launchPasswordActivityWithPath(String path) {
|
||||
@@ -258,50 +262,76 @@ public class FileSelectActivity extends StylishActivity implements
|
||||
fileNameView.updateExternalStorageWarning();
|
||||
updateTitleFileListView();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
// For the first time show the tuto
|
||||
checkAndPerformedEducation();
|
||||
}
|
||||
|
||||
private void checkAndPerformedEducation() {
|
||||
if (!PreferencesUtil.isEducationSelectDatabasePerformed(this)) {
|
||||
new TapTargetSequence(this)
|
||||
.targets(
|
||||
TapTarget.forView(createButtonView,
|
||||
getString(R.string.education_create_database_title),
|
||||
getString(R.string.education_create_database_summary))
|
||||
.tintTarget(false),
|
||||
TapTarget.forView(browseButtonView,
|
||||
getString(R.string.education_select_database_title),
|
||||
getString(R.string.education_select_database_summary))
|
||||
.tintTarget(false),
|
||||
TapTarget.forView(openButtonView,
|
||||
getString(R.string.education_open_link_database_title),
|
||||
getString(R.string.education_open_link_database_summary))
|
||||
.tintTarget(false)
|
||||
).listener(new TapTargetSequence.Listener() {
|
||||
@Override
|
||||
public void onSequenceFinish() {
|
||||
saveEducationPreference();
|
||||
}
|
||||
private void checkAndPerformedEducation(Bundle savedInstanceState) {
|
||||
|
||||
@Override
|
||||
public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) {}
|
||||
// If no recent files
|
||||
if ( !fileHistory.hasRecentFiles() ) {
|
||||
// Try to open the creation base education
|
||||
if (!PreferencesUtil.isEducationSelectDatabasePerformed(this) ) {
|
||||
|
||||
@Override
|
||||
public void onSequenceCanceled(TapTarget lastTarget) {}
|
||||
}).continueOnCancel(true).start();
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forView(createButtonView,
|
||||
getString(R.string.education_create_database_title),
|
||||
getString(R.string.education_create_database_summary))
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
FileSelectActivityPermissionsDispatcher
|
||||
.openCreateFileDialogFragmentWithPermissionCheck(FileSelectActivity.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTargetCancel(TapTargetView view) {
|
||||
super.onTargetCancel(view);
|
||||
// But if the user cancel, it can also select a database
|
||||
TapTargetView.showFor(FileSelectActivity.this,
|
||||
TapTarget.forView(browseButtonView,
|
||||
getString(R.string.education_select_database_title),
|
||||
getString(R.string.education_select_database_summary))
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
keyFileHelper.getOpenFileOnClickViewListener().onClick(view);
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(FileSelectActivity.this,
|
||||
R.string.education_select_db_key);
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(FileSelectActivity.this,
|
||||
R.string.education_create_db_key);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!PreferencesUtil.isEducationOpenLinkDatabasePerformed(this) ) {
|
||||
|
||||
TapTargetView.showFor(FileSelectActivity.this,
|
||||
TapTarget.forView(openButtonView,
|
||||
getString(R.string.education_open_link_database_title),
|
||||
getString(R.string.education_open_link_database_summary))
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
new TapTargetView.Listener() {
|
||||
@Override
|
||||
public void onTargetClick(TapTargetView view) {
|
||||
super.onTargetClick(view);
|
||||
// Do nothing here
|
||||
}
|
||||
});
|
||||
PreferencesUtil.saveEducationPreference(FileSelectActivity.this,
|
||||
R.string.education_open_link_db_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveEducationPreference() {
|
||||
SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean(getString(R.string.education_select_db_key), true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
@@ -145,17 +145,47 @@ public class PreferencesUtil {
|
||||
ctx.getResources().getBoolean(R.bool.allow_copy_password_default));
|
||||
}
|
||||
|
||||
/**
|
||||
* Education Preferences
|
||||
*/
|
||||
|
||||
public static int[] educationResourceKeys = new int[] {
|
||||
R.string.education_select_db_key, R.string.education_group_key, R.string.education_entry_key,
|
||||
R.string.education_password_key, R.string.education_entry_edit_key
|
||||
R.string.education_create_db_key,
|
||||
R.string.education_select_db_key,
|
||||
R.string.education_open_link_db_key,
|
||||
R.string.education_group_key,
|
||||
R.string.education_entry_key,
|
||||
R.string.education_password_key,
|
||||
R.string.education_entry_edit_key
|
||||
};
|
||||
|
||||
public static void saveEducationPreference(Context context, int... educationKeys) {
|
||||
SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
for (int key : educationKeys) {
|
||||
editor.putBoolean(context.getString(key), true);
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean isEducationCreateDatabasePerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_create_db_key),
|
||||
context.getResources().getBoolean(R.bool.education_create_db_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationSelectDatabasePerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_select_db_key),
|
||||
context.getResources().getBoolean(R.bool.education_select_db_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationOpenLinkDatabasePerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_open_link_db_key),
|
||||
context.getResources().getBoolean(R.bool.education_open_link_db_default));
|
||||
}
|
||||
|
||||
public static boolean isEducationGroupPerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_group_key),
|
||||
|
||||
Reference in new issue
Block a user