Fix [RTL] Wifi QR Scanner option overlaps wifi Password text
Use android:layout_alignParentStart & android:layout_alignParentEnd to fix the RTL issue. And refine code of the scanner button. Bug: 123923904 Test: manual test Change-Id: I85491b99d22ec303e370422a81a43fc203b695fa
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
<EditText android:id="@+id/ssid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/wifi_ssid_hint"
|
||||
android:singleLine="true"
|
||||
@@ -64,12 +65,11 @@
|
||||
android:id="@+id/ssid_scanner_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@null"
|
||||
android:src="@drawable/ic_scan_24dp"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/wifi_add_network" />
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -291,6 +291,7 @@
|
||||
<EditText android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:password="true" />
|
||||
@@ -299,12 +300,11 @@
|
||||
android:id="@+id/password_scanner_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@null"
|
||||
android:src="@drawable/ic_scan_24dp"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/wifi_add_network" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
@@ -40,6 +40,7 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
||||
final static int SUBMIT_BUTTON_ID = android.R.id.button1;
|
||||
@VisibleForTesting
|
||||
final static int CANCEL_BUTTON_ID = android.R.id.button2;
|
||||
final static int SCANNER_BUTTON_ID = R.id.ssid_scanner_button;
|
||||
|
||||
private WifiConfigController mUIController;
|
||||
private Button mSubmitBtn;
|
||||
@@ -62,20 +63,12 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
||||
|
||||
mSubmitBtn = rootView.findViewById(SUBMIT_BUTTON_ID);
|
||||
mCancelBtn = rootView.findViewById(CANCEL_BUTTON_ID);
|
||||
final ImageButton scannerButton = rootView.findViewById(SCANNER_BUTTON_ID);
|
||||
mSubmitBtn.setOnClickListener(this);
|
||||
mCancelBtn.setOnClickListener(this);
|
||||
scannerButton.setOnClickListener(this);
|
||||
mUIController = new WifiConfigController(this, rootView, null, getMode());
|
||||
|
||||
final ImageButton scannerButton = rootView.findViewById(R.id.ssid_scanner_button);
|
||||
if (scannerButton != null) {
|
||||
scannerButton.setVisibility(View.VISIBLE);
|
||||
scannerButton.setOnClickListener((View v) -> {
|
||||
// Launch QR code scanner to join a network.
|
||||
getContext().startActivity(
|
||||
WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
|
||||
});
|
||||
}
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@@ -94,6 +87,11 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
||||
case CANCEL_BUTTON_ID:
|
||||
handleCancelAction();
|
||||
break;
|
||||
case SCANNER_BUTTON_ID:
|
||||
// Launch QR code scanner to join a network.
|
||||
getContext().startActivity(
|
||||
WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,6 @@ public class WifiDialog extends AlertDialog implements WifiConfigUiBase,
|
||||
mView = getLayoutInflater().inflate(R.layout.wifi_dialog, /* root */ null);
|
||||
final ImageButton scannerButton = mView.findViewById(R.id.password_scanner_button);
|
||||
if (scannerButton != null) {
|
||||
scannerButton.setVisibility(View.VISIBLE);
|
||||
scannerButton.setOnClickListener((View v) -> {
|
||||
String ssid = null;
|
||||
if (mAccessPoint != null) {
|
||||
|
Reference in New Issue
Block a user