markusfisch / ShaderEditor

Android app to create GLSL shaders and use them as live wallpaper
https://play.google.com/store/apps/details?id=de.markusfisch.android.shadereditor
MIT License
924 stars 137 forks source link

Long errors will get trimmed by Android #146

Closed Martysh12 closed 3 months ago

Martysh12 commented 1 year ago

Problem

Screenshot_20230711-151831_Shader Editor.png

Errors that are too long will get trimmed by Android.

Solution

I don't know if it's possible to change the maximum length of a toast in Android. If it isn't, I suggest replacing the error toasts with a small panel in the bottom of the editor that displays the latest error (just like Bonzomatic, but smaller).

Martysh12 commented 1 year ago

Screenshot_20230711-153658_Shader Editor.png

what is that 🫠

Looks like the OpenGL implementation on my phone doesn't like ternary operations with custom structs.

markusfisch commented 1 year ago

No, the Toast cannot be enlarged, unfortunately. From Toast redesign:

In Android 12, the toast view has been redesigned. Toasts are now limited to two lines of text and show the application icon next to the text.

A modern alternative would be a Bottom Sheet, I guess.

And about the missing error message: these come directly from the OpenGL driver on the phone, and yes, they can be very different or even completely missing 🤷‍♂️ Unfortunately, there's nothing the app can do about this. Apart from including a GLSL compiler/linter, which would be overkill, of course.

AntonPieper commented 1 year ago

Another alternative would be to make the top bar draggable and move the full error messages there. Then one can additionally keep the old behavior of creating a Toast for the first error.

Here is a recording of my (crude) shader-editor app I made a few years ago:

https://github.com/markusfisch/ShaderEditor/assets/94118572/c2a9690c-a204-4b48-a6f1-3e6f582c73bd

markusfisch commented 1 year ago

Yes, this would be another option, indeed!

My only concern would be that a user would have to know that he/she can pull down the top bar for more information 🤔

AntonPieper commented 1 year ago

That's also what I thought when creating this. I have rounded the bottom corners a bit to show that it is a bigger surface (because the top has no rounded corners), but adding another handle icon (like iphone X's bottom handle for navigation) could help UX as well. Also a Problems icon could conditionally show up that opens the problems section when pressed.

Problems Icon Material Symbols: ![Problems Symbol](https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/brightness_alert/default/48px.svg) Material Icons: ![Problems Icon](https://fonts.gstatic.com/s/i/materialiconsoutlined/report_problem/v18/24px.svg)
Martysh12 commented 1 year ago

It would be nice to have the errors show up without giving away the focus from the editor, so if you have a bunch of errors you don't have to jump between the error view and the editor.

AntonPieper commented 1 year ago

Well, if all four were to be implemented, would that solve this problem? Feel free to suggest improvements.

  1. A Toast appears for the first error
  2. All erroneous get the dark red background
  3. A panel to show all errors that when clicked move the cursor there
  4. An icon that conditionally shows up in the top bar when there are errors that shows how many errors there are. When clicked, it opens the error panel
Zabadam commented 11 months ago

Well, if all four were to be implemented, would that solve this problem? Feel free to suggest improvements.

This application sorely needs these updates.

A single error message, displayed via a temporary toast of finite length, is the worst possible solution for this scenario, at any rate.

This should be a high priority issue.

AntonPieper commented 7 months ago

@Zabadam I am sorry this is taking so long. This also is a high priority issue for me and I want to work on this👍 However to truly implement this the way I envision this to work, I first need the space on the top bar. That is why I redesigned the menu (#173) (to potentially add custom widgets in there) and why I'll first implement the shortcut bar (#175) to move the tab icon away from this menu. Then there is enough space to add a "show errors" icon😉 Because I have already implemented a similar (yet still prototype) feature for my own shader editor for learning purposes, the rest will be fairly easy.

So having said all this, I am finally getting to work on this and you can hopefully expect this feature in the coming month🤞

Zabadam commented 7 months ago

@AntonPieper That's great to hear! Reading back, I came off as harsh. Truthfully I wish I could contribute. Good luck and thank you.

markusfisch commented 7 months ago

@AntonPieper That would be awesome! 👍

And sorry that I currently don't have the time to bring the app much further. I really do appreciate your excellent work on it!

AntonPieper commented 4 months ago

In case you guys are wondering what is taking so long:

My prototype used a third-party dependency for the top sheet behavior (and also a coordinator layout for the main layout), which is something I don't really want to use here. There really seems to be no maintained version of the BottomSheetBehavior "mod". Also, refactoring the layout to use a coordinator layout has its quirks as well.

I am reconsidering how I should implement this. Maybe even a simple bottom sheet behavior for the errors could maybe work (would only be accessible by clicking on some icon in the toolbar) together with a snack bar with a go to error action.

What do you guys think of this?

markusfisch commented 4 months ago

@AntonPieper I think a Snackbar with a button (that shows the full error message) might be a good solution.

Thinking about this, I couldn't stop myself from implementing it so there is this commit now 😉