Remove ripple effect from main buttons

This commit is contained in:
Ensar Sarajčić 2023-10-02 09:20:20 +02:00
parent 7937a71b0d
commit b61288407b
2 changed files with 29 additions and 187 deletions

View File

@ -3,6 +3,7 @@ package com.simplemobiletools.flashlight.screens
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
@ -102,7 +103,13 @@ internal fun MainScreen(
modifier = Modifier modifier = Modifier
.size(dimensionResource(id = R.dimen.main_button_size)) .size(dimensionResource(id = R.dimen.main_button_size))
.padding(vertical = dimensionResource(id = R.dimen.normal_margin)) .padding(vertical = dimensionResource(id = R.dimen.normal_margin))
.clickable(onClick = onFlashlightPress), .clickable(
indication = null,
interactionSource = remember {
MutableInteractionSource()
},
onClick = onFlashlightPress
),
painter = painterResource(id = R.drawable.ic_flashlight_vector), painter = painterResource(id = R.drawable.ic_flashlight_vector),
contentDescription = stringResource(id = R.string.flashlight_short), contentDescription = stringResource(id = R.string.flashlight_short),
tint = if (flashlightActive) MaterialTheme.colorScheme.primary else Color.Unspecified tint = if (flashlightActive) MaterialTheme.colorScheme.primary else Color.Unspecified
@ -113,7 +120,13 @@ internal fun MainScreen(
modifier = Modifier modifier = Modifier
.size(dimensionResource(id = R.dimen.smaller_button_size)) .size(dimensionResource(id = R.dimen.smaller_button_size))
.padding(vertical = dimensionResource(id = R.dimen.normal_margin)) .padding(vertical = dimensionResource(id = R.dimen.normal_margin))
.clickable(onClick = onBrightDisplayPress), .clickable(
indication = null,
interactionSource = remember {
MutableInteractionSource()
},
onClick = onBrightDisplayPress
),
painter = painterResource(id = R.drawable.ic_bright_display_vector), painter = painterResource(id = R.drawable.ic_bright_display_vector),
contentDescription = stringResource(id = R.string.bright_display) contentDescription = stringResource(id = R.string.bright_display)
) )
@ -123,7 +136,13 @@ internal fun MainScreen(
Text( Text(
modifier = Modifier modifier = Modifier
.padding(vertical = dimensionResource(id = R.dimen.normal_margin)) .padding(vertical = dimensionResource(id = R.dimen.normal_margin))
.clickable(onClick = onSosButtonPress), .clickable(
indication = null,
interactionSource = remember {
MutableInteractionSource()
},
onClick = onSosButtonPress
),
text = "SOS", text = "SOS",
fontSize = TextUnit(dimensionResource(id = R.dimen.sos_text_size).value, TextUnitType.Sp), fontSize = TextUnit(dimensionResource(id = R.dimen.sos_text_size).value, TextUnitType.Sp),
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
@ -136,7 +155,13 @@ internal fun MainScreen(
modifier = Modifier modifier = Modifier
.size(dimensionResource(id = R.dimen.smaller_button_size)) .size(dimensionResource(id = R.dimen.smaller_button_size))
.padding(vertical = dimensionResource(id = R.dimen.normal_margin)) .padding(vertical = dimensionResource(id = R.dimen.normal_margin))
.clickable(onClick = onStroboscopeButtonPress), .clickable(
indication = null,
interactionSource = remember {
MutableInteractionSource()
},
onClick = onStroboscopeButtonPress
),
painter = painterResource(id = R.drawable.ic_stroboscope_vector), painter = painterResource(id = R.drawable.ic_stroboscope_vector),
contentDescription = "", contentDescription = "",
tint = if (stroboscopeActive) MaterialTheme.colorScheme.primary else Color.Unspecified tint = if (stroboscopeActive) MaterialTheme.colorScheme.primary else Color.Unspecified

View File

@ -1,183 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:menu="@menu/menu"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
<androidx.core.widget.NestedScrollView
android:id="@+id/main_nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:fillViewport="true"
android:scrollbars="none">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/main_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/flashlight_btn"
android:layout_width="@dimen/main_button_size"
android:layout_height="@dimen/main_button_size"
android:layout_marginTop="@dimen/normal_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:background="@drawable/ic_flashlight_vector"
app:layout_constraintBottom_toTopOf="@+id/bright_display_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bright_display_btn"
android:layout_width="@dimen/smaller_button_size"
android:layout_height="@dimen/smaller_button_size"
android:layout_marginTop="@dimen/normal_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:background="@drawable/ic_bright_display_vector"
android:padding="@dimen/activity_margin"
app:layout_constraintBottom_toTopOf="@+id/sos_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/flashlight_btn" />
<TextView
android:id="@+id/sos_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/activity_margin"
android:text="SOS"
android:textSize="@dimen/sos_text_size"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/stroboscope_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bright_display_btn" />
<ImageView
android:id="@+id/stroboscope_btn"
android:layout_width="@dimen/smaller_button_size"
android:layout_height="@dimen/smaller_button_size"
android:layout_marginTop="@dimen/normal_margin"
android:background="@drawable/ic_stroboscope_vector"
android:padding="@dimen/activity_margin"
app:layout_constraintBottom_toTopOf="@+id/stroboscope_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sos_btn" />
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/stroboscope_bar"
android:layout_width="@dimen/seekbar_width"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"
android:paddingBottom="@dimen/medium_margin"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/stroboscope_btn" />
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/brightness_bar"
android:layout_width="@dimen/seekbar_width"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"
android:paddingBottom="@dimen/medium_margin"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/stroboscope_btn" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/sleep_timer_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/default_background_color"
android:clickable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible">
<ImageView
android:id="@+id/sleep_timer_divider_top"
android:layout_width="0dp"
android:layout_height="1px"
android:background="@color/divider_grey"
app:layout_constraintBottom_toTopOf="@+id/sleep_timer_stop"
app:layout_constraintEnd_toEndOf="@+id/sleep_timer_stop"
app:layout_constraintStart_toStartOf="@+id/sleep_timer_label" />
<ImageView
android:id="@+id/sleep_timer_divider_start"
android:layout_width="1px"
android:layout_height="0dp"
android:background="@color/divider_grey"
app:layout_constraintBottom_toBottomOf="@+id/sleep_timer_stop"
app:layout_constraintStart_toStartOf="@+id/sleep_timer_label"
app:layout_constraintTop_toTopOf="@+id/sleep_timer_stop" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/sleep_timer_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingStart="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:text="@string/sleep_timer"
android:textSize="@dimen/big_text_size"
app:layout_constraintBottom_toBottomOf="@+id/sleep_timer_stop"
app:layout_constraintEnd_toStartOf="@+id/sleep_timer_value"
app:layout_constraintTop_toTopOf="@+id/sleep_timer_stop" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/sleep_timer_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00"
android:textSize="@dimen/big_text_size"
app:layout_constraintBottom_toBottomOf="@+id/sleep_timer_stop"
app:layout_constraintEnd_toStartOf="@+id/sleep_timer_stop"
app:layout_constraintTop_toTopOf="@+id/sleep_timer_stop"
tools:ignore="HardcodedText" />
<ImageView
android:id="@+id/sleep_timer_stop"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:layout_marginStart="@dimen/tiny_margin"
android:layout_marginEnd="@dimen/tiny_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_cross_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>