Creating view in advance in Flex mobile app - actionscript-3

In my Flex mobile application, I have ViewNavigator and three Views.
As it is very important for final user to see the second view without a delay, I would like it to be created in advance (e.g. right after the first one is created).
Is it possible to achieve it with Flex mobile?

View extends SkinnableContainer which has a property "creationPolicy".
view.creationPolicy = "all";

Related

Android TV how to make a tab on the top of screen?

I want to make a tab on the top of screen like this :
I know that tabLayout and viewPager can solve it on the phone. However, how to do on the android tv?
There are several ways you could do this - but I think the short answer is no matter what you do, it'll have to be custom. So far leanback is the only framework offered by Google for any TV specific components and that framework only provides you with a left navigational drawer.
I can offer one solution for if you're using leanback. You could use a BrowseFragment with a custom TitleView which has tabs and keeps track of the focus of the tabs within. As long as your custom view implements TitleViewAdapter.Provider then you can use it with a BrowseFragment as the TitleView. The benefit to this is that you can have it automatically animate in and out from the top with little additional work.
As for the custom view, you can specify focusRight and focusLeft on each tab and have an listener onFocus or onClick to swap out the fragments in the BrowseFragment. This class in leanback shows how to swap fragments in the BrowseFragment (specifically PageRowFragmentFactory).
I would highly recommend you clone the leanback showcase app that the Android team put together and play around in that.
For the specifics of customizing the TitleView, it'll look something like the below:
Create your custom view
class YourTitleView extends RelativeLayout implements TitleViewAdapter.Provider {
... do custom view setup/logic here ...
}
Create an XML file named lb_browse_title.xml. This overrides leanback's layout which they use to create their TitleView.
Put your title view in this lb_browse_title.xml file and ensure it has the id of #+id/browse_title_group. This is so leanback knows to grab your title view.
<com.your.android.app.views.YourTitleView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/browse_title_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/browseTitleViewStyle" />
Then create a Fragment that extends BrowseFragment and it should apply your title view automatically. Please refer to the leanback-showcase app for how to get a BrowseFragment up and running.

Add Horizontal view to FullCalendar API

I am using full-calendar API for vertical resource view in my project. All is working fine for around 10 resources. But when I increase the number of resources in my project the view got screwed up.
SO how can I add a horizontal scrolling in this view.
in the viewRender callback function you can add something like
if(view.name === "agendaDay"){
$('.fc-view-container').css('overflow-x','auto');
$("#fullcalendar_container").css('min-width',$('.fc-resource-cell').length*slot_width_resource);
}
I have my slot_width_resource equal to 125. You can play around with that value so the spacing works better.

TileMap not generated; add to stage?

I'm failrly new to LibGDX and I'm running into a problem.
I'm building a classically styled RPG/Adventure game in which I'm using a TiledMap(-Renderer) to create the map. I've followed different tutorials but can't get it to work. (last one was DPG's: Full working example link)
What I need, is a column of buttons on the right side of the screen (implemented that through ImageButtons). One of these buttons lead to a settings-kind of screen and another one should lead to the game map. Under a ClickListener of the button I've added DPK's code of
MapHelper map = new MapHelper();
map.setPackerDirectory("data/packer");
map.loadMap("data/world/level1/level.tmx");
map.prepareCamera((int)stage.getWidth(), (int)stage.getHeight());
map.getCamera().update();
map.render();
The MapHelper class is an exact copy of dpk's, only change above is the setting of the width and height of the camera. Any suggestion what I'm doing wrong here?
I don't think you want to invoke map.render() in the ClickListener callback. That would mean the map is only rendered when you click, and then not re-rendered (generally everything gets re-rendered on every screen re-fresh).
I think you need to track the map in your application class, and in the ClickListener callback you need to set a flag or somehow "enable" the map (perhaps setting it to something other than null). Then in the application's render() method you can check to see if the map should be rendered or not, and render it if so.
Specifically, move the calls to prepareCamera, getCamera and render out of the ClickListener.

Preload dynamically created views in Actionscript for Flex Mobile App

I've got the following problem, my boss wants me to make our app far more responsive without any waiting time between switching views. It used to a "standard" application based on a ViewNavigator but with just one View that was destroyed and re-created with different content based on the user's selection of tabs he created himself. Views were switched with the default SlideViewTransition. I'm down to half a second now with a slightly more lightweight approach as described below, however that half second is still too much.
The app is a tabbed application where the user can create and edit new views himself, so create/edit/delete tabs and their corresponding tabs.
My current implementation is based on a ButtonBar and a Group that is used to display the "views". The group's content is created based on the selected tab. The content is based on XML data that stores all the required information to build the "view". Naturally, removing and creating the component's takes a little while (the half second I talked about), so I'm after another solution.
What I thought about is using the ViewNavigator and create all stored views upon application start.
Very much like this:
for each (var _view:XML in _allViewsConfig.children()) {
var compView:View = new View();
compView.percentHeight = 100;
compView.percentWidth = 100;
compView.name = _view.label;
for each (var _groupElement:XML in _view.vgroup) {
var group:VGroup = new VGroup;
group.percentWidth = 100;
group.percentHeight = 100;
for each (var _windowElement:XML in _groupElement.window) {
var window:WindowContainer = new WindowContainer;
for each (var _componentElement:XML in _windowElement.component) {
var component:UIComponent = _componentManager.create(_componentElement.#type, _componentElement);
window.addElement(component);
}
group.addElement(window);
}
compView.addElement(group);
}
views.addItem(compView);
}
views is an ArrayList that is used to store the created views.
The only problem I've got right now is that I can't use the Views stored in this ArrayList in the corresponding ViewNavigator.
I tried it the usual way, i.e. navigation.pushView(_viewCreator.views.getItemAt(0) as Class);
This, however doesn't work, no error or anything, the ViewNavigatorjust doesn't do anything, so I guess that a View class can't be created like this.
So how can I make this work?
Also, do you guys think that this is a proper solution to the problem, especially considering the whole dynamic nature of the application (being based on tabs)?
Naturally, slide transitions will be completely disabled as they are quite slow with our complex components.
Any help, comments or thoughts would be greatly appreciated!
EDIT:
On second thought, simply using Groups instead of ViewNavigator and View should make this a little more lightweight and solve the issue of views not being pushed.
In fact ViewNavigator pushView() is a mechanism which create an instance of a given Class (method parameter).
For all navigation history purpose, ViewNavigator uses NavigationStack objects to store relevant values (that you can customize too).
I don't have a straightforward answer for you, but I think you'll have to implement your own custom ViewNavigator mechanism (extending ViewNavigator to leverage existing useful methods and override others).

iPhone - How do I make viewControllers landscape?

I have a uiNavigationController and two viewControllers. The problem I am having is the views are being generated in portrait size even though I want them in landscape!
Here is what I am doing:
1) Creating an instance of view1 and adding it to the uiNavigationControllers stack. This is performed inside the applications delegate didFinishLoadingWithOptions(...) method.
2) view1 has a button that when clicked creates an instance of view2 and pushes it onto the uiNavigationControllers stack.
This appears to work fine apart from the fact the views are being created in portrait format. I was going to manually force landscape by using transform methods once I create their instance but this feels really hacky.
I did speculate that this has something to do with the "shouldAutorotateToInterfaceOrientation" method, but this is set for landscape in all viewControllers.
I am royally confused.
Question 1) How on earth do I solve this, is the 'hacky transform' approach the only way?
Question 2) Is this the correct way to be using a navigationController - I am new to iPhone programming. All I want are two landscape views that I can click between and this seems to do this aside from the landscape bit ^^.
I found the answer for this problem.
The navigation controller DOES inherit the shouldAuthororateToInterfaceOrierntation method for each of the views inside its stack, I however made a mistake :)
After adding the navController to the main window I had not deleted the part where by default it adds the a rootController view to the main window. There was some kind of conflict which stopped my navigation controller working as expecting - removing that line fixed everything.