Skip to content

Commit

Permalink
Added simple calculator for image dimensions by #1581
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Jan 10, 2025
1 parent 5142459 commit 009a22d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -37,6 +38,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Calculate
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -48,6 +50,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.github.keelar.exprk.Expressions
import ru.tech.imageresizershrinker.core.domain.image.model.ImageFormat
Expand Down Expand Up @@ -247,6 +250,25 @@ internal fun ResizeImageFieldImpl(
) {
Text(stringResource(R.string.close))
}
},
text = {
OutlinedTextField(
shape = RoundedCornerShape(16.dp),
value = calculatorExpression,
textStyle = MaterialTheme.typography.titleMedium.copy(textAlign = TextAlign.Center),
maxLines = 1,
placeholder = {
Text(
text = "(5+5)*10",
style = MaterialTheme.typography.titleMedium.copy(textAlign = TextAlign.Center),
modifier = Modifier.fillMaxWidth(),
color = MaterialTheme.colorScheme.outline
)
},
onValueChange = { expr ->
calculatorExpression = expr.replace(",", ".").filter { !it.isWhitespace() }
}
)
}
)
}
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trickle = "1.2.2"
avifCoder = "2.0.10"
avifCoderCoil = "2.0.10"
aire = "0.15.6"
jxlCoder = "2.4.0.5"
jxlCoder = "2.4.0.6"
jxlCoderCoil = "2.4.0.6"
jpegliCoder = "1.0.1"

Expand All @@ -25,7 +25,7 @@ materialIconsExtended = "1.7.6"
androidx-datastorePreferencesAndroid = "1.1.1"
appUpdateKtx = "2.1.0"
appUpdate = "2.1.0"
shadowGadgets = "2.3.0"
shadowGadgets = "2.3.1"
fadingEdges = "1.0.4"
firebaseCrashlyticsKtx = "19.3.0"
konfettiCompose = "2.0.5"
Expand All @@ -40,8 +40,8 @@ detektCompose = "0.4.22"
decompose = "3.2.2"

kotlin = "2.1.0"
agp = "8.7.3"
hilt = "2.54"
agp = "8.8.0"
hilt = "2.55"
gms = "4.4.2"

ktor = "3.0.3"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.apache.org/licenses/LICENSE-2.0>.
#
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 009a22d

Please sign in to comment.