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

Bug: FreePaint requires you to open the settings menu before strokes can be seen [1.0.1, 1.0] #1

Closed
pastthepixels opened this issue Aug 16, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@pastthepixels
Copy link
Owner

Device: Pixel 6
Android version: GrapheneOS, Android 13

Background:

This is something I noticed after adding FreePaint to F-Droid (aargh!). It's something I didn't notice during testing of 1.0, and since I barely changed anything in the codebase between 1.0 and 1.0.1 it might be an error introduced by Android/GrapheneOS. Still worth looking into.

I don't want to release a fix right as soon as the app got on F-Droid, but I believe this is still quite critical, especially for new users who may think the program will never work.

What's happening:

When you open the app for the first time, you can draw paths. They just won't be visible! Save your "invisible" drawing as a .svg and open it, and you'll find you have drawn paths with the regular settings. Once you start the app and open the settings menu, even if you don't change any settings, you will draw paths with the default settings again. This fix will persist across app restarts.

My best guess is that when you're opening the app for the first time, you have no settings config stored and FreePaint looks for the default settings when calls are made to load settings (argument 2 of the function to read settings, in Java). However, something is bugging out which is setting all default settings to some kind of null value. When you open the settings menu, Android (could be) updating your settings based on the default values in preferences.xml.

@pastthepixels pastthepixels added the bug Something isn't working label Aug 16, 2023
@pastthepixels pastthepixels self-assigned this Aug 16, 2023
@pastthepixels pastthepixels changed the title Bug: FreePaint requires you to open the settings menu before strokes can be seen [1.0.1, 1.0?] Bug: FreePaint requires you to open the settings menu before strokes can be seen [1.0.1, 1.0] Aug 17, 2023
@pastthepixels
Copy link
Owner Author

Confirmed to be an error on 1.0 as well, and on confirmed to be on another device. This is especially strange because when I first tested FreePaint (1.0), everything seemed to be working fine. I'll take a look into this and see if I can get it fixed as soon as possible.

@HarriBuh
Copy link

I've got the same issue.

@pastthepixels
Copy link
Owner Author

Update: found the issue. I have a bit of code that checks to see what the preference is for strokes/fills, and if there isn't any, it assumes you deleted that preference (set to "No color") and makes the stroke/fill transparent. I would set default values in preferences.xml, which was to be loaded when the program began.

HOWEVER, it just never loaded until the preferences fragment was created, which only happened once it was opened. A quick fix -- which should also give a bit of a performance bump -- is to just put creating the PreferencesFragment in MainActivity instead of every time the modal dialog is opened.

@pastthepixels
Copy link
Owner Author

Wow, I didn't expect my commit to actually close this issue, that's pretty cool. Anyway, I pushed a fix to the main branch, and since this is a pretty important bug I'll release v1.0.2 as soon as possible.

@pastthepixels pastthepixels reopened this Aug 17, 2023
@pastthepixels
Copy link
Owner Author

REOPENINING. Sorry for writing a lot of comments, I'm just frantically trying to fix this as fast as possible. Anyway, ANDROID.

Apparently you can only set default preferences in an INITIALIZED PreferencesFragment, which can only happen if the ModalBottomDialog is initialized, but the way those dialogs are programmed, they can only be initialized when they are shown. AARGH!

This might lead to me moving the settings menu to a different screen. It will fix this issue, but unfortunately it will be a bit inconvenient to switch to another screen just to change a stroke size. But that's all I can do because... Android!

@pastthepixels
Copy link
Owner Author

Alright. Last update. (I swear!)

As always, with Android, I'm searching and searching for this thing I think is impossible, no search results come up that actually help me, and then, suddenly, some random StackOverflow post "just works". I have no idea why; nobody else ever talked about the thing the StackOverflow post did. But it works. For some reason.

I've tested it and I can finally close this issue. Developing Android apps is a pain, but thank you so, so much to those who starred this repo. It just shows that someone cares, and it makes me want to keep going through this to make a cool drawing app.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants