mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Add receiver to lock the entry in the keyboard
This commit is contained in:
@@ -33,6 +33,7 @@ public class EntrySelectionHelper {
|
|||||||
Log.d(activity.getClass().getName(), "Reply entry selection");
|
Log.d(activity.getClass().getName(), "Reply entry selection");
|
||||||
|
|
||||||
Entry entryModel = new Entry();
|
Entry entryModel = new Entry();
|
||||||
|
entryModel.setTitle(entry.getTitle());
|
||||||
entryModel.setUsername(entry.getUsername());
|
entryModel.setUsername(entry.getUsername());
|
||||||
entryModel.setPassword(entry.getPassword());
|
entryModel.setPassword(entry.getPassword());
|
||||||
entryModel.setUrl(entry.getUrl());
|
entryModel.setUrl(entry.getUrl());
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ 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.MagikIMESettings;
|
import com.kunzisoft.magikeyboard.settings.MagikIMESettings;
|
||||||
|
|
||||||
public class NestedSettingsFragment extends PreferenceFragmentCompat
|
public class NestedSettingsFragment extends PreferenceFragmentCompat
|
||||||
implements Preference.OnPreferenceClickListener {
|
implements Preference.OnPreferenceClickListener {
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class Entry implements Parcelable {
|
public class Entry implements Parcelable {
|
||||||
|
|
||||||
|
private String title;
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
private String url;
|
private String url;
|
||||||
private Map<String, String> customFields;
|
private Map<String, String> customFields;
|
||||||
|
|
||||||
public Entry() {
|
public Entry() {
|
||||||
|
this.title = "";
|
||||||
this.username = "";
|
this.username = "";
|
||||||
this.password = "";
|
this.password = "";
|
||||||
this.url = "";
|
this.url = "";
|
||||||
@@ -22,6 +24,7 @@ public class Entry implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Entry(Parcel in) {
|
protected Entry(Parcel in) {
|
||||||
|
title = in.readString();
|
||||||
username = in.readString();
|
username = in.readString();
|
||||||
password = in.readString();
|
password = in.readString();
|
||||||
url = in.readString();
|
url = in.readString();
|
||||||
@@ -41,6 +44,14 @@ public class Entry implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
@@ -84,6 +95,7 @@ public class Entry implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel parcel, int i) {
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeString(title);
|
||||||
parcel.writeString(username);
|
parcel.writeString(username);
|
||||||
parcel.writeString(password);
|
parcel.writeString(password);
|
||||||
parcel.writeString(url);
|
parcel.writeString(url);
|
||||||
|
|||||||
@@ -14,12 +14,11 @@
|
|||||||
</service>
|
</service>
|
||||||
<service android:name=".KeyboardEntryNotificationService" />
|
<service android:name=".KeyboardEntryNotificationService" />
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".KeyboardEntryNotificationService$NotificationDeleteBroadcastReceiver"
|
android:name=".receiver.NotificationDeleteBroadcastReceiver"
|
||||||
android:exported="false" >
|
android:exported="false" >
|
||||||
</receiver>
|
</receiver>
|
||||||
<activity android:name=".KeyboardManagerActivity"
|
|
||||||
android:label=""/>
|
<activity android:name="com.kunzisoft.magikeyboard.settings.MagikIMESettings"
|
||||||
<activity android:name="com.kunzisoft.magikeyboard.MagikIMESettings"
|
|
||||||
android:label="@string/keyboard_setting_label">
|
android:label="@string/keyboard_setting_label">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|||||||
@@ -4,16 +4,19 @@ import android.app.NotificationChannel;
|
|||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
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.IntentFilter;
|
||||||
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.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver;
|
||||||
|
import com.kunzisoft.magikeyboard.receiver.NotificationDeleteBroadcastReceiver;
|
||||||
|
|
||||||
import static android.content.ContentValues.TAG;
|
import static android.content.ContentValues.TAG;
|
||||||
|
import static com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver.LOCK_ACTION;
|
||||||
|
|
||||||
public class KeyboardEntryNotificationService extends Service {
|
public class KeyboardEntryNotificationService extends Service {
|
||||||
|
|
||||||
@@ -45,6 +48,14 @@ public class KeyboardEntryNotificationService extends Service {
|
|||||||
NotificationManager.IMPORTANCE_LOW);
|
NotificationManager.IMPORTANCE_LOW);
|
||||||
notificationManager.createNotificationChannel(channel);
|
notificationManager.createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register a lock receiver to stop notification service when lock on keyboard is performed
|
||||||
|
registerReceiver(new LockBroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveLock(Context context, Intent intent) {
|
||||||
|
context.stopService(new Intent(context, KeyboardEntryNotificationService.class));
|
||||||
|
}
|
||||||
|
}, new IntentFilter(LOCK_ACTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -60,28 +71,31 @@ public class KeyboardEntryNotificationService extends Service {
|
|||||||
|
|
||||||
private void newNotification() {
|
private void newNotification() {
|
||||||
|
|
||||||
Intent contentIntent = new Intent(this, KeyboardManagerActivity.class);
|
|
||||||
contentIntent.setAction(Intent.ACTION_MAIN);
|
|
||||||
contentIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
|
||||||
PendingIntent pendingContentIntent = PendingIntent.getActivity(
|
|
||||||
this, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
||||||
|
|
||||||
Intent deleteIntent = new Intent(this, NotificationDeleteBroadcastReceiver.class);
|
Intent deleteIntent = new Intent(this, NotificationDeleteBroadcastReceiver.class);
|
||||||
PendingIntent pendingDeleteIntent =
|
PendingIntent pendingDeleteIntent =
|
||||||
PendingIntent.getBroadcast(getApplicationContext(), 0, deleteIntent, 0);
|
PendingIntent.getBroadcast(getApplicationContext(), 0, deleteIntent, 0);
|
||||||
|
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID_KEYBOARD)
|
if (MagikIME.getEntryKey() != null) {
|
||||||
.setSmallIcon(R.drawable.ic_vpn_key_white_24dp)
|
String entryTitle = getString(R.string.notification_entry_content_title_text);
|
||||||
.setContentTitle(getString(R.string.notification_entry_content_title, "Entry"))
|
String entryUsername = "";
|
||||||
.setAutoCancel(false)
|
if (!MagikIME.getEntryKey().getTitle().isEmpty())
|
||||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
entryTitle = MagikIME.getEntryKey().getTitle();
|
||||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
if (!MagikIME.getEntryKey().getUsername().isEmpty())
|
||||||
.setContentText(getString(R.string.notification_entry_content_text, "Username"))
|
entryUsername = MagikIME.getEntryKey().getUsername();
|
||||||
.setContentIntent(pendingContentIntent)
|
|
||||||
.setDeleteIntent(pendingDeleteIntent);
|
|
||||||
|
|
||||||
notificationManager.cancel(notificationId);
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID_KEYBOARD)
|
||||||
notificationManager.notify(notificationId, builder.build());
|
.setSmallIcon(R.drawable.ic_vpn_key_white_24dp)
|
||||||
|
.setContentTitle(getString(R.string.notification_entry_content_title, entryTitle))
|
||||||
|
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||||
|
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
||||||
|
.setContentText(getString(R.string.notification_entry_content_text, entryUsername))
|
||||||
|
.setAutoCancel(false)
|
||||||
|
.setContentIntent(null)
|
||||||
|
.setDeleteIntent(pendingDeleteIntent);
|
||||||
|
|
||||||
|
notificationManager.cancel(notificationId);
|
||||||
|
notificationManager.notify(notificationId, builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
// TODO Get timeout
|
// TODO Get timeout
|
||||||
/*
|
/*
|
||||||
@@ -118,22 +132,4 @@ public class KeyboardEntryNotificationService extends Service {
|
|||||||
notificationManager.cancel(notificationId);
|
notificationManager.cancel(notificationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NotificationDeleteBroadcastReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
// TODO Crash here
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
// Clear the entry if define in preferences
|
|
||||||
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
if (sharedPreferences.getBoolean(getString(R.string.notification_entry_clear_close_key),
|
|
||||||
getResources().getBoolean(R.bool.notification_entry_clear_close_default))) {
|
|
||||||
MagikIME.deleteEntryKey(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop the service in all cases
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
package com.kunzisoft.magikeyboard;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activity to show keyboard manager
|
|
||||||
*/
|
|
||||||
public class KeyboardManagerActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private View rootView;
|
|
||||||
|
|
||||||
enum DialogState {
|
|
||||||
PICKING, CHOSEN
|
|
||||||
}
|
|
||||||
|
|
||||||
private DialogState mState;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.empty);
|
|
||||||
rootView = findViewById(R.id.root_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
|
||||||
super.onWindowFocusChanged(hasFocus);
|
|
||||||
if(mState == DialogState.PICKING) {
|
|
||||||
mState = DialogState.CHOSEN;
|
|
||||||
}
|
|
||||||
else if(mState == DialogState.CHOSEN) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
rootView.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
InputMethodManager imeManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
|
||||||
if (imeManager != null) {
|
|
||||||
imeManager.showInputMethodPicker();
|
|
||||||
}
|
|
||||||
mState = DialogState.PICKING;
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
super.onBackPressed();
|
|
||||||
// Close the back activity
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.kunzisoft.magikeyboard;
|
package com.kunzisoft.magikeyboard;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.inputmethodservice.Keyboard;
|
import android.inputmethodservice.Keyboard;
|
||||||
@@ -37,14 +37,14 @@ import android.view.inputmethod.InputConnection;
|
|||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.kunzisoft.keepass_model.Entry;
|
import com.kunzisoft.keepass_model.Entry;
|
||||||
import com.kunzisoft.magikeyboard.utils.Utility;
|
import com.kunzisoft.magikeyboard.receiver.LockBroadcastReceiver;
|
||||||
|
|
||||||
|
import static com.kunzisoft.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 String LOCK_ACTION = "com.kunzisoft.keepass.LOCK";
|
|
||||||
|
|
||||||
private static final int KEY_CHANGE_KEYBOARD = 600;
|
private static final int KEY_CHANGE_KEYBOARD = 600;
|
||||||
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;
|
||||||
@@ -60,6 +60,20 @@ public class MagikIME extends InputMethodService
|
|||||||
private Keyboard keyboard;
|
private Keyboard keyboard;
|
||||||
private Keyboard keyboard_entry;
|
private Keyboard keyboard_entry;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
|
||||||
|
// Remove the entry and lock the keyboard when the lock signal is receive
|
||||||
|
registerReceiver(new LockBroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveLock(Context context, Intent intent) {
|
||||||
|
entryKey = null;
|
||||||
|
assignKeyboardView();
|
||||||
|
}
|
||||||
|
}, new IntentFilter(LOCK_ACTION));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateInputView() {
|
public View onCreateInputView() {
|
||||||
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard, null);
|
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard, null);
|
||||||
@@ -88,6 +102,10 @@ public class MagikIME extends InputMethodService
|
|||||||
assignKeyboardView();
|
assignKeyboardView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Entry getEntryKey() {
|
||||||
|
return entryKey;
|
||||||
|
}
|
||||||
|
|
||||||
public static void setEntryKey(Entry entry) {
|
public static void setEntryKey(Entry entry) {
|
||||||
entryKey = entry;
|
entryKey = entry;
|
||||||
}
|
}
|
||||||
@@ -110,7 +128,9 @@ public class MagikIME extends InputMethodService
|
|||||||
imeManager.switchToLastInputMethod(getWindow().getWindow().getAttributes().token);
|
imeManager.switchToLastInputMethod(getWindow().getWindow().getAttributes().token);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Unable to switch to the previous IME", e);
|
Log.e(TAG, "Unable to switch to the previous IME", e);
|
||||||
Utility.openInputMethodPicker(this);
|
InputMethodManager imeManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||||
|
if (imeManager != null)
|
||||||
|
imeManager.showInputMethodPicker();
|
||||||
}
|
}
|
||||||
// TODO Add a long press to choose the keyboard
|
// TODO Add a long press to choose the keyboard
|
||||||
break;
|
break;
|
||||||
@@ -218,18 +238,4 @@ public class MagikIME extends InputMethodService
|
|||||||
default: am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
|
default: am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LockBroadcastReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (action != null
|
|
||||||
&& action.equals(LOCK_ACTION)) {
|
|
||||||
entryKey = null;
|
|
||||||
assignKeyboardView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.kunzisoft.magikeyboard.receiver;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public abstract class LockBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
public static final String LOCK_ACTION = "com.kunzisoft.keepass.LOCK";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (action != null
|
||||||
|
&& action.equals(LOCK_ACTION)) {
|
||||||
|
onReceiveLock(context, intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onReceiveLock(Context context, Intent intent);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.kunzisoft.magikeyboard.receiver;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import com.kunzisoft.magikeyboard.KeyboardEntryNotificationService;
|
||||||
|
import com.kunzisoft.magikeyboard.MagikIME;
|
||||||
|
import com.kunzisoft.magikeyboard.R;
|
||||||
|
|
||||||
|
public class NotificationDeleteBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
// Clear the entry if define in preferences
|
||||||
|
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
if (sharedPreferences.getBoolean(context.getString(R.string.notification_entry_clear_close_key),
|
||||||
|
context.getResources().getBoolean(R.bool.notification_entry_clear_close_default))) {
|
||||||
|
MagikIME.deleteEntryKey(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop the service in all cases
|
||||||
|
context.stopService(new Intent(context, KeyboardEntryNotificationService.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,13 +17,15 @@
|
|||||||
* 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.magikeyboard.settings;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
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;
|
||||||
|
|
||||||
public class MagikIMESettings extends AppCompatActivity {
|
public class MagikIMESettings extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.kunzisoft.magikeyboard;
|
package com.kunzisoft.magikeyboard.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;
|
||||||
|
|
||||||
public class MagikIMESettingsFragment extends PreferenceFragmentCompat {
|
public class MagikIMESettingsFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.kunzisoft.magikeyboard.utils;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
|
|
||||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
|
||||||
|
|
||||||
public class Utility {
|
|
||||||
|
|
||||||
public static void openInputMethodPicker(Context context) {
|
|
||||||
|
|
||||||
// TODO Change don't really work on activity
|
|
||||||
InputMethodManager imeManager = (InputMethodManager) context.getSystemService(INPUT_METHOD_SERVICE);
|
|
||||||
if (imeManager != null)
|
|
||||||
imeManager.showInputMethodPicker();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
<string name="notification_entry_summary">Show a notification when an entry is available</string>
|
<string name="notification_entry_summary">Show a notification when an entry is available</string>
|
||||||
<bool name="notification_entry_default" translatable="false">true</bool>
|
<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_title">%1$s available on Magikeyboard</string>
|
||||||
<string name="notification_entry_content_text">%1$s</string>
|
<string name="notification_entry_content_text">%1$s</string>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="@string/entry_timeout_key"
|
android:key="@string/entry_timeout_key"
|
||||||
android:title="@string/entry_timeout_title"
|
android:title="@string/entry_timeout_title"
|
||||||
android:summary="@string/entry_timeout_summary" />
|
android:summary="@string/entry_timeout_summary"
|
||||||
|
android:enabled="false"/>
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="@string/notification_entry_key"
|
android:key="@string/notification_entry_key"
|
||||||
android:title="@string/notification_entry_title"
|
android:title="@string/notification_entry_title"
|
||||||
|
|||||||
Reference in New Issue
Block a user