[Provider Model] 1.Fix the color of the dark mode 2.Fix RTL layout

Bug: 194982368
Test: manual test
Change-Id: I912e8d21d19be0a82d7f3b3f8398808f335b42de
Merged-In: I912e8d21d19be0a82d7f3b3f8398808f335b42de
(cherry picked from commit 528298596f)
This commit is contained in:
Zoey Chen
2021-08-03 17:56:11 +08:00
parent 29aedbe529
commit 007eb0da4b
7 changed files with 64 additions and 44 deletions

View File

@@ -94,8 +94,8 @@
android:background="?android:attr/selectableItemBackground"
android:layout_gravity="center_vertical|start"
android:orientation="horizontal"
android:layout_marginRight="@dimen/settingslib_switchbar_margin"
android:layout_marginLeft="@dimen/settingslib_switchbar_margin"
android:layout_marginEnd="@dimen/settingslib_switchbar_margin"
android:layout_marginStart="@dimen/settingslib_switchbar_margin"
android:layout_marginTop="16dp"
android:paddingStart="22dp"
android:paddingEnd="22dp">
@@ -107,6 +107,7 @@
android:layout_gravity="center_vertical|start">
<ImageView
android:id="@+id/signal_icon"
android:autoMirrored="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
@@ -122,10 +123,11 @@
android:gravity="start|center_vertical">
<TextView
android:id="@+id/mobile_title"
android:layout_marginLeft="16dp"
android:textDirection="locale"
android:layout_marginStart="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_gravity="center_vertical|start"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
@@ -133,10 +135,11 @@
android:fontFamily="google-sans"/>
<TextView
android:id="@+id/mobile_summary"
android:layout_marginLeft="16dp"
android:textDirection="locale"
android:layout_marginStart="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_gravity="center_vertical|start"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorTertiary"
@@ -169,8 +172,8 @@
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginRight="@dimen/settingslib_switchbar_margin"
android:layout_marginLeft="@dimen/settingslib_switchbar_margin"
android:layout_marginEnd="@dimen/settingslib_switchbar_margin"
android:layout_marginStart="@dimen/settingslib_switchbar_margin"
android:paddingStart="22dp"
android:paddingEnd="22dp">
@@ -182,6 +185,7 @@
android:layout_height="match_parent">
<TextView
android:text="@string/turn_on_wifi"
android:textDirection="locale"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="start|center_vertical"
@@ -217,8 +221,8 @@
android:visibility="gone"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:layout_marginRight="@dimen/settingslib_switchbar_margin"
android:layout_marginLeft="@dimen/settingslib_switchbar_margin"
android:layout_marginEnd="@dimen/settingslib_switchbar_margin"
android:layout_marginStart="@dimen/settingslib_switchbar_margin"
android:paddingStart="22dp"
android:paddingEnd="22dp">
@@ -244,10 +248,11 @@
android:gravity="start|center_vertical">
<TextView
android:id="@+id/wifi_connected_title"
android:textDirection="locale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical|start"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
@@ -255,10 +260,11 @@
android:fontFamily="google-sans"/>
<TextView
android:id="@+id/wifi_connected_summary"
android:textDirection="locale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical|start"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorTertiary"
@@ -269,7 +275,7 @@
<FrameLayout
android:layout_width="24dp"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:clickable="false"
android:gravity="center">
<ImageView
@@ -323,9 +329,10 @@
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp">
android:layout_marginStart="16dp">
<TextView
android:text="@string/see_all_networks"
android:textDirection="locale"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="start|center_vertical"
@@ -353,7 +360,7 @@
android:id="@+id/done"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="24dp"
android:layout_gravity="end"
android:background="@drawable/internet_dialog_footer_background"
android:textColor="?android:attr/textColorPrimary"

View File

@@ -56,12 +56,13 @@
android:layout_height="72dp">
<TextView
android:id="@+id/wifi_title"
android:textDirection="locale"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_gravity="center_vertical|start"
android:gravity="start|center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
@@ -69,12 +70,13 @@
android:fontFamily="google-sans"/>
<TextView
android:id="@+id/wifi_summary"
android:textDirection="locale"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_gravity="center_vertical|start"
android:gravity="start|center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
@@ -85,7 +87,7 @@
<FrameLayout
android:layout_width="24dp"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/settingslib_switchbar_padding_right"
android:layout_marginEnd="@dimen/settingslib_switchbar_padding_right"
android:clickable="false"
android:gravity="center">
<ImageView

View File

@@ -291,6 +291,6 @@
<color name="settingslib_track_on_color">?androidprv:attr/colorAccentPrimaryVariant</color>
<!-- Material next track off color-->
<color name="settingslib_track_off_color">?androidprv:attr/colorAccentSecondaryVariant</color>
<color name="connected_network_primary_color">#ff000000</color>
<color name="connected_network_tertiary_color">#808080</color>
<color name="connected_network_primary_color">#191C18</color>
<color name="connected_network_secondary_color">#41493D</color>
</resources>

View File

@@ -215,7 +215,7 @@ public class InternetAdapter extends RecyclerView.Adapter<InternetAdapter.Intern
return null;
}
drawable.setTint(
Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorControlNormal));
Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorTertiary));
final AtomicReference<Drawable> shared = new AtomicReference<>();
shared.set(drawable);
return shared.get();

View File

@@ -341,14 +341,17 @@ public class InternetDialog extends SystemUIDialog implements
mMobileSummaryText.setVisibility(View.GONE);
}
mSignalIcon.setImageDrawable(getSignalStrengthDrawable());
int titleColor = isCellularNetwork ? mContext.getColor(
R.color.connected_network_primary_color) : Utils.getColorAttrDefaultColor(
mContext, android.R.attr.textColorPrimary);
int summaryColor = isCellularNetwork ? mContext.getColor(
R.color.connected_network_tertiary_color) : Utils.getColorAttrDefaultColor(
mContext, android.R.attr.textColorTertiary);
mMobileTitleText.setTextColor(titleColor);
mMobileSummaryText.setTextColor(summaryColor);
if (mInternetDialogController.isNightMode()) {
int titleColor = isCellularNetwork ? mContext.getColor(
R.color.connected_network_primary_color) : Utils.getColorAttrDefaultColor(
mContext, android.R.attr.textColorPrimary);
int summaryColor = isCellularNetwork ? mContext.getColor(
R.color.connected_network_secondary_color) : Utils.getColorAttrDefaultColor(
mContext, android.R.attr.textColorSecondary);
mMobileTitleText.setTextColor(titleColor);
mMobileSummaryText.setTextColor(summaryColor);
}
mMobileNetworkLayout.setBackground(isCellularNetwork ? mBackgroundOn : null);
mMobileDataToggle.setVisibility(mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE);
@@ -366,10 +369,12 @@ public class InternetDialog extends SystemUIDialog implements
mConnectedWifiSummaryText.setText(getConnectedWifiSummary());
mConnectedWifiIcon.setImageDrawable(
mInternetDialogController.getConnectedWifiDrawable(mConnectedWifiEntry));
mConnectedWifiTitleText.setTextColor(
mContext.getColor(R.color.connected_network_primary_color));
mConnectedWifiSummaryText.setTextColor(
mContext.getColor(R.color.connected_network_tertiary_color));
if (mInternetDialogController.isNightMode()) {
mConnectedWifiTitleText.setTextColor(
mContext.getColor(R.color.connected_network_primary_color));
mConnectedWifiSummaryText.setTextColor(
mContext.getColor(R.color.connected_network_secondary_color));
}
mWifiSettingsIcon.setColorFilter(
mContext.getColor(R.color.connected_network_primary_color));
mConnectedWifListLayout.setBackground(mBackgroundOn);

View File

@@ -23,6 +23,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -323,11 +324,15 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
if (drawable == null) {
return null;
}
drawable.setTint(Utils.getColorAttrDefaultColor(mContext,
com.android.internal.R.attr.colorControlNormal));
drawable.setTint(mContext.getColor(R.color.connected_network_primary_color));
return drawable;
}
boolean isNightMode() {
return (mContext.getResources().getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
}
Drawable getSignalStrengthDrawable() {
Drawable drawable = mContext.getDrawable(
R.drawable.ic_signal_strength_zero_bar_no_internet);
@@ -345,8 +350,9 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
drawable = shared.get();
}
drawable.setTint(
Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorControlNormal));
drawable.setTint(activeNetworkIsCellular() ? mContext.getColor(
R.color.connected_network_primary_color) : Utils.getColorAttrDefaultColor(
mContext, android.R.attr.textColorTertiary));
} catch (Throwable e) {
e.printStackTrace();
}
@@ -393,7 +399,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
// Set the signal strength icon at the bottom right
icons.setLayerGravity(1 /* index of SignalDrawable */, Gravity.BOTTOM | Gravity.RIGHT);
icons.setLayerSize(1 /* index of SignalDrawable */, iconSize, iconSize);
icons.setTintList(Utils.getColorAttr(context, android.R.attr.colorControlNormal));
icons.setTintList(Utils.getColorAttr(context, android.R.attr.textColorTertiary));
return icons;
}

View File

@@ -35,6 +35,7 @@ import com.android.internal.logging.UiEventLogger;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.settingslib.Utils;
import com.android.settingslib.wifi.WifiUtils;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.Main;
@@ -288,8 +289,7 @@ public class InternetDialogControllerTest extends SysuiTestCase {
mInternetDialogController.getConnectedWifiDrawable(mConnectedEntry);
verify(mWifiIconInjector).getIcon(eq(false), anyInt());
verify(drawable).setTint(Utils.getColorAttrDefaultColor(mContext,
com.android.internal.R.attr.colorControlNormal));
verify(drawable).setTint(mContext.getColor(R.color.connected_network_primary_color));
}
@Test