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:
Arc Wang
2019-02-15 16:30:17 +08:00
parent 3a5d9020e8
commit 07ced72e67
3 changed files with 12 additions and 15 deletions

View File

@@ -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;
}
}