Commit b9915592 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

add switch button

parent af6e9841
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:width="http://schemas.android.com/apk/res-auto">
<item android:state_checked="false">
<layer-list>
<item>
<shape android:shape="rectangle"
android:dither="true"
android:useLevel="false">
<size android:width="48dp" android:height="24dp"/>
<corners android:radius="12dp"/>
</shape>
</item>
<item
android:right="8dp">
<bitmap
android:width="14dp"
android:height="15dp"
android:src="@drawable/ic_bell_off"
android:tintMode="multiply"
android:gravity="end"
android:tint="@color/colorPrimaryDark" />
</item>
</layer-list>
</item>
<item android:state_checked="true">
<layer-list>
<item>
<shape android:shape="rectangle"
android:dither="true"
android:useLevel="false">
<size android:width="48dp" android:height="24dp"/>
<solid android:color="#FFFFFFFF"/>
<corners android:radius="12dp" />
</shape>
</item>
<item
android:left="8dp"
>
<bitmap
android:right="27dp"
android:top="5dp"
android:bottom="5dp"
android:src="@drawable/ic_bell_on"
android:mipMap="true"
android:gravity="start"
android:tintMode="screen"
android:tint="@color/colorPrimaryDark" />
</item>
</layer-list>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/colorAccent">
</item>
<item android:state_checked="true"
android:color="@color/colorAccent">
</item>
<item android:color="@color/colorOpacityBackgroundInv">
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:width="24dp" android:height="24dp">
<shape android:shape="oval">
<size android:width="24dp" android:height="24dp"/>
<stroke
android:width="2dp"
android:color="#00000000" />
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp" />
</shape>
</item>
<item android:state_checked="true"
android:width="24dp" android:height="24dp">
<shape android:shape="oval">
<size android:width="24dp" android:height="24dp"/>
<stroke
android:width="2dp"
android:color="#00000000" />
</shape>
</item>
<item>
<shape android:shape="oval">
<size android:width="24dp" android:height="24dp"/>
<stroke
android:width="2dp"
android:color="#00000000" />
</shape>
</item>
</selector>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".base.RoomParkMainActivity">
<TextView <TextView
android:id="@+id/entryTextView" android:id="@+id/entryTextView"
...@@ -16,4 +16,15 @@ ...@@ -16,4 +16,15 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<include
layout="@layout/bell_switch_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/entryTextView"
app:layout_constraintVertical_bias="0.16000003" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch1"
android:layout_width="48dp"
android:layout_height="24dp"
android:height="24dp"
android:checked="false"
app:switchMinWidth="48dp" />
</LinearLayout>
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<color name="colorAccentSecondary">#093835</color> <color name="colorAccentSecondary">#093835</color>
<color name="colorGray">#A1A1A1</color> <color name="colorGray">#A1A1A1</color>
<color name="colorOpacityBackgroundInv">#E3E3E3</color>
//region background //region background
......
<resources> <resources xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorSecondary">@color/colorAccent</item>
<item name="colorSecondaryVariant">@color/colorAccentSecondary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="materialCardViewStyle">@style/Widget.Biganto.MaterialCardView</item>
<item name="switchStyle">@style/Widget.MaterialComponents.CompoundButton.Switch.BellSwitchStyle</item>
<!-- <item name="android:track" >@drawable/bell_switcher</item>-->
<!-- <item name="android:trackTint" tools:targetApi="m">@color/colorAccentSecondary</item>-->
<!-- active thumb & track color (30% transparency) -->
<!-- <item name="colorControlActivated">@color/colorOpacityBackground</item>-->
<!-- &lt;!&ndash; inactive thumb color &ndash;&gt;-->
<!-- <item name="colorSwitchThumbNormal">@color/colorAccent</item>-->
<!-- &lt;!&ndash; inactive track color (30% transparency) &ndash;&gt;-->
<!-- <item name="android:colorForeground">@color/colorPrimaryDark</item>-->
</style>
<style name="Widget.MaterialComponents.CompoundButton.Switch.BellSwitchStyle" >
<item name="track" >@drawable/bell_switch_track</item>
<item name="android:thumb" >@drawable/bell_switcher</item>
<item name="thumbTint">@color/colorPrimaryDark</item>
<item name="trackTint">@drawable/bell_switch_track_tint</item>
<!-- <item name="android:trackTint" tools:targetApi="m">@color/colorAccentSecondary</item>-->
<!-- <item name="android:thumb" >@drawable/bell_switcher</item>-->
<!-- <item name="android:thumbTint">@color/colorPrimaryDark</item>-->
</style>
<style name="Widget.Biganto.MaterialCardView" parent="Widget.MaterialComponents.CardView">
<item name="cardUseCompatPadding">false</item>
<item name="strokeColor">#1e000000</item>
<item name="strokeWidth">1dp</item>
<item name="cornerFamily">cut</item>
<item name="cornerSize">4dp</item>
</style> </style>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment