Skip to content
Contains demo projects for Android Assets transformation
Swift Java
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Anim_Android Uploaded complete Android project files Oct 15, 2019
Anim_iOS Anim demo Aug 23, 2019
Asset_Android Uploaded complete Android project files Oct 15, 2019
Asset_iOS Updated project files Aug 23, 2019
Vector_Android Uploaded complete Android project files Oct 15, 2019
Vector_iOS Added license info Aug 23, 2019
Visuals Optimized GIF Aug 26, 2019
LICENSE AssetDemo using RC Ver1 Aug 14, 2019
readme.md Formatting Aug 23, 2019

readme.md

ReflectCode

Automated Source Code Transformation service

Platform - Android | iOS Follow @reflectcode


ReflectCode Assets demo

This repository contains the Android and iOS source code for projets used to demonstrate the Assets Transformation service from RefelectCode.

Using this service the assets files in \Android\res are converted into asset catalog files for Xcode in \AssetDemo\Assets.xcassets folder.

  • Image assets from mdpi, hdpi, xhdpi and xxhdpi are mapped to 1x, 2x and 3x images
  • For .9.png files, slicing information is added for asset in catalog
  • Vector image xml are converted into .pdf files for use in Storyboard
  • Vector image xml are also transformed into Swift code and for each vector file a static method is added in VectorStore.swift

Files transformed

This sample project demonstrates conversion of following files -

  • .png
  • .9.png
  • color.xml
  • MipMap images
  • Vector xml
  • Shape xml
  • Anim xml

Dev Notes

File Type Location Usage
.png, .9.png, color and MipMap Asset Catalog In storyboard - Directly accessed in attribute inspector pane
In code - Use UIImage(named: "MyImage")
Vector / Shape xml Asset Catalog In storyboard - Directly accessed in attribute inspector pane
In code - Use UIImage(named: "MyImage")
Vector or Shape xml VectorStore.swift In code - Use imgView!.layer.addSublayer(VectorStore.ic_launcher_foreground(viewBounds: imgView!.bounds))
Anim xml RC_AnimationStore.swift In code - Use imgView?.layer.add( anim!, forKey: "bounse")

Statement Estimation

File Type Estimate
png or .jpg 5 stm for image + 10 stm for 'Contents.json'
9.png 5 stm for image + 20 for 'Contents.json' with slicing data
color.xml 10 stm for each color value ".colorset"
MipMap images 5 stm for each .jpg or .png
Shape xml PDF file : stm = count of "android:" attribute in source xml + 10 stm for 'Contents.json'
Vector xml PDF file : stm = count of "android:" attribute in source xml + 10 stm for 'Contents.json'
Swift code = LOC of Swift code generated for the file
Anim xml Swift code = LOC of Swift code generated for the file

Statement Estimation for few vector files from demo project

Estimate


Assets conversion - Screen shots

Screen shot of Android and iOS devices showing usage of various assets -

Screenshot


Android Studio layout editor.

XcodeEditor

Xcode Storyboard editor.

XcodeEditor


Android Studio image assets.

AndroidEditor

Xcode Asset Catalog showing mapping of 1x, 2x and 3x assets.

AssetCatalog


Android Studio .9.PNG image assets editor.

Android9PNG

Xcode AssetCatalog with slicing information extracted from .9.png file Estimation : 25 stm for each imageset in asset catalog.

AssetSlicing

Vector conversion - Screen shots

Screen shot of Android and iOS devices showing usage of various vector xml.

Vector-Screenshot-Portrait-1

Showing CAShapeLayer returned by func heart_vector() generated from heart_vector.xml android vector file

Vector-Screenshot-Portrait-2

UI with FingerPrint vector xml from material.io

Vector-Screenshot-Portrait-3

Shape xml file comparison

Vector-Screenshot-Portrait-4

Animation conversion - Screen shots

Screen shot of Android and iOS devices for animation demo project

Anim-Screenshot-Portrait-1

Android Screen Rec iOS Screen Rec
Anim-ScreenRec-Android Anim-ScreenRec-iOS

Note : the GIF files are not in sync, but animation in actual app are in sync and takes same duration


File locations

  1. Anim_Android contains the Android demo project for Animation
  2. Anim_iOS contains the iOS demo project for Animation
  3. Asset_Android contains the Android source demo project
  4. Asset_iOS contains the ported Xcode project
  5. Vector_Android contains Android demo project for vector xml
  6. Vector_iOS contains Xcode demo project for vector files
  7. Visuals contains images

License

This project is made available under the MIT license. See the LICENSE file for more details.

You can’t perform that action at this time.