Testing new skins on Android

317 views
Skip to first unread message

Hans J Albertsson

unread,
Nov 9, 2023, 6:13:33 AM11/9/23
to Free42 & Plus42
Is it possible to design a new skin or tweak an existing one, and then test it directly on one's Android 14 phone?

Thomas Okken

unread,
Nov 10, 2023, 5:42:52 AM11/10/23
to Free42 & Plus42
Yes, that is possible, but the tricky part is getting the skin files into a directory where the app can see them. Take a look at https://thomasokken.com/free42/#android-files ; does that help?

Hans J Albertsson

unread,
Nov 13, 2023, 12:54:12 PM11/13/23
to Free42 & Plus42
No, it doesn't seem to help.
I suppose the goal is to place the skin file pair In the private "files" directory?
I've tried putting a skin file pair in the android clip board and clicking Paste in Plus42.

I also tried starting with Skin: Other and tried to step into the Download folder, but Plus42 couldn't see the layout file. The gif was visible and could be selected but couldn't be "installed".
I think, judging from other apps and some Developer docs, that an app can request "all files access" and then the user can grant access to everything except the various sandboxes of Android. 
There are lots of apps that can manipulate files in the Download folder and put that data in their private sandboxes.

Thomas Okken

unread,
Nov 13, 2023, 5:21:52 PM11/13/23
to Free42 & Plus42
Free42 and Plus42 request WRITE_EXTERNAL_STORAGE in their manifests, but that appears to come with that annoying restriction that it will only show you files of certain types. I don't know how to get access to all files. If there is something I missed, I'll be happy to fix it, if someone can point me in the right direction -- the last time I looked into this was a few years ago, and after banging my head into the wall enough times, I threw up my hands in disgust and gave up.

MickM

unread,
Nov 13, 2023, 5:39:23 PM11/13/23
to Free42 & Plus42
I wonder if ZIP is a type that is allowed? I really like that I can import a zip file (containing the gif and layout files) into Free42 on iOS, using the http server method, and it just knows to automatically unpack it at the destination. Hmmm, I should say I only think it's Free42 doing the unpacking - maybe that's wrong...

Thomas Okken

unread,
Nov 13, 2023, 7:15:13 PM11/13/23
to Free42 & Plus42
When you're uploading a zip file with the built-in HTTP server in the iOS version, then yes, it is the app that does the unpacking.

Adding logic to allow selecting and automatically unpacking zip files with Skin: Other in the Android version would be a possibility, but of course there wouldn't be any point if the app can't see zip files in the download directory either. Can people confirm? The more the merrier, since I don't trust all Android >= 11 devices to behave the same. Just download any old zip file using the browser, and then go to Free42 or Plus42, and try Main Menu -> Skin: Other, navigate to the download directory, and set the file type selector to "*", and see if the zip file is visible.

MickM

unread,
Nov 13, 2023, 7:58:12 PM11/13/23
to Free42 & Plus42

Or, and this is a shameless plug, you could try loading this skin which is contained in a zip file :-)
Mueck_1072.zip

Hans J Albertsson

unread,
Nov 14, 2023, 4:58:23 AM11/14/23
to Free42 & Plus42
No, the zip file wasn't visible.

However, I have the calculator app emu42 that seems to be able to read and write any file type I Downloads.
Maybe you can learn from the author of that app?

Hans J Albertsson

unread,
Nov 14, 2023, 5:08:39 AM11/14/23
to Free42 & Plus42
This link seems interesting:

But I am not an accomplished android app writer.

Thomas Okken

unread,
Nov 14, 2023, 9:04:50 AM11/14/23
to Free42 & Plus42
I'll look into it after I release 3.1 and 1.1. I already have a list of UI improvements to work on, so this will fit right in. Here's hoping I can make it work this time. 🤞

Hans J Albertsson

unread,
Nov 15, 2023, 3:37:23 AM11/15/23
to Free42 & Plus42
👍

Hans J Albertsson

unread,
Dec 8, 2023, 2:40:35 AM12/8/23
to Free42 & Plus42
Thomas, have you found the time to investigate the file access issues on Android yet?

Thomas Okken

unread,
Dec 8, 2023, 3:06:19 AM12/8/23
to Free42 & Plus42
Not yet!

I currently have two bugs to deal with: a startup crash in Plus42 >= 1.1 affecting some users of the MacOS and iOS versions, and a remote pasting glitch in iOS.

Once I get back to doing actual development, the Android file access issue is at the top of my list.
Message has been deleted

Thomas Okken

unread,
Dec 19, 2023, 9:01:28 PM12/19/23
to Free42 & Plus42
Hans, have you tried the new functionality in 3.1.2b yet? You should be able to get skins from the Download directory into Free42's private storage now, using File Import & Export. If you import the gif and layout to <home>, the skin should appear in the Select Skin list.

Hans J Albertsson

unread,
Dec 20, 2023, 9:44:22 AM12/20/23
to Free42 & Plus42
I haven't tried that yet, and I'm on Plus42... :-)
Your note said raw and states, so I didn't think to look further. I will try!

Hans J Albertsson

unread,
Dec 20, 2023, 10:02:08 AM12/20/23
to Free42 & Plus42
Your method seems to work. I'll try modifying a skin and see if it works.
Is the UI you get for selecting files your work too?
It seems not to allow selecting more than one file at once.

Thomas Okken

unread,
Dec 20, 2023, 11:05:37 AM12/20/23
to Free42 & Plus42
That's an Android thing. Not my work. I disclaim all responsibility.

Hans J Albertsson

unread,
Dec 20, 2023, 12:18:23 PM12/20/23
to Free42 & Plus42
I suppose there might be some config thing for selecting multiple vs single file(s).
But it seems to work for the immediate purpose, and probably won't be used enough to warrant much work.

Thomas Okken

unread,
Dec 20, 2023, 4:41:56 PM12/20/23
to Free42 & Plus42
Yes, exactly. I agree that it would be nice if you could import or export multiple files at once, but the Android API I'm using here doesn't appear to support that, and the important thing at this moment is to be able to import and export files at all. If I can find a way to make this functionality nicer, maybe I'll add it in a future release.

Hans J Albertsson

unread,
Jan 1, 2024, 4:36:46 AMJan 1
to Free42 & Plus42

I can't seem to find a description of how to produce the gif for a new skin.
I think I understand some of it, but I would like to be sure.

Thomas Okken

unread,
Jan 1, 2024, 5:49:12 AMJan 1
to Free42 & Plus42
I'll be happy to help, but I'm not sure what the question is.

Hans J Albertsson

unread,
Jan 1, 2024, 7:10:27 AMJan 1
to Free42 & Plus42
Your reaction indicates that I must have missed or misunderstood something in connection to how a skin's layout and gif work together.
I was probably confused by looking at skins that seemed very regular except for a few "extra button/anunciator images".

Thomas Okken

unread,
Jan 1, 2024, 9:02:19 AMJan 1
to Free42 & Plus42
My reaction was meant to indicate that I don't know what aspect of skin creation you are having trouble with. I cannot read your mind.

Hans J Albertsson

unread,
Jan 2, 2024, 4:31:12 AMJan 2
to Free42 & Plus42
Ok, I'll try to clarify.
For starters, I wouldn't know what tool to use for making the gif of a skin. So a suggestion for that would be appreciated.
I'll now take a closer look at some gif/layout file pairs and see if I can relate the parts of one file to their counterparts in the other file. And ask if I can't decipher stuff on my own.
I think I can see some regularity in the placement of key images for the pressed vs the unpressed state.

Thomas Okken

unread,
Jan 2, 2024, 11:55:08 AMJan 2
to Free42 & Plus42
I used Microsoft Paint to create the Standard and Realistic skin images for Free42. For the built-in skins for Plus42, I used GIMP.
Microsoft Paint doesn't do a very good job of exporting GIF images, or at least, it didn't when I was using it -- maybe it's better now. I would save the images as BMP files, and then use other tools to do the BMP-to-GIF conversion, specifically, the Netpbm tool set. With GIMP, I used a similar approach, saving the images as PNG and then using Netpbm to do the scaling and conversion to GIF.

As far as the layout files are concerned, be sure to read the layout format documentation carefully. You can find it in skins/README.txt in the Free42 and Plus42 source repositories on GitHub, and in the skin collections in my web site:


The key images for the pressed state can be basically anywhere in the skin image. For skins where the pressed state simply moves the key a couple of pixels, there aren't even separate images. And the annunciators can be basically anywhere as well.

When designing skins for Plus42, there are a few additional wrinkles, but basically any skin that works with Free42 will work with Plus42 as well. The additional layout elements specific to Plus42 deal with the way the display area is expanded, and with the way the +/-, E, R/S, and period keys are rendered differently when the equation editor is active.

One final point: while the Skin: element in the layout lets you specify x,y,width,height coordinates for the section of the gif that is used to paint the main window, you should always use 0,0 for x,y. There aren't any skins that place this rectangle anywhere other than the top left corner, and the skin display logic doesn't really support that. This could be fixed, but there was never an urgent reason to, so this bug is basically as old as Free42 itself.

Hans J Albertsson

unread,
Jan 7, 2024, 1:46:22 PMJan 7
to Free42 & Plus42
After reading and thinking, and repeating that twice, I realized you probably had answered my question.
I'll try my hand at modifying and testing, and get back to you if I can't make it work!
One question though: can you easily make any key on the skin execute any function at all?

Thomas Okken

unread,
Jan 7, 2024, 2:52:42 PMJan 7
to Free42 & Plus42
One question though: can you easily make any key on the skin execute any function at all?

Yes, using "direct command mapping."
For example, this is how the standard Plus42 skin maps the VIEW and SST↑ functions to the VIEW key:

Key: 46,47 211,189,51,53 216,203,41,31 527,203
Macro: 46 "VIEW"
Macro: 47 "SST^"
Reply all
Reply to author
Forward
0 new messages