Archive for 'Hierarchy'

Useful Shortcut Keys:
(replace cmd with ctrl and opt with alt on Windows/Linux)

Android Emulator:
esc - back key
ctrl + f12 - toggle landscape and portrait
cmd + option + enter - full screen
f2 - menu

Eclipse:
cmd + shift + L - Displays all available shortcuts
cmd + shift + F - formats source
cmd + shift + O - organize imports
cmd + L - go to line number
cmd + 1 - quick fix
control + space - content assist
cmd + shift + T - finds a class
cmd + T - shows hierarchy of class you’ve selected
option + shift + a - shows Android specific shortcuts

Optimize Layouts in Android with layoutopt tool

The layoutopt tool is a command-line utility which helps you to analyze and optimize the XML files that define your application’s UI. It also helps to find inefficiencies in the view hierarchy. This tool is included along with the SDK.

Command:layoutopt
usage: layoutopt

To run the tool, open a terminal or command-prompt and type layoutopt followed by the from your SDK tools/ directory. The argument is a space- delimited list of resources you want to analyze, either non-compiled resource xml files or directories of such files.

The tool loads the specified XML files and analyzes their definitions and hierarchies according to a set of predefined rules. For every issue it detects, it displays the following information:
The filename in which the issue was detected.
The line number for the issue.
A description of the issue, and for some types of issues it also suggest resolutions.

 

See some sample optimization testing screen shots below:

Intro to Themes

A theme is a combination of files which are responsible for the visual output.

What files form the theme ?

Magento themes are split into two directories.  The files are separated into “browser accessible” (such as image and Javascripts) and those that can be hidden from it for security reasons.

  • Directory 1: app/design/frontend/default/default/ — This directory contains the layout, translation (locale) and template materials.
  • Directory 2: skin/frontend/default/default/ — This directory contains the images, CSS and block-specific Javascripts.

So a theme consists of the following files :

Layout (located in app/design/frontend/your_interface/your_theme/layout/)
These are basic XML files that define block structure for different pages.

Templates (located in app/design/frontend/your_interface/your_theme/template/)
These are PHTML files that contain (X)HTML markups and any necessary PHP tags to create logic for visual presentation.

Locale (located in app/design/frontend/your_interface/your_theme/locale/)
Theses are simple text documents organized on a per language basis that contain translations for store copy.

Skins (located in skin/frontend/your_interface/your_theme/)
These are block-specific Javascript and CSS and image files that compliment your (X)HTML.

Hierarchy of themes:

Magento has a very powerful theme concept. For instance, you can use a default theme which comes with Magento and a new one of your own side by side. That new individual theme only contains files which differ from the default theme. Thus it forms a hierarchy of themes.

For example If you simply want to move the mini cart from the left sidebar to the right sidebar you just copy the required file from “default” to your new theme directory and adjust some code. Magento first loads all files from your new theme and then falls back to the next theme lower in hierarchy (in this case “default”) and requires all missing files from that theme.

Doing so, Magento conserves the ability to be upgraded. With every upgrade,  files in your default theme are getting overwritten. The original files are protected this way.

What are Blocks ?

In Magento we work with structural blocks and content blocks. Structural blocks represent the basic structure of a page. Usually we have structural blocks like header, left sidebar, middle content, right sidebar and footer. We can assign content blocks like category list, navigation, search bar, callout etc. to a certain structural block.

themes_blocks

Content blocks are assigned to structural blocks with the help of layout. Layout is build with XML files and can be found under app/design/frontend/default/default/layout. This way you can reuse earlier created templates, such as the mini cart module on the sidebar, on different pages by simply calling them within a layout xml file.

themes_layout

In this case we are adding the content block ‘cart_sidebar’ (shopping cart) to the structural block ‘left’.

Template Path Hints:

You can see info about the template that a block uses by turning on Template Path Hints. Here are the steps to turn on template path hints. Make sure you disable your cache by going to System->Cache Management.

Open admin page and go to System->Configuration. Then Select Developer on the left sidebar. Also select Main Website from the Current Config Scope Drop Down.  Next Open the debug drop down and set template hints to yes.


templaetspathhints

The result will be as follows. Each content block will be outlined and labeled with the location of template file which is used to design that block.

magentotemplatetip

iphone applications without using interfaceBuilder

Implement loadView to create a view hierarchy programmatically, without using a nib.

-(void)loadView {
self.view = [[UIView alloc] init];
self.view.backgroundColor = [UIColor clearColor];
self.view.frame = CGRectMake(0, 0, 768, 1024); //For ipad…
self.view.frame = CGRectMake(0, 0, 320, 480); //For iphone...
//.…..also for adding button,imageView,label,textView etc…
     we should give the frame as given below…..

bgImgView = [[UIImageView alloc] init];
bgImg = [UIImage imageNamed:@"someImage.png"];
		bgImgView.image = bgImg;

bgImgView.frame = CGRectMake(CGFloat x, CGFloat y, CGFloat 

       width, CGFloat height) ;

[self.view addSubview:bgImgView];
}
We Can Build Your App for You. Lets Get Started !