[Android] Unify switch style across the app (#36652)
This commit is contained in:
@@ -100,7 +100,7 @@
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/vpn_hostname_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -110,7 +110,7 @@
|
||||
android:textSize="16sp"
|
||||
android:text="@string/vpn_hostname" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/subscription_type_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -120,7 +120,7 @@
|
||||
android:textSize="16sp"
|
||||
android:text="@string/subscription_type" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/app_receipt_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -130,7 +130,7 @@
|
||||
android:textSize="16sp"
|
||||
android:text="@string/app_receipt" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/app_version_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -140,7 +140,7 @@
|
||||
android:textSize="16sp"
|
||||
android:text="@string/app_version" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/timezone_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -150,7 +150,7 @@
|
||||
android:textSize="16sp"
|
||||
android:text="@string/timezone" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/network_type_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -160,7 +160,7 @@
|
||||
android:textSize="16sp"
|
||||
android:text="@string/network_type" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/cellular_carrier_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/switch_show_news"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -55,16 +55,13 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/site_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:switchMinWidth="56dp"
|
||||
android:scaleX="2.2"
|
||||
android:scaleY="2.2"
|
||||
android:layout_marginTop="32dp"
|
||||
android:theme="@style/BraveSwitchTheme"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/brave_shields_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:switchMinWidth="56dp"
|
||||
android:theme="@style/BraveSwitchTheme"
|
||||
android:gravity="center|center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/filter_summary_color"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/toggle_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -35,15 +35,14 @@
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/filter_summary_color"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/toggle_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:theme="@style/BraveSwitchTheme"/>
|
||||
android:layout_marginEnd="16dp"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
-->
|
||||
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="BraveSwitchTheme">
|
||||
<item name="colorControlActivated">#fb542b</item>
|
||||
<item name="switchStyle">@style/Widget.MaterialComponents.CompoundButton.Switch</item>
|
||||
</style>
|
||||
|
||||
<style name="BraveDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
@@ -19,12 +19,12 @@ import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.airbnb.lottie.LottieAnimationView;
|
||||
import com.airbnb.lottie.LottieProperty;
|
||||
import com.airbnb.lottie.model.KeyPath;
|
||||
import com.google.android.material.materialswitch.MaterialSwitch;
|
||||
|
||||
import org.chromium.base.BravePreferenceKeys;
|
||||
import org.chromium.base.ThreadUtils;
|
||||
@@ -60,7 +60,7 @@ public class BraveNewsPreferencesV2 extends BravePreferenceFragment
|
||||
|
||||
private LinearLayout mParentLayout;
|
||||
private LinearLayout mOptinLayout;
|
||||
private SwitchCompat mSwitchShowNews;
|
||||
private MaterialSwitch mSwitchShowNews;
|
||||
private TextView mTvSearch;
|
||||
private TextView mTvFollowingCount;
|
||||
private Button mBtnTurnOnNews;
|
||||
@@ -99,7 +99,7 @@ public class BraveNewsPreferencesV2 extends BravePreferenceFragment
|
||||
if (view != null) {
|
||||
mParentLayout = (LinearLayout) view.findViewById(R.id.layout_parent);
|
||||
mOptinLayout = (LinearLayout) view.findViewById(R.id.layout_optin_card);
|
||||
mSwitchShowNews = (SwitchCompat) view.findViewById(R.id.switch_show_news);
|
||||
mSwitchShowNews = (MaterialSwitch) view.findViewById(R.id.switch_show_news);
|
||||
mDivider = view.findViewById(R.id.divider);
|
||||
mLayoutSwitch = view.findViewById(R.id.layout_switch);
|
||||
mBtnTurnOnNews = (Button) view.findViewById(R.id.btn_turn_on_news);
|
||||
|
||||
@@ -43,9 +43,10 @@ import android.widget.RadioGroup;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.google.android.material.materialswitch.MaterialSwitch;
|
||||
|
||||
import org.chromium.base.BraveFeatureList;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.R;
|
||||
@@ -150,11 +151,11 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
private View mHardwareButtonMenuAnchor;
|
||||
private final Map<Integer, BlockersInfo> mTabsStat =
|
||||
Collections.synchronizedMap(new HashMap<Integer, BlockersInfo>());
|
||||
private SwitchCompat mBraveShieldsBlockingScriptsSwitch;
|
||||
private MaterialSwitch mBraveShieldsBlockingScriptsSwitch;
|
||||
private OnCheckedChangeListener mBraveShieldsBlockingScriptsChangeListener;
|
||||
private SwitchCompat mBraveShieldsForgetFirstPartyStorageSwitch;
|
||||
private MaterialSwitch mBraveShieldsForgetFirstPartyStorageSwitch;
|
||||
private OnCheckedChangeListener mBraveShieldsForgetFirstPartyStorageChangeListener;
|
||||
private SwitchCompat mFingerprintingSwitch;
|
||||
private MaterialSwitch mFingerprintingSwitch;
|
||||
private OnCheckedChangeListener mBraveShieldsFingerprintingChangeListener;
|
||||
|
||||
private View mPopupView;
|
||||
@@ -541,7 +542,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
TextView mSiteText = mMainLayout.findViewById(R.id.site_text);
|
||||
mSiteText.setText(mHost.replaceFirst("^(http[s]?://www\\.|http[s]?://|www\\.)", ""));
|
||||
|
||||
SwitchCompat mShieldMainSwitch = mMainLayout.findViewById(R.id.site_switch);
|
||||
MaterialSwitch mShieldMainSwitch = mMainLayout.findViewById(R.id.site_switch);
|
||||
|
||||
ImageView helpImage = (ImageView) mMainLayout.findViewById(R.id.help);
|
||||
ImageView shareImage = (ImageView) mMainLayout.findViewById(R.id.share);
|
||||
@@ -1454,7 +1455,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
setUpMainLayout();
|
||||
}
|
||||
|
||||
private void setupBlockingScriptsSwitchClick(SwitchCompat braveShieldsBlockingScriptsSwitch) {
|
||||
private void setupBlockingScriptsSwitchClick(MaterialSwitch braveShieldsBlockingScriptsSwitch) {
|
||||
if (null == braveShieldsBlockingScriptsSwitch) {
|
||||
return;
|
||||
}
|
||||
@@ -1479,7 +1480,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
}
|
||||
|
||||
private void setupBlockingScriptsSwitch(
|
||||
SwitchCompat braveShieldsBlockingScriptsSwitch, boolean fromTopSwitch) {
|
||||
MaterialSwitch braveShieldsBlockingScriptsSwitch, boolean fromTopSwitch) {
|
||||
if (null == braveShieldsBlockingScriptsSwitch) {
|
||||
return;
|
||||
}
|
||||
@@ -1508,7 +1509,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
}
|
||||
|
||||
private void setupForgetFirstPartyStorageSwitchClick(
|
||||
SwitchCompat braveShieldsForgetFirstPartyStorageSwitch) {
|
||||
MaterialSwitch braveShieldsForgetFirstPartyStorageSwitch) {
|
||||
if (null == braveShieldsForgetFirstPartyStorageSwitch) {
|
||||
return;
|
||||
}
|
||||
@@ -1531,7 +1532,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
}
|
||||
|
||||
private void setupForgetFirstPartyStorageSwitch(
|
||||
SwitchCompat braveShieldsForgetFirstPartyStorageSwitch, boolean fromTopSwitch) {
|
||||
MaterialSwitch braveShieldsForgetFirstPartyStorageSwitch, boolean fromTopSwitch) {
|
||||
if (null == braveShieldsForgetFirstPartyStorageSwitch) {
|
||||
return;
|
||||
}
|
||||
@@ -1561,7 +1562,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
}
|
||||
}
|
||||
|
||||
private void setupFingerprintingSwitchClick(SwitchCompat fingerprintingSwitch) {
|
||||
private void setupFingerprintingSwitchClick(MaterialSwitch fingerprintingSwitch) {
|
||||
if (null == fingerprintingSwitch) {
|
||||
return;
|
||||
}
|
||||
@@ -1588,7 +1589,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
}
|
||||
|
||||
private void setupFingerprintingSwitch(
|
||||
SwitchCompat braveShieldsFingerprintingSwitch, boolean fromTopSwitch) {
|
||||
MaterialSwitch braveShieldsFingerprintingSwitch, boolean fromTopSwitch) {
|
||||
if (null == braveShieldsFingerprintingSwitch) {
|
||||
return;
|
||||
}
|
||||
@@ -1622,7 +1623,7 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCal
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMainSwitchClick(SwitchCompat braveShieldsSwitch) {
|
||||
private void setupMainSwitchClick(MaterialSwitch braveShieldsSwitch) {
|
||||
if (null == braveShieldsSwitch) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.materialswitch.MaterialSwitch;
|
||||
|
||||
import org.chromium.brave_shields.mojom.SubscriptionInfo;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.mojo_base.mojom.Value;
|
||||
@@ -286,7 +287,7 @@ public class ContentFilteringAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
TextView mUrlText;
|
||||
ImageView mDeleteImageView;
|
||||
ImageView mArrowImageView;
|
||||
SwitchCompat mToggleSwitch;
|
||||
MaterialSwitch mToggleSwitch;
|
||||
View mDivider;
|
||||
|
||||
CustomFilterListViewHolder(View itemView) {
|
||||
@@ -296,7 +297,7 @@ public class ContentFilteringAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
mUrlText = (TextView) itemView.findViewById(R.id.url_text);
|
||||
mDeleteImageView = (ImageView) itemView.findViewById(R.id.iv_delete);
|
||||
mArrowImageView = (ImageView) itemView.findViewById(R.id.iv_arrow);
|
||||
mToggleSwitch = (SwitchCompat) itemView.findViewById(R.id.toggle_switch);
|
||||
mToggleSwitch = (MaterialSwitch) itemView.findViewById(R.id.toggle_switch);
|
||||
mDivider = itemView.findViewById(R.id.divider);
|
||||
}
|
||||
}
|
||||
@@ -304,13 +305,13 @@ public class ContentFilteringAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
public static class FilterListViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView mTitleText;
|
||||
TextView mDescriptionText;
|
||||
SwitchCompat mToggleSwitch;
|
||||
MaterialSwitch mToggleSwitch;
|
||||
|
||||
FilterListViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mTitleText = (TextView) itemView.findViewById(R.id.title_text);
|
||||
mDescriptionText = (TextView) itemView.findViewById(R.id.description_text);
|
||||
mToggleSwitch = (SwitchCompat) itemView.findViewById(R.id.toggle_switch);
|
||||
mToggleSwitch = (MaterialSwitch) itemView.findViewById(R.id.toggle_switch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-8
@@ -21,9 +21,10 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.AppCompatRadioButton;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.google.android.material.materialswitch.MaterialSwitch;
|
||||
|
||||
import org.chromium.base.supplier.OneshotSupplier;
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.chrome.R;
|
||||
@@ -49,13 +50,13 @@ public class BraveVpnSupportActivity extends AsyncInitializationActivity {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setTitle(getResources().getString(R.string.contact_technical_support));
|
||||
|
||||
SwitchCompat vpnHostnameSwitch = findViewById(R.id.vpn_hostname_switch);
|
||||
SwitchCompat subscriptionTypeSwitch = findViewById(R.id.subscription_type_switch);
|
||||
SwitchCompat appReceiptSwitch = findViewById(R.id.app_receipt_switch);
|
||||
SwitchCompat appVersionSwitch = findViewById(R.id.app_version_switch);
|
||||
SwitchCompat timezoneSwitch = findViewById(R.id.timezone_switch);
|
||||
SwitchCompat networkTypeSwitch = findViewById(R.id.network_type_switch);
|
||||
SwitchCompat cellularCarrierSwitch = findViewById(R.id.cellular_carrier_switch);
|
||||
MaterialSwitch vpnHostnameSwitch = findViewById(R.id.vpn_hostname_switch);
|
||||
MaterialSwitch subscriptionTypeSwitch = findViewById(R.id.subscription_type_switch);
|
||||
MaterialSwitch appReceiptSwitch = findViewById(R.id.app_receipt_switch);
|
||||
MaterialSwitch appVersionSwitch = findViewById(R.id.app_version_switch);
|
||||
MaterialSwitch timezoneSwitch = findViewById(R.id.timezone_switch);
|
||||
MaterialSwitch networkTypeSwitch = findViewById(R.id.network_type_switch);
|
||||
MaterialSwitch cellularCarrierSwitch = findViewById(R.id.cellular_carrier_switch);
|
||||
|
||||
RadioGroup otherIssuesRadioGroup = findViewById(R.id.other_issues_radiogroup);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user