summaryrefslogtreecommitdiff
path: root/WifiDialog/src
diff options
context:
space:
mode:
author Quang Anh Luong <qal@google.com> 2023-07-05 16:16:35 +0900
committer Quang Anh Luong <qal@google.com> 2023-07-13 16:44:05 +0900
commit83f40c6f4473d157f4837ad37ab6a803dbd280c9 (patch)
tree426f8ffa76945121a9c8594e470391f3970c1ad2 /WifiDialog/src
parent34c6be8515d20d963df658989d51670f0f0bd97b (diff)
Fix P2P dialog time remaining text being cut off
P2P dialog time remaining text is set as a message in the AlertDialog, separately from the ScrollView containing the rest of the P2P dialog text. If the screen size is too small to fit the dialog and the keyboard, the dialog will get squished and push the message underneath the Title, cutting it off. To prevent this, move the time remaining text to the ScrollView with the rest of the P2P text so the text is more compact and is able to be scrolled together if the dialog is too small. Updated-Overlayable: Not applicable - changing default value Bug: 288179496 Test: manually verify timeleft text appears in rest of the ScrollView using adb shell cmd wifi launch-p2p-dialog-invitation-received DeviceName -c 15000 -p Change-Id: Ic2cf4dd0cbf5e33ff38023e89b3e1388cf4d1fdb
Diffstat (limited to 'WifiDialog/src')
-rw-r--r--WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
index 34fc8e3d28..43d7d92e1e 100644
--- a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
+++ b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
@@ -406,9 +406,12 @@ public class WifiDialogActivity extends Activity {
// Round up to the nearest whole second.
secondsRemaining++;
}
- dialog.setMessage(MessageFormat.format(
+ TextView timeRemaining = dialog.getWindow().findViewById(
+ getWifiViewId("time_remaining"));
+ timeRemaining.setText(MessageFormat.format(
getWifiString("wifi_p2p_invitation_seconds_remaining"),
secondsRemaining));
+ timeRemaining.setVisibility(View.VISIBLE);
}
}
@@ -586,15 +589,15 @@ public class WifiDialogActivity extends Activity {
@Nullable final String deviceName,
final boolean isPinRequested,
@Nullable final String displayPin) {
- final View textEntryView = getWifiLayoutInflater()
- .inflate(getWifiLayoutId("wifi_p2p_dialog"), null);
- ViewGroup group = textEntryView.findViewById(getWifiViewId("info"));
if (TextUtils.isEmpty(deviceName)) {
Log.w(TAG, "P2P Invitation Received dialog device name is null or empty."
+ " id=" + dialogId
+ " deviceName=" + deviceName
+ " displayPin=" + displayPin);
}
+ final View textEntryView = getWifiLayoutInflater()
+ .inflate(getWifiLayoutId("wifi_p2p_dialog"), null);
+ ViewGroup group = textEntryView.findViewById(getWifiViewId("info"));
addRowToP2pDialog(group, getWifiString("wifi_p2p_from_message"), deviceName);
final EditText pinEditText;
@@ -612,8 +615,6 @@ public class WifiDialogActivity extends Activity {
AlertDialog dialog = getWifiAlertDialogBuilder("wifi_p2p_invitation_received_dialog")
.setTitle(getWifiString("wifi_p2p_invitation_to_connect_title"))
- // Set the message to "" to allow us to modify it after building (b/36913966).
- .setMessage("")
.setView(textEntryView)
.setPositiveButton(getWifiString("accept"), (dialogPositive, which) -> {
String pin = null;