Notes
Notes copied to clipboard
Read only feature
What is it?
- [ ] Bugfix
- [x] Feature
- [ ] Codebase improvement
Description of the changes in your PR
- Added read-only functionality which blocks a note if activated
- Adding a boolean to the class Note to to identify if readonly true or false
- Added read-only status check function in MainActivity and TextFragment
- Added 2 buttons for read only option
Before/After Screenshots/Screen Record
-
Before:
-
After:
https://github.com/user-attachments/assets/978aded2-edf1-42b3-830e-822c5b13b74f
Fixes the following issue(s)
- Fixes #69
Acknowledgement
- [x] I read the contribution guidelines.
@vbernier02 everything okay? :)
@vbernier02 everything okay? :)
Yes, just a little fix with the import
I don't know what to do about NotesDatabase.kt:90:59: This expression contains a magic number. Consider defining it as a well-named constant. [MagicNumber]. There was no error like this in my last pull request, and I haven't changed the file since
Hey, don't worry about it for now. Some checks are failing on master as well. I'll be soon updating the contribution guidelines regarding this.
Thanks for your feedback and the suggestions, I'll try to fix the issues when I have time.
Regarding the loss of the read-only state that’s strange. When I test it, the note retains its read-only state, so I'm not sure how to fix it
I also wanted your opinion on the read-only button icon. Currently, it shows the icon of the mode the note will switch to after clicking it.
Currently
Read-only disabled:
Read-only enabled:
Do you think it would be better if the button showed the current mode of the note instead ?
An about the workflow failures should I ignore them ?
When I test it, the note retains its read-only state, so I'm not sure how to fix it
Ok, I'll check that myself later during review. You may focus on points 2, 3, and 4
Currently, it shows the icon of the mode the note will switch to after clicking it.
This is the expected behavior. Icons in buttons represent the action that will be performed. Not the current state.
(Check this app for example)
An about the workflow failures should I ignore them ?
Yes, ignore detekt and android-lint.
I think this should fix the spell check and keyboard issue. I haven't looked at the undo button yet.
I think this should fix the spell check and keyboard issue
Yep, those seem to be fixed now :tada:
But it looks like your latest commit broke selection in read-only mode. Now I also get a crash on long press:
Process: org.fossify.notes, PID: 31839
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.Editor$SelectionModifierCursorController.getMinTouchOffset()' on a null object reference
at android.widget.Editor.touchPositionIsInSelection(Editor.java:1386)
at android.widget.Editor.performLongClick(Editor.java:1477)
at android.widget.TextView.performLongClick(TextView.java:13025)
at android.view.View.performLongClick(View.java:7656)
at android.view.View$CheckForLongPress.run(View.java:30144)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8503)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
But it looks like your latest commit broke selection in read-only mode. Now I also get a crash on long press:
I haven't been able to reproduce the crash but I think it has to do with the fact that I deleted some lines which during my last tests no longer seem to influence the code. So I think I was wrong.
I haven't been able to reproduce the crash but I think it has to do with the fact that I deleted some lines
Yes, that was it. No crashes now.
Nice, thank and sorry for making you test it once more. To debug, I use my phone or the Android Studio emulator, but I often feel like it keeps some old code during my tests like the crash you reported, which doesn’t happen on my side possibly. Do you know what might cause that ? Maybe a setting to change in Android Studio or a clear of data/cache ?
To debug, I use my phone or the Android Studio emulator, but I often feel like it keeps some old code during my tests like the crash you reported, which doesn’t happen on my side possibly. Do you know what might cause that ? Maybe a setting to change in Android Studio or a clear of data/cache ?
It's usually not the build, and some issues only manifest under specific conditions, but here are some options to get a clean slate:
- Android Studio ➜ Build ➜ Clean project (or run
./gradlew cleanin the terminal) - Clear data or uninstall the app. You can install ADB Idea plugin from the marketplace if you find yourself doing this often.
This pull request was automatically closed due to inactivity and/or lack of response from the author. If you have further updates or additional information, please comment or reopen the PR to continue.
Hey, still working on this? I'm happy to take it from here if you aren't free.
Hey, still working on this? I'm happy to take it from here if you aren't free.
Sorry, I've been pretty busy lately and probably will be for a while longer. No problem, you can continue the feature if you want.
Okay. Thanks for working on this!