Skip to content

Commit fdd3414

Browse files
authored
Merge pull request #122 from OpenIPC/fix/webui-keyboard
fix: WebUI — on-screen keyboard for the camera's text fields (#120)
2 parents 799d2f2 + 57d46c1 commit fdd3414

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎android/app/src/main/java/com/openipc/decoder/MenuManager.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,18 @@ public void onReceivedHttpAuthRequest(
530530
});
531531
mBrowserDialog = dialog;
532532
dialog.show();
533+
// AlertDialog marks its window "no input method" when its content has no EditText,
534+
// and a WebView is not one: text fields of the camera's page then got no keyboard
535+
// (#120). Clear that, and let the page take the focus for its fields
536+
android.view.Window w = dialog.getWindow();
537+
if (w != null) {
538+
w.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
539+
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
540+
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
541+
}
542+
view.setFocusable(true);
543+
view.setFocusableInTouchMode(true);
544+
view.requestFocus(View.FOCUS_DOWN);
533545
view.loadUrl(scheme + "://" + link);
534546
}
535547

‎android/app/src/test/java/com/openipc/decoder/CredentialStoreTest.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ public void undecryptableValueBecomesAnEmptySlot() throws Exception {
8383
// Another key (e.g. data restored on another device)
8484
assertNull(new CredentialStore(new TestCipher()).open(sealed));
8585
// Tampered or truncated data
86-
assertNull(store.open(sealed.substring(0, sealed.length() - 2) + "00"));
86+
// Change the last two characters for sure: "00" could be the original ones (1 in 256)
87+
String tail = sealed.endsWith("00") ? "ff" : "00";
88+
assertNull(store.open(sealed.substring(0, sealed.length() - 2) + tail));
8789
assertNull(store.open(CredentialStore.PREFIX + "zz"));
8890
assertNull(store.open(CredentialStore.PREFIX + "abc"));
8991
}

0 commit comments

Comments
 (0)