Merge "Fix renaming for Bluetooth devices when rotating to landscape" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-22 07:17:17 +00:00
committed by Android (Google) Code Review
2 changed files with 88 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
@@ -89,8 +90,15 @@ abstract class BluetoothNameDialogFragment extends InstrumentedDialogFragment
})
.setNegativeButton(android.R.string.cancel, null);
mAlertDialog = builder.create();
mAlertDialog.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
mAlertDialog.setOnShowListener(d -> {
if (mDeviceNameView != null && mDeviceNameView.requestFocus()) {
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(mDeviceNameView, InputMethodManager.SHOW_IMPLICIT);
}
}
});
return mAlertDialog;
}