Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 890f3a43 authored by Arc Wang's avatar Arc Wang
Browse files

Add divider line in Preference for scan QR code button and share hotspot button

Bug: 128940862
Test: manual test
Change-Id: If576f0840cc8924b63348f04fe12c3a0d4edcb89
parent 64df6a30
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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"
+0 −5
Original line number Diff line number Diff line
@@ -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);
        }
    }

+7 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }