Merge "Update strings for Wi-Fi DPP handshake running state"

This commit is contained in:
TreeHugger Robot
2019-02-26 07:15:27 +00:00
committed by Android (Google) Code Review
3 changed files with 35 additions and 8 deletions

View File

@@ -2153,6 +2153,10 @@
<string name="wifi_dpp_could_not_add_device">Couldn\u2019t add device</string> <string name="wifi_dpp_could_not_add_device">Couldn\u2019t add device</string>
<!-- Title for the fragment to show that device found but naming known [CHAR LIMIT=50] --> <!-- Title for the fragment to show that device found but naming known [CHAR LIMIT=50] -->
<string name="wifi_dpp_device_found">Device found</string> <string name="wifi_dpp_device_found">Device found</string>
<!-- Hint for Wi-Fi DPP handshake running [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_sharing_wifi_with_this_device">Sharing Wi\u2011Fi with this device\u2026</string>
<!-- Hint for Wi-Fi DPP handshake running [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_connecting">Connecting\u2026</string>
<!-- Label for the try again button [CHAR LIMIT=20]--> <!-- Label for the try again button [CHAR LIMIT=20]-->
<string name="retry">Retry</string> <string name="retry">Retry</string>
<!-- Label for the check box to share a network with other users on the same device --> <!-- Label for the check box to share a network with other users on the same device -->

View File

@@ -172,6 +172,9 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
mLatestStatusCode = code; mLatestStatusCode = code;
} }
if (isGoingInitiator()) {
mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
}
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE); mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE); mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
} }
@@ -255,7 +258,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
mTitle.setText(information); mTitle.setText(information);
} }
mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid())); updateSummary();
mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view); mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network); mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
@@ -273,6 +276,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.VISIBLE);
mButtonRight.setVisibility(View.INVISIBLE); mButtonRight.setVisibility(View.INVISIBLE);
startWifiDppConfiguratorInitiator(); startWifiDppConfiguratorInitiator();
updateSummary();
}); });
if (savedInstanceState != null) { if (savedInstanceState != null) {
@@ -342,4 +346,12 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
return model.isGoingInitiator(); return model.isGoingInitiator();
} }
private void updateSummary() {
if (isGoingInitiator()) {
mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
} else {
mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
}
}
} }

View File

@@ -229,13 +229,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
} else { } else {
mTitle.setText(R.string.wifi_dpp_scan_qr_code); mTitle.setText(R.string.wifi_dpp_scan_qr_code);
String description; updateEnrolleeSummary();
if (TextUtils.isEmpty(mSsid)) {
description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
} else {
description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
}
mSummary.setText(description);
} }
mErrorMessage = view.findViewById(R.id.error_message); mErrorMessage = view.findViewById(R.id.error_message);
@@ -415,6 +409,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
if (!mIsConfiguratorMode) { if (!mIsConfiguratorMode) {
mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.VISIBLE);
startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj); startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
updateEnrolleeSummary();
} }
break; break;
@@ -461,6 +456,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
Log.e(TAG, "Invalid networkId " + newNetworkId); Log.e(TAG, "Invalid networkId " + newNetworkId);
mLatestStatusCode = EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC; mLatestStatusCode = EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC;
updateEnrolleeSummary();
mProgressBar.setVisibility(View.INVISIBLE); mProgressBar.setVisibility(View.INVISIBLE);
showErrorMessage(getString(R.string.wifi_dpp_check_connection_try_again)); showErrorMessage(getString(R.string.wifi_dpp_check_connection_try_again));
restartCamera(); restartCamera();
@@ -528,6 +524,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
} }
mLatestStatusCode = code; mLatestStatusCode = code;
updateEnrolleeSummary();
mProgressBar.setVisibility(View.INVISIBLE); mProgressBar.setVisibility(View.INVISIBLE);
restartCamera(); restartCamera();
} }
@@ -588,4 +585,18 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
mCamera.start(surfaceTexture); mCamera.start(surfaceTexture);
} }
private void updateEnrolleeSummary() {
if (isGoingInitiator()) {
mSummary.setText(R.string.wifi_dpp_connecting);
} else {
String description;
if (TextUtils.isEmpty(mSsid)) {
description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
} else {
description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
}
mSummary.setText(description);
}
}
} }