Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1325] Add PreviewContext element to XML views

GitHub Issuen/a
TypeNew Feature
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-11-12T18:22:38.000+0000
Affected Version/salloy 1.7.24
Fix Version/sRelease 5.2.0, alloy 1.7.25
ComponentsXML
Labelsn/a
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao
Created2015-11-04T11:51:27.000+0000
Updated2016-02-02T22:47:55.000+0000

Description

Alloy should support the new Ti.UI.iOS.createPreviewContext. * A PreviewContext can be added to most views via their previewContext property. * The PreviewContext itself has a preview property which must be assigned a single View. * The PreviewContext also has an actions property for one or more actions or action groups.
<Alloy>
	<View>
		<PreviewContext onPeek="fn1" onPop="fn2" contentHeight="300">
			<Preview>
				<View>
					<Label>Hello</Label>
				</View>
			</Preview>
		</PreviewContext>
	<View>
	<ListView>
		<PreviewContext onPeek="fn">
			<Preview>
				<View>
					<Label>Hello</Label>
				</View>
			</Preview>
			<Actions>
				<Action title="Email" onClick="fn" />
				<ActionGroup title="Delete">
					<Action title="Confirm" onClick="fn" />
					<Action title="Cancel" onClick="fn" />
				</ActionGroup>
			</Actions>
		</PreviewContext>
		<ListSection>
			<ListItem title="Hello" />
		</ListSection>
	</ListView>
</Alloy>

Comments

  1. Feon Sua Xin Miao 2015-11-06

    How about something like this:
       <Alloy>
       	<Window>
       		<View>
       			<PreviewContext>
       				<View>
       					<Label>Hello</Label>
       				</View>
       				<PreviewAction title='Preview Action' style='Ti.UI.iOS.PREVIEW_ACTION_STYLE_DESTRUCTIVE'/>
       				<PreviewActionGroup>
       					<PreviewAction id='action1' />
       					<PreviewAction id='action2' />
       					<PreviewAction id='action3' />
       				</PreviewActionGroup>
       			</PreviewContext>
       		</View>
       	</Window>
       </Alloy>
       
  2. Hans Knöchel 2015-11-06

    [~fmiao] The preview actions should be surrounded by <Actions> just like we do it with <ButtonNames> etc. Overall, I would just suggest [~fokkezb]'s proposal.
  3. Feon Sua Xin Miao 2015-11-06

    Sure, that's fine with me.
  4. Fokke Zandbergen 2015-11-06

    I also recommend wrapping the contextpreview preview view in a contentview or maybe better preview element. Just like the popover.
  5. Hans Knöchel 2015-11-06

    Semantically right would be the <Preview> tag to have parity with the API.
  6. Feon Sua Xin Miao 2015-11-06

    I agree with [~hansknoechel], semantically it should be Preview. Although I would prefer to have less tags that don't correspond to a Ti.UI.* object. preview, actions are after all properties of Ti.UI.iOS.PreviewContext. [~fokkezb]'s initial proposal looks good to me,
  7. Feon Sua Xin Miao 2015-11-10

    PR: https://github.com/appcelerator/alloy/pull/739 Test app: https://github.com/feons/alloy/tree/ALOY-1325-1/test/apps/testing/ALOY-1325
  8. Fokke Zandbergen 2015-11-11

    Found 2 more typos but with those fixed in my local version it works.
  9. Feon Sua Xin Miao 2015-11-12

    PR merged.
  10. Fokke Zandbergen 2015-11-21

    This has nothing to do with the SDK version but with Alloy. If you run from OSS CLI you need 1.7.25 of Alloy. If you run from AppC CLI then 5.1.0-63+ has the correct Alloy version.
  11. Eric Wieber 2016-02-02

    Verified implemented, using: MacOS 10.11.3 (15D21) Studio 4.5.0.201601262138 Ti SDK 5.2.0.v20160202103508 Appc NPM 4.2.3-1 Appc CLI 5.2.0-239 Alloy 1.7.33 Xcode 7.2 (7C68) iPhone 6S PreviewContext element is now usable and behaves as expected. Tested using the app provided at: https://github.com/feons/alloy/tree/ALOY-1325-1/test/apps/testing/ALOY-1325, and simple modifications to the default sample app.

JSON Source