<?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>widget &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/widget/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Sat, 22 Oct 2022 07:27:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.sephiroth.it/wp-content/uploads/2019/03/cropped-sepy-big-32x32.png</url>
	<title>widget &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Android Wheel Widget</title>
		<link>https://blog.sephiroth.it/2012/01/28/android-wheel-widget/</link>
					<comments>https://blog.sephiroth.it/2012/01/28/android-wheel-widget/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Sat, 28 Jan 2012 19:11:35 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[widget]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1616</guid>

					<description><![CDATA[This is a simple widget I created as part of the Aviary Editor SDK for Android. It creates a wheel-like widet which can be scrolled in both directions. The idea was to replace the default slider widget and use a more &#8220;real world&#8221; component. Moreover if you&#8217;ll add the VIBRATE permission into your AndroidManifest.xml file &#8230; <a href="https://blog.sephiroth.it/2012/01/28/android-wheel-widget/" class="more-link">Continue reading <span class="screen-reader-text">Android Wheel Widget</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://blog.sephiroth.it/wp-content/uploads/2012/01/landing-phone-1.jpg"><img fetchpriority="high" decoding="async" class="alignleft size-medium wp-image-1617" title="landing-phone-1" src="https://blog.sephiroth.it/wp-content/uploads/2012/01/landing-phone-1-170x300.jpg" alt="" width="170" height="300" srcset="https://blog.sephiroth.it/wp-content/uploads/2012/01/landing-phone-1-170x300.jpg 170w, https://blog.sephiroth.it/wp-content/uploads/2012/01/landing-phone-1.jpg 270w" sizes="(max-width: 170px) 100vw, 170px" /></a></p>
<p>This is a simple widget I created as part of the <a title="Aviary Editor SDK" href="http://www.aviary.com/android" target="_blank" rel="noopener">Aviary Editor SDK</a> for Android. It creates a wheel-like widet which can be scrolled in both directions.<br />
The idea was to replace the default slider widget and use a more &#8220;real world&#8221; component.<br />
Moreover if you&#8217;ll add the VIBRATE permission into your AndroidManifest.xml file you&#8217;ll have also haptics feedback while the wheel is scrolling:<br />
[cce]&lt;uses-permission android:name=&#8221;android.permission.VIBRATE&#8221; /&gt;[/cce]</p>
<p>To include the wheel widget in the current layout, you should add in the layout xml this lines:</p>
<p>&lt;it.sephiroth.android.wheel.view.Wheel<br />
android:id=&#8221;@+id/wheel&#8221;<br />
xmlns:sephiroth=&#8221;http://schemas.android.com/apk/res/it.sephiroth.android.wheel&#8221;<br />
android:layout_width=&#8221;match_parent&#8221;<br />
android:layout_height=&#8221;match_parent&#8221;<br />
sephiroth:numRotations=&#8221;6&#8243;<br />
sephiroth:ticks=&#8221;28&#8243; /&gt;</p>
<p>Where <strong>numRotations</strong> is the max number of rotations the wheel can perform and <strong>ticks</strong> is the total number of ticks the wheel will display.</p>
<pre>Then in your <a href="http://developer.android.com/reference/android/app/Activity.html">activity</a> you can add a <strong>OnScrollListener</strong> listener to the wheel widget, in this way:

mWheel = (Wheel) findViewById( R.id.wheel );
mWheel.setOnScrollListener( new OnScrollListener() {

@Override
public void onScrollStarted( Wheel view, float value, int roundValue ) {
}

@Override
public void onScrollFinished( Wheel view, float value, int roundValue ) {
}

@Override
public void onScroll( Wheel view, float value, int roundValue ) {
}
} );

</pre>
<p>You can download the source at the <a href="https://github.com/sephiroth74/AndroidWheel" target="_blank" rel="noopener">gihub project page</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2012/01/28/android-wheel-widget/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Android Workspace Widget</title>
		<link>https://blog.sephiroth.it/2011/11/01/android-workspace-widget/</link>
					<comments>https://blog.sephiroth.it/2011/11/01/android-workspace-widget/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 01 Nov 2011 02:48:09 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[workspace]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1592</guid>

					<description><![CDATA[&#160; I was looking for an android widget similar to the launcher workspace widget ( the one used in almost all launchers ), but a bit more customizable and with the possibility to use an Adapter as content provider. So at the end I mixed&#160;portion of code from the android launcher Workspace widget, the Gallery &#8230; <a href="https://blog.sephiroth.it/2011/11/01/android-workspace-widget/" class="more-link">Continue reading <span class="screen-reader-text">Android Workspace Widget</span></a>]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="https://blog.sephiroth.it/wp-content/uploads/2011/11/device-2011-10-31-220138.png"><img decoding="async" class="size-thumbnail wp-image-1598 alignright" title="workspace_thumb" src="https://blog.sephiroth.it/wp-content/uploads/2011/11/workspace_thumb-150x150.png" alt="" width="150" height="150" /></a>I was looking for an android widget similar to the launcher workspace widget ( the one used in almost all launchers ), but a bit more customizable and with the possibility to use an Adapter as content provider. So at the end I mixed portion of code from the android launcher <a href="http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/packages/apps/Launcher2/src/com/android/launcher2/Workspace.java">Workspace</a> widget, the <a href="http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/frameworks/base/core/java/android/widget/Gallery.java&amp;q=Gallery.java&amp;exact_package=android&amp;type=cs">Gallery</a> widget and the <a href="http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/frameworks/base/core/java/android/widget/AbsListView.java&amp;q=AbsListView.java&amp;exact_package=android&amp;type=cs">AbsListView</a> widget.</p>
<p>Nothing particular tricky, just a combination of the 3 widgets in order to have the same sliding effect of the workspace ( using custom number of columns and rows ), but at the same time with an <strong>ArrayAdapter</strong> for creating views, and a little glow effect at start at the end of scrolling for creating the gingerbread style overscroll effect.</p>
<p>This is the source code: <strong><a href="https://blog.sephiroth.it/wp-content/uploads/2011/11/workspace.zip">workspace</a></strong></p>
<p>It&#8217;s just a first version, so it&#8217;s not really optimized&#8230;</p>
<p>The adapter used for creating this example looks like this:<br />
[cc]<br />
class WorkspaceAdapter extends ArrayAdapter<applicationinfo> {</p>
<p>	int screenId;<br />
	PackageManager pm;<br />
	private LayoutInflater mInflater;<br />
	private int nCellsPerScreen = 4;</p>
<p>	public WorkspaceAdapter( Context context, int textViewResourceId, List</applicationinfo><applicationinfo> objects ) {<br />
		super( context, textViewResourceId, objects );<br />
		screenId = textViewResourceId;<br />
		pm = context.getPackageManager();<br />
		nCellsPerScreen = context.getResources().getInteger( R.integer.config_portraitCells ) * context.getResources().getInteger( R.integer.config_portraitRows );<br />
		mInflater = (LayoutInflater) context.getSystemService( LAYOUT_INFLATER_SERVICE );<br />
	}</p>
<p>	@Override<br />
	public int getCount() {<br />
		return (int) Math.ceil( (double) super.getCount() / nCellsPerScreen );<br />
	}</p>
<p>	public int getRealCount() {<br />
		return super.getCount();<br />
	}</p>
<p>	@Override<br />
	public View getView( int position, View convertView, ViewGroup parent ) {</p>
<p>		if ( convertView == null ) {<br />
			convertView = mInflater.inflate( screenId, mWorkspace, false );<br />
			((CellLayout)convertView).setNumCols( nCellsPerScreen );<br />
		}</p>
<p>		CellLayout cell = (CellLayout) convertView;</p>
<p>		int index = position * nCellsPerScreen;<br />
		int realCount = getRealCount();</p>
<p>		for ( int i = 0; i < nCellsPerScreen; i++ ) {
			CellInfo cellInfo = cell.findVacantCell( 1, 1 );
			TextView text;

			if ( cellInfo == null ) {
				text = (TextView) cell.getChildAt( i );
			} else {
				text = (TextView) mInflater.inflate( R.layout.application_boxed, cell, false );
				CellLayout.LayoutParams lp = new CellLayout.LayoutParams( cellInfo.cellX, cellInfo.cellY, cellInfo.spanH,
						cellInfo.spanV );
				cell.addView( text, i, lp );
			}

			if ( index + i < realCount ) {
				ApplicationInfo appInfo = getItem( index + i );
				CharSequence label = appInfo.loadLabel( pm );
				Drawable bm = appInfo.loadIcon( pm );

				text.setCompoundDrawablesWithIntrinsicBounds( null, bm, null, null ); // new
				text.setText( label );
				text.setClickable( true );
				text.setFocusable( true );
				text.setVisibility( View.VISIBLE );
			} else {
				text.setVisibility( View.INVISIBLE );
			}
		}
		return convertView;
	}
}
[/cc]

&nbsp;

</applicationinfo></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2011/11/01/android-workspace-widget/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Widget: SlidingDrawer top to bottom</title>
		<link>https://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/</link>
					<comments>https://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 29 Mar 2011 16:36:59 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[sliding drawer]]></category>
		<category><![CDATA[widget]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1511</guid>

					<description><![CDATA[My android experiments continue&#8230; In the last project I had to implement a SlidingDrawer which comes from top and left. The problem was that the default widget does not support all the directions, but only bottom to top and right to left. That&#8217;s why I grabbed the SlidingDrawer source code and modified it in order &#8230; <a href="https://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/" class="more-link">Continue reading <span class="screen-reader-text">Widget: SlidingDrawer top to bottom</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://blog.sephiroth.it/wp-content/uploads/2011/03/device.png"><img decoding="async" class="size-thumbnail wp-image-1512 alignright" style="margin: 5px;" title="slidingdrawer screenshot" src="https://blog.sephiroth.it/wp-content/uploads/2011/03/device-150x150.png" alt="" width="150" height="150"/></a>My android experiments continue&#8230;<br />
In the last project I had to implement a <a href="http://developer.android.com/reference/android/widget/SlidingDrawer.html" target="_blank" rel="noopener">SlidingDrawer</a> which comes from top and left. The problem was that the default widget does not support all the directions, but only bottom to top and right to left.</p>
<p>That&#8217;s why I grabbed the SlidingDrawer source code and modified it in order to allow any direction ( defined as styleable in attrs.xml ). The only problem using custom styleable xml is that if you want to use this widget as library you need to include in the main project also the attrs.xml file as well.. a bit frustrating.</p>
<p>Anyway this is just the sample xml how to include the widget:<br />
<code lang="xml"><br />
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"><br />
<view class="it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer" xmlns:my="http://schemas.android.com/apk/res/it.sephiroth.demo.slider" android:id="@+id/drawer" my:direction="topToBottom" android:layout_width="fill_parent" android:layout_height="wrap_content" my:handle="@+id/handle" my:content="@+id/content"><br />
<include android:id="@id/content" layout="@layout/pen_content"><br />
<imageview android:id="@id/handle" android:layout_width="wrap_content" android:layout_height="40px" android:src="@drawable/sliding_drawer_handle_bottom"><br />
</imageview></include></view><br />
</relativelayout><br />
</code></p>
<p>Btw If you&#8217;re interest, here you can find the full source code of the widget including a running application:</p>
<p><strong><a href="https://blog.sephiroth.it/wp-content/uploads/2011/03/SlidingDrawerDemo1.zip">SlidingDrawer Demo</a>&nbsp;</strong></p>
<p>* Updated the code&nbsp;thanks to <i>Maciej Ciemięga</i>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/feed/</wfw:commentRss>
			<slash:comments>76</slash:comments>
		
		
			</item>
	</channel>
</rss>
