diff --git a/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintDialog.java b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintExplanationDialog.java similarity index 70% rename from app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintDialog.java rename to app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintExplanationDialog.java index be2813fc6..f7114b623 100644 --- a/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintDialog.java +++ b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintExplanationDialog.java @@ -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(); } diff --git a/app/src/main/java/com/kunzisoft/keepass/keyboard/KeyboardExplanationDialog.java b/app/src/main/java/com/kunzisoft/keepass/keyboard/KeyboardExplanationDialog.java new file mode 100644 index 000000000..2f2008be6 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/keyboard/KeyboardExplanationDialog.java @@ -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 . + * + */ +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); + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java index a95a5707c..8fd5fe29a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java @@ -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); diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java b/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java index e8fbd0f4c..4b6cb5762 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java @@ -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: diff --git a/app/src/main/res/drawable/capture_keyboard_entry_key.png b/app/src/main/res/drawable/capture_keyboard_entry_key.png new file mode 100644 index 000000000..95f020e84 Binary files /dev/null and b/app/src/main/res/drawable/capture_keyboard_entry_key.png differ diff --git a/app/src/main/res/drawable/capture_keyboard_fields_keys.png b/app/src/main/res/drawable/capture_keyboard_fields_keys.png new file mode 100644 index 000000000..856fc9603 Binary files /dev/null and b/app/src/main/res/drawable/capture_keyboard_fields_keys.png differ diff --git a/app/src/main/res/drawable/capture_keyboard_lock_key.png b/app/src/main/res/drawable/capture_keyboard_lock_key.png new file mode 100644 index 000000000..f0a530e8c Binary files /dev/null and b/app/src/main/res/drawable/capture_keyboard_lock_key.png differ diff --git a/app/src/main/res/drawable/capture_keyboard_switch_key.png b/app/src/main/res/drawable/capture_keyboard_switch_key.png new file mode 100644 index 000000000..5862f3e99 Binary files /dev/null and b/app/src/main/res/drawable/capture_keyboard_switch_key.png differ diff --git a/app/src/main/res/drawable/capture_keyboard_switcher_logo.png b/app/src/main/res/drawable/capture_keyboard_switcher_logo.png new file mode 100644 index 000000000..ba0cd6af9 Binary files /dev/null and b/app/src/main/res/drawable/capture_keyboard_switcher_logo.png differ diff --git a/app/src/main/res/drawable/type_assword.png b/app/src/main/res/drawable/capture_type_password.png similarity index 100% rename from app/src/main/res/drawable/type_assword.png rename to app/src/main/res/drawable/capture_type_password.png diff --git a/app/src/main/res/layout-v23/fingerprint_dialog.xml b/app/src/main/res/layout-v23/fingerprint_explanation.xml similarity index 98% rename from app/src/main/res/layout-v23/fingerprint_dialog.xml rename to app/src/main/res/layout-v23/fingerprint_explanation.xml index 418db9b0d..6dd639e96 100644 --- a/app/src/main/res/layout-v23/fingerprint_dialog.xml +++ b/app/src/main/res/layout-v23/fingerprint_explanation.xml @@ -71,7 +71,7 @@ + android:src="@drawable/capture_type_password"/> diff --git a/app/src/main/res/layout/keyboard_explanation.xml b/app/src/main/res/layout/keyboard_explanation.xml new file mode 100644 index 000000000..b14dfac2a --- /dev/null +++ b/app/src/main/res/layout/keyboard_explanation.xml @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 31a0ef50a..b43ac104a 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -20,6 +20,7 @@ KeePass DX + https://play.google.com/store/apps/details?id=com.kunzisoft.keepass.pro http://code.google.com/p/android/issues/detail?id=35732 https://www.kunzisoft.com/donation?project=keepassdx @@ -28,6 +29,9 @@ https://play.google.com/store/apps/details?id=org.openintents.filemanager https://f-droid.org/packages/org.openintents.filemanager/ https://keepass.info/help/base/fieldrefs.html + https://play.google.com/store/apps/details?id=com.kunzisoft.keyboard.switcher + https://f-droid.org/en/packages/com.kunzisoft.keyboard.switcher/ + Keyboard Switcher --,--`--,{@ @@ -93,6 +97,7 @@ education_screen_reclicked_key settings_appearance_key magic_keyboard_key + magic_keyboard_preference_key true true @@ -123,7 +128,6 @@ false false false - false 300000 60000 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9aacc2bcd..d11889b38 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -262,9 +262,21 @@ Text appearance Application appearance Other + Keyboard Magikeyboard - Activate a custom keyboard that populates your passwords and all your identity fields easily. + Activate a custom keyboard that populates your passwords and all your identity fields securely. + Magikeyboard preferences + How to configure the keyboard for secure form filling? + Activate the Magikeyboard in the device setting. + Settings -> Language & input -> Current keyboard -> CHOOSE KEYBOARDS + or (Settings -> System -> Language & input -> Virtual keyboard -> Manage keyboards) + Choose the Magikeyboard when you need to fill a form. + You can easily switch from your main keyboard to Magikeyboard with : + Select your entry with the key. + Fill in your fields with the elements of the entry. + Lock the database. + Go back to your main keyboard. Reset education screens Highlight the elements to learn how the application works diff --git a/app/src/main/res/xml/form_filling_preferences.xml b/app/src/main/res/xml/form_filling_preferences.xml index c6cac5418..38f8d8322 100644 --- a/app/src/main/res/xml/form_filling_preferences.xml +++ b/app/src/main/res/xml/form_filling_preferences.xml @@ -27,6 +27,17 @@ android:key="@string/settings_autofill_enable_key"/> + + + + + - - - - \ No newline at end of file diff --git a/magikeyboard/src/main/AndroidManifest.xml b/magikeyboard/src/main/AndroidManifest.xml index 5fd42f460..43cfe6527 100644 --- a/magikeyboard/src/main/AndroidManifest.xml +++ b/magikeyboard/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ @@ -11,7 +12,7 @@ + android:label="@string/keyboard_setting_label"> diff --git a/magikeyboard/src/main/res/values/strings.xml b/magikeyboard/src/main/res/values/strings.xml index e17888795..4936eb1f0 100644 --- a/magikeyboard/src/main/res/values/strings.xml +++ b/magikeyboard/src/main/res/values/strings.xml @@ -18,4 +18,6 @@ --> Magikeyboard + Magikeyboard (KeePass DX) + Magikeyboard settings