mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Add keyboard explanation
This commit is contained in:
1 parent
44111507e7
commit
015a368a1d
17 files changed
+357
-37
No files matched your search
+8
-16
@@ -20,7 +20,6 @@
|
||||
package com.kunzisoft.keepass.fingerprint;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -30,41 +29,34 @@ import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.kunzisoft.keepass.R;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public class FingerPrintDialog extends DialogFragment {
|
||||
public class FingerPrintExplanationDialog extends DialogFragment {
|
||||
|
||||
private FingerPrintAnimatedVector fingerPrintAnimatedVector;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
assert getActivity() != null;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fingerprint_dialog, null);
|
||||
View rootView = inflater.inflate(R.layout.fingerprint_explanation, null);
|
||||
|
||||
View fingerprintSettingWayTextView = rootView.findViewById(R.id.fingerprint_setting_way_text);
|
||||
fingerprintSettingWayTextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS));
|
||||
}
|
||||
});
|
||||
fingerprintSettingWayTextView.setOnClickListener(
|
||||
view -> startActivity(new Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS)));
|
||||
|
||||
fingerPrintAnimatedVector =
|
||||
new FingerPrintAnimatedVector(getContext(),
|
||||
(ImageView) rootView.findViewById(R.id.fingerprint_image));
|
||||
new FingerPrintAnimatedVector(getActivity(),
|
||||
rootView.findViewById(R.id.fingerprint_image));
|
||||
|
||||
builder.setView(rootView)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
||||
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
|
||||
*
|
||||
* This file is part of KeePass DX.
|
||||
*
|
||||
* KeePass DX is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KeePass DX is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.kunzisoft.keepass.keyboard;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.kunzisoft.keepass.BuildConfig;
|
||||
import com.kunzisoft.keepass.R;
|
||||
import com.kunzisoft.keepass.utils.Util;
|
||||
|
||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
|
||||
public class KeyboardExplanationDialog extends DialogFragment {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
assert getActivity() != null;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
||||
View rootView = inflater.inflate(R.layout.keyboard_explanation, null);
|
||||
|
||||
View fingerprintSettingPath1TextView = rootView.findViewById(R.id.keyboards_activate_setting_path1_text);
|
||||
fingerprintSettingPath1TextView.setOnClickListener(
|
||||
view -> launchActivateKeyboardSetting());
|
||||
View fingerprintSettingPath2TextView = rootView.findViewById(R.id.keyboards_activate_setting_path2_text);
|
||||
fingerprintSettingPath2TextView.setOnClickListener(
|
||||
view -> launchActivateKeyboardSetting());
|
||||
|
||||
View containerKeyboardSwitcher = rootView.findViewById(R.id.container_keyboard_switcher);
|
||||
if(BuildConfig.CLOSED_STORE) {
|
||||
containerKeyboardSwitcher.setOnClickListener(
|
||||
view -> Util.gotoUrl(getContext(), R.string.keyboard_switcher_play_store));
|
||||
} else {
|
||||
containerKeyboardSwitcher.setOnClickListener(
|
||||
view -> Util.gotoUrl(getContext(), R.string.keyboard_switcher_f_droid));
|
||||
}
|
||||
|
||||
builder.setView(rootView)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, id) -> {});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private void launchActivateKeyboardSetting() {
|
||||
Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
|
||||
intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ import com.kunzisoft.keepass.database.action.OnFinishRunnable;
|
||||
import com.kunzisoft.keepass.dialogs.PasswordEncodingDialogHelper;
|
||||
import com.kunzisoft.keepass.fileselect.KeyFileHelper;
|
||||
import com.kunzisoft.keepass.fingerprint.FingerPrintAnimatedVector;
|
||||
import com.kunzisoft.keepass.fingerprint.FingerPrintDialog;
|
||||
import com.kunzisoft.keepass.fingerprint.FingerPrintExplanationDialog;
|
||||
import com.kunzisoft.keepass.fingerprint.FingerPrintHelper;
|
||||
import com.kunzisoft.keepass.settings.PreferencesUtil;
|
||||
import com.kunzisoft.keepass.stylish.StylishActivity;
|
||||
@@ -710,7 +710,7 @@ public class PasswordActivity extends StylishActivity
|
||||
else {
|
||||
// show explanations
|
||||
fingerprintContainerView.setOnClickListener(view -> {
|
||||
FingerPrintDialog fingerPrintDialog = new FingerPrintDialog();
|
||||
FingerPrintExplanationDialog fingerPrintDialog = new FingerPrintExplanationDialog();
|
||||
fingerPrintDialog.show(getSupportFragmentManager(), "fingerprintDialog");
|
||||
});
|
||||
setFingerPrintVisibility(View.VISIBLE);
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.kunzisoft.keepass.dialogs.UnavailableFeatureDialogFragment;
|
||||
import com.kunzisoft.keepass.dialogs.UnderDevelopmentFeatureDialogFragment;
|
||||
import com.kunzisoft.keepass.fingerprint.FingerPrintHelper;
|
||||
import com.kunzisoft.keepass.icons.IconPackChooser;
|
||||
import com.kunzisoft.keepass.keyboard.KeyboardExplanationDialog;
|
||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat;
|
||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseDescriptionPreferenceDialogFragmentCompat;
|
||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseKeyDerivationPreferenceDialogFragmentCompat;
|
||||
@@ -280,17 +281,21 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat
|
||||
});
|
||||
}
|
||||
|
||||
// TODO define the checkbox by verifying
|
||||
SwitchPreference keyboardPreference = (SwitchPreference) findPreference(getString(R.string.magic_keyboard_key));
|
||||
Preference keyboardPreference = findPreference(getString(R.string.magic_keyboard_key));
|
||||
keyboardPreference.setOnPreferenceClickListener(preference -> {
|
||||
if (getContext() != null) {
|
||||
InputMethodManager imeManager = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
if (imeManager != null)
|
||||
imeManager.showInputMethodPicker();
|
||||
if (getFragmentManager() != null) {
|
||||
KeyboardExplanationDialog fingerPrintDialog = new KeyboardExplanationDialog();
|
||||
fingerPrintDialog.show(getFragmentManager(), "keyboardExplanationDialog");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Preference keyboardSubPreference = findPreference(getString(R.string.magic_keyboard_preference_key));
|
||||
keyboardSubPreference.setOnPreferenceClickListener(preference -> {
|
||||
// TODO Open magikeyboard preference
|
||||
return false;
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case DATABASE:
|
||||
|
||||
Reference in new issue
Block a user