change switch to material switch

only-core-features
Felix Prahl-Kamps 2019-10-22 15:56:45 +02:00
parent 9ab170c05b
commit cc6ee5b7ad
3 changed files with 12 additions and 11 deletions

View File

@ -7,18 +7,19 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.google.android.material.switchmaterial.SwitchMaterial;
import lu.circl.mispbump.R;
public class MaterialPreferenceSwitch extends ConstraintLayout {
private TextView titleView, subTitleView;
private Switch switchView;
private SwitchMaterial switchView;
private CompoundButton.OnCheckedChangeListener onCheckedChangeListener;
public MaterialPreferenceSwitch(Context context, AttributeSet attrs) {

View File

@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:layout_marginBottom="4dp"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
@ -41,16 +41,14 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/material_preference_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/material_preference_title"
app:layout_constraintTop_toBottomOf="@+id/material_preference_title"
tools:text="Subtitle" />
<Switch
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/material_preference_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="@id/material_preference_subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/material_preference_title" />

View File

@ -1,9 +1,11 @@
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">@color/colorOnSecondary</item>
@ -29,11 +31,11 @@
<style name="AppTheme.TextAppearance.ListTitle">
<item name="android:textColor">#de000000</item>
<item name="android:textSize">16dp</item>
<item name="android:textSize">16sp</item>
</style>
<style name="AppTheme.TextAppearance.ListSubtitle">
<item name="android:textColor">#99000000</item>
<item name="android:textSize">14dp</item>
<item name="android:textSize">14sp</item>
</style>
</resources>