(the "table of contents" shows up automatically when there are enough sections; formatting) |
(Bundle description) |
||
Line 16: | Line 16: | ||
== How to make a template bundle == | == How to make a template bundle == | ||
'' | These bundles contain information about how a switch glyph (the image that the user sees for a given switch) is rendered when it is used in a button returned by the appropriate method of the FlipSwitch panel. Bundles contain an <code>Info.plist</code> file and optionally image files. Here is an example of an <code>Info.plist</code>, taken from [https://github.com/rpetrich/SwitchIcons/blob/master/layout/Library/Application%20Support/SwitchIcons/IconTemplate.bundle/Info.plist SwitchIcons]: | ||
<source lang="xml"> | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>CFBundleDevelopmentRegion</key> | |||
<string>English</string> | |||
<key>CFBundleIdentifier</key> | |||
<string>com.rpetrich.switchicon.icon-template</string> | |||
<key>CFBundleInfoDictionaryVersion</key> | |||
<string>6.0</string> | |||
<key>CFBundlePackageType</key> | |||
<string>BNDL</string> | |||
<key>CFBundleShortVersionString</key> | |||
<string>1.0.0</string> | |||
<key>CFBundleSignature</key> | |||
<string>????</string> | |||
<key>CFBundleVersion</key> | |||
<string>1.0</string> | |||
<key>DTPlatformName</key> | |||
<string>iphoneos</string> | |||
<key>MinimumOSVersion</key> | |||
<string>2.0</string> | |||
<key>width</key> | |||
<integer>59</integer> | |||
<key>height</key> | |||
<integer>60</integer> | |||
<key>layers</key> | |||
<array> | |||
<...> | |||
</array> | |||
</dict> | |||
</plist> | |||
</source> | |||
Keys not specified in the following table can use the same values as the example given. | |||
{| class="wikitable" | |||
|- | |||
! key !! colspan="2" | type !! meaning | |||
|- | |||
| CFBundleIdentifier || colspan="2" | string || Template bundle identifier. | |||
|- | |||
| width || colspan="2" | integer || Width of the icon. | |||
|- | |||
| height || colspan="2" | integer || Height of the icon. | |||
|- | |||
| layers || array || ... of dictionaries || Change visuals of switch glyph. | |||
|} | |||
<code>Layers</code> array can contain dictionaries with the following keys: | |||
{| class="wikitable" | |||
|- | |||
! key !! type !! meaning !! range of values !! default value !! depends | |||
|- | |||
| type || string || Layer type. || "image", "glyph" || - || - | |||
|- | |||
| opacity || float || Alpha value for current layer. || 0.0 to 1.0 || 1.0 || - | |||
|- | |||
| x || float || X value for offset position. || - || 0.0 || - | |||
|- | |||
| y || float || Y value for offset position. || - || 0.0 || - | |||
|- | |||
| fileName || string || Image filename without extension. || - || - || - | |||
|- | |||
| blur || float || Blur value for current layer. || 0.0 to 1.0 || 0.0 || ''type'' = "glyph" | |||
|- | |||
| size || float || Glyph size. || - || 0 || ''type'' = "glyph" | |||
|- | |||
| state || string || Switch state filter. || "on", "off", "indeterminate" || - || ''type'' = "glyph" | |||
|- | |||
| cutout || BOOL || Cutout mask flag. || - || NO || ''type'' = "glyph" | |||
|- | |||
| cutoutX || float || X offset for cutout mask. || - || 0.0 || ''type'' = "glyph" && ''cutout'' = YES | |||
|- | |||
| cutoutY || float || Y offset for cutout mask. || - || 0.0 || ''type'' = "glyph" && ''cutout'' = YES | |||
|- | |||
| cutoutBlur || float || Blur for cutout mask. || 0.0 to 1.0 || 0.0 || ''type'' = "glyph" && ''cutout'' = YES | |||
|- | |||
| color || string || Hex color for current layer. || "#000000" to "#ffffff" || "#000000" || ''type'' = "glyph" && ''filename'' = nil | |||
|} | |||
''For more information, see [https://github.com/a3tweaks/Flipswitch/blob/master/FSSwitchPanel.m#L307 here]'' | |||
== External links == | == External links == | ||
* [https://github.com/a3tweaks/Flipswitch Flipswitch source code] | * [https://github.com/a3tweaks/Flipswitch Flipswitch source code] | ||
* [https://github.com/rpetrich/SwitchIcons On-SpringBoard example usage, SwitchIcons] | |||
[[Category:Cydia packages]] | [[Category:Cydia packages]] |
Revision as of 05:05, 11 January 2014
Flipswitch | |
Cydia Package | |
---|---|
Developer | Ryan Petrich, Jack Willis |
Package ID | libflipswitch |
Latest Version | 1.0.2 |
libflipswitch is a library used to implement a centralized toggle system.
How to make a new switch
Save this NIC template to the $THEOS/templates/iphone
directory and call $THEOS/bin/nic.pl
to get a premade switch.
Add instructions about writing code.
Secondary action
In the file Resources/Info.plist
you can find the key "alternate-action-url", which will enable you to open a URI when the secondary action of the switch is invoked, in case it is not implemented in code. The default value is "prefs:".
How to make a template bundle
These bundles contain information about how a switch glyph (the image that the user sees for a given switch) is rendered when it is used in a button returned by the appropriate method of the FlipSwitch panel. Bundles contain an Info.plist
file and optionally image files. Here is an example of an Info.plist
, taken from SwitchIcons:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.rpetrich.switchicon.icon-template</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>MinimumOSVersion</key>
<string>2.0</string>
<key>width</key>
<integer>59</integer>
<key>height</key>
<integer>60</integer>
<key>layers</key>
<array>
<...>
</array>
</dict>
</plist>
Keys not specified in the following table can use the same values as the example given.
key | type | meaning | |
---|---|---|---|
CFBundleIdentifier | string | Template bundle identifier. | |
width | integer | Width of the icon. | |
height | integer | Height of the icon. | |
layers | array | ... of dictionaries | Change visuals of switch glyph. |
Layers
array can contain dictionaries with the following keys:
key | type | meaning | range of values | default value | depends |
---|---|---|---|---|---|
type | string | Layer type. | "image", "glyph" | - | - |
opacity | float | Alpha value for current layer. | 0.0 to 1.0 | 1.0 | - |
x | float | X value for offset position. | - | 0.0 | - |
y | float | Y value for offset position. | - | 0.0 | - |
fileName | string | Image filename without extension. | - | - | - |
blur | float | Blur value for current layer. | 0.0 to 1.0 | 0.0 | type = "glyph" |
size | float | Glyph size. | - | 0 | type = "glyph" |
state | string | Switch state filter. | "on", "off", "indeterminate" | - | type = "glyph" |
cutout | BOOL | Cutout mask flag. | - | NO | type = "glyph" |
cutoutX | float | X offset for cutout mask. | - | 0.0 | type = "glyph" && cutout = YES |
cutoutY | float | Y offset for cutout mask. | - | 0.0 | type = "glyph" && cutout = YES |
cutoutBlur | float | Blur for cutout mask. | 0.0 to 1.0 | 0.0 | type = "glyph" && cutout = YES |
color | string | Hex color for current layer. | "#000000" to "#ffffff" | "#000000" | type = "glyph" && filename = nil |
For more information, see here