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"
|
<EditText android:id="@+id/ssid"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
style="@style/wifi_item_edit_content"
|
style="@style/wifi_item_edit_content"
|
||||||
android:hint="@string/wifi_ssid_hint"
|
android:hint="@string/wifi_ssid_hint"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
@@ -64,12 +65,11 @@
|
|||||||
android:id="@+id/ssid_scanner_button"
|
android:id="@+id/ssid_scanner_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:src="@drawable/ic_scan_24dp"
|
android:src="@drawable/ic_scan_24dp"
|
||||||
android:visibility="gone"
|
|
||||||
android:contentDescription="@string/wifi_add_network" />
|
android:contentDescription="@string/wifi_add_network" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@@ -291,6 +291,7 @@
|
|||||||
<EditText android:id="@+id/password"
|
<EditText android:id="@+id/password"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
style="@style/wifi_item_edit_content"
|
style="@style/wifi_item_edit_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:password="true" />
|
android:password="true" />
|
||||||
@@ -299,12 +300,11 @@
|
|||||||
android:id="@+id/password_scanner_button"
|
android:id="@+id/password_scanner_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:src="@drawable/ic_scan_24dp"
|
android:src="@drawable/ic_scan_24dp"
|
||||||
android:visibility="gone"
|
|
||||||
android:contentDescription="@string/wifi_add_network" />
|
android:contentDescription="@string/wifi_add_network" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -40,6 +40,7 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
|||||||
final static int SUBMIT_BUTTON_ID = android.R.id.button1;
|
final static int SUBMIT_BUTTON_ID = android.R.id.button1;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final static int CANCEL_BUTTON_ID = android.R.id.button2;
|
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 WifiConfigController mUIController;
|
||||||
private Button mSubmitBtn;
|
private Button mSubmitBtn;
|
||||||
@@ -62,20 +63,12 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
|||||||
|
|
||||||
mSubmitBtn = rootView.findViewById(SUBMIT_BUTTON_ID);
|
mSubmitBtn = rootView.findViewById(SUBMIT_BUTTON_ID);
|
||||||
mCancelBtn = rootView.findViewById(CANCEL_BUTTON_ID);
|
mCancelBtn = rootView.findViewById(CANCEL_BUTTON_ID);
|
||||||
|
final ImageButton scannerButton = rootView.findViewById(SCANNER_BUTTON_ID);
|
||||||
mSubmitBtn.setOnClickListener(this);
|
mSubmitBtn.setOnClickListener(this);
|
||||||
mCancelBtn.setOnClickListener(this);
|
mCancelBtn.setOnClickListener(this);
|
||||||
|
scannerButton.setOnClickListener(this);
|
||||||
mUIController = new WifiConfigController(this, rootView, null, getMode());
|
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;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +87,11 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
|||||||
case CANCEL_BUTTON_ID:
|
case CANCEL_BUTTON_ID:
|
||||||
handleCancelAction();
|
handleCancelAction();
|
||||||
break;
|
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);
|
mView = getLayoutInflater().inflate(R.layout.wifi_dialog, /* root */ null);
|
||||||
final ImageButton scannerButton = mView.findViewById(R.id.password_scanner_button);
|
final ImageButton scannerButton = mView.findViewById(R.id.password_scanner_button);
|
||||||
if (scannerButton != null) {
|
if (scannerButton != null) {
|
||||||
scannerButton.setVisibility(View.VISIBLE);
|
|
||||||
scannerButton.setOnClickListener((View v) -> {
|
scannerButton.setOnClickListener((View v) -> {
|
||||||
String ssid = null;
|
String ssid = null;
|
||||||
if (mAccessPoint != null) {
|
if (mAccessPoint != null) {
|
||||||
|
Reference in New Issue
Block a user