Android (complex) Calendar Layout - android

I wrote a calendar app and I'm now rethinking how to display the items. I don't want to use a simple table layout anymore because the different tasks have different durations.
What options are there to create a Layout like this instead of this?
I think drawing is no option respect to performance?
I would also like to use xclicklisteners...

I did something extremely similar to what you want by creating my own view type (extended the View class, and handled my own drawing). Performance is excellent as this is not typically data that is rapidly changing while the view is active (like a video game might).
It's also very simple to support all the usual (or custom) listeners for navigation, selection, touch, etc., etc., etc.
Food for thought.

Related

Material Design - Expanding (Transition) a Card to full screen

I'm struggling to implement the expand feature of the card view described by the Material Design for Android.
In their design guidelines they show off different layouts for the Card component, but one example shows a card transition to fullscreen onClick.
This is the transition shown on their website:
I've tried out implementing a feature like this, but it would require much more work than what their guideline examples are suggesting... How does Material Design accomplish this? Is there a built-in feature for this, should I just manually translate and fit the card to fit the screen, or should I use an entirely new fragment or activity for the full-card-view?
Here are the Design guidelines, which contain that example, but nothing is said about the transition, neither on the documented Develop page, which is minimal really.
TL;DR
In the case of the gif image you've attached above, the RecyclerView and the detailed CardView should have their own separate Fragments which are operated in one single Activity.
Jump to the links at the end for the animation part.
Detail
Why so? Well, we had three choices:
Keep both Views in one Activity and overlap the detailed CardView on top of RecyclerView on click event. (This one is stupid, and not a good practice)
Create separate Activities for both Views (Recycler & fullscreen-Card)
The one I mentioned above.
RecyclerView and Detailed View shown as two separate Fragments
Now the reason for not choosing the 2nd option was because it is more performance intensive as compared to the 3rd one. We may not notice this in a small scale app but it certainly makes an impact when the app scales. Plus, creating fragments is more effective as we are sharing common views and variables in between the Views. So the best choice is number three. Note that this isn't a universal case and the usage will differ according to your requirement.
Using Fragments can be overwhelming at first but it keeps the code more organised when you get a hang of it. You should try to keep your app divided into few broadly divided activities and within those should be as many fragments as you want.
Here's a few links that helped me implement the exact same thing you're looking for.
MDC: Material Motion
Implementing Motion with MM
Building Transitions with MM
Hands-on experience in Codelab
All three of them helped me gain a better understanding on how the whole Material Motion framework works and how to implement it in my program.

Tips to boost performance of TileLayout?

I am targeting mobile using FlashBuilder, I am using TileLayout to view items of data, I am setting useVirtualLayout to "true"
I have some questions please:
Is item renderer resued by default? or shall I set it to true my self?
How can I control the range of items being virtualized?
Is there any tips on boosting performance of building child items of TileLayout ?
If native TileLayout is slow, is there alternative control to use? if building my own would be better, is there any example to build custom layout?
It is set to true by default. There are a few instances where they are not virtualized, however. If you have the list sizing to fit its contents, I don't believe virtualization occurs. If I am not mistaken, virtualization only occurs when an ItemRenderer leaves the viewport of the parent List control. So if you have a list on a page and that page is controlling the scrolling and not the list, I don't believe virutalization occurs. That is what I have seen in the past. Not sure if that is how it actually works, but that is the impression I have gotten. Easy way to find out is to throw a trace statement in your DataChange handler. If it traces out after initialization, you know virtualization is working
I'm not sure you can control this. You may be able to write a custom layout that does it, but that is likely more trouble than it is worth
The TileLayout itself is likely not the issue you are having, it is the ItemRenderer.
On mobile, do not extend any ItemRenderer class except LabelItemRenderer and IconItemRenderer.
Do not write a renderer in MXML. Write in AS3.
Utilize the proper renderer life-cycle. This means you should do very little in your constructor. Maybe set a few properties, but do not instantiate any DisplayObject. Instead, override createChildren() and do it there. Override layoutContents() for positioning and sizing. Override drawBackground() for handling the background. I highly suggest reading this post from Flextras (you'll see him going by Reboog77 on SO) about writing mobile item renderers. https://www.flextras.com/blog/index.cfm/2011/6/24/Building-a-Mobile-ItemRenderer-in-Flex
Keep the renderers as simple as possible. If you can get away with drawing directly into the object using the Graphics class, do that instead of using a Rect or similar.
Text is slow to render. Do not change it often and keep the text seen in the renderer to a minimum
Use ContentCache for any images outside of the iconDisplay in IconItemRenderer. ContentCache will negate the need for reloading images every single time.(iconDisplay/icon already utilizes this by default)

A view for a game without a layout

I'm at the beginning of my development for my game and I have a basic question.
Is the layout necessary for displaying a view?
I have the method which allows me to make the toolbar disappear and set the view screen wide, but it seems a bit useless to do so.
Besides in the snake sample provided in the sdk, the views are merged without a layout.
So, which one is the best practice.
And if it's the layout-less solution, how to do for a unique view to display?
Thanks.
Well, I am as new as you are too, but as far as I have searched and learned online and with a few examples, all I can say is, NO. Game programming does not need any xml layouts. For developing a game, you need to first create a good basic framework. All the views, sprites, actions, audio, etc... is created at background.
This is a very nice tutorial to start with.
It depends on lots of things, but yes you don't need to create an XML layout. Pay attention to the word XML. You can create a custom class which extends SurfaceView and work in cooperate with Thread to do the update. So in this case you just need to set your Activity's Content View to this subclass of SurfaceView. But by using SurfaceView you have a raw of context which means you should do everything from stratch, e.g you should implement your own button.
Beside this it depends on the engine/framework you use too. But for SurfaceView/Canvas API the lines I mentioned above is valid.

Android layout design for many menu options

What is the best way to go about designing an Android application that features quite a bit of formulas and conversions? I was thinking that multiple Activities with ListViews sort of like a tree with the leaves being the actual calculations. However, after reading Android design principles it's better to avoid a pure navigational structure and try to reduce the deepness of the app.
For example:
Main Menu
Conversions
Weight
Distance
Distance - Speed - Time
Calculate air speed
Calculate distance traveled
Weather
METAR
TAF
So by the 3rd or 4th screen we've reached the actual individual calculator. Does this make sense? And if it does, is there a better way of designing this (maybe using action bars or tabs)?
By using a very simple UI concept of Expandable Listviews, in which there is more than one child row for each section of the parent row, by tapping on the "Conversions", could expand into sub-rows, likewise for each section as you see fit, and treat that as a Main Menu in a sense of a word, that is, your main application screen.
The nice advantage is that the nesting of the menus in the Android way, is eliminated and can accomodate as many as you wish.
The third or forth screen sounds like it's too deep down the rabbit hole, how about instead having multiple tabs for each "type"?
For example;
[Conversions][Distances][Weather]
If you add an ActionBar to it, you could have a type of filter as the GMAIL app has (where you select the account) and use it to toggle the different "modes" so to speak.
Another approach would be to have it all in one screen, just that you switch the active layout (or perhaps Fragment) via the filter I mentioned above.
Check out the GMAIL app, and you'll see what I mean in terms of the filter. :-)

Android: Is View class appropriate for graphical elements?

We're designing an application that displays several hundred graphical elements on a single screen that need to respond to touch events and that can be animated -- however, they are not full-blown widgets (no focusing and other event handling). Is the View class appropriate for this, or is there a more lightweight class we should use?
(For those familiar with the Qt Framework, we're looking for something like the QGraphicsItem class)
View is just fine. It provides the full functionality and flexibility you may need to obtain graphical elements.

Categories

Resources