[Wi-Fi] Request focus on input field when config a WiFi network
For better user experience, recover the dialog focus command to get password field focused. Bug: 158393164 Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiConfigController2Test Change-Id: I343a7b43bd1ad2478991051b0bd8ef6082f75dc1
This commit is contained in:
@@ -113,8 +113,7 @@ public class ConfigureWifiEntryFragment extends InstrumentedFragment implements
|
|||||||
mSubmitBtn.setOnClickListener(view -> handleSubmitAction());
|
mSubmitBtn.setOnClickListener(view -> handleSubmitAction());
|
||||||
mCancelBtn.setOnClickListener(view -> handleCancelAction());
|
mCancelBtn.setOnClickListener(view -> handleCancelAction());
|
||||||
|
|
||||||
mUiController = new WifiConfigController2(this, rootView, mWifiEntry,
|
mUiController = new WifiConfigController2(this, rootView, mWifiEntry, getMode());
|
||||||
getMode(), false /* requestFocus */);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For this add WifiEntry UI, need to remove the Home button, so set related feature as
|
* For this add WifiEntry UI, need to remove the Home button, so set related feature as
|
||||||
|
@@ -193,7 +193,6 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
private ProxySettings mProxySettings = ProxySettings.UNASSIGNED;
|
private ProxySettings mProxySettings = ProxySettings.UNASSIGNED;
|
||||||
private ProxyInfo mHttpProxy = null;
|
private ProxyInfo mHttpProxy = null;
|
||||||
private StaticIpConfiguration mStaticIpConfiguration = null;
|
private StaticIpConfiguration mStaticIpConfiguration = null;
|
||||||
private boolean mRequestFocus = true;
|
|
||||||
|
|
||||||
private String[] mLevels;
|
private String[] mLevels;
|
||||||
private int mMode;
|
private int mMode;
|
||||||
@@ -208,17 +207,10 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
|
|
||||||
public WifiConfigController2(WifiConfigUiBase2 parent, View view, WifiEntry wifiEntry,
|
public WifiConfigController2(WifiConfigUiBase2 parent, View view, WifiEntry wifiEntry,
|
||||||
int mode) {
|
int mode) {
|
||||||
this (parent, view, wifiEntry, mode, true /* requestFocus */);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WifiConfigController2(WifiConfigUiBase2 parent, View view, WifiEntry wifiEntry,
|
|
||||||
int mode, boolean requestFocus) {
|
|
||||||
mConfigUi = parent;
|
mConfigUi = parent;
|
||||||
|
|
||||||
mView = view;
|
mView = view;
|
||||||
mWifiEntry = wifiEntry;
|
mWifiEntry = wifiEntry;
|
||||||
mContext = mConfigUi.getContext();
|
mContext = mConfigUi.getContext();
|
||||||
mRequestFocus = requestFocus;
|
|
||||||
|
|
||||||
// Init Wi-Fi manager
|
// Init Wi-Fi manager
|
||||||
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
||||||
@@ -443,10 +435,8 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
enableSubmitIfAppropriate();
|
enableSubmitIfAppropriate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// After done view show and hide, request focus from parameter.
|
// After done view show and hide, request focus
|
||||||
if (mRequestFocus) {
|
mView.findViewById(R.id.l_wifidialog).requestFocus();
|
||||||
mView.findViewById(R.id.l_wifidialog).requestFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
Reference in New Issue
Block a user