Add divider line in Preference for scan QR code button and share hotspot button
Bug: 128940862 Test: manual test Change-Id: If576f0840cc8924b63348f04fe12c3a0d4edcb89
This commit is contained in:
@@ -54,6 +54,10 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/preference_two_target_divider"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@android:id/widget_frame"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -20,7 +20,6 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
@@ -63,10 +62,6 @@ public class AddWifiNetworkPreference extends Preference {
|
||||
getContext().startActivity(
|
||||
WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
|
||||
});
|
||||
|
||||
final View divider = (View) holder.findViewById(
|
||||
com.android.settingslib.R.id.two_target_divider);
|
||||
divider.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,6 +39,7 @@ public class WifiTetherSsidPreference extends ValidatedEditTextPreference {
|
||||
|
||||
private ImageButton mImageButton;
|
||||
private Drawable mButtonIcon;
|
||||
private View mDivider;
|
||||
private View.OnClickListener mClickListener;
|
||||
private boolean mVisible;
|
||||
|
||||
@@ -68,6 +69,8 @@ public class WifiTetherSsidPreference extends ValidatedEditTextPreference {
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
// TODO(b/129019971): use methods of divider line in parent object
|
||||
setLayoutResource(R.layout.preference);
|
||||
setWidgetLayoutResource(R.layout.wifi_button_preference_widget);
|
||||
}
|
||||
|
||||
@@ -82,13 +85,17 @@ public class WifiTetherSsidPreference extends ValidatedEditTextPreference {
|
||||
getContext().getString(R.string.wifi_dpp_share_hotspot));
|
||||
setButtonIcon(R.drawable.ic_qrcode_24dp);
|
||||
mImageButton.setImageDrawable(mButtonIcon);
|
||||
|
||||
mDivider = holder.findViewById(R.id.two_target_divider);
|
||||
}
|
||||
|
||||
if (mVisible) {
|
||||
mImageButton.setOnClickListener(mClickListener);
|
||||
mImageButton.setVisibility(View.VISIBLE);
|
||||
mDivider.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mImageButton.setVisibility(View.GONE);
|
||||
mDivider.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user