Merge branch 'feature/Magikeyboard' into develop
@@ -107,9 +107,7 @@ dependencies {
|
|||||||
implementation 'biz.source_code:base64coder:2010-12-19'
|
implementation 'biz.source_code:base64coder:2010-12-19'
|
||||||
implementation 'com.google.code.gson:gson:2.8.4'
|
implementation 'com.google.code.gson:gson:2.8.4'
|
||||||
implementation 'com.google.guava:guava:23.0-android'
|
implementation 'com.google.guava:guava:23.0-android'
|
||||||
// Icon pack, classic for all, material for libre and pro
|
// Icon pack
|
||||||
implementation project(path: ':icon-pack-classic')
|
implementation project(path: ':icon-pack-classic')
|
||||||
implementation project(path: ':icon-pack-material')
|
implementation project(path: ':icon-pack-material')
|
||||||
implementation project(path: ':magikeyboard')
|
|
||||||
implementation project(path: ':keepass-model')
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,22 @@
|
|||||||
<activity android:name="com.kunzisoft.keepass.selection.EntrySelectionAuthActivity"
|
<activity android:name="com.kunzisoft.keepass.selection.EntrySelectionAuthActivity"
|
||||||
android:configChanges="orientation|keyboardHidden" />
|
android:configChanges="orientation|keyboardHidden" />
|
||||||
<activity android:name="com.kunzisoft.keepass.settings.SettingsAutofillActivity" />
|
<activity android:name="com.kunzisoft.keepass.settings.SettingsAutofillActivity" />
|
||||||
|
<activity android:name="com.kunzisoft.keepass.magikeyboard.EntryRetrieverActivity"
|
||||||
|
android:label="@string/keyboard_name">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.kunzisoft.keepass.settings.MagikIMESettings"
|
||||||
|
android:label="@string/keyboard_setting_label">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Receiver for Keyboard -->
|
||||||
|
<receiver
|
||||||
|
android:name="com.kunzisoft.keepass.magikeyboard.receiver.NotificationDeleteBroadcastReceiver"
|
||||||
|
android:exported="false" >
|
||||||
|
</receiver>
|
||||||
<service
|
<service
|
||||||
android:name="com.kunzisoft.keepass.notifications.NotificationCopyingService"
|
android:name="com.kunzisoft.keepass.notifications.NotificationCopyingService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -149,6 +164,17 @@
|
|||||||
<action android:name="android.service.autofill.AutofillService" />
|
<action android:name="android.service.autofill.AutofillService" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
<service
|
||||||
|
android:name="com.kunzisoft.keepass.magikeyboard.MagikIME"
|
||||||
|
android:label="@string/keyboard_label"
|
||||||
|
android:permission="android.permission.BIND_INPUT_METHOD" >
|
||||||
|
<meta-data android:name="android.view.im"
|
||||||
|
android:resource="@xml/keyboard_method"/>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.view.InputMethod" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
<service android:name="com.kunzisoft.keepass.magikeyboard.KeyboardEntryNotificationService" />
|
||||||
|
|
||||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.kunzisoft.keepass.keyboard;
|
package com.kunzisoft.keepass.dialogs;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -28,16 +28,14 @@ import android.support.v4.app.DialogFragment;
|
|||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
|
|
||||||
import com.kunzisoft.keepass.BuildConfig;
|
import com.kunzisoft.keepass.BuildConfig;
|
||||||
import com.kunzisoft.keepass.R;
|
import com.kunzisoft.keepass.R;
|
||||||
import com.kunzisoft.keepass.utils.Util;
|
import com.kunzisoft.keepass.utils.Util;
|
||||||
|
|
||||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
|
||||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
|
||||||
public class KeyboardExplanationDialog extends DialogFragment {
|
public class KeyboardExplanationDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kunzisoft.magikeyboard;
|
package com.kunzisoft.keepass.magikeyboard;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -9,7 +9,8 @@ import android.support.annotation.Nullable;
|
|||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.kunzisoft.keepass_model.Entry;
|
import com.kunzisoft.keepass.R;
|
||||||
|
import com.kunzisoft.keepass.model.Entry;
|
||||||
|
|
||||||
public class EntryRetrieverActivity extends AppCompatActivity {
|
public class EntryRetrieverActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@@ -43,8 +44,8 @@ public class EntryRetrieverActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
// Show the notification if allowed in Preferences
|
// Show the notification if allowed in Preferences
|
||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
if (sharedPreferences.getBoolean(getString(R.string.notification_entry_key),
|
if (sharedPreferences.getBoolean(getString(R.string.keyboard_notification_entry_key),
|
||||||
getResources().getBoolean(R.bool.notification_entry_default))) {
|
getResources().getBoolean(R.bool.keyboard_notification_entry_default))) {
|
||||||
Intent notificationIntent = new Intent(this, KeyboardEntryNotificationService.class);
|
Intent notificationIntent = new Intent(this, KeyboardEntryNotificationService.class);
|
||||||
startService(notificationIntent);
|
startService(notificationIntent);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kunzisoft.magikeyboard;
|
package com.kunzisoft.keepass.magikeyboard;
|
||||||
|
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@@ -7,19 +7,24 @@ import android.app.Service;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
import android.support.v7.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver;
|
import com.kunzisoft.keepass.R;
|
||||||
import com.kunzisoft.magikeyboard.receiver.NotificationDeleteBroadcastReceiver;
|
import com.kunzisoft.keepass.magikeyboard.receiver.LockBroadcastReceiver;
|
||||||
|
import com.kunzisoft.keepass.magikeyboard.receiver.NotificationDeleteBroadcastReceiver;
|
||||||
|
import com.kunzisoft.keepass.timeout.TimeoutHelper;
|
||||||
|
|
||||||
import static android.content.ContentValues.TAG;
|
import static com.kunzisoft.keepass.magikeyboard.receiver.LockBroadcastReceiver.LOCK_ACTION;
|
||||||
import static com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver.LOCK_ACTION;
|
|
||||||
|
|
||||||
public class KeyboardEntryNotificationService extends Service {
|
public class KeyboardEntryNotificationService extends Service {
|
||||||
|
|
||||||
|
private static final String TAG = KeyboardEntryNotificationService.class.getName();
|
||||||
|
|
||||||
private static final String CHANNEL_ID_KEYBOARD = "com.kunzisoft.keyboard.notification.entry.channel";
|
private static final String CHANNEL_ID_KEYBOARD = "com.kunzisoft.keyboard.notification.entry.channel";
|
||||||
private static final String CHANNEL_NAME_KEYBOARD = "Magikeyboard notification";
|
private static final String CHANNEL_NAME_KEYBOARD = "Magikeyboard notification";
|
||||||
|
|
||||||
@@ -80,7 +85,7 @@ public class KeyboardEntryNotificationService extends Service {
|
|||||||
PendingIntent.getBroadcast(getApplicationContext(), 0, deleteIntent, 0);
|
PendingIntent.getBroadcast(getApplicationContext(), 0, deleteIntent, 0);
|
||||||
|
|
||||||
if (MagikIME.getEntryKey() != null) {
|
if (MagikIME.getEntryKey() != null) {
|
||||||
String entryTitle = getString(R.string.notification_entry_content_title_text);
|
String entryTitle = getString(R.string.keyboard_notification_entry_content_title_text);
|
||||||
String entryUsername = "";
|
String entryUsername = "";
|
||||||
if (!MagikIME.getEntryKey().getTitle().isEmpty())
|
if (!MagikIME.getEntryKey().getTitle().isEmpty())
|
||||||
entryTitle = MagikIME.getEntryKey().getTitle();
|
entryTitle = MagikIME.getEntryKey().getTitle();
|
||||||
@@ -89,40 +94,50 @@ public class KeyboardEntryNotificationService extends Service {
|
|||||||
|
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID_KEYBOARD)
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID_KEYBOARD)
|
||||||
.setSmallIcon(R.drawable.ic_vpn_key_white_24dp)
|
.setSmallIcon(R.drawable.ic_vpn_key_white_24dp)
|
||||||
.setContentTitle(getString(R.string.notification_entry_content_title, entryTitle))
|
.setContentTitle(getString(R.string.keyboard_notification_entry_content_title, entryTitle))
|
||||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
||||||
.setContentText(getString(R.string.notification_entry_content_text, entryUsername))
|
.setContentText(getString(R.string.keyboard_notification_entry_content_text, entryUsername))
|
||||||
.setAutoCancel(false)
|
.setAutoCancel(false)
|
||||||
.setContentIntent(null)
|
.setContentIntent(null)
|
||||||
.setDeleteIntent(pendingDeleteIntent);
|
.setDeleteIntent(pendingDeleteIntent);
|
||||||
|
|
||||||
notificationManager.cancel(notificationId);
|
notificationManager.cancel(notificationId);
|
||||||
notificationManager.notify(notificationId, builder.build());
|
notificationManager.notify(notificationId, builder.build());
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Get timeout
|
// Timeout
|
||||||
/*
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
String keyboardTimeout = prefs.getString(getString(R.string.keyboard_entry_timeout_key),
|
||||||
notificationTimeoutMilliSecs = prefs.getInt(getString(R.string.entry_timeout_key), 100000);
|
getString(R.string.timeout_default));
|
||||||
*/
|
try {
|
||||||
|
notificationTimeoutMilliSecs = Long.parseLong(keyboardTimeout);
|
||||||
/*
|
} catch (NumberFormatException e) {
|
||||||
stopTask(cleanNotificationTimer);
|
notificationTimeoutMilliSecs = TimeoutHelper.DEFAULT_TIMEOUT;
|
||||||
cleanNotificationTimer = new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Thread.sleep(notificationTimeoutMilliSecs);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
cleanNotificationTimer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
notificationManager.cancel(notificationId);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
cleanNotificationTimer.start();
|
if (notificationTimeoutMilliSecs != TimeoutHelper.TIMEOUT_NEVER) {
|
||||||
*/
|
stopTask(cleanNotificationTimer);
|
||||||
|
cleanNotificationTimer = new Thread(() -> {
|
||||||
|
int maxPos = 100;
|
||||||
|
long posDurationMills = notificationTimeoutMilliSecs / maxPos;
|
||||||
|
for (int pos = maxPos; pos > 0; --pos) {
|
||||||
|
builder.setProgress(maxPos, pos, false);
|
||||||
|
notificationManager.notify(notificationId, builder.build());
|
||||||
|
try {
|
||||||
|
Thread.sleep(posDurationMills);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pendingDeleteIntent.send();
|
||||||
|
} catch (PendingIntent.CanceledException e) {
|
||||||
|
Log.e(TAG, e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cleanNotificationTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopTask(Thread task) {
|
private void stopTask(Thread task) {
|
||||||
@@ -130,12 +145,19 @@ public class KeyboardEntryNotificationService extends Service {
|
|||||||
task.interrupt();
|
task.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void destroyKeyboardNotification() {
|
||||||
public void onDestroy() {
|
stopTask(cleanNotificationTimer);
|
||||||
|
cleanNotificationTimer = null;
|
||||||
unregisterReceiver(lockBroadcastReceiver);
|
unregisterReceiver(lockBroadcastReceiver);
|
||||||
pendingDeleteIntent.cancel();
|
pendingDeleteIntent.cancel();
|
||||||
|
|
||||||
notificationManager.cancel(notificationId);
|
notificationManager.cancel(notificationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
|
||||||
|
destroyKeyboardNotification();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.kunzisoft.magikeyboard;
|
package com.kunzisoft.keepass.magikeyboard;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -28,24 +28,35 @@ import android.inputmethodservice.Keyboard;
|
|||||||
import android.inputmethodservice.KeyboardView;
|
import android.inputmethodservice.KeyboardView;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.support.v7.preference.PreferenceManager;
|
import android.support.v7.preference.PreferenceManager;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.PopupWindow;
|
||||||
|
|
||||||
import com.kunzisoft.keepass_model.Entry;
|
import com.kunzisoft.keepass.R;
|
||||||
import com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver;
|
import com.kunzisoft.keepass.magikeyboard.adapter.FieldsAdapter;
|
||||||
|
import com.kunzisoft.keepass.magikeyboard.receiver.LockBroadcastReceiver;
|
||||||
|
import com.kunzisoft.keepass.magikeyboard.view.MagikeyboardView;
|
||||||
|
import com.kunzisoft.keepass.model.Entry;
|
||||||
|
|
||||||
import static com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver.LOCK_ACTION;
|
import static com.kunzisoft.keepass.magikeyboard.receiver.LockBroadcastReceiver.LOCK_ACTION;
|
||||||
|
|
||||||
public class MagikIME extends InputMethodService
|
public class MagikIME extends InputMethodService
|
||||||
implements KeyboardView.OnKeyboardActionListener {
|
implements KeyboardView.OnKeyboardActionListener {
|
||||||
private static final String TAG = MagikIME.class.getName();
|
private static final String TAG = MagikIME.class.getName();
|
||||||
|
|
||||||
private static final int KEY_CHANGE_KEYBOARD = 600;
|
public static final int KEY_BACK_KEYBOARD = 600;
|
||||||
|
public static final int KEY_CHANGE_KEYBOARD = 601;
|
||||||
private static final int KEY_UNLOCK = 610;
|
private static final int KEY_UNLOCK = 610;
|
||||||
private static final int KEY_LOCK = 611;
|
private static final int KEY_LOCK = 611;
|
||||||
private static final int KEY_ENTRY = 620;
|
private static final int KEY_ENTRY = 620;
|
||||||
@@ -59,6 +70,9 @@ public class MagikIME extends InputMethodService
|
|||||||
private KeyboardView keyboardView;
|
private KeyboardView keyboardView;
|
||||||
private Keyboard keyboard;
|
private Keyboard keyboard;
|
||||||
private Keyboard keyboard_entry;
|
private Keyboard keyboard_entry;
|
||||||
|
private PopupWindow popupCustomKeys;
|
||||||
|
private FieldsAdapter fieldsAdapter;
|
||||||
|
private boolean playSoundDuringCLick;
|
||||||
|
|
||||||
private LockBroadcastReceiver lockBroadcastReceiver;
|
private LockBroadcastReceiver lockBroadcastReceiver;
|
||||||
|
|
||||||
@@ -77,22 +91,48 @@ public class MagikIME extends InputMethodService
|
|||||||
registerReceiver(lockBroadcastReceiver, new IntentFilter(LOCK_ACTION));
|
registerReceiver(lockBroadcastReceiver, new IntentFilter(LOCK_ACTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
unregisterReceiver(lockBroadcastReceiver);
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateInputView() {
|
public View onCreateInputView() {
|
||||||
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard, null);
|
keyboardView = (MagikeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
|
||||||
keyboard = new Keyboard(this, R.xml.keyboard_password);
|
keyboard = new Keyboard(this, R.xml.keyboard_password);
|
||||||
keyboard_entry = new Keyboard(this, R.xml.keyboard_password_entry);
|
keyboard_entry = new Keyboard(this, R.xml.keyboard_password_entry);
|
||||||
|
|
||||||
assignKeyboardView();
|
assignKeyboardView();
|
||||||
keyboardView.setOnKeyboardActionListener(this);
|
keyboardView.setOnKeyboardActionListener(this);
|
||||||
keyboardView.setPreviewEnabled(false);
|
keyboardView.setPreviewEnabled(false);
|
||||||
keyboardView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
|
||||||
|
Context context = getBaseContext();
|
||||||
|
View popupFieldsView = LayoutInflater.from(context)
|
||||||
|
.inflate(R.layout.keyboard_popup_fields, new FrameLayout(context));
|
||||||
|
|
||||||
|
if (popupCustomKeys != null)
|
||||||
|
popupCustomKeys.dismiss();
|
||||||
|
|
||||||
|
popupCustomKeys = new PopupWindow(context);
|
||||||
|
popupCustomKeys.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
|
||||||
|
popupCustomKeys.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
|
||||||
|
popupCustomKeys.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
popupCustomKeys.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
||||||
|
popupCustomKeys.setContentView(popupFieldsView);
|
||||||
|
|
||||||
|
RecyclerView recyclerView = popupFieldsView.findViewById(R.id.keyboard_popup_fields_list);
|
||||||
|
fieldsAdapter = new FieldsAdapter(this);
|
||||||
|
fieldsAdapter.setOnItemClickListener(item -> getCurrentInputConnection().commitText(item.getValue(), 1));
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
|
||||||
|
recyclerView.setAdapter(fieldsAdapter);
|
||||||
|
|
||||||
|
View closeView = popupFieldsView.findViewById(R.id.keyboard_popup_close);
|
||||||
|
closeView.setOnClickListener(v -> popupCustomKeys.dismiss());
|
||||||
|
|
||||||
|
// Define preferences
|
||||||
|
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
keyboardView.setHapticFeedbackEnabled(
|
||||||
|
sharedPreferences.getBoolean(
|
||||||
|
getString(R.string.keyboard_key_vibrate_key),
|
||||||
|
getResources().getBoolean(R.bool.keyboard_key_vibrate_default)));
|
||||||
|
playSoundDuringCLick = sharedPreferences.getBoolean(
|
||||||
|
getString(R.string.keyboard_key_sound_key),
|
||||||
|
getResources().getBoolean(R.bool.keyboard_key_sound_default));
|
||||||
|
|
||||||
return keyboardView;
|
return keyboardView;
|
||||||
}
|
}
|
||||||
@@ -103,8 +143,10 @@ public class MagikIME extends InputMethodService
|
|||||||
if (keyboard_entry != null)
|
if (keyboard_entry != null)
|
||||||
keyboardView.setKeyboard(keyboard_entry);
|
keyboardView.setKeyboard(keyboard_entry);
|
||||||
} else {
|
} else {
|
||||||
if (keyboard != null)
|
if (keyboard != null) {
|
||||||
|
dismissCustomKeys();
|
||||||
keyboardView.setKeyboard(keyboard);
|
keyboardView.setKeyboard(keyboard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,9 +173,16 @@ public class MagikIME extends InputMethodService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onKey(int primaryCode, int[] keyCodes) {
|
public void onKey(int primaryCode, int[] keyCodes) {
|
||||||
InputConnection ic = getCurrentInputConnection();
|
InputConnection inputConnection = getCurrentInputConnection();
|
||||||
|
|
||||||
|
// Vibrate
|
||||||
|
keyboardView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||||
|
// Play a sound
|
||||||
|
if (playSoundDuringCLick)
|
||||||
|
playClick(primaryCode);
|
||||||
|
|
||||||
switch(primaryCode){
|
switch(primaryCode){
|
||||||
case KEY_CHANGE_KEYBOARD:
|
case KEY_BACK_KEYBOARD:
|
||||||
try {
|
try {
|
||||||
InputMethodManager imeManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
InputMethodManager imeManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||||
assert imeManager != null;
|
assert imeManager != null;
|
||||||
@@ -145,99 +194,74 @@ public class MagikIME extends InputMethodService
|
|||||||
if (imeManager != null)
|
if (imeManager != null)
|
||||||
imeManager.showInputMethodPicker();
|
imeManager.showInputMethodPicker();
|
||||||
}
|
}
|
||||||
// TODO Add a long press to choose the keyboard
|
|
||||||
break;
|
break;
|
||||||
|
case KEY_CHANGE_KEYBOARD:
|
||||||
|
InputMethodManager imeManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||||
|
if (imeManager != null)
|
||||||
|
imeManager.showInputMethodPicker();
|
||||||
|
break;
|
||||||
case KEY_UNLOCK:
|
case KEY_UNLOCK:
|
||||||
// TODO Unlock key
|
// TODO Unlock key
|
||||||
break;
|
break;
|
||||||
case KEY_ENTRY:
|
case KEY_ENTRY:
|
||||||
|
deleteEntryKey(this);
|
||||||
Intent intent = new Intent(this, EntryRetrieverActivity.class);
|
Intent intent = new Intent(this, EntryRetrieverActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
case KEY_LOCK:
|
case KEY_LOCK:
|
||||||
deleteEntryKey(this);
|
deleteEntryKey(this);
|
||||||
|
dismissCustomKeys();
|
||||||
break;
|
break;
|
||||||
case KEY_USERNAME:
|
case KEY_USERNAME:
|
||||||
if (entryKey != null) {
|
if (entryKey != null) {
|
||||||
InputConnection inputConnection = getCurrentInputConnection();
|
|
||||||
inputConnection.commitText(entryKey.getUsername(), 1);
|
inputConnection.commitText(entryKey.getUsername(), 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_PASSWORD:
|
case KEY_PASSWORD:
|
||||||
if (entryKey != null) {
|
if (entryKey != null) {
|
||||||
InputConnection inputConnection = getCurrentInputConnection();
|
|
||||||
inputConnection.commitText(entryKey.getPassword(), 1);
|
inputConnection.commitText(entryKey.getPassword(), 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_URL:
|
case KEY_URL:
|
||||||
if (entryKey != null) {
|
if (entryKey != null) {
|
||||||
InputConnection inputConnection = getCurrentInputConnection();
|
|
||||||
inputConnection.commitText(entryKey.getUrl(), 1);
|
inputConnection.commitText(entryKey.getUrl(), 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_FIELDS:
|
case KEY_FIELDS:
|
||||||
// TODO Fields key
|
fieldsAdapter.setFields(entryKey.getCustomFields());
|
||||||
|
popupCustomKeys.showAtLocation(keyboardView, Gravity.END | Gravity.TOP, 0, 0);
|
||||||
|
break;
|
||||||
case Keyboard.KEYCODE_DELETE :
|
case Keyboard.KEYCODE_DELETE :
|
||||||
ic.deleteSurroundingText(1, 0);
|
inputConnection.deleteSurroundingText(1, 0);
|
||||||
break;
|
break;
|
||||||
case Keyboard.KEYCODE_DONE:
|
case Keyboard.KEYCODE_DONE:
|
||||||
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
|
inputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean(getString(R.string.key_vibrate_key), getResources().getBoolean(R.bool.key_vibrate_default)))
|
|
||||||
vibrate();
|
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean(getString(R.string.key_sound_key), getResources().getBoolean(R.bool.key_sound_default)))
|
|
||||||
playClick(primaryCode);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPress(int primaryCode) {
|
public void onPress(int primaryCode) {}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public void onRelease(int primaryCode) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRelease(int primaryCode) {
|
public void onText(CharSequence text) {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onText(CharSequence text) {
|
public void swipeDown() {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void swipeDown() {
|
public void swipeLeft() {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void swipeLeft() {
|
public void swipeRight() {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void swipeRight() {
|
public void swipeUp() {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void swipeUp() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void vibrate() {
|
|
||||||
// TODO better vibration
|
|
||||||
/*
|
|
||||||
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
if (vibrator != null) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
vibrator.vibrate(VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE));
|
|
||||||
} else {
|
|
||||||
vibrator.vibrate(50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
private void playClick(int keyCode){
|
private void playClick(int keyCode){
|
||||||
AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
|
AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
|
||||||
@@ -253,4 +277,18 @@ public class MagikIME extends InputMethodService
|
|||||||
default: am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
|
default: am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dismissCustomKeys() {
|
||||||
|
if (popupCustomKeys != null)
|
||||||
|
popupCustomKeys.dismiss();
|
||||||
|
if (fieldsAdapter != null)
|
||||||
|
fieldsAdapter.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
dismissCustomKeys();
|
||||||
|
unregisterReceiver(lockBroadcastReceiver);
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.kunzisoft.keepass.magikeyboard.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.kunzisoft.keepass.R;
|
||||||
|
import com.kunzisoft.keepass.model.Field;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FieldsAdapter extends RecyclerView.Adapter<FieldsAdapter.FieldViewHolder> {
|
||||||
|
|
||||||
|
private LayoutInflater inflater;
|
||||||
|
private List<Field> fields;
|
||||||
|
private OnItemClickListener listener;
|
||||||
|
|
||||||
|
public FieldsAdapter(Context context) {
|
||||||
|
this.inflater = LayoutInflater.from(context);
|
||||||
|
this.fields = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<Field> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public FieldViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = inflater.inflate(R.layout.keyboard_popup_fields_item, parent, false);
|
||||||
|
return new FieldViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull FieldViewHolder holder, int position) {
|
||||||
|
Field field = fields.get(position);
|
||||||
|
holder.name.setText(field.getName());
|
||||||
|
holder.bind(field, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return fields.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
fields.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(Field item);
|
||||||
|
}
|
||||||
|
|
||||||
|
class FieldViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
TextView name;
|
||||||
|
|
||||||
|
FieldViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
name = itemView.findViewById(R.id.keyboard_popup_field_item_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(final Field item, final OnItemClickListener listener) {
|
||||||
|
itemView.setOnClickListener(v -> listener.onItemClick(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kunzisoft.magikeyboard.receiver;
|
package com.kunzisoft.keepass.magikeyboard.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.kunzisoft.magikeyboard.receiver;
|
package com.kunzisoft.keepass.magikeyboard.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import com.kunzisoft.magikeyboard.KeyboardEntryNotificationService;
|
import com.kunzisoft.keepass.R;
|
||||||
import com.kunzisoft.magikeyboard.MagikIME;
|
import com.kunzisoft.keepass.magikeyboard.KeyboardEntryNotificationService;
|
||||||
import com.kunzisoft.magikeyboard.R;
|
import com.kunzisoft.keepass.magikeyboard.MagikIME;
|
||||||
|
|
||||||
public class NotificationDeleteBroadcastReceiver extends BroadcastReceiver {
|
public class NotificationDeleteBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@@ -15,8 +15,8 @@ public class NotificationDeleteBroadcastReceiver extends BroadcastReceiver {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
// Clear the entry if define in preferences
|
// Clear the entry if define in preferences
|
||||||
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
if (sharedPreferences.getBoolean(context.getString(R.string.notification_entry_clear_close_key),
|
if (sharedPreferences.getBoolean(context.getString(R.string.keyboard_notification_entry_clear_close_key),
|
||||||
context.getResources().getBoolean(R.bool.notification_entry_clear_close_default))) {
|
context.getResources().getBoolean(R.bool.keyboard_notification_entry_clear_close_default))) {
|
||||||
MagikIME.deleteEntryKey(context);
|
MagikIME.deleteEntryKey(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.kunzisoft.keepass.magikeyboard.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.inputmethodservice.Keyboard;
|
||||||
|
import android.inputmethodservice.KeyboardView;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import static com.kunzisoft.keepass.magikeyboard.MagikIME.KEY_BACK_KEYBOARD;
|
||||||
|
import static com.kunzisoft.keepass.magikeyboard.MagikIME.KEY_CHANGE_KEYBOARD;
|
||||||
|
|
||||||
|
public class MagikeyboardView extends KeyboardView {
|
||||||
|
|
||||||
|
public MagikeyboardView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MagikeyboardView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public MagikeyboardView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onLongPress(Keyboard.Key key) {
|
||||||
|
// TODO Action on long press
|
||||||
|
if (key.codes[0] == KEY_BACK_KEYBOARD) {
|
||||||
|
getOnKeyboardActionListener().onKey(KEY_CHANGE_KEYBOARD, null);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
//Log.d("LatinKeyboardView", "KEY: " + key.codes[0]);
|
||||||
|
return super.onLongPress(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.kunzisoft.keepass_model;
|
package com.kunzisoft.keepass.model;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class Entry implements Parcelable {
|
public class Entry implements Parcelable {
|
||||||
|
|
||||||
@@ -13,14 +12,14 @@ public class Entry implements Parcelable {
|
|||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
private String url;
|
private String url;
|
||||||
private Map<String, String> customFields;
|
private List<Field> customFields;
|
||||||
|
|
||||||
public Entry() {
|
public Entry() {
|
||||||
this.title = "";
|
this.title = "";
|
||||||
this.username = "";
|
this.username = "";
|
||||||
this.password = "";
|
this.password = "";
|
||||||
this.url = "";
|
this.url = "";
|
||||||
this.customFields = new HashMap<>();
|
this.customFields = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Entry(Parcel in) {
|
protected Entry(Parcel in) {
|
||||||
@@ -29,7 +28,7 @@ public class Entry implements Parcelable {
|
|||||||
password = in.readString();
|
password = in.readString();
|
||||||
url = in.readString();
|
url = in.readString();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
customFields = in.readHashMap(String.class.getClassLoader());
|
customFields = in.readArrayList(Field.class.getClassLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<Entry> CREATOR = new Creator<Entry>() {
|
public static final Creator<Entry> CREATOR = new Creator<Entry>() {
|
||||||
@@ -76,16 +75,12 @@ public class Entry implements Parcelable {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getCustomFieldsKeys() {
|
public List<Field> getCustomFields() {
|
||||||
return customFields.keySet();
|
return customFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustomField(String key) {
|
public void addCustomField(Field field) {
|
||||||
return customFields.get(key);
|
this.customFields.add(field);
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomField(String key, String value) {
|
|
||||||
this.customFields.put(key, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,6 +94,6 @@ public class Entry implements Parcelable {
|
|||||||
parcel.writeString(username);
|
parcel.writeString(username);
|
||||||
parcel.writeString(password);
|
parcel.writeString(password);
|
||||||
parcel.writeString(url);
|
parcel.writeString(url);
|
||||||
parcel.writeMap(customFields);
|
parcel.writeArray(customFields.toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
59
app/src/main/java/com/kunzisoft/keepass/model/Field.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package com.kunzisoft.keepass.model;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
public class Field implements Parcelable {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public Field(String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Field(Parcel in) {
|
||||||
|
this.name = in.readString();
|
||||||
|
this.value = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<Field> CREATOR = new Creator<Field>() {
|
||||||
|
@Override
|
||||||
|
public Field createFromParcel(Parcel in) {
|
||||||
|
return new Field(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Field[] newArray(int size) {
|
||||||
|
return new Field[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeString(name);
|
||||||
|
dest.writeString(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ import android.content.Intent;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.kunzisoft.keepass.database.PwEntry;
|
import com.kunzisoft.keepass.database.PwEntry;
|
||||||
import com.kunzisoft.keepass_model.Entry;
|
import com.kunzisoft.keepass.model.Entry;
|
||||||
|
import com.kunzisoft.keepass.model.Field;
|
||||||
|
|
||||||
public class EntrySelectionHelper {
|
public class EntrySelectionHelper {
|
||||||
|
|
||||||
@@ -37,9 +38,11 @@ public class EntrySelectionHelper {
|
|||||||
entryModel.setUsername(entry.getUsername());
|
entryModel.setUsername(entry.getUsername());
|
||||||
entryModel.setPassword(entry.getPassword());
|
entryModel.setPassword(entry.getPassword());
|
||||||
entryModel.setUrl(entry.getUrl());
|
entryModel.setUrl(entry.getUrl());
|
||||||
// TODO Fields
|
|
||||||
if (entry.containsCustomFields()) {
|
if (entry.containsCustomFields()) {
|
||||||
//entryModel.setCustomField(entry.getFields());
|
entry.getFields()
|
||||||
|
.doActionToAllCustomProtectedField(
|
||||||
|
(key, value) -> entryModel.addCustomField(
|
||||||
|
new Field(key, value.toString())));
|
||||||
}
|
}
|
||||||
|
|
||||||
mReplyIntent.putExtra(
|
mReplyIntent.putExtra(
|
||||||
|
|||||||
@@ -17,21 +17,16 @@
|
|||||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.kunzisoft.magikeyboard.settings;
|
package com.kunzisoft.keepass.settings;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import com.kunzisoft.magikeyboard.R;
|
import com.kunzisoft.keepass.R;
|
||||||
|
import com.kunzisoft.keepass.lock.LockingActivity;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
public class MagikIMESettings extends LockingActivity {
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
public class MagikIMESettings extends AppCompatActivity {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -49,26 +44,6 @@ public class MagikIMESettings extends AppCompatActivity {
|
|||||||
.replace(R.id.fragment_container, new MagikIMESettingsFragment())
|
.replace(R.id.fragment_container, new MagikIMESettingsFragment())
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Remove after all dev
|
|
||||||
try {
|
|
||||||
Class<?> underDevClass = Class.forName("com.kunzisoft.keepass.dialogs.UnderDevelopmentFeatureDialogFragment");
|
|
||||||
Constructor<?> constructor = underDevClass.getConstructor();
|
|
||||||
Object object = constructor.newInstance();
|
|
||||||
Method showMethod = underDevClass.getMethod("show", FragmentManager.class, String.class);
|
|
||||||
showMethod.invoke(object, getSupportFragmentManager(), "magikeyboard_dev_dialog");
|
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.kunzisoft.magikeyboard.settings;
|
package com.kunzisoft.keepass.settings;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
import com.kunzisoft.magikeyboard.R;
|
import com.kunzisoft.keepass.R;
|
||||||
|
|
||||||
public class MagikIMESettingsFragment extends PreferenceFragmentCompat {
|
public class MagikIMESettingsFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
// Load the preferences from an XML resource
|
// Load the preferences from an XML resource
|
||||||
setPreferencesFromResource(R.xml.ime_preferences, rootKey);
|
setPreferencesFromResource(R.xml.keyboard_preferences, rootKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ import com.kunzisoft.keepass.dialogs.UnavailableFeatureDialogFragment;
|
|||||||
import com.kunzisoft.keepass.dialogs.UnderDevelopmentFeatureDialogFragment;
|
import com.kunzisoft.keepass.dialogs.UnderDevelopmentFeatureDialogFragment;
|
||||||
import com.kunzisoft.keepass.fingerprint.FingerPrintHelper;
|
import com.kunzisoft.keepass.fingerprint.FingerPrintHelper;
|
||||||
import com.kunzisoft.keepass.icons.IconPackChooser;
|
import com.kunzisoft.keepass.icons.IconPackChooser;
|
||||||
import com.kunzisoft.keepass.keyboard.KeyboardExplanationDialog;
|
import com.kunzisoft.keepass.dialogs.KeyboardExplanationDialogFragment;
|
||||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseDescriptionPreferenceDialogFragmentCompat;
|
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseDescriptionPreferenceDialogFragmentCompat;
|
||||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat;
|
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat;
|
||||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseKeyDerivationPreferenceDialogFragmentCompat;
|
import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseKeyDerivationPreferenceDialogFragmentCompat;
|
||||||
@@ -60,7 +60,6 @@ import com.kunzisoft.keepass.settings.preferenceDialogFragment.MemoryUsagePrefer
|
|||||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.ParallelismPreferenceDialogFragmentCompat;
|
import com.kunzisoft.keepass.settings.preferenceDialogFragment.ParallelismPreferenceDialogFragmentCompat;
|
||||||
import com.kunzisoft.keepass.settings.preferenceDialogFragment.RoundsPreferenceDialogFragmentCompat;
|
import com.kunzisoft.keepass.settings.preferenceDialogFragment.RoundsPreferenceDialogFragmentCompat;
|
||||||
import com.kunzisoft.keepass.stylish.Stylish;
|
import com.kunzisoft.keepass.stylish.Stylish;
|
||||||
import com.kunzisoft.magikeyboard.settings.MagikIMESettings;
|
|
||||||
|
|
||||||
public class NestedSettingsFragment extends PreferenceFragmentCompat
|
public class NestedSettingsFragment extends PreferenceFragmentCompat
|
||||||
implements Preference.OnPreferenceClickListener {
|
implements Preference.OnPreferenceClickListener {
|
||||||
@@ -303,8 +302,8 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat
|
|||||||
Preference keyboardPreference = findPreference(getString(R.string.magic_keyboard_key));
|
Preference keyboardPreference = findPreference(getString(R.string.magic_keyboard_key));
|
||||||
keyboardPreference.setOnPreferenceClickListener(preference -> {
|
keyboardPreference.setOnPreferenceClickListener(preference -> {
|
||||||
if (getFragmentManager() != null) {
|
if (getFragmentManager() != null) {
|
||||||
KeyboardExplanationDialog fingerPrintDialog = new KeyboardExplanationDialog();
|
KeyboardExplanationDialogFragment keyboardDialog = new KeyboardExplanationDialogFragment();
|
||||||
fingerPrintDialog.show(getFragmentManager(), "keyboardExplanationDialog");
|
keyboardDialog.show(getFragmentManager(), "keyboardExplanationDialog");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ public class TimeoutHelper {
|
|||||||
|
|
||||||
private static final String TAG = "TimeoutHelper";
|
private static final String TAG = "TimeoutHelper";
|
||||||
|
|
||||||
private static final long DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
public static final long DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
||||||
|
public static final long TIMEOUT_NEVER = -1; // Infinite
|
||||||
|
|
||||||
public static void recordTime(Activity act) {
|
public static void recordTime(Activity act) {
|
||||||
// Record timeout time in case timeout service is killed
|
// Record timeout time in case timeout service is killed
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
@@ -56,9 +57,9 @@ public class TimeoutHelper {
|
|||||||
long cur_time = System.currentTimeMillis();
|
long cur_time = System.currentTimeMillis();
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(act);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(act);
|
||||||
long timeout_start = prefs.getLong(act.getString(R.string.timeout_key), -1);
|
long timeout_start = prefs.getLong(act.getString(R.string.timeout_key), TIMEOUT_NEVER);
|
||||||
// The timeout never started
|
// The timeout never started
|
||||||
if (timeout_start == -1) {
|
if (timeout_start == TIMEOUT_NEVER) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ public class TimeoutHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We are set to never timeout
|
// We are set to never timeout
|
||||||
if (timeout == -1) {
|
if (timeout == TIMEOUT_NEVER) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1001 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 1.1 KiB |
26
app/src/main/res/layout/keyboard_popup_fields.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:background="@color/keyboard_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/keyboard_popup_fields_list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_toStartOf="@+id/keyboard_popup_close"
|
||||||
|
android:layout_toLeftOf="@+id/keyboard_popup_close" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/keyboard_popup_close"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:background="@drawable/key_background"
|
||||||
|
android:src="@drawable/ic_close_white_24dp" />
|
||||||
|
</RelativeLayout>
|
||||||
15
app/src/main/res/layout/keyboard_popup_fields_item.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/keyboard_popup_field_item_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/key_background"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="qsjdbhqsdv"
|
||||||
|
android:textColor="@color/white"/>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -17,16 +17,16 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<android.inputmethodservice.KeyboardView
|
<com.kunzisoft.keepass.magikeyboard.view.MagikeyboardView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/keyboard"
|
android:id="@+id/keyboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:keyPreviewLayout ="@layout/key_preview"
|
|
||||||
android:background="@color/keyboard_background"
|
android:background="@color/keyboard_background"
|
||||||
android:keyBackground="@drawable/key_background"
|
android:keyBackground="@drawable/key_background"
|
||||||
android:keyTextColor="#ffff"
|
android:keyTextColor="#ffff"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
|
android:popupLayout="@layout/keyboard_popup_fields"
|
||||||
/>
|
/>
|
||||||
@@ -68,4 +68,9 @@
|
|||||||
<color name="colorTextSecondaryDisable">#c7c7c7</color>
|
<color name="colorTextSecondaryDisable">#c7c7c7</color>
|
||||||
<color name="colorTextSecondaryInverse">#999999</color>
|
<color name="colorTextSecondaryInverse">#999999</color>
|
||||||
<color name="colorTextSecondaryInverseDisable">#565656</color>
|
<color name="colorTextSecondaryInverseDisable">#565656</color>
|
||||||
</resources>
|
|
||||||
|
<color name="keyboard_button">#3c474c</color>
|
||||||
|
<color name="keyboard_button_pressed">#263238</color>
|
||||||
|
<color name="keyboard_button_border">#3c464c</color>
|
||||||
|
<color name="keyboard_background">#263238</color>
|
||||||
|
</resources>
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
<bool name="allow_no_password_default" translatable="false">true</bool>
|
<bool name="allow_no_password_default" translatable="false">true</bool>
|
||||||
<bool name="enable_read_only_default" translatable="false">false</bool>
|
<bool name="enable_read_only_default" translatable="false">false</bool>
|
||||||
|
|
||||||
<string name="app_timeout_default" translatable="false">300000</string>
|
<string name="timeout_default" translatable="false">300000</string>
|
||||||
<string name="clipboard_timeout_default" translatable="false">60000</string>
|
<string name="clipboard_timeout_default" translatable="false">60000</string>
|
||||||
|
|
||||||
<string-array name="timeout_values">
|
<string-array name="timeout_values">
|
||||||
|
|||||||
@@ -288,6 +288,44 @@
|
|||||||
<string name="keyboard_lock_database_text">Lock the database.</string>
|
<string name="keyboard_lock_database_text">Lock the database.</string>
|
||||||
<string name="keyboard_back_main_keyboard_text">Go back to your main keyboard.</string>
|
<string name="keyboard_back_main_keyboard_text">Go back to your main keyboard.</string>
|
||||||
|
|
||||||
|
<string name="keyboard_name">Magikeyboard</string>
|
||||||
|
<string name="keyboard_label">Magikeyboard (KeePass DX)</string>
|
||||||
|
<string name="keyboard_setting_label">Magikeyboard settings</string>
|
||||||
|
|
||||||
|
<string name="keyboard_entry_category">Entry</string>
|
||||||
|
|
||||||
|
<string name="keyboard_entry_timeout_key" translatable="false">erase_entry_timeout_key</string>
|
||||||
|
<string name="keyboard_entry_timeout_title">Timeout</string>
|
||||||
|
<string name="keyboard_entry_timeout_summary">Timeout to clear the keyboard entry</string>
|
||||||
|
|
||||||
|
<string name="keyboard_notification_entry_key" translatable="false">notification_entry_key</string>
|
||||||
|
<string name="keyboard_notification_entry_title">Notification information</string>
|
||||||
|
<string name="keyboard_notification_entry_summary">Show a notification when an entry is available</string>
|
||||||
|
<bool name="keyboard_notification_entry_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="keyboard_notification_entry_content_title_text">Entry</string>
|
||||||
|
<string name="keyboard_notification_entry_content_title">%1$s available on Magikeyboard</string>
|
||||||
|
<string name="keyboard_notification_entry_content_text">%1$s</string>
|
||||||
|
|
||||||
|
<string name="keyboard_notification_entry_clear_close_key" translatable="false">notification_entry_slide_close_key</string>
|
||||||
|
<string name="keyboard_notification_entry_clear_close_title">Clear at closing</string>
|
||||||
|
<string name="keyboard_notification_entry_clear_close_summary">Clear the keyboard entry when closing the notification</string>
|
||||||
|
<bool name="keyboard_notification_entry_clear_close_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="keyboard_appearance_category">Appearance</string>
|
||||||
|
|
||||||
|
<string name="keyboard_theme_key" translatable="false">keyboard_theme_key</string>
|
||||||
|
<string name="keyboard_theme_title">Keyboard theme</string>
|
||||||
|
|
||||||
|
<string name="keyboard_keys_category">Keys</string>
|
||||||
|
<string name="keyboard_key_vibrate_key" translatable="false">keyboard_key_vibrate_key</string>
|
||||||
|
<string name="keyboard_key_vibrate_title">Vibrate on keypress</string>
|
||||||
|
<bool name="keyboard_key_vibrate_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="keyboard_key_sound_key" translatable="false">key_sound_key</string>
|
||||||
|
<string name="keyboard_key_sound_title">Sound on keypress</string>
|
||||||
|
<bool name="keyboard_key_sound_default" translatable="false">false</bool>
|
||||||
|
|
||||||
<string name="allow_no_password_title">Allow no password</string>
|
<string name="allow_no_password_title">Allow no password</string>
|
||||||
<string name="allow_no_password_summary">Enable the open button if no password identification is selected</string>
|
<string name="allow_no_password_summary">Enable the open button if no password identification is selected</string>
|
||||||
<string name="enable_read_only_title">Read only</string>
|
<string name="enable_read_only_title">Read only</string>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
android:entries="@array/timeout_options"
|
android:entries="@array/timeout_options"
|
||||||
android:entryValues="@array/timeout_values"
|
android:entryValues="@array/timeout_values"
|
||||||
android:dialogTitle="@string/app_timeout"
|
android:dialogTitle="@string/app_timeout"
|
||||||
android:defaultValue="@string/app_timeout_default"/>
|
android:defaultValue="@string/timeout_default"/>
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="@string/lock_database_screen_off_key"
|
android:key="@string/lock_database_screen_off_key"
|
||||||
android:title="@string/lock_database_screen_off_title"
|
android:title="@string/lock_database_screen_off_title"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<input-method
|
<input-method
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:settingsActivity="com.kunzisoft.magikeyboard.MagikIMESettings"
|
android:settingsActivity="com.kunzisoft.keepass.settings.MagikIMESettings"
|
||||||
android:supportsSwitchingToNextInputMethod="true"
|
android:supportsSwitchingToNextInputMethod="true"
|
||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
<subtype
|
<subtype
|
||||||
@@ -29,21 +29,13 @@
|
|||||||
<Key android:codes="500"
|
<Key android:codes="500"
|
||||||
android:keyIcon="@drawable/ic_person_white_24dp"
|
android:keyIcon="@drawable/ic_person_white_24dp"
|
||||||
android:isRepeatable="false" />
|
android:isRepeatable="false" />
|
||||||
<Key android:codes="510"
|
|
||||||
android:keyWidth="50%p"
|
|
||||||
android:keyIcon="@drawable/ic_password_white_24dp"
|
|
||||||
android:isRepeatable="false"/>
|
|
||||||
<!--
|
|
||||||
TODO Fields
|
|
||||||
<Key android:codes="510"
|
<Key android:codes="510"
|
||||||
android:keyIcon="@drawable/ic_password_white_24dp"
|
android:keyIcon="@drawable/ic_password_white_24dp"
|
||||||
android:isRepeatable="false"/>
|
android:isRepeatable="false"/>
|
||||||
<Key android:codes="530"
|
<Key android:codes="530"
|
||||||
android:keyIcon="@drawable/ic_list_white_24dp"
|
android:keyIcon="@drawable/ic_list_white_24dp"
|
||||||
android:isRepeatable="false"
|
android:isRepeatable="false"
|
||||||
android:popupKeyboard="@xml/keyboard_fields_list"
|
|
||||||
android:keyEdgeFlags="right"/>
|
android:keyEdgeFlags="right"/>
|
||||||
-->
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="600"
|
<Key android:codes="600"
|
||||||
64
app/src/main/res/xml/keyboard_preferences.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2018 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/>.
|
||||||
|
-->
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/keyboard_entry_category">
|
||||||
|
<ListPreference
|
||||||
|
android:key="@string/keyboard_entry_timeout_key"
|
||||||
|
android:title="@string/keyboard_entry_timeout_title"
|
||||||
|
android:summary="@string/keyboard_entry_timeout_summary"
|
||||||
|
android:entries="@array/timeout_options"
|
||||||
|
android:entryValues="@array/timeout_values"
|
||||||
|
android:dialogTitle="@string/keyboard_entry_timeout_title"
|
||||||
|
android:defaultValue="@string/timeout_default"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/keyboard_notification_entry_key"
|
||||||
|
android:title="@string/keyboard_notification_entry_title"
|
||||||
|
android:summary="@string/keyboard_notification_entry_summary"
|
||||||
|
android:defaultValue="@bool/keyboard_notification_entry_default"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/keyboard_notification_entry_clear_close_key"
|
||||||
|
android:title="@string/keyboard_notification_entry_clear_close_title"
|
||||||
|
android:summary="@string/keyboard_notification_entry_clear_close_summary"
|
||||||
|
android:dependency="@string/keyboard_notification_entry_key"
|
||||||
|
android:defaultValue="@bool/keyboard_notification_entry_clear_close_default"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
<!--
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/keyboard_appearance_category">
|
||||||
|
<Preference
|
||||||
|
android:key="@string/keyboard_theme_key"
|
||||||
|
android:title="@string/keyboard_theme_title"
|
||||||
|
android:summary="dark"
|
||||||
|
android:enabled="false"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
-->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/keyboard_keys_category">
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/keyboard_key_vibrate_key"
|
||||||
|
android:title="@string/keyboard_key_vibrate_title"
|
||||||
|
android:defaultValue="@bool/keyboard_key_vibrate_default"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/keyboard_key_sound_key"
|
||||||
|
android:defaultValue="@bool/keyboard_key_sound_default"
|
||||||
|
android:title="@string/keyboard_key_sound_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
||||||
@@ -1 +0,0 @@
|
|||||||
R.java
|
|
||||||
@@ -1,440 +0,0 @@
|
|||||||
package org.bouncycastle.asn1.util;
|
|
||||||
|
|
||||||
import org.bouncycastle.asn1.ASN1OctetString;
|
|
||||||
import org.bouncycastle.asn1.ASN1Sequence;
|
|
||||||
import org.bouncycastle.asn1.ASN1Set;
|
|
||||||
import org.bouncycastle.asn1.BERConstructedOctetString;
|
|
||||||
import org.bouncycastle.asn1.BERConstructedSequence;
|
|
||||||
import org.bouncycastle.asn1.BERSequence;
|
|
||||||
import org.bouncycastle.asn1.BERSet;
|
|
||||||
import org.bouncycastle.asn1.BERTaggedObject;
|
|
||||||
import org.bouncycastle.asn1.DERBMPString;
|
|
||||||
import org.bouncycastle.asn1.DERBitString;
|
|
||||||
import org.bouncycastle.asn1.DERBoolean;
|
|
||||||
import org.bouncycastle.asn1.DERConstructedSequence;
|
|
||||||
import org.bouncycastle.asn1.DERConstructedSet;
|
|
||||||
import org.bouncycastle.asn1.DEREncodable;
|
|
||||||
import org.bouncycastle.asn1.DERGeneralizedTime;
|
|
||||||
import org.bouncycastle.asn1.DERIA5String;
|
|
||||||
import org.bouncycastle.asn1.DERInteger;
|
|
||||||
import org.bouncycastle.asn1.DERNull;
|
|
||||||
import org.bouncycastle.asn1.DERObject;
|
|
||||||
import org.bouncycastle.asn1.DERObjectIdentifier;
|
|
||||||
import org.bouncycastle.asn1.DEROctetString;
|
|
||||||
import org.bouncycastle.asn1.DERPrintableString;
|
|
||||||
import org.bouncycastle.asn1.DERSequence;
|
|
||||||
import org.bouncycastle.asn1.DERSet;
|
|
||||||
import org.bouncycastle.asn1.DERT61String;
|
|
||||||
import org.bouncycastle.asn1.DERTaggedObject;
|
|
||||||
import org.bouncycastle.asn1.DERUTCTime;
|
|
||||||
import org.bouncycastle.asn1.DERUTF8String;
|
|
||||||
import org.bouncycastle.asn1.DERUnknownTag;
|
|
||||||
import org.bouncycastle.asn1.DERVisibleString;
|
|
||||||
import org.bouncycastle.asn1.DERApplicationSpecific;
|
|
||||||
import org.bouncycastle.asn1.DERTags;
|
|
||||||
import org.bouncycastle.asn1.BERApplicationSpecific;
|
|
||||||
import org.bouncycastle.util.encoders.Hex;
|
|
||||||
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class ASN1Dump
|
|
||||||
{
|
|
||||||
private static final String TAB = " ";
|
|
||||||
private static final int SAMPLE_SIZE = 32;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* dump a DER object as a formatted string with indentation
|
|
||||||
*
|
|
||||||
* @param obj the DERObject to be dumped out.
|
|
||||||
*/
|
|
||||||
static String _dumpAsString(
|
|
||||||
String indent,
|
|
||||||
boolean verbose,
|
|
||||||
DERObject obj)
|
|
||||||
{
|
|
||||||
String nl = System.getProperty("line.separator");
|
|
||||||
if (obj instanceof ASN1Sequence)
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
Enumeration e = ((ASN1Sequence)obj).getObjects();
|
|
||||||
String tab = indent + TAB;
|
|
||||||
|
|
||||||
buf.append(indent);
|
|
||||||
if (obj instanceof BERConstructedSequence)
|
|
||||||
{
|
|
||||||
buf.append("BER ConstructedSequence");
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERConstructedSequence)
|
|
||||||
{
|
|
||||||
buf.append("DER ConstructedSequence");
|
|
||||||
}
|
|
||||||
else if (obj instanceof BERSequence)
|
|
||||||
{
|
|
||||||
buf.append("BER Sequence");
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERSequence)
|
|
||||||
{
|
|
||||||
buf.append("DER Sequence");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append("Sequence");
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.append(nl);
|
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
|
||||||
{
|
|
||||||
Object o = e.nextElement();
|
|
||||||
|
|
||||||
if (o == null || o.equals(new DERNull()))
|
|
||||||
{
|
|
||||||
buf.append(tab);
|
|
||||||
buf.append("NULL");
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
else if (o instanceof DERObject)
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, (DERObject)o));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, ((DEREncodable)o).getDERObject()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERTaggedObject)
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
String tab = indent + TAB;
|
|
||||||
|
|
||||||
buf.append(indent);
|
|
||||||
if (obj instanceof BERTaggedObject)
|
|
||||||
{
|
|
||||||
buf.append("BER Tagged [");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append("Tagged [");
|
|
||||||
}
|
|
||||||
|
|
||||||
DERTaggedObject o = (DERTaggedObject)obj;
|
|
||||||
|
|
||||||
buf.append(Integer.toString(o.getTagNo()));
|
|
||||||
buf.append(']');
|
|
||||||
|
|
||||||
if (!o.isExplicit())
|
|
||||||
{
|
|
||||||
buf.append(" IMPLICIT ");
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.append(nl);
|
|
||||||
|
|
||||||
if (o.isEmpty())
|
|
||||||
{
|
|
||||||
buf.append(tab);
|
|
||||||
buf.append("EMPTY");
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, o.getObject()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERConstructedSet)
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
Enumeration e = ((ASN1Set)obj).getObjects();
|
|
||||||
String tab = indent + TAB;
|
|
||||||
|
|
||||||
buf.append(indent);
|
|
||||||
buf.append("ConstructedSet");
|
|
||||||
buf.append(nl);
|
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
|
||||||
{
|
|
||||||
Object o = e.nextElement();
|
|
||||||
|
|
||||||
if (o == null)
|
|
||||||
{
|
|
||||||
buf.append(tab);
|
|
||||||
buf.append("NULL");
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
else if (o instanceof DERObject)
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, (DERObject)o));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, ((DEREncodable)o).getDERObject()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
else if (obj instanceof BERSet)
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
Enumeration e = ((ASN1Set)obj).getObjects();
|
|
||||||
String tab = indent + TAB;
|
|
||||||
|
|
||||||
buf.append(indent);
|
|
||||||
buf.append("BER Set");
|
|
||||||
buf.append(nl);
|
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
|
||||||
{
|
|
||||||
Object o = e.nextElement();
|
|
||||||
|
|
||||||
if (o == null)
|
|
||||||
{
|
|
||||||
buf.append(tab);
|
|
||||||
buf.append("NULL");
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
else if (o instanceof DERObject)
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, (DERObject)o));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, ((DEREncodable)o).getDERObject()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERSet)
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
Enumeration e = ((ASN1Set)obj).getObjects();
|
|
||||||
String tab = indent + TAB;
|
|
||||||
|
|
||||||
buf.append(indent);
|
|
||||||
buf.append("DER Set");
|
|
||||||
buf.append(nl);
|
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
|
||||||
{
|
|
||||||
Object o = e.nextElement();
|
|
||||||
|
|
||||||
if (o == null)
|
|
||||||
{
|
|
||||||
buf.append(tab);
|
|
||||||
buf.append("NULL");
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
else if (o instanceof DERObject)
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, (DERObject)o));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(tab, verbose, ((DEREncodable)o).getDERObject()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERObjectIdentifier)
|
|
||||||
{
|
|
||||||
return indent + "ObjectIdentifier(" + ((DERObjectIdentifier)obj).getId() + ")" + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERBoolean)
|
|
||||||
{
|
|
||||||
return indent + "Boolean(" + ((DERBoolean)obj).isTrue() + ")" + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERInteger)
|
|
||||||
{
|
|
||||||
return indent + "Integer(" + ((DERInteger)obj).getValue() + ")" + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof BERConstructedOctetString)
|
|
||||||
{
|
|
||||||
ASN1OctetString oct = (ASN1OctetString)obj;
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
return indent + "BER Constructed Octet String" + "[" + oct.getOctets().length + "] " + dumpBinaryDataAsString(indent, oct.getOctets()) + nl;
|
|
||||||
}
|
|
||||||
return indent + "BER Constructed Octet String" + "[" + oct.getOctets().length + "] " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DEROctetString)
|
|
||||||
{
|
|
||||||
ASN1OctetString oct = (ASN1OctetString)obj;
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
return indent + "DER Octet String" + "[" + oct.getOctets().length + "] " + dumpBinaryDataAsString(indent, oct.getOctets()) + nl;
|
|
||||||
}
|
|
||||||
return indent + "DER Octet String" + "[" + oct.getOctets().length + "] " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERBitString)
|
|
||||||
{
|
|
||||||
DERBitString bt = (DERBitString)obj;
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
return indent + "DER Bit String" + "[" + bt.getBytes().length + ", " + bt.getPadBits() + "] " + dumpBinaryDataAsString(indent, bt.getBytes()) + nl;
|
|
||||||
}
|
|
||||||
return indent + "DER Bit String" + "[" + bt.getBytes().length + ", " + bt.getPadBits() + "] " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERIA5String)
|
|
||||||
{
|
|
||||||
return indent + "IA5String(" + ((DERIA5String)obj).getString() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERUTF8String)
|
|
||||||
{
|
|
||||||
return indent + "UTF8String(" + ((DERUTF8String)obj).getString() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERPrintableString)
|
|
||||||
{
|
|
||||||
return indent + "PrintableString(" + ((DERPrintableString)obj).getString() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERVisibleString)
|
|
||||||
{
|
|
||||||
return indent + "VisibleString(" + ((DERVisibleString)obj).getString() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERBMPString)
|
|
||||||
{
|
|
||||||
return indent + "BMPString(" + ((DERBMPString)obj).getString() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERT61String)
|
|
||||||
{
|
|
||||||
return indent + "T61String(" + ((DERT61String)obj).getString() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERUTCTime)
|
|
||||||
{
|
|
||||||
return indent + "UTCTime(" + ((DERUTCTime)obj).getTime() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERGeneralizedTime)
|
|
||||||
{
|
|
||||||
return indent + "GeneralizedTime(" + ((DERGeneralizedTime)obj).getTime() + ") " + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERUnknownTag)
|
|
||||||
{
|
|
||||||
return indent + "Unknown " + Integer.toString(((DERUnknownTag)obj).getTag(), 16) + " " + new String(Hex.encode(((DERUnknownTag)obj).getData())) + nl;
|
|
||||||
}
|
|
||||||
else if (obj instanceof BERApplicationSpecific)
|
|
||||||
{
|
|
||||||
return outputApplicationSpecific("BER", indent, verbose, obj, nl);
|
|
||||||
}
|
|
||||||
else if (obj instanceof DERApplicationSpecific)
|
|
||||||
{
|
|
||||||
return outputApplicationSpecific("DER", indent, verbose, obj, nl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return indent + obj.toString() + nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String outputApplicationSpecific(String type, String indent, boolean verbose, DERObject obj, String nl)
|
|
||||||
{
|
|
||||||
DERApplicationSpecific app = (DERApplicationSpecific)obj;
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
|
|
||||||
if (app.isConstructed())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ASN1Sequence s = ASN1Sequence.getInstance(app.getObject(DERTags.SEQUENCE));
|
|
||||||
buf.append(indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "]" + nl);
|
|
||||||
for (Enumeration e = s.getObjects(); e.hasMoreElements();)
|
|
||||||
{
|
|
||||||
buf.append(_dumpAsString(indent + TAB, verbose, (DERObject)e.nextElement()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
buf.append(e);
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "] (" + new String(Hex.encode(app.getContents())) + ")" + nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* dump out a DER object as a formatted string, in non-verbose mode.
|
|
||||||
*
|
|
||||||
* @param obj the DERObject to be dumped out.
|
|
||||||
* @return the resulting string.
|
|
||||||
*/
|
|
||||||
public static String dumpAsString(
|
|
||||||
Object obj)
|
|
||||||
{
|
|
||||||
return dumpAsString(obj, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dump out the object as a string.
|
|
||||||
*
|
|
||||||
* @param obj the object to be dumped
|
|
||||||
* @param verbose if true, dump out the contents of octet and bit strings.
|
|
||||||
* @return the resulting string.
|
|
||||||
*/
|
|
||||||
public static String dumpAsString(
|
|
||||||
Object obj,
|
|
||||||
boolean verbose)
|
|
||||||
{
|
|
||||||
if (obj instanceof DERObject)
|
|
||||||
{
|
|
||||||
return _dumpAsString("", verbose, (DERObject)obj);
|
|
||||||
}
|
|
||||||
else if (obj instanceof DEREncodable)
|
|
||||||
{
|
|
||||||
return _dumpAsString("", verbose, ((DEREncodable)obj).getDERObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
return "unknown object type " + obj.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String dumpBinaryDataAsString(String indent, byte[] bytes)
|
|
||||||
{
|
|
||||||
String nl = System.getProperty("line.separator");
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
|
|
||||||
indent += TAB;
|
|
||||||
|
|
||||||
buf.append(nl);
|
|
||||||
for (int i = 0; i < bytes.length; i += SAMPLE_SIZE)
|
|
||||||
{
|
|
||||||
if (bytes.length - i > SAMPLE_SIZE)
|
|
||||||
{
|
|
||||||
buf.append(indent);
|
|
||||||
buf.append(new String(Hex.encode(bytes, i, SAMPLE_SIZE)));
|
|
||||||
buf.append(TAB);
|
|
||||||
buf.append(calculateAscString(bytes, i, SAMPLE_SIZE));
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf.append(indent);
|
|
||||||
buf.append(new String(Hex.encode(bytes, i, bytes.length - i)));
|
|
||||||
for (int j = bytes.length - i; j != SAMPLE_SIZE; j++)
|
|
||||||
{
|
|
||||||
buf.append(" ");
|
|
||||||
}
|
|
||||||
buf.append(TAB);
|
|
||||||
buf.append(calculateAscString(bytes, i, bytes.length - i));
|
|
||||||
buf.append(nl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String calculateAscString(byte[] bytes, int off, int len)
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
|
|
||||||
for (int i = off; i != off + len; i++)
|
|
||||||
{
|
|
||||||
if (bytes[i] >= ' ' && bytes[i] <= '~')
|
|
||||||
{
|
|
||||||
buf.append((char)bytes[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
keepass-model/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 27
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 14
|
|
||||||
targetSdkVersion 27
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
}
|
|
||||||
21
keepass-model/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.kunzisoft.keepass_model" />
|
|
||||||
1
magikeyboard/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 27
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 14
|
|
||||||
targetSdkVersion 27
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
def supportVersion = "27.1.1"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
implementation "com.android.support:appcompat-v7:$supportVersion"
|
|
||||||
implementation "com.android.support:preference-v7:$supportVersion"
|
|
||||||
implementation "com.android.support:preference-v14:$supportVersion"
|
|
||||||
implementation project(path: ':keepass-model')
|
|
||||||
}
|
|
||||||
21
magikeyboard/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.kunzisoft.magikeyboard" >
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
|
||||||
<application>
|
|
||||||
<service
|
|
||||||
android:name="com.kunzisoft.magikeyboard.MagikIME"
|
|
||||||
android:label="@string/keyboard_label"
|
|
||||||
android:permission="android.permission.BIND_INPUT_METHOD" >
|
|
||||||
<meta-data android:name="android.view.im"
|
|
||||||
android:resource="@xml/method"/>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.view.InputMethod" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
<service android:name=".KeyboardEntryNotificationService" />
|
|
||||||
<receiver
|
|
||||||
android:name=".receiver.NotificationDeleteBroadcastReceiver"
|
|
||||||
android:exported="false" >
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<activity android:name="com.kunzisoft.magikeyboard.settings.MagikIMESettings"
|
|
||||||
android:label="@string/keyboard_setting_label">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity android:name="com.kunzisoft.magikeyboard.EntryRetrieverActivity"
|
|
||||||
android:label="@string/keyboard_name">
|
|
||||||
</activity>
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package com.kunzisoft.magikeyboard;
|
|
||||||
|
|
||||||
public class Utility {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
|
||||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<path android:fillColor="#FF000000" android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
layout="@layout/toolbar_default" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/fragment_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2018 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/>.
|
|
||||||
-->
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:paddingBottom="10dp"
|
|
||||||
android:alpha="0.7"
|
|
||||||
android:background="#f1f1f1"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:textColor="#333">
|
|
||||||
|
|
||||||
</TextView>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical" android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
<android.support.v7.widget.RecyclerView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:elevation="4dp"
|
|
||||||
tools:targetApi="lollipop" />
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2018 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/>.
|
|
||||||
-->
|
|
||||||
<resources>
|
|
||||||
<color name="keyboard_button">#3c474c</color>
|
|
||||||
<color name="keyboard_button_pressed">#263238</color>
|
|
||||||
<color name="keyboard_button_border">#3c464c</color>
|
|
||||||
<color name="keyboard_background">#263238</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright 2018 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/>.
|
|
||||||
-->
|
|
||||||
<resources>
|
|
||||||
<string name="keyboard_name">Magikeyboard</string>
|
|
||||||
<string name="keyboard_label">Magikeyboard (KeePass DX)</string>
|
|
||||||
<string name="keyboard_setting_label">Magikeyboard settings</string>
|
|
||||||
|
|
||||||
<string name="entry_category">Entry</string>
|
|
||||||
|
|
||||||
<string name="entry_timeout_key" translatable="false">erase_entry_timeout_key</string>
|
|
||||||
<string name="entry_timeout_title">Timeout</string>
|
|
||||||
<string name="entry_timeout_summary">Timeout to clear the keyboard entry</string>
|
|
||||||
|
|
||||||
<string name="notification_entry_key" translatable="false">notification_entry_key</string>
|
|
||||||
<string name="notification_entry_title">Notification information</string>
|
|
||||||
<string name="notification_entry_summary">Show a notification when an entry is available</string>
|
|
||||||
<bool name="notification_entry_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="notification_entry_content_title_text">Entry</string>
|
|
||||||
<string name="notification_entry_content_title">%1$s available on Magikeyboard</string>
|
|
||||||
<string name="notification_entry_content_text">%1$s</string>
|
|
||||||
|
|
||||||
<string name="notification_entry_clear_close_key" translatable="false">notification_entry_slide_close_key</string>
|
|
||||||
<string name="notification_entry_clear_close_title">Clear at closing</string>
|
|
||||||
<string name="notification_entry_clear_close_summary">Clear the keyboard entry when closing the notification</string>
|
|
||||||
<bool name="notification_entry_clear_close_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="appearance_category">Appearance</string>
|
|
||||||
|
|
||||||
<string name="theme_key" translatable="false">theme_key</string>
|
|
||||||
<string name="theme_title">Theme</string>
|
|
||||||
|
|
||||||
<string name="keys_category">Keys</string>
|
|
||||||
<string name="key_vibrate_key" translatable="false">key_vibrate_key</string>
|
|
||||||
<string name="key_vibrate_title">Vibrate on keypress</string>
|
|
||||||
<bool name="key_vibrate_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="key_vibrate_duration_key" translatable="false">key_vibrate_duration_key</string>
|
|
||||||
<string name="key_vibrate_duration_title">Keypress vibration duration</string>
|
|
||||||
|
|
||||||
<string name="key_sound_key" translatable="false">key_sound_key</string>
|
|
||||||
<string name="key_sound_title">Sound on keypress</string>
|
|
||||||
<bool name="key_sound_default" translatable="false">false</bool>
|
|
||||||
|
|
||||||
<string name="key_long_press_delay_key" translatable="false">key_long_press_delay_key</string>
|
|
||||||
<string name="key_long_press_delay_title">Key long press delay</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2018 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/>.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/entry_category">
|
|
||||||
<Preference
|
|
||||||
android:key="@string/entry_timeout_key"
|
|
||||||
android:title="@string/entry_timeout_title"
|
|
||||||
android:summary="@string/entry_timeout_summary"
|
|
||||||
android:enabled="false"/>
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="@string/notification_entry_key"
|
|
||||||
android:title="@string/notification_entry_title"
|
|
||||||
android:summary="@string/notification_entry_summary"
|
|
||||||
android:defaultValue="@bool/notification_entry_default"/>
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="@string/notification_entry_clear_close_key"
|
|
||||||
android:title="@string/notification_entry_clear_close_title"
|
|
||||||
android:summary="@string/notification_entry_clear_close_summary"
|
|
||||||
android:dependency="@string/notification_entry_key"
|
|
||||||
android:defaultValue="@bool/notification_entry_clear_close_default"/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/appearance_category">
|
|
||||||
<Preference
|
|
||||||
android:key="@string/theme_key"
|
|
||||||
android:title="@string/theme_title"
|
|
||||||
android:summary="dark"
|
|
||||||
android:enabled="false"/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/keys_category">
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="@string/key_vibrate_key"
|
|
||||||
android:title="@string/key_vibrate_title"
|
|
||||||
android:defaultValue="@bool/key_vibrate_default"
|
|
||||||
android:enabled="false"/>
|
|
||||||
<Preference
|
|
||||||
android:key="@string/key_vibrate_duration_key"
|
|
||||||
android:title="@string/key_vibrate_duration_title"
|
|
||||||
android:enabled="false"/>
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="@string/key_sound_key"
|
|
||||||
android:defaultValue="@bool/key_sound_default"
|
|
||||||
android:title="@string/key_sound_title" />
|
|
||||||
<Preference
|
|
||||||
android:key="@string/key_long_press_delay_key"
|
|
||||||
android:title="@string/key_long_press_delay_title"
|
|
||||||
android:enabled="false" />
|
|
||||||
</PreferenceCategory>
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright 2018 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/>.
|
|
||||||
-->
|
|
||||||
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:keyWidth="25%p"
|
|
||||||
android:horizontalGap="2dp"
|
|
||||||
android:verticalGap="8dp"
|
|
||||||
android:keyHeight="38dp">
|
|
||||||
</Keyboard>
|
|
||||||
@@ -1 +1 @@
|
|||||||
include ':app', ':icon-pack-classic', ':icon-pack-material', ':magikeyboard', ':keepass-model'
|
include ':app', ':icon-pack-classic', ':icon-pack-material'
|
||||||
|
|||||||