diff options
3 files changed, 13 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; diff --git a/service/ServiceWifiResources/res/layout/wifi_p2p_dialog.xml b/service/ServiceWifiResources/res/layout/wifi_p2p_dialog.xml index 85794936d4..947f976fcc 100644 --- a/service/ServiceWifiResources/res/layout/wifi_p2p_dialog.xml +++ b/service/ServiceWifiResources/res/layout/wifi_p2p_dialog.xml @@ -23,6 +23,10 @@ android:layout_height="wrap_content" android:orientation="vertical"> + <TextView android:id="@+id/time_remaining" + style="@style/wifi_p2p_dialog_timeout" + android:visibility="gone"/> + <LinearLayout android:id="@+id/info" style="@style/wifi_section" /> diff --git a/service/ServiceWifiResources/res/values/styles.xml b/service/ServiceWifiResources/res/values/styles.xml index e3ad1619a5..714d10fe0f 100644 --- a/service/ServiceWifiResources/res/values/styles.xml +++ b/service/ServiceWifiResources/res/values/styles.xml @@ -46,6 +46,8 @@ <style name="wifi_dialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert" /> <style name="wifi_p2p_invitation_received_dialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert" /> + <style name="wifi_p2p_dialog_timeout" parent="@style/wifi_item" /> + <style name="wifi_p2p_dialog_row_label" parent="@style/wifi_item_label" /> <style name="wifi_p2p_dialog_row_content" parent="@style/wifi_item_content"> |