Merge "Add divider line in Preference for scan QR code button and share hotspot button"
This commit is contained in:
@@ -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(com.android.settingslib.R.layout.preference_two_target);
|
||||
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