Skip to content
Snippets Groups Projects
Commit 2c1bf903 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

TV: auto show/hide keyboard for login dialog

parent c03b748d
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......@@ -45,6 +49,16 @@ public class VlcLoginDialog extends VlcDialog<Dialog.LoginDialog, VlcLoginDialog
return R.layout.vlc_login_dialog;
}
@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);
......@@ -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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment