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

Commit 7a78a801 authored by Weng Su's avatar Weng Su
Browse files

Set background for ripple feedback on network items

- Set selectable item background to Carrier Network and WiFi Networks

Bug: 203263016
Test: manual test
atest -c InternetDialogTest

Change-Id: Ia158f6d9e693e661f957a7bda07af5a8656d1391
parent 2121a9f3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -329,7 +329,8 @@
                android:layout_height="wrap_content"
                android:paddingBottom="4dp"
                android:clickable="false"
                android:focusable="false">
                android:focusable="false"
                android:visibility="gone">

                <LinearLayout
                    android:layout_width="wrap_content"
+3 −0
Original line number Diff line number Diff line
@@ -980,12 +980,15 @@
    <style name="InternetDialog.Network">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">88dp</item>
        <item name="android:layout_marginStart">@dimen/internet_dialog_network_layout_margin</item>
        <item name="android:layout_marginEnd">@dimen/internet_dialog_network_layout_margin</item>
        <item name="android:layout_gravity">center_vertical|start</item>
        <item name="android:paddingStart">22dp</item>
        <item name="android:paddingEnd">22dp</item>
        <item name="android:orientation">horizontal</item>
        <item name="android:focusable">true</item>
        <item name="android:clickable">true</item>
        <item name="android:background">?android:attr/selectableItemBackground</item>
    </style>

    <style name="InternetDialog.NetworkTitle">
+12 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static com.android.systemui.Prefs.Key.QS_HAS_TURNED_OFF_MOBILE_DATA;

import android.app.AlertDialog;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.net.Network;
import android.net.NetworkCapabilities;
@@ -122,6 +123,7 @@ public class InternetDialog extends SystemUIDialog implements
    private Switch mWiFiToggle;
    private FrameLayout mDoneLayout;
    private Drawable mBackgroundOn;
    private Drawable mBackgroundOff = null;
    private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    private boolean mCanConfigMobileData;

@@ -209,6 +211,14 @@ public class InternetDialog extends SystemUIDialog implements
        mInternetDialogTitle.setText(getDialogTitleText());
        mInternetDialogTitle.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);

        TypedArray typedArray = mContext.obtainStyledAttributes(
                new int[]{android.R.attr.selectableItemBackground});
        try {
            mBackgroundOff = typedArray.getDrawable(0 /* index */);
        } finally {
            typedArray.recycle();
        }

        setOnClickListener();
        mTurnWifiOnLayout.setBackground(null);
        mWifiRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
@@ -364,7 +374,8 @@ public class InternetDialog extends SystemUIDialog implements
            mMobileSummaryText.setTextAppearance(isCarrierNetworkConnected
                    ? R.style.TextAppearance_InternetDialog_Secondary_Active
                    : R.style.TextAppearance_InternetDialog_Secondary);
            mMobileNetworkLayout.setBackground(isCarrierNetworkConnected ? mBackgroundOn : null);
            mMobileNetworkLayout.setBackground(
                    isCarrierNetworkConnected ? mBackgroundOn : mBackgroundOff);

            mMobileDataToggle.setVisibility(mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE);
        }