Can we have different menu items for cards formed using htmlPages attribute of the timeline? - google-mirror-api

I'm creating a bundle using timeline.html as my cover page and providing other sub-pages using the timeline.htmlPages attribute. I want to have different menu items for the cover page as well as for each of the sub-pages. Currently I dont' see any way to have a menuItem for each htmlPage and/or the cover page. Am I missing something ?
I have a work around for this which I did during Glass Foundry : I created a random bundle id, then i looped over all my html pages and using the same bundle id inserted a timeline item, with the same cover page and a single htmlPages with whatever menuItems i want for that index. This works as I want, however since this results in N insert() calls, it takes a lot of time for the glass to receive the bundle [also eats into my api quota as a side effect]

You can only have one menu for a given timeline card, even if it has many pages.
timelineItem.html and timelineItem.htmlPages are intended to be used for a single logical piece of content that just happens to exceed the space available on the screen. For this reason, they all share the same menu and the same timelineItem.id.
If you require a different menu for each page, you probably have content that's logically separate. This warrants a distinct timeline card for each piece of content, and this allows you to specify a different menu. Bundling by timelineItem.bundleId allows you to group similar distinct cards, just as you describe.
The total amount of data transmitted is roughly the same, so total latency shouldn't be too much of an issue. If the gradual insert is noticeable, consider only setting timelineItem.notification on the last item to be inserted.

Related

Looking for guidance on how to add custom class to sections and modules in Squarespace?

I have a client who is using Squarespace and asked that I fix a mobile stacking issue.
I have 2 rows that have image + text alternating side by side. This looks fine on desktop, but the on mobile the stacking order is wrong.
Desktop Stacking:
Image + Text
Text + Image
Current Mobile Stacking:
ImageĀ 
Text
Text
Image
Ideal Stacking:
Image
Text
Image
Text
Typically I was accomplish this by alternating the sections with a custom class, but I'm not seeing any place to add this. Are you able to add custom classes to sections?
Any help is appreciated. Thanks!
It is not possible to directly edit the markup that appears within Squarepace's default grid and block system (they call it, "LayoutEngine"). Generally speaking, one must either write their own HTML within a Code Block (or via Code Injection points), or use JavaScript to alter the HTML after the default markup is loaded onto the page.
But in your case specifically, this is a common problem in Squarespace, and it is usually solved with just CSS, using a combination of:
first-child, last-child and nth-child selectors, and/or
the > direct-descendant/child-combinator, and/or
specific block IDs (each sqs-block has a unique id attribute), and/or
a media query so that the rules only take affect after your mobile breakpoint is reached, and/or
either display:flex with the order property. or display:table-header with display:table-footer in order to force a different stacking order.
The specific CSS often varies greatly based on the specific circumstance, whether you're trying to reorder blocks, columns, or rows. The similar question linked to above provides a specific solution to the same problem you are trying to solve, but the code that solves it in your case may look quite different, though it will likely use a combination of the five things mentioned above.
Or, you can use JavaScript to target the blocks and add your own classes, then write the CSS with those classes. Even in that case, the general approach is the same.

ADF PanelGroupLayout vs PanelGridLayout

I am experiencing some delay in rendering part as my page contains lots of components like (inputs and labels etc). I have placed them in panelgridlayout.
I also used audit method in jdev there also found lots of time is taken by rendering.
So, I want to know which component will be the best or suitable for this. I also implemented panelGroupLayout (with horizontal and vertical) and panelfromlayout but has same slow rendering problem.
Please help me on this.
You need to check how many layout managers you have inside of others. Too many layout managers inside one another can affect render speed.
PanelGroup Layout is for taking a "small" island of content and making its contents horiz, vertical - like buttons or fields or even groups of other islands of content - or add scroll bars if needed, like for a table.
PanelGrid layout is designed to layout a "larger" area and give the layout a grid and allow you to place items almost exactly where you want it.
Some layout managers are designed to layout "the whole page" - like PanelStretch, PanelSlider and PanelGrid, while others are for specialized tasks or group of content, like PanelGroup, FormLayout, Tab, Accordion.
So, depending on the layout, using PanelGrid may mean you do not need the others, and can simply free position all the item which may speed up rendering.
That said, there are many variables that affect rendering speed, and the complexity of the items on the ADF Faces page is not the first thing we look at - The ADF Model layer, how that is implemented and how the data source is tuned (or not) can be a bigger source of impact on rendering.
You did not specify version, that would help as well.
Before PanelGrid we tended to use PanelStretch or PanelSlider as the main window layouts that laid out the main sections of the page - and put the other ones - panel group and formlayout inside it. With the advent of PanelGrid, some of this practice is no longer needed.
This, this and this may help as well.

How to make UIScrollView load data as scrolling happens

I have an IOS application designed for ipad. In one page, I display a report to the user and the report requires 5000 UILabels to be rendered on the screen inside a UIScrollView. This causes application to crash due to being out of memory. I know that UITableView has the functionality for loading content on demand. How can I make scroll view render only certain content and as the scrolling happens remove the content that got invisible and add the content that should be visible?
Is there any way you can reconfigure it to use a table view with custom rows, perhaps rows that consist of several labels? That model supports load on demand and resource reuse in a very natural way...
Perhaps you can be more specific on your screen layout?
You should re-cycle (i.e., reuse) the labels just like a table view recycles its table cells. This is sometimes referred to as "tiling" subviews. Tiling allows you to display more than will fit into memory.
I recommend watching WWDC 2012 Session 104. This session's tutorial creates a photo app that tiles image views in a UIScrollView. Although the photo app scrolls pages of content, rather than a grid of items, I think the video could be relevant to your app.
Here's a very brief overview of the tutorial applied to your specific case:
(1.) declare iVars that keep track of your labels:
NSMutableSet *recycledLabels;
NSMutableSet *visibleLabels;
(2.) implement a method that fetches a re-usable label:
- (UILabel *)dequeueRecycledLabel;
(3.) implement a method that does the tiling:
- (void)tileLabels; // this will add/remove labels from the scroll view
(4.) set your scroll view's delegate and call tileLabels in the scrollViewDidScroll: delegate method
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self tileLabels];
}
The WWDC video will help you fill in the details, which I think are applicable to your case. However, you will have to do plenty of improvising in order to make it work for your specific case. This may not be easy; but its doable.
At the end of the video, tiling with CATileLayer is discussed. I'll be honest, I didn't understand that part. But I don't think it's applicable in your case because you're not displaying large images.
I finally implemented dynamic content loading. The method I implemented is scrollViewDidScroll.
Inside this method I determined the direction of scroll by the following
bool isUp = (currentOffset.y > lastScrollOffset);
Then I determined the visible content rectangle by the following.
CGRect visibleContentRect;
visibleContentRect.origin = scrollView.contentOffset;
visibleContentRect.size = scrollView.bounds.size;
Then I had an array of View Elements and each knew its place in the scroll view because of their frame being set. Long story short, each time scroll happened, I determined the views whose frame either intersected or contained by visible content frame. I added those views to the scroll view. I also determined the ones that disappeared and removed them from scroll view and I also set those views to nil and recreated them. Once [scrollView addSubview:view] method is called, then view gets more space in the memory because it gets visible. [view removeFromSuperView] method doesn't deallocate that space. That's why setting the view to nil and recreating it is necessary.

Is there a pagination option for WPF/Silverlight RichEditControls?

I have a RichEditControl with a given width and height. It's usually a one page document, but sometimes documents can get longer than that. When that happens, the RichEditControl adds a page to it underneath the current one, and a vertical scroll bar to navigate both.
Is there a way to make the document show only one page at a time, so I see Page 1 by default until I write enough to get a page jump, and then I only see page 2 in screen?
This would probably require some sort of pagination, which I imagine is not built-in, so my derived question is:
Since there is no ability to re-size control based on content size (source), would it be better to just count the number of pages, and make the RichEditControl height a multiple of that number? Since this is all inside a bigger ScrollViewer, I'm trying to avoid more inner scroll bars.

substitutes for vertically scrolling through a large list

I am envisioning a Google Glass knitting app to help my sister. Many knitters, including her, like to work from knitting charts, which are big grids with special symbols to indicate the type of stitch. You work your way down the chart, one row at a time, knitting the indicated stitches, and voila! you have a fancy sweater or whatever. She often knits while sitting on the bus, or even while walking, and having the chart on Glass would leave her hands free to do what's important.
Let me describe the ideal, but apparently unsupported, interface, and then you can tell me if there's any good substitute. Ideally, there would be a bundle containing 100 numbered rows of knitting symbols (or however long the chart is). The user sees the current row across the middle of the screen, with the rows above and below displayed more dimly. Swiping back and forward would move up and down the chart, vertically scrolling by one row and highlighting the current row. Because there are so many rows, the user needs a way to skip to a particular row, if they are picking up where they left off. I imagine them tapping to bring up a menu that allows them to speak the desired row number.
It appears that this is completely impossible at the moment. Vertical scrolling is not supported; instead, I would need to create a bundle of horizontally scrolling images of sets of three rows, with the one in the middle highlighted to be the "current" one. OK, that's an acceptable substitute. But then how does the user select a particular row? Do I need to give each card a menu allowing them to somehow request a particular row, which then gets sent over the network to the server, which then sends back a new version of the bundle with the desired row toward the beginning? That sounds wasteful, slow and fragile. Does the Glass UI provide any way to handle this kind of data? If not, is it possible that it will handle it in the future?
I can imagine plenty of applications (teleprompter, karaoke, etc.) that involve vertically scrolling through significant numbers of rows, so I'm sure I'm not the only requester of this, which makes me think that maybe, if it's not currently supported, it might be in the future. Thanks.
It sounds like you are interested in filing a feature request with the Glass team. You can do so here by clicking the New Issue button in the top left. In your request, it will be helpful to the Glass team to summarize the use case that you have described in this question.

Resources