File injection tool for Android developers using MotionLayout. Use scenemerge to reuse ConstraintSet/KeyFrameSet/etc definitions in multiple MotionScenes via a templating system.
Project description
scenemerge
File injection tool to allow reuse of ConstraintSet/KeyFrameSet/etc definitions in multiple MotionScenes.
Installation
pip install motionscene-merger
or
git clone https://github.com/motionscene-merger
python setup.py install
Then run with:
scenemerge .
Creating merge instructions
In your Android project res/xml directory:
- Create a MotionScene file with content that you want to inject into some other file. The filename must start with
_e.g.res/xml/_my_injectable_motionscene.xml - Create a template for your parent MotionScene. Again, the filename must start with
_e.g.res/xml/_my_parent_motionscene.xml-
add a line in this file with
<inject src="source_filename"/>e.g:<?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto"> <!-- Any other content here --> <inject src="my_injectable_motionscene"/> <!-- Any other content here --> </MotionScene>
-
Now when you run scenemerge the content from the MotionScene in _my_injectable_motionscene.xml will be copied in place into a new MotionScene file called my_parent_motionscene.xml in your res/xml directory. The <MotionScene...></MotionScene> tags will not be copied - only the content between them.
Please check the files in test/example_root_dir/res/inject for example source files.
Android Studio File Watcher
- Install the
File Watcherplugin for Android Studio viaSettings -> Plugins. - Restart and open
Settings -> Tools -> File Watchers, then click the+to create a new Watcher. - Set
File typeto XML. - Create a Scope with a pattern like
file[app]:src/**/res/xml/_*.xml - Set
Programtoscenemergein your environment. e.g. env/Scripts/scenemerge - Set
Argumentsto. - Set
Working directoryto your app root. OK
Now scenemerge should run automatically whenever you edit a res/xml/_YOUR_FILENAME.xml file,
creating/updating the merged MotionScene file res/xml/YOUR_FILENAME.xml.
This project was written on a Sunday evening. It is unlikely to have any major updates but feel free to make pull requests or whatever. Hopefully MotionScene will someday have some kind built-in include/merge functionality and make this obsolete but this will have to do for now...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file motionscene-merger-2.4.1.tar.gz.
File metadata
- Download URL: motionscene-merger-2.4.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16993182f55a40e5c52cd476d0c9f7ed7af4ce47a48a1a230273cb0dae278c33
|
|
| MD5 |
1e57dff6aced0f07e0448cd8c58d067e
|
|
| BLAKE2b-256 |
633b33127e8bef1f339ed77415d6f2992354cba52c7ea774c9839eccd428f81c
|
File details
Details for the file motionscene_merger-2.4.1-py3-none-any.whl.
File metadata
- Download URL: motionscene_merger-2.4.1-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04224cfcff5a7f7744318304c5566cb6a300dfd3ad6f4de0ff137844eaf675ea
|
|
| MD5 |
872981d16e4b459fbfa42609698c5345
|
|
| BLAKE2b-256 |
08a07f9d3821a29b64670bcef4e04bd1fee4f34a9f7c59edc0fbfd748279211b
|