summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java11
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java6
2 files changed, 17 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java
index ed7bd9f2..e04ba70d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java
@@ -229,8 +229,19 @@ public class ViewHelper {
}
public static void hideKeyboardFrom(Context context, View view) {
+ if (context == null) {
+ return;
+ }
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
+ public static boolean isKeyboardShown(Context context) {
+ if (context == null) {
+ return false;
+ }
+ InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
+ return imm.isActive();
+ }
+
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
index 8ccfee22..0b0c5034 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
@@ -121,6 +121,12 @@ public class ProviderSelectionFragment extends BaseSetupFragment implements Canc
ViewHelper.hideKeyboardFrom(getContext(), v);
}
});
+
+ binding.getRoot().getViewTreeObserver().addOnGlobalLayoutListener(() -> {
+ if(ViewHelper.isKeyboardShown(getContext())) {
+ binding.getRoot().smoothScrollTo(binding.editCustomProvider.getLeft(), binding.getRoot().getBottom());
+ }
+ });
binding.providerRadioGroup.check(viewModel.getSelected());
}