Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#21: The app becomes unusable if user closes folder selection dialog #32

Merged
merged 10 commits into from
Jan 11, 2024

Conversation

shubertm
Copy link
Member

@shubertm shubertm commented Dec 5, 2023

Comment on lines 22 to 24
val activity = (requireActivity() as MainActivity)
if (activity.memoPreferences.getPathString() == null) activity.finish()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming FilePickerDialog might probably be used in other activity in the future, rather than MainActivity, this casting will cause a crash.
What do you think about below?

Suggested change
val activity = (requireActivity() as MainActivity)
if (activity.memoPreferences.getPathString() == null) activity.finish()
}
val activity = (activity as? MainActivity)
if (activity?.memoPreferences?.getPathString() == null) activity?.finish()
}

fun show() {
ArkFilePickerFragment.newInstance(getFilePickerConfig()).show(fragmentManager!!, TAG)
newInstance(getFilePickerConfig()).show(fragmentManager!!, TAG)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
newInstance(getFilePickerConfig()).show(fragmentManager!!, TAG)
fragmentManager?.let { newInstance(getFilePickerConfig()).show(it, TAG) }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think fragmentManager can not really be null here. We can just make it non-nullable

@kirillt
Copy link
Member

kirillt commented Jan 2, 2024

Doesn't look fixed:

bug.mp4

It's possible to close the app and start it again, but it works the same way in other branches.

The best would be to disable touching outside the filepicker.

hieuwu and others added 6 commits January 8, 2024 15:51
* SVG generating
* Fix gradle build and deprecated APIs
* Move local texts to string resource file
* Add extended fab
* Generalize file listing function
* Fix extra line feed in text content

Co-authored-by: Tuan Nguyen <tuancoltech@gmail.com>
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.8.9 to 2.10.1.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/main/CHANGELOG.md)
- [Commits](google/gson@gson-parent-2.8.9...gson-parent-2.10.1)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Copy link
Member

@kirillt kirillt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works 👍

@shubertm
Copy link
Member Author

Cool

# Conflicts:
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/activities/MainActivity.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/dialogs/FilePickerDialog.kt
@shubertm shubertm merged commit b4d3d2b into main Jan 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants