Skip to content

Adding a selection dialog #21

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

Open
C-512L opened this issue Aug 23, 2024 · 3 comments
Open

Adding a selection dialog #21

C-512L opened this issue Aug 23, 2024 · 3 comments

Comments

@C-512L
Copy link

C-512L commented Aug 23, 2024

I am writting a Multi-ISO boot script and one thing I found missing is the ability to call from lua to open a selection dialog with options passed by lua. The code i conceptualize in lua could look something like this:

...
-- a, b and c would be an integer representing the selected option in the array or nil
local a,b,c = select {
  message = "Please select an option",
    -- maybe throw an error if it is empty?
  select_opts = { 
     [1] = "A Text",
     [2] = "B Text",
     [3] = "C Text".
  },
  multiple = true -- false by default
}
...
-- Possible code used later on
luausb.create({
  type = "storage"
  file = boot_entries[a].path
})

I have dived into the Java/Kotlin side of the code a little so If I have spare time, I might even try to make a PR implementing it.

@Netdex
Copy link
Owner

Netdex commented Aug 24, 2024

That looks like a reasonable addition to me, if you're interested in implementing this feel free to submit a PR. Otherwise, I could implement it myself.

@C-512L
Copy link
Author

C-512L commented Aug 24, 2024

That looks like a reasonable addition to me, if you're interested in implementing this feel free to submit a PR. Otherwise, I could implement it myself.

I see the project uses both Kotlin and Java in a lot of places. Are there any contributing guidelines for the project on whether certain functionality should be written on Java or Kotlin?

@Netdex
Copy link
Owner

Netdex commented Aug 24, 2024

The Kotlin is a fairly recent addition, in general I have been writing new code in Kotlin and slowly rewriting the Java into Kotlin. The exception is classes which are directly exposed to the lua interface using CoerceJavaToLua, because LuaJ doesn't support Kotlin. These classes are contained under org.netdex.androidusbscript.lua and have a special Proguard rule to avoid scrambling names.

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

No branches or pull requests

2 participants