Skip to content

Commit

Permalink
Merge pull request #94 from aashishksahu/bug-fix
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
aashishksahu authored Sep 28, 2024
2 parents c65b10d + f48fb9c commit fa39916
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {

minSdk 29
targetSdk 34
versionCode 36
versionName "2.0.5"
versionCode 37
versionName "2.0.6"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class MainActivityViewModel(private val application: Application) : AndroidViewM
ops.deleteFile(item)
}
}
clearSelection()
getItems()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class BottomAppBar(private val activity: MainnActivity) {
private val createFolderShowDialog = mutableStateOf(false)
private val createNoteShowDialog = mutableStateOf(false)
private val renameShowDialog = mutableStateOf(false)
private val namePattern = Regex("[~`!@#\$%^&*()+=|\\\\:;\"'>?/<,\\[\\]{}]")
private var name: String = ""

@Composable
Expand Down Expand Up @@ -137,8 +138,8 @@ class BottomAppBar(private val activity: MainnActivity) {
)
if (showDialog.value) {
Prompt(
onConfirmation = {
if (name.isNotEmpty()) {
onConfirmation = { isValid ->
if (name.isNotEmpty() && isValid) {
try {
activity.viewModel.createFolder(name)
} catch (e: Exception) {
Expand Down Expand Up @@ -183,8 +184,8 @@ class BottomAppBar(private val activity: MainnActivity) {
)
if (showDialog.value) {
Prompt(
onConfirmation = {
if (name.isNotEmpty()) {
onConfirmation = { isValid ->
if (name.isNotEmpty() && isValid) {
val noteFile = activity.viewModel.createTextNote(name)
val documentViewIntent = Intent(
activity.application, TextDocumentView::class.java
Expand Down Expand Up @@ -294,8 +295,8 @@ class BottomAppBar(private val activity: MainnActivity) {
)
if (showDialog.value) {
Prompt(
onConfirmation = {
if (name.isNotEmpty()) {
onConfirmation = { isValid ->
if (name.isNotEmpty() && isValid) {

if (!activity.viewModel.renameFile(name)) {
showMessage(activity.getString(R.string.generic_error))
Expand Down Expand Up @@ -525,11 +526,13 @@ class BottomAppBar(private val activity: MainnActivity) {

@Composable
fun Prompt(
onConfirmation: () -> Unit, onDismiss: () -> Unit, dialogTitle: String, okBtnText: String
onConfirmation: (Boolean) -> Unit,
onDismiss: () -> Unit,
dialogTitle: String,
okBtnText: String
) {
val textFieldContent = remember { mutableStateOf(TextFieldValue(name)) }
val isValid = remember { mutableStateOf(true) }
val namePattern = Regex("[~`!@#\$%^&*()+=|\\\\:;\"'>?/<,\\[\\]{}]")

AlertDialog(title = {
Text(text = dialogTitle)
Expand Down Expand Up @@ -573,7 +576,7 @@ class BottomAppBar(private val activity: MainnActivity) {
onDismiss()
textFieldContent.value = TextFieldValue("")
}, confirmButton = {
TextButton(onClick = { onConfirmation() }) {
TextButton(onClick = { onConfirmation(isValid.value) }) {
Text(text = okBtnText)
}
})
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.5.2' apply false
id 'com.android.library' version '8.5.2' apply false
id 'com.android.application' version '8.6.0' apply false
id 'com.android.library' version '8.6.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
}
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/37.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fixed an issue where files were created with special characters
* fixed selection counter

0 comments on commit fa39916

Please sign in to comment.