
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agafix Blog</title>
	<atom:link href="http://agafix.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://agafix.org</link>
	<description>Agafix provides Web Design and Web Development tutorials, tips, and tricks for beginner and advanced. At Agafix we also create themes and develop plugins for Wordpress.</description>
	<lastBuildDate>Tue, 13 Mar 2012 18:07:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Android: How to make a dashboard using a GridView</title>
		<link>http://agafix.org/android-how-to-make-a-dashboard-using-a-gridview/</link>
		<comments>http://agafix.org/android-how-to-make-a-dashboard-using-a-gridview/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 15:42:18 +0000</pubDate>
		<dc:creator>Taoufix</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Web & Design]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Dashboard]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Layout]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://agafix.org/?p=1870</guid>
		<description><![CDATA[When your Android application provides many functionalities via different Activities, it is a good UI Design to provide a dashboard for an easy access and navigation.]]></description>
			<content:encoded><![CDATA[<p>When your Android application provides many functionalities via different Activities, it is a good UI Design to provide a dashboard for an easy access and navigation. This pattern can be found in major Android applications such as Google+, Twitter, Evernote.</p>
<p>In our use case scenario, you are developing an application which provides maps for the main Paris transportation services (i.e. Metro, RER, Bus, Noctilien).</p>
<p>The main entry to your application will be a dashboard containing icons to access the transportation maps.</p>
<p>The dashboard Activity will be using a <a href="http://developer.android.com/reference/android/widget/GridView.html">GridView</a> of 2 columns in portrait mode and 4 columns in landscape mode.</p>
<p>Here is the code for the dashboard layout:</p>
<p><strong>Dashboard layout: res/layout/dashboard.xml</strong>:</p>
<div class="codesnip-container" >
<div class="xml codesnip" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;utf-8&quot;</span><span class="re2">?&gt;</span></span><br />
<span class="sc3"><span class="re1">&lt;RelativeLayout</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">xmlns:android</span>=<span class="st0">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:background</span>=<span class="st0">&quot;@android:color/white&quot;</span><span class="re2">&gt;</span></span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;GridView</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:id</span>=<span class="st0">&quot;@+id/dashboard_grid&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;wrap_content&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:listSelector</span>=<span class="st0">&quot;@android:color/transparent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:stretchMode</span>=<span class="st0">&quot;columnWidth&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:verticalSpacing</span>=<span class="st0">&quot;20.0dip&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_centerInParent</span>=<span class="st0">&quot;true&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">style</span>=<span class="st0">&quot;@style/dashboard&quot;</span> <span class="re2">/&gt;</span></span><br />
&nbsp;<br />
<span class="sc3"><span class="re1">&lt;/RelativeLayout<span class="re2">&gt;</span></span></span></div>
</div>
<p>The above layout uses a reference to an external style which is going to provide a different UI depending on the orientation (portrait or landscape).</p>
<p><strong>Dashboard portrait mode style: res/values/styles.xml</strong></p>
<div class="codesnip-container" >
<div class="xml codesnip" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;utf-8&quot;</span><span class="re2">?&gt;</span></span><br />
<span class="sc3"><span class="re1">&lt;resources<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;style</span> <span class="re0">name</span>=<span class="st0">&quot;dashboard&quot;</span><span class="re2">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;item</span> <span class="re0">name</span>=<span class="st0">&quot;android:numColumns&quot;</span><span class="re2">&gt;</span></span>2<span class="sc3"><span class="re1">&lt;/item<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/style<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;/resources<span class="re2">&gt;</span></span></span></div>
</div>
<p><strong>Dashboard landscape mode style: res/values-land/styles.xml</strong></p>
<div class="codesnip-container" >
<div class="xml codesnip" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;utf-8&quot;</span><span class="re2">?&gt;</span></span><br />
<span class="sc3"><span class="re1">&lt;resources<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;style</span> <span class="re0">name</span>=<span class="st0">&quot;dashboard&quot;</span><span class="re2">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;item</span> <span class="re0">name</span>=<span class="st0">&quot;android:numColumns&quot;</span><span class="re2">&gt;</span></span>4<span class="sc3"><span class="re1">&lt;/item<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/style<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;/resources<span class="re2">&gt;</span></span></span></div>
</div>
<p>The GridView will be filled programatically using an inflater for the dashboard entries (icon + text)</p>
<p><strong>Dashboard entry layout: res/layout/dashboard_icon.xml</strong></p>
<div class="codesnip-container" >
<div class="xml codesnip" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;utf-8&quot;</span><span class="re2">?&gt;</span></span><br />
<span class="sc3"><span class="re1">&lt;LinearLayout</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">xmlns:android</span>=<span class="st0">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;wrap_content&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_marginBottom</span>=<span class="st0">&quot;20.0dip&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:gravity</span>=<span class="st0">&quot;center&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:orientation</span>=<span class="st0">&quot;vertical&quot;</span><span class="re2">&gt;</span></span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;ImageView</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:id</span>=<span class="st0">&quot;@+id/dashboard_icon_img&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;96.0dip&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:scaleType</span>=<span class="st0">&quot;fitCenter&quot;</span> <span class="re2">/&gt;</span></span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;TextView</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:id</span>=<span class="st0">&quot;@+id/dashboard_icon_text&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;wrap_content&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_marginBottom</span>=<span class="st0">&quot;20.0dip&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_marginTop</span>=<span class="st0">&quot;2.0dip&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:gravity</span>=<span class="st0">&quot;center&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:textAppearance</span>=<span class="st0">&quot;?android:textAppearanceMedium&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:textColor</span>=<span class="st0">&quot;@android:color/black&quot;</span> <span class="re2">/&gt;</span></span><br />
&nbsp;<br />
<span class="sc3"><span class="re1">&lt;/LinearLayout<span class="re2">&gt;</span></span></span></div>
</div>
<p>The dashboard Activity where we fill the GridView :</p>
<p><strong>Dashboard Activity: src/org/agafix/metro/DashboardActivity.java</strong></p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;"><span class="kw1">package</span> <span class="co2">org.agafix.metro</span><span class="sy0">;</span><br />
&nbsp;<br />
<span class="kw1">import</span> <span class="co2">android.app.Activity</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.content.Context</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.content.Intent</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.os.Bundle</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.view.LayoutInflater</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.view.MotionEvent</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.view.View</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.view.View.OnTouchListener</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.view.ViewGroup</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.widget.AdapterView</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.widget.AdapterView.OnItemClickListener</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.widget.BaseAdapter</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.widget.GridView</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.widget.ImageView</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.widget.TextView</span><span class="sy0">;</span><br />
&nbsp;<br />
<span class="kw1">public</span> <span class="kw1">class</span> DashboardActivity <span class="kw1">extends</span> Activity <span class="kw1">implements</span> OnItemClickListener <span class="br0">&#123;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="kw1">static</span> <span class="kw1">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> EXTRA_MAP <span class="sy0">=</span> <span class="st0">&quot;map&quot;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="kw1">static</span> <span class="kw1">final</span> LauncherIcon<span class="br0">&#91;</span><span class="br0">&#93;</span> ICONS <span class="sy0">=</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">new</span> LauncherIcon<span class="br0">&#40;</span>R.<span class="me1">drawable</span>.<span class="me1">ic_metro</span>, <span class="st0">&quot;Metro&quot;</span>, <span class="st0">&quot;metro.png&quot;</span><span class="br0">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">new</span> LauncherIcon<span class="br0">&#40;</span>R.<span class="me1">drawable</span>.<span class="me1">ic_rer</span>, <span class="st0">&quot;RER&quot;</span>, <span class="st0">&quot;rer.png&quot;</span><span class="br0">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">new</span> LauncherIcon<span class="br0">&#40;</span>R.<span class="me1">drawable</span>.<span class="me1">ic_bus</span>, <span class="st0">&quot;Bus&quot;</span>, <span class="st0">&quot;bus.png&quot;</span><span class="br0">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">new</span> LauncherIcon<span class="br0">&#40;</span>R.<span class="me1">drawable</span>.<span class="me1">ic_noctilien</span>, <span class="st0">&quot;Noctilien&quot;</span>, <span class="st0">&quot;noctilien.png&quot;</span><span class="br0">&#41;</span>,<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> onCreate<span class="br0">&#40;</span>Bundle savedInstanceState<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">super</span>.<span class="me1">onCreate</span><span class="br0">&#40;</span>savedInstanceState<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setContentView<span class="br0">&#40;</span>R.<span class="me1">layout</span>.<span class="me1">dashboard</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; GridView gridview <span class="sy0">=</span> <span class="br0">&#40;</span>GridView<span class="br0">&#41;</span> findViewById<span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">dashboard_grid</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; gridview.<span class="me1">setAdapter</span><span class="br0">&#40;</span><span class="kw1">new</span> ImageAdapter<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; gridview.<span class="me1">setOnItemClickListener</span><span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Hack to disable GridView scrolling</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; gridview.<span class="me1">setOnTouchListener</span><span class="br0">&#40;</span><span class="kw1">new</span> OnTouchListener<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">boolean</span> onTouch<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> v, MotionEvent event<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> event.<span class="me1">getAction</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">==</span> MotionEvent.<span class="me1">ACTION_MOVE</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> onItemClick<span class="br0">&#40;</span>AdapterView<span class="sy0">&lt;?&gt;</span> parent, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> v, <span class="kw4">int</span> position, <span class="kw4">long</span> id<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Intent intent <span class="sy0">=</span> <span class="kw1">new</span> Intent<span class="br0">&#40;</span><span class="kw1">this</span>, MapActivity.<span class="kw1">class</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; intent.<span class="me1">putExtra</span><span class="br0">&#40;</span>EXTRA_MAP, ICONS<span class="br0">&#91;</span>position<span class="br0">&#93;</span>.<span class="me1">map</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; startActivity<span class="br0">&#40;</span>intent<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="kw1">static</span> <span class="kw1">class</span> LauncherIcon <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> text<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">final</span> <span class="kw4">int</span> imgId<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> map<span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> LauncherIcon<span class="br0">&#40;</span><span class="kw4">int</span> imgId, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> text, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> map<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">super</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">imgId</span> <span class="sy0">=</span> imgId<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">text</span> <span class="sy0">=</span> text<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">map</span> <span class="sy0">=</span> map<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="kw1">static</span> <span class="kw1">class</span> ImageAdapter <span class="kw1">extends</span> BaseAdapter <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Context</span></a> mContext<span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> ImageAdapter<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Context</span></a> c<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mContext <span class="sy0">=</span> c<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">int</span> getCount<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> ICONS.<span class="me1">length</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> LauncherIcon getItem<span class="br0">&#40;</span><span class="kw4">int</span> position<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">null</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">long</span> getItemId<span class="br0">&#40;</span><span class="kw4">int</span> position<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">static</span> <span class="kw1">class</span> ViewHolder <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> ImageView icon<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> TextView text<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create a new ImageView for each item referenced by the Adapter</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> getView<span class="br0">&#40;</span><span class="kw4">int</span> position, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> convertView, ViewGroup parent<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> v <span class="sy0">=</span> convertView<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ViewHolder holder<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>v <span class="sy0">==</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LayoutInflater vi <span class="sy0">=</span> <span class="br0">&#40;</span>LayoutInflater<span class="br0">&#41;</span> mContext.<span class="me1">getSystemService</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Context</span></a>.<span class="me1">LAYOUT_INFLATER_SERVICE</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v <span class="sy0">=</span> vi.<span class="me1">inflate</span><span class="br0">&#40;</span>R.<span class="me1">layout</span>.<span class="me1">dashboard_icon</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; holder <span class="sy0">=</span> <span class="kw1">new</span> ViewHolder<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; holder.<span class="me1">text</span> <span class="sy0">=</span> <span class="br0">&#40;</span>TextView<span class="br0">&#41;</span> v.<span class="me1">findViewById</span><span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">dashboard_icon_text</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; holder.<span class="me1">icon</span> <span class="sy0">=</span> <span class="br0">&#40;</span>ImageView<span class="br0">&#41;</span> v.<span class="me1">findViewById</span><span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">dashboard_icon_img</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v.<span class="me1">setTag</span><span class="br0">&#40;</span>holder<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; holder <span class="sy0">=</span> <span class="br0">&#40;</span>ViewHolder<span class="br0">&#41;</span> v.<span class="me1">getTag</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; holder.<span class="me1">icon</span>.<span class="me1">setImageResource</span><span class="br0">&#40;</span>ICONS<span class="br0">&#91;</span>position<span class="br0">&#93;</span>.<span class="me1">imgId</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; holder.<span class="me1">text</span>.<span class="me1">setText</span><span class="br0">&#40;</span>ICONS<span class="br0">&#91;</span>position<span class="br0">&#93;</span>.<span class="me1">text</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> v<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>For the sake of completeness, the map will be displayed using an activity using a WebView.</p>
<p><strong>Map layout: res/layout/map.xml</strong></p>
<div class="codesnip-container" >
<div class="xml codesnip" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;utf-8&quot;</span><span class="re2">?&gt;</span></span><br />
<span class="sc3"><span class="re1">&lt;LinearLayout</span> <span class="re0">xmlns:android</span>=<span class="st0">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp;<span class="re0">android:orientation</span>=<span class="st0">&quot;vertical&quot;</span><span class="re2">&gt;</span></span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;WebView</span> </span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:id</span>=<span class="st0">&quot;@+id/webview&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_width</span>=<span class="st0">&quot;fill_parent&quot;</span></span><br />
<span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">android:layout_height</span>=<span class="st0">&quot;fill_parent&quot;</span> <span class="re2">/&gt;</span></span><br />
&nbsp;<br />
<span class="sc3"><span class="re1">&lt;/LinearLayout<span class="re2">&gt;</span></span></span></div>
</div>
<p><strong>Map Activity: src/org/agafix/metro/MapActivity.java</strong></p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;"><span class="kw1">package</span> <span class="co2">org.agafix.metro</span><span class="sy0">;</span><br />
&nbsp;<br />
<span class="kw1">import</span> <span class="co2">android.app.Activity</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.content.res.Configuration</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.os.Bundle</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.webkit.WebSettings</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">android.webkit.WebView</span><span class="sy0">;</span><br />
&nbsp;<br />
<span class="kw1">public</span> <span class="kw1">class</span> MapActivity <span class="kw1">extends</span> Activity <span class="br0">&#123;</span><br />
&nbsp;<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> onCreate<span class="br0">&#40;</span><span class="kw1">final</span> Bundle savedInstanceState<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">super</span>.<span class="me1">onCreate</span><span class="br0">&#40;</span>savedInstanceState<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setContentView<span class="br0">&#40;</span>R.<span class="me1">layout</span>.<span class="me1">map</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; WebView webview <span class="sy0">=</span> <span class="br0">&#40;</span>WebView<span class="br0">&#41;</span> findViewById<span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">webview</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; WebSettings settings <span class="sy0">=</span> webview.<span class="me1">getSettings</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; webview.<span class="me1">setScrollBarStyle</span><span class="br0">&#40;</span>WebView.<span class="me1">SCROLLBARS_OUTSIDE_OVERLAY</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; webview.<span class="me1">setScrollbarFadingEnabled</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; settings.<span class="me1">setJavaScriptEnabled</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; settings.<span class="me1">setLoadWithOverviewMode</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; settings.<span class="me1">setUseWideViewPort</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; settings.<span class="me1">setBuiltInZoomControls</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> dim<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>getResources<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getConfiguration</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">orientation</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">==</span> Configuration.<span class="me1">ORIENTATION_PORTRAIT</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dim <span class="sy0">=</span> <span class="st0">&quot;height&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dim <span class="sy0">=</span> <span class="st0">&quot;width&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> map <span class="sy0">=</span> getIntent<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getStringExtra</span><span class="br0">&#40;</span>DashboardActivity.<span class="me1">EXTRA_MAP</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> imgSrc <span class="sy0">=</span> <span class="st0">&quot;&lt;img src=<span class="es0">\&quot;</span>&quot;</span> <span class="sy0">+</span> map <span class="sy0">+</span> <span class="st0">&quot;<span class="es0">\&quot;</span> &quot;</span> <span class="sy0">+</span> dim <span class="sy0">+</span> <span class="st0">&quot;=<span class="es0">\&quot;</span>100%<span class="es0">\&quot;</span>&gt;&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; webview.<span class="me1">loadDataWithBaseURL</span><span class="br0">&#40;</span><span class="st0">&quot;file:///android_asset/&quot;</span>, imgSrc,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;text/html&quot;</span>, <span class="st0">&quot;utf-8&quot;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp;<br />
<span class="br0">&#125;</span></div>
</div>
<p>Here are the results:</p>
<p><strong>Portrait mode</strong></p>
<p><a href="http://agafix.org/wp-content/uploads/2012/03/screenshot-1331638714781.png"><img class="alignnone  wp-image-1884" title="Portrait" src="http://agafix.org/wp-content/uploads/2012/03/screenshot-1331638714781.png" alt="" width="288" height="480" /></a></p>
<p><strong>Landscape mode</strong></p>
<p><a href="http://agafix.org/wp-content/uploads/2012/03/screenshot-13316387396211.png"><img class="alignnone  wp-image-1882" title="Landscape" src="http://agafix.org/wp-content/uploads/2012/03/screenshot-13316387396211.png" alt="" width="480" height="288" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://agafix.org/android-how-to-make-a-dashboard-using-a-gridview/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress CSS Sprites Generator For Posts Content</title>
		<link>http://agafix.org/wordpress-css-sprites-generator-for-posts-content/</link>
		<comments>http://agafix.org/wordpress-css-sprites-generator-for-posts-content/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 12:49:26 +0000</pubDate>
		<dc:creator>Fayçal</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Web & Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css sprites]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[page speed]]></category>
		<category><![CDATA[server load]]></category>
		<category><![CDATA[sprites]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://agafix.org/?p=1852</guid>
		<description><![CDATA[WordPress CSS Sprites Generator for posts content try to offer your pages better performance improvement by automatically creating for you corresponding CSS sprites for images in posts, pages and custom type posts which reduce by the way the amount of image files and then the amount of HTTP requests.]]></description>
			<content:encoded><![CDATA[<noscript><img class="aligncenter size-full wp-image-1853" title="WordPress CSS Sprites" src="http://agafix.org/wp-content/uploads/2012/02/CS-Preview.jpg" alt="WordPress CSS Sprites Generator For Posts Content" width="590" height="300" /></noscript><p>Are you after reducing your server load and speeding up your web pages? You’ve heard of CSS sprites before but you don’t know how they can bring improvements in your situation?</p>
<p>Well, simply put, each image on a web page is a separate HTTP request to the server, and experience shows that you can dramatically increase the performance of a page by combining multiple images or icons into a larger image sprite sheet. CSS is finally used to select the parts of the composite image to display at different places in the page.</p>
<p style="text-align: center;"> <img class="aligncenter size-full wp-image-1853 lazy" title="WordPress CSS Sprites" src="http://agafix.org/wp-content/plugins/wp-advanced-image-lazy-load/img/white.gif" alt="WordPress CSS Sprites Generator For Posts Content" width="590" height="300" data-original="http://agafix.org/wp-content/uploads/2012/02/CS-Preview.jpg" /></p>
<p><a class="buttonlink" target="_blank" href="http://codecanyon.net/item/wordpress-css-sprites-generator-for-posts-content/1535109?ref=fayway">Download WordPress CSS Sprites Generator For Posts Content</a></p>
<p>&nbsp;</p>
<h3>Plugin Description</h3>
<p>WordPress CSS Sprites Generator for posts content try to offer your pages this performance improvement by automatically creating for you corresponding CSS sprites for images in posts, pages and custom type posts which reduce by the way the amount of image files and then the amount of HTTP requests.</p>
<p>Family galleries, portfolios, news reports with a lot of small and medium photos, manual making of sprites for every post content can be a really tedious task. WordPress CSS Sprites Generator for posts content saves your bandwidth and provides an automated solution to replace all standard tag by the corresponding CSS sprites.</p>
<p>You can compare performance difference between those two pages having the same content with and without CSS Sprites:</p>
<ul>
<li>With CSS Sprites: <a href="../faytest/wordpress.labs/2012/01/national-geographic-photo-contest-2011/" rel="nofollow">http://agafix.org/faytest/wordpress.labs/2012/01/national-geographic-photo-contest-2011/</a></li>
<li>Without CSS Sprites: <a href="../faytest/wordpress.labs/2012/01/national-geographic-photo-contest-2011-no-sprites/" rel="nofollow">http://agafix.org/faytest/wordpress.labs/2012/01/national-geographic-photo-contest-2011-no-sprites/</a></li>
</ul>
<h3>Main Features:</h3>
<ul>
<li>Ready to use, global options are applied on existing and future posts/pages images</li>
<li>Customizing the number of images per sprite for every single post/page</li>
<li>Automation of the generated sprites quality compression for better optimization</li>
</ul>
<p>WP CSS Sprites Generator for posts content is available in the following languages:</p>
<ul>
<li>English</li>
<li>French</li>
</ul>
<h3>Requirements:</h3>
<p>PHP5 and GD support turned on (which is already the case for 99,99% if you are dealing with images)</p>
<h3>Limitations:</h3>
<ul>
<li>CSS Sprites generation <strong> WILL NOT WORK </strong> with <strong> PAGED </strong> galleries plugin, it’s not possible to automate this generation since every plugin handles the pagination on its own way</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://agafix.org/wordpress-css-sprites-generator-for-posts-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Warm-up Lifts [Android App]</title>
		<link>http://agafix.org/warm-up-lifts-android-app/</link>
		<comments>http://agafix.org/warm-up-lifts-android-app/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 22:56:27 +0000</pubDate>
		<dc:creator>Fahdos</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[gym]]></category>

		<guid isPermaLink="false">http://agafix.org/?p=1814</guid>
		<description><![CDATA[We proudly present you Taoufix's first Android app: Warm-up Lifts for gym users. Warm-up Lifts is a Weight calculator. By providing your target lifting weight and number of repetitions, this app helps you calculate your warm-up lifts weight and reps.]]></description>
			<content:encoded><![CDATA[<p>We proudly present you Taoufix&#8217;s first Android app: Warm-up Lifts for gym users.</p>
<p>Warm-up Lifts is a Weight calculator. By providing your target lifting weight and number of repetitions, this app helps you calculate your warm-up lifts weight and reps.</p>
<p style="text-align: center;"><a href="https://market.android.com/details?id=com.taoufix.warmup" target="_blank"><img class="aligncenter size-full wp-image-1823" title="Warm-up Lifts - Android Market" src="http://agafix.org/wp-content/uploads/2011/11/60_avail_market_logo2.png" alt="Warm-up Lifts - Android Market" width="260" height="60" /></a></p>
<h4>Features:</h4>
<ul>
<li>Calculation based on target lifting weight and reps.</li>
<li>Rest timer.</li>
<li>Check boxes to track your warm-up lifts.</li>
<li>Metric/Imperial settings (kg/lbs).</li>
<li>Alarm Sound/Vibrate options.</li>
</ul>
<p><img class="size-full wp-image-1815 alignleft" title="ss-480-0-0" src="http://agafix.org/wp-content/uploads/2011/11/ss-480-0-0.jpg" alt="" width="336" height="560" /><img class="size-full wp-image-1816 alignleft" title="ss-480-1-0" src="http://agafix.org/wp-content/uploads/2011/11/ss-480-1-0.png" alt="" width="336" height="560" /></p>
<h4>Permissions:</h4>
<p><strong>VIBRATE</strong>: option to vibrate when the timer is up.<br />
<strong>INTERNET,ACCESS_NETWORK_STATE</strong>: for ads.</p>
<p style="text-align: center;"><a href="https://market.android.com/details?id=com.taoufix.warmup" target="_blank"><img class="aligncenter size-full wp-image-1823" title="Warm-up Lifts - Android Market" src="http://agafix.org/wp-content/uploads/2011/11/60_avail_market_logo2.png" alt="Warm-up Lifts - Android Market" width="260" height="60" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://agafix.org/warm-up-lifts-android-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Advanced Image Lazy Load</title>
		<link>http://agafix.org/wordpress-advanced-image-lazy-load/</link>
		<comments>http://agafix.org/wordpress-advanced-image-lazy-load/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 20:41:12 +0000</pubDate>
		<dc:creator>Fayçal</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Web & Design]]></category>

		<guid isPermaLink="false">http://agafix.org/?p=1799</guid>
		<description><![CDATA[Your website has a lot of image intensive content and take up a lot of resources when loading up? Your boss and your clients consider the pages fluidity a serous matter? WordPress Advanced Image Lazy Load is the solution ...]]></description>
			<content:encoded><![CDATA[<p>Your website has a lot of image intensive content and take up a lot of resources when loading up? Your boss and your clients consider the pages fluidity a serous matter?</p>
<p>With WP Image Lazy Load plugin, no more need to sacrifice your beautiful images quality!</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-1800" title="Lazy_Load" src="http://agafix.org/wp-content/uploads/2011/11/preview.jpg" alt="WordPress Advanced Image Lazy Load" width="590" height="300" /></p>
<p>Family galleries, portfolios, news reports with a lot of photos. This plugin provides a better user experience by delaying the load of images in (especially long) web pages. Images outside of the visible portion of the page that the user is viewing wont be loaded before the user scrolls down to them.</p>
<p><a class="buttonlink" href="http://codecanyon.net/item/wordpress-advanced-image-lazy-load/704574?ref=fayway">Download WordPress Advanced Image Lazy Load</a></p>
<h4>Main Features:</h4>
<ul>
<ul>
<li>Ready to use, no action is needed for existing or future images on posts/pages</li>
<li>Improving images selection performance by customizing default selectors for several site sections</li>
<li>Cascading enabling/disabling levels :
<ul>
<li>Level 1 : Enable or disable for the whole website</li>
<li>Level 2 : Enable or disable for all posts and pages</li>
<li>Level 3 : Enable or disable for all images within a specific post or page</li>
<li>Level 4 : Enable or disable for a specific post&#8217;s or page&#8217;s image</li>
</ul>
</li>
<li>Customizing the loading of images</li>
<li>Possibility to also hack theme images that are not part posts/pages to be lazy loaded</li>
</ul>
</ul>
<p>WP Advanced Image Lazy Load is available in the following languages:</p>
<ul>
<ul>
<ul>
<li>English</li>
<li>French</li>
</ul>
</ul>
</ul>
<h4>Theme Hacks</h4>
<p>The plugin does its magic for you when it comes to images within posts or pages. If you want to reuse the same mechanism for your own theme&#8217;s images that are not part of posts body:</p>
<ul>
<ul>
<ul>
<li>Make sure your image belongs to the selector scope</li>
<li>Set the src attribute of the img tag with this function helper as value get_wp_lazy_loading_image()</li>
<li>Add a &#8220;is_lazy&#8221; attribute to the img tag</li>
<li>Add a &#8220;rel&#8221; attribute to the img tag with the the original image URI</li>
</ul>
</ul>
</ul>
<p><strong>Example</strong></p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">Instead of having<span class="sy0">:</span><br />
<span class="sy0">&lt;</span> img src<span class="sy0">=</span><span class="st0">&quot;&lt; ? php bloginfo(&#8216;template_directory&#8217;).get_post_meta(<span class="es4">$post-&gt;ID</span>, &quot;</span>thumb<span class="st0">&quot;, <span class="es4">$single</span> = true); ? &gt; &quot;</span> alt<span class="sy0">=</span><span class="st0">&quot;&lt; ? php the_title(); ? &gt; &quot;</span> <span class="sy0">/</span> <span class="sy0">&gt;</span></p>
<p>Use<span class="sy0">:</span><br />
<span class="sy0">&lt;</span> img src<span class="sy0">=</span><span class="st0">&quot;&lt; ? php echo get_wp_lazy_loading_image(); ? &gt; &quot;</span> is_lazy<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> rel<span class="sy0">=</span><span class="st0">&quot;&lt; ? php bloginfo(&#8216;template_directory&#8217;).get_post_meta(<span class="es4">$post-&gt;ID</span>, &quot;</span>thumb<span class="st0">&quot;, <span class="es4">$single</span> = true); ? &gt; &quot;</span> alt<span class="sy0">=</span><span class="st0">&quot;&lt; ? php the_title(); ? &gt; &quot;</span> <span class="sy0">/</span> <span class="sy0">&gt;</span></div>
</div>
<p>Please feel free to contact me if you have any further questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://agafix.org/wordpress-advanced-image-lazy-load/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show specific thumbnail while sharing on Google+ / Facebook</title>
		<link>http://agafix.org/show-specific-thumbnail-while-sharing-on-google-facebook/</link>
		<comments>http://agafix.org/show-specific-thumbnail-while-sharing-on-google-facebook/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 22:09:12 +0000</pubDate>
		<dc:creator>Fahdos</dc:creator>
				<category><![CDATA[Web & Design]]></category>

		<guid isPermaLink="false">http://agafix.org/?p=1722</guid>
		<description><![CDATA[The problem while sharing an article on google+ or Facebook is, either they show irrelevant thumbnail or nothing at all. To prevent this, you can force the exact thumbnail to be displayed.]]></description>
			<content:encoded><![CDATA[<p>The problem while sharing an article on google+ or Facebook is, either they show irrelevant thumbnail or nothing at all. To prevent this, you can force the exact thumbnail to be displayed.<br />
To do so, simply include an additional <meta> tag in the <head>.</p>
<h4>For Facebook</h4>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/meta.html"><span class="kw2">meta</span></a> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;og:image&quot;</span> <span class="kw3">content</span><span class="sy0">=</span><span class="st0">&quot;http://www.example.com/image.jpg&quot;</span><span class="sy0">/</span>&gt;</span></div>
</div>
<p><strong>Update:</strong> thanks to <a href="http://agafix.org/show-specific-thumbnail-while-sharing-on-google-facebook/comment-page-1/#comment-1037">ATJ</a></p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/meta.html"><span class="kw2">meta</span></a> property<span class="sy0">=</span><span class="st0">&quot;og:image&quot;</span> <span class="kw3">content</span><span class="sy0">=</span><span class="st0">&quot;http://www.example.com/image.jpg&quot;</span><span class="sy0">/</span>&gt;</span></div>
</div>
<h4>For Google+</h4>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/meta.html"><span class="kw2">meta</span></a> property<span class="sy0">=</span><span class="st0">&quot;og:image&quot;</span> <span class="kw3">content</span><span class="sy0">=</span><span class="st0">&quot;http://www.example.com/image.jpg&quot;</span><span class="sy0">/</span>&gt;</span></div>
</div>
<h4>Using Custom Fields ( WordPress )</h4>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">global</span> <span class="re0">$wp_query</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$postid</span> <span class="sy0">=</span> <span class="re0">$wp_query</span><span class="sy0">-&gt;</span><span class="me1">post</span><span class="sy0">-&gt;</span><span class="me1">ID</span><span class="sy0">;</span></p>
<p>&nbsp;<span class="sy1">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &lt;meta name=&quot;og:image&quot; content=&quot;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> get_post_meta<span class="br0">&#40;</span><span class="re0">$postid</span><span class="sy0">,</span> <span class="st_h">&#8216;thumbnail&#8217;</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&quot;/&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;meta property=&quot;og:image&quot; content=&quot;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> get_post_meta<span class="br0">&#40;</span><span class="re0">$postid</span><span class="sy0">,</span> <span class="st_h">&#8216;thumbnail&#8217;</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&quot;/&gt;</div>
</div>
<p>PS: where <strong>thumbnail</strong> is the custom fields&#8217; key</p>
<p>^^ we&#8217;re not done yet, this snippet works only with single pages ( post page ), which means you&#8217;ll get an empty <strong>content=&#8221;"</strong> on the ( Frond page, archives.php &#8230;. ), to avoid this all you need to do is to use the is_single function.</p>
<h3>Spicific thumbnail for spicific page types</h3>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span> <span class="kw1">if</span> <span class="br0">&#40;</span>is_single<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="sy1">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">global</span> <span class="re0">$wp_query</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$postid</span> <span class="sy0">=</span> <span class="re0">$wp_query</span><span class="sy0">-&gt;</span><span class="me1">post</span><span class="sy0">-&gt;</span><span class="me1">ID</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sy1">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &lt;meta name=&quot;og:image&quot; content=&quot;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> get_post_meta<span class="br0">&#40;</span><span class="re0">$postid</span><span class="sy0">,</span> <span class="st_h">&#8216;thumbnail&#8217;</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&quot;/&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;meta property=&quot;og:image&quot; content=&quot;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> get_post_meta<span class="br0">&#40;</span><span class="re0">$postid</span><span class="sy0">,</span> <span class="st_h">&#8216;thumbnail&#8217;</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&quot;/&gt;<br />
&nbsp; &nbsp; &nbsp; <br />
<span class="kw2">&lt;?php</span> <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><span class="sy1">?&gt;</span></p>
<p>&nbsp; &nbsp; &nbsp; &lt;meta name=&quot;og:image&quot; content=&quot;http://www.example.com/image.jpg&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;meta property=&quot;og:image&quot; content=&quot;http://www.example.com/image.jpg&quot; /&gt;</p>
<p><span class="kw2">&lt;?php</span> <span class="br0">&#125;</span> <span class="sy1">?&gt;</span></div>
</div>
<p>Have Fun ^^</p>
]]></content:encoded>
			<wfw:commentRss>http://agafix.org/show-specific-thumbnail-while-sharing-on-google-facebook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.888 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-18 10:27:29 -->

