[Android] TV: auto show/hide keyboard for login dialog
Geoffrey Métais
git at videolan.org
Fri Apr 1 15:36:19 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 1 15:31:32 2016 +0200| [2c1bf903d2fa7437c30712e40502ec9804a906d6] | committer: Geoffrey Métais
TV: auto show/hide keyboard for login dialog
> https://code.videolan.org/videolan/vlc-android/commit/2c1bf903d2fa7437c30712e40502ec9804a906d6
---
.../videolan/vlc/gui/dialogs/VlcLoginDialog.java | 24 ++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/VlcLoginDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/VlcLoginDialog.java
index a5d788f..c2ae549 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/VlcLoginDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/VlcLoginDialog.java
@@ -24,19 +24,23 @@
package org.videolan.vlc.gui.dialogs;
-import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
import android.support.v7.preference.PreferenceManager;
import android.view.View;
+import android.widget.EditText;
import org.videolan.libvlc.Dialog;
import org.videolan.vlc.R;
+import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.databinding.VlcLoginDialogBinding;
+import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.gui.preferences.PreferencesActivity;
import org.videolan.vlc.util.Util;
-public class VlcLoginDialog extends VlcDialog<Dialog.LoginDialog, VlcLoginDialogBinding> {
+public class VlcLoginDialog extends VlcDialog<Dialog.LoginDialog, VlcLoginDialogBinding> implements View.OnFocusChangeListener {
SharedPreferences mSettings;
@@ -46,6 +50,16 @@ public class VlcLoginDialog extends VlcDialog<Dialog.LoginDialog, VlcLoginDialog
}
@Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ if (VLCApplication.showTvUi()) {
+ mBinding.login.setOnFocusChangeListener(this);
+ mBinding.password.setOnFocusChangeListener(this);
+ }
+ mBinding.store.setOnFocusChangeListener(this);
+ }
+
+ @Override
public void onAttach(Context context) {
super.onAttach(context);
mSettings = PreferenceManager.getDefaultSharedPreferences(context);
@@ -63,4 +77,10 @@ public class VlcLoginDialog extends VlcDialog<Dialog.LoginDialog, VlcLoginDialog
public boolean store() {
return mSettings.getBoolean(PreferencesActivity.LOGIN_STORE, true);
}
+
+ @Override
+ public void onFocusChange(final View v, boolean hasFocus) {
+ if (hasFocus)
+ UiTools.setKeyboardVisibility(v, v instanceof EditText);
+ }
}
More information about the Android
mailing list