python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

Adds an option to allow add resources to Android res/ directory

Open DexerBR opened this issue 3 years ago • 0 comments

Related to kivy/buildozer#1428

Reference: https://developer.android.com/guide/topics/resources/providing-resources

PRs it can cover (at least partially) : #2330 #2200 #1922 #2299 #2570 #2322

Maybe related issues: #1964 #2298 #2614

Important notes:

  • It is important that the user defined resource folder follows the file structure of the Android documentation linked above.
  • If not followed, p4a will perform the copy/overwrite, according to the documentation:
    • Only folders will be copied to res/ directory.
    • Only files will be copied to each of the folders (existing or to be created) in the res/ directory.

Copy/overwrite process steps:

  • Clean android resources directory (res)
  • Create default/required p4a res directories (I believe this still needs to be defined)
    • Current default res directories:

      • drawable
      • drawable-mdpi
      • drawable-hdpi
      • drawable-xhdpi
      • drawable-xxhdpi
      • layout
      • mipmap
      • mipmap-anydpi-v26
      • values
      • xml
    • Currently in p4a, some of these directories are required by later code, but the directory is not created if it doesn't exist.

    • I'm not sure if they all need to stay or if it would be nice to include others by default (Although they are not needed by p4a at the moment).

  • Copy default/required p4a files (currently, many of them are copied on demand along the code. It might be interesting to keep this in one place).
  • Finally, copy directories and files (overwrite where applicable) according to user defined folder (via add-res argument) in res folder.

❗Note: Later arguments that change files in the resource folder, such as icon_fg, icon_bg, may override the add-res argument, if the user decides to put an icon in the "custom resource folder", and then pass another file to the icon_fg argument, for example. Changes in this behavior may also need to be evaluated.

Some things need tweaking, but overall, the templating process needs an update.

DexerBR avatar Apr 18 '22 01:04 DexerBR