Android 3.0 CalendarView - android-3.0-honeycomb

I'm trying to implement a CalendarView, it takes an absurd amount of time (about 10 seconds) to appear on screen and it only loads the month and weekday headers, it does not display any calendar content.
Using the same code from this video but not seeing the same result. I'm trying to launch it in a dialog:
CalendarView calendarView = new CalendarView(this);
dialog.setContentView(calendarView);
but when I tried to embed it in an activity it took the screen the same amount of time to load and similarly failed to display correctly.

The tracing helped reveal that GregorianCalendar was being called thousands of times.
It seems that when the calendar days aren't visible, it tries to calculate all of the dates rather than just the visible ones.
The issue of the CalendarView only displaying the header information was solved by setting the layout_width and layout_height explicitly. Neither wrap_content or match_parent worked properly to display the calendar contents.

Related

Using Applescript or Automator to edit a calendar to move "bump" all events forward one day

I want to be able to move all events within my mac calendar up one day, ideally with the ability to exclude weekends.
Use Case: A training program had 10 weeks of daily sessions. The calendar is uploaded via csv edited for start days and skipped days. If one were to miss a day they were able to simple push all the events forward one day.
I have looked at Automator and there doesn't appear to be a simple way to set this up with the exception of possibly a folder action option.
Anyone ever do something like this?
I'd be careful about AppleScripting Calendar.app in Catalina onwards, as it's now extremely buggy and very easy to incur data loss when something goes wrong.
However, a non-scripting solution would be to cut and paste the events whilst viewing them in Month view:
Select all the events that you wish to bring forward, which is best done starting with the last, so you end up at the first;
If you deselect all other calendars so that the only events visible are the ones in your training programme (I presume these are stored in their own calendar, right...?!), then you can ⌘A to Select All, being careful to deselect the ones that overlap from the previous month or into the next month. Individual events are selected/deselected by holding down ⌘ and clicking the event.
Hit ⌘X to Cut them to the clipboard;
Use the mouse to single-click the day previous to one that contained the first event;
Hit ⌘V to Paste the events, the first of which will be pasted into the day that you clicked in step ⓷, with the remaining events repositioned by the same relative amount as was the first.

Track scroll in google universal analytics

I would like to know if "scroll" event can be added to the Google analytics universal code? i have the below
setTimeout("ga('send','event','engaged users','page visit 30 seconds or more')",30000);
I wanted to track visits over 30secs that the scrolls
You can use window.scroll which is available in the jQuery API.
$(window).scroll(function() {
ga('send','event', 'engaged users');
});
See https://api.jquery.com/scroll/
There are several plugins/libraries out there that add scroll tracking, but if you want to do it yourself make sure you don't send too many events.
You shouldn't send an event to GA directly on the window.onscroll event - this is fired dozens of times a second. It will chew through your hit allowance and it won't provide any useful data.
Even a sampled scroll event isn't much better (where you set a timeout every few hundred milliseconds to check if the user has scrolled) - it still sends potentially hundreds of events user page view.
You should either set it to fire on certain scroll "thresholds" (e.g. 20%, 50%), or, the better way in my opinion is to store a variable with the maximum scroll depth and then use the document.onbeforeunload event to fire just one event at the end of the user's page view. This gives way more accurate data and doesn't send too many events.
onbeforeunload has some browser inconsistencies though (especially on mobile), so you'll want a fallback for that. There's a full tutorial here on creating a cross-browser scroll tracking plugin with tons of code examples here: building a better scroll tracking plugin

How to scroll to a selectedAppointment in JFXtras Agenda

I have some kind of 'find' function, where I select an appointment by adding it to the selectedAppointments list. Works, but Agenda does not scroll to the correct position automatically. So in some cases, the user cannot see the selected appointment.
How can I tell Agenda to scroll to the correct position?
Thank you!
There is a displayedLocalDateTime property on Agenda (or displayedCalendar if you are still using the depricated property). It will tell Agenda to show that specific moment in time, but depending on the active skin (week, day, or whatever the future will bring) that may be a different time frame.
After rereading, I noticed that you used the word "scroll" very specifically, so I checked and agenda correct shows the date based on displayedLocalDateTime, but it did not scroll to the correct time within that date. Fixed that just now.

What could possibily slow down my flex mobile application?

I am working with flex for the last two years on some desktop apps. Until now I never had any performance related issues but today as we completed a mobile application for the iPad, I'm facing a challenge, the application is incredibly slow on the iPad.
http://i.stack.imgur.com/qkbWn.png
Slow, means that when I press a button in the menu to change the splitview I must wait something like 5s. Then scrolling is really slow two, with less than one fps and my TextInput starts to bug (the text is not in his box anymore).
I started to read a lot of blog post and presentation about optimisation for the mobile platform and then I rewrite some of the components I use. I removed the SkinnableContainer for instance and replaced it by a VGroup including some actionScript based drawing.
Now what you see is a VGroup (the dark grey one) containing some others VGroup (the group with title here) and then each widget is an HGroup with a label and a Widget. I only use Label and TextInput for the text.
Creation time is slow even (several seconds to create the view) for another page where there is only 4 text widget on it, or another one with only a list with a custom item renderer where each row is a set of 4 labels.
The whole things is cabled with RobotLegs, with nothing fancy, one models is injected in the view and at the beginning I set a member variable on the view with this object to bind my variables.
Frankly my thinking right now is : it smells fishy because if I've done everything right it is impossible to have such low performance and thinks that flex is competitive on the mobile platform. So right now I'm trying to disable the application piece by piece to try to locate what could slow it like that. I've got a couple suspects to check, for instance I've got some binding warning to check, and then see if robotlegs has got its share of the problem.
So my main question here is what do you think, and could you have some ideas about "is there a problem" and "how do we solve it".
Thanks
Run profiler for startup and separatelly for each operation that takes longed that it needs. Then prioritize the problems and try to solve them with basic optimization techniques.
Some problems you will not be able to solve fast - e.g. time for creating big components. The only option there is to rewrite those components with AS3 without MXML, styles and anything. I'm sure that flash.text.TextField is created many times faster than mx.controls.Label. The same for other components.
When component is created, it can be reused at a very low price. In your app there must be a lot of places where you recreate while you can reuse old components. It will save you memory and time.
Layouts tend to redraw even when it's not needed. If you have a lot of nested layouts, find the most critical places and replace a series of layouts with one custom layout or even component.
This all is very developer time consuming. At the end you will not get a smooth app anyway, but I believe that it can become usable.

Design advices for quick navigation between view

Usually, when a View requires a lot of bindings, or some UI Elements like a Bing Map, it takes a "while" to load (like between half a second and a second).
I don't want a delay between a "tap" action (like tapping an element on a ListBox) and the navigation action (displaying a new page).
I don't mind displaying the page progressively. For example, for a Bing Map, I don't mind displaying a black page with only a title, and a second later, having the Map appear.
What are the best practices ? It could post a sample if i'm not clear enough
edit: I'll keep the question open for a while, so other can answer. Thanks Matt and Mick for awesome answers. I'm already working on some improvements. The major one being binding my controls after the page loaded.
It's expected on resource constrained devices that non trivial actions will take at least a little time to execute.
The most commonly recommended best practice for dealing with this is to use animations to give the user the impression of perceived performance. This has been a recurring recommendation throughout the CTP and Beta phases by the product team and in presentations at Mix 10 and Tech Ed 2010.
Page transitions are a common approach to this.
Discussed here by Kevin Marshall, prior to inclusion in the November toolkit.
WP7 – Page Transitions Sample
And here, referencing the control in the toolkit.
Transitions for Windows Phone 7
There are also a number of very basic optimisations you can do that will give you some bang for a little effort.
don't name controls that you don't reference in code
use background worker to load any data to avoid impact the UI thread (already busy loading your page) and fire this off after the page is loaded (disable any controls not usable in leui of this) (Phạm Tiểu Giao - Threads in WP7)
use httpwebrequest over webclient for the same reason (WebClient, HttpWebRequest and the UI Thread on Windows Phone 7)
I would also reiterate Matt's suggestion for not loading controls that aren't used initially.
If you decide to go the extra mile, there is more you can do to optimise page loading. These two posts are worth absorbing in that regard.
Creating High Performing Silverlight Applications for Windows Phone
WP7 Development Tips Part 1 - Kevin Marshall's Epic Work Blog for Awesome People
If using Listboxes, also familiarise with Oren Nachman and David Anson's
WP7 Silverlight Perf Demo 1: VirtualizingStackPanel vs. StackPanel as a ListBox ItemsPanel
Keep a low profile LowProfileImageLoader helps the Windows Phone 7 UI thread stay responsive by loading images in the background
Never do today what you can put off till tomorrow DeferredLoadListBox (and StackPanel) help Windows Phone 7 lists scroll smoothly and consistently
and be sure image sizes are optimised for their display size.
My suggestions/recommendations:
Create and navigate to the new page as quickly as possible.
Display the page with placeholder content while it loads (if appropriate).
Give an indication that something is happening while the page loads. An indeterminate progress bar (use this one) is the convention on the platform.
If it's not possible to use the page until all controls are loaded, then prevent access to the page. A semi-transparent object displayed over the entire page is a common technique to not only prevent touching of controls but also to indicate that they can't yet be touched.
If possible/practical set the size of the items in xaml/code to prevent relayout due to resizing once an item is loaded.
Try delay loading of items which aren't on the screen initially to get the perceived total load time down.
and finally:
Optimize everything to get the load time down and the application as responsive as possible.

Resources