|
|
@@ -9,9 +9,10 @@ import android.os.Handler;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
+import android.view.Window;
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
-import android.widget.ScrollView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import java.io.File;
|
|
|
@@ -26,17 +27,14 @@ import info.knacki.pass.io.FileInterfaceFactory;
|
|
|
import info.knacki.pass.io.FileUtils;
|
|
|
import info.knacki.pass.io.IFileInterface;
|
|
|
import info.knacki.pass.io.OnResponseListener;
|
|
|
-import info.knacki.pass.io.PathUtils;
|
|
|
import info.knacki.pass.settings.SettingsManager;
|
|
|
import info.knacki.pass.ui.MainActivity;
|
|
|
import info.knacki.pass.ui.alertPrompt.ServiceAlertPromptGenerator;
|
|
|
import info.knacki.pass.ui.alertPrompt.views.SimpleTextEditWithKeyboard;
|
|
|
-import info.knacki.pass.ui.passwordList.PasswordClickListener;
|
|
|
-import info.knacki.pass.ui.passwordList.PasswordListView;
|
|
|
import info.knacki.pass.ui.passwordPicker.PasswordPickerFactory;
|
|
|
|
|
|
-public class InputService extends InputMethodService implements PasswordClickListener {
|
|
|
- protected PasswordListView fPasswordListView;
|
|
|
+public class InputService extends InputMethodService implements AccessibilityView.AccessibilityViewListener {
|
|
|
+ protected AccessibilityView fPasswordListView;
|
|
|
private static final Logger log = Logger.getLogger(InputService.class.getName());
|
|
|
protected View fInputView;
|
|
|
|
|
|
@@ -73,7 +71,8 @@ public class InputService extends InputMethodService implements PasswordClickLis
|
|
|
log.log(Level.SEVERE, "Cannot get Input method service");
|
|
|
return;
|
|
|
}
|
|
|
- if (!service.switchToLastInputMethod(getWindow().getWindow().getAttributes().token))
|
|
|
+ Window win = getWindow().getWindow();
|
|
|
+ if (win != null && !service.switchToLastInputMethod(win.getAttributes().token))
|
|
|
PromptInputService();
|
|
|
}
|
|
|
}
|
|
|
@@ -82,11 +81,7 @@ public class InputService extends InputMethodService implements PasswordClickLis
|
|
|
@Override
|
|
|
public View onCreateInputView() {
|
|
|
fInputView = LayoutInflater.from(this).inflate(R.layout.input, null, false);
|
|
|
- fPasswordListView = new PasswordListView(this, this, PathUtils.GetPassDir(this));
|
|
|
- ((ScrollView)fInputView.findViewById(R.id.passwordListContainer)).addView(fPasswordListView);
|
|
|
- fInputView.findViewById(R.id.prevButton).setOnClickListener(view -> {
|
|
|
- SwitchToPreviousInputMethod();
|
|
|
- });
|
|
|
+ fInputView.findViewById(R.id.prevButton).setOnClickListener(view -> SwitchToPreviousInputMethod());
|
|
|
fInputView.findViewById(R.id.backspaceButton).setOnTouchListener(new View.OnTouchListener() {
|
|
|
private final static int INIT_DELAY = 650;
|
|
|
private final static int DELAY = 250;
|
|
|
@@ -124,6 +119,11 @@ public class InputService extends InputMethodService implements PasswordClickLis
|
|
|
});
|
|
|
fInputView.findViewById(R.id.generateButton).setOnClickListener(view -> CreatePassword());
|
|
|
fInputView.findViewById(R.id.openAppButton).setOnClickListener(view -> startActivity(new Intent(InputService.this, MainActivity.class)));
|
|
|
+
|
|
|
+ fPasswordListView = ((AccessibilityView) LayoutInflater.from(this)
|
|
|
+ .inflate(R.layout.activity_accessibility, null, false))
|
|
|
+ .init(this, this);
|
|
|
+ ((LinearLayout) fInputView.findViewById(R.id.container)).addView(fPasswordListView);
|
|
|
return fInputView;
|
|
|
}
|
|
|
|
|
|
@@ -137,7 +137,7 @@ public class InputService extends InputMethodService implements PasswordClickLis
|
|
|
Toast.makeText(InputService.this, "Error: Empty file name", Toast.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
- File f = new File(fPasswordListView.fCurrentDir +"/" +filename +FileInterfaceFactory.GetExtension(SettingsManager.GetDefaultEncryptionType(InputService.this)));
|
|
|
+ File f = new File(fPasswordListView.GetCurrentDir() +"/" +filename +FileInterfaceFactory.GetExtension(SettingsManager.GetDefaultEncryptionType(InputService.this)));
|
|
|
try {
|
|
|
FileUtils.Touch(f);
|
|
|
fPasswordListView.refresh();
|
|
|
@@ -209,4 +209,8 @@ public class InputService extends InputMethodService implements PasswordClickLis
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void cancel() {
|
|
|
+ }
|
|
|
}
|