Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,782,554 Members 36,588 Now Online
XDA Developers Android and Mobile Development Forum

[SDK] XFControls - Advanced UI SDK [UPDATED w/ Sense UI Example!]

Tip us?
 
joe_coolish
Old
#31  
Recognized Developer - OP
Thanks Meter 229
Posts: 753
Join Date: Mar 2010
Location: American Fork

 
DONATE TO ME
Quote:
Originally Posted by JarekG View Post
I fugure out how to add this, one problem that I'm having is to load the images.
When I pass image location, the image is not loading.
This line of code always has 0 for all options:
_imgRec = this.GetImageRec(ImageUri);

It looks like the GetImageRec can't return the actual size of the image...not sure why..I try different ways. The only way I didn't try is to load from resources.
Sorry it has taken me this long to reply.

The GetImageRec takes the ImageUri and does the following:
  • Takes the calling object and gets its assembly information
  • appends .Resources.<ImageUri value> to the retrieved assembly's namespace
  • calls myAssembly.GetManifestResourceStream(<string from process above>) and gets that image's rectangle

So, check the calling object's NameSpace and see if there is a Resources folder at the first level, then check to see if that URI is in that folder.

Alternatively, you could output the image to the local device in a folder called Resources that is located in the same directory as the executable

let me know if there is anything else i can help you with
 
Blade0rz
Old
#32  
Senior Member
Thanks Meter 33
Posts: 549
Join Date: Apr 2008
Location: Belfast
Quote:
Originally Posted by joe_coolish View Post
The code is my original work, but I did get ideas for implementation from various places on the internet (mainly math and physics sites believe it or not). I haven't seen the scrolling panel from the link you provided and I haven't downloaded the code to see what it does. The process might be similar, but I did not base my code off of it.

Feel free to browse the code and see if it works for your target devices. So far I haven't found a (touch screen) device on which the SDK doesn't work.

I'm also available to answer any questions for you

Let me know what you think!

The link to the source is in the 3rd post, or right here
http://code.google.com/p/xda-winmo-f...source/browse/
Nice work! Had a glance through the source. Looks very neat. I'm not very good with bitmap memory management in .NET CF - but I think you should be disposing of the background Bitmaps in the XFPanelBase literally as soon as you're done with them? Maybe not.

This looks like a great base SDK. I don't have the time to rewrite the basic stuff (e.g. A text input control) but I'm sure someone will create some great controls from this.
Device: Google Nexus 5
 
joe_coolish
Old
#33  
Recognized Developer - OP
Thanks Meter 229
Posts: 753
Join Date: Mar 2010
Location: American Fork

 
DONATE TO ME
Quote:
Originally Posted by Blade0rz View Post
Nice work! Had a glance through the source. Looks very neat. I'm not very good with bitmap memory management in .NET CF - but I think you should be disposing of the background Bitmaps in the XFPanelBase literally as soon as you're done with them? Maybe not.

This looks like a great base SDK. I don't have the time to rewrite the basic stuff (e.g. A text input control) but I'm sure someone will create some great controls from this.
Thank you!

The reason I don't dispose of the background bitmaps is because I use them as a cache. They get disposed when the panel is disposed, but while the panel is actively used, the background bitmaps are constantly in use.

This is because the double buffer is the fastest refresh technique on our phones and if you are constantly creating and disposing the bitmap, that creates more overhead than just keeping it in memory and manipulating the bitmap.

The bitmaps are also cached in the IXFItem. This is because the cost in time to render the image in the first place is pretty expensive. but rendering the cached image is super cheap. this allows for the really smooth scrolling and animation effects.
 
meltwater
Old
#34  
meltwater's Avatar
Recognized Developer
Thanks Meter 325
Posts: 2,066
Join Date: Jan 2009
Quote:
Originally Posted by joe_coolish View Post
Thank you!

The reason I don't dispose of the background bitmaps is because I use them as a cache. They get disposed when the panel is disposed, but while the panel is actively used, the background bitmaps are constantly in use.

This is because the double buffer is the fastest refresh technique on our phones and if you are constantly creating and disposing the bitmap, that creates more overhead than just keeping it in memory and manipulating the bitmap.

The bitmaps are also cached in the IXFItem. This is because the cost in time to render the image in the first place is pretty expensive. but rendering the cached image is super cheap. this allows for the really smooth scrolling and animation effects.
Can I just download your .net knowledge instead of the code!

There is such a steep learning curve when you have to step off the standard control path (which with compact framework, is quite often). Fingers crossed they've done a better job with Silverlight.

Will have a test of it today.
HTC Touch HD
____
* Energy 28244|Feb 19| 2.5.2012114 Cookie *
Radio: 1.17.25.09

Sense Wiki | Facebook Tab v1.6 | RSS Tab | SenseUtil | CHTwPictureFrame
Android-On-A-Shoestring



___
PayPal: if you enjoy the fb/RSS tab!
 
JarekG
Old
#35  
Senior Member
Thanks Meter 10
Posts: 134
Join Date: Feb 2008
Quote:
Originally Posted by joe_coolish View Post
Sorry it has taken me this long to reply.

The GetImageRec takes the ImageUri and does the following:
  • Takes the calling object and gets its assembly information
  • appends .Resources.<ImageUri value> to the retrieved assembly's namespace
  • calls myAssembly.GetManifestResourceStream(<string from process above>) and gets that image's rectangle

So, check the calling object's NameSpace and see if there is a Resources folder at the first level, then check to see if that URI is in that folder.

Alternatively, you could output the image to the local device in a folder called Resources that is located in the same directory as the executable

let me know if there is anything else i can help you with
I don't think that will work. Correct me if I'm wrong but if I save the files to Resources folder they also have to be set as Embedded Resource in order for the GetManifestResourceStream to get them. But if I save them on the fly, they will only be set as Content.
 
Sherri1023
Old
#36  
Account currently disabled
Thanks Meter 0
Posts: 183
Join Date: Oct 2010
Location: Chicago iL

 
DONATE TO ME
I am implementing it into my application as soon I research on this.
 
joe_coolish
Old
#37  
Recognized Developer - OP
Thanks Meter 229
Posts: 753
Join Date: Mar 2010
Location: American Fork

 
DONATE TO ME
Quote:
Originally Posted by JarekG View Post
I don't think that will work. Correct me if I'm wrong but if I save the files to Resources folder they also have to be set as Embedded Resource in order for the GetManifestResourceStream to get them. But if I save them on the fly, they will only be set as Content.
Whoa, I totally didn't see this comment! I should be more on top of things

If you save it directly to a folder called "Resources" then it can be loaded on the fly. Also, you can take a look at how I implemented Icons for my XDAFacebook App to see how I'm handling images downloaded from the internet.

Either way, you can load the images how ever you want and just render them in the ItemDraw() method of the IXFItem. If the image is added after the initial loading of the image, you need to clear the buffer for it to be drawn. This is accomplished by doing the following:

if(Buffer != null)
Buffer.Dispose();
Buffer = null;

That way the next time the item is drawn, the buffer is redrawn as well.

Quote:
Originally Posted by Sherri1023 View Post
I am implementing it into my application as soon I research on this.
Sweet! Glad to help in any way I can
 
tilleke
Old
#38  
Retired Recognized Developer
Thanks Meter 66
Posts: 600
Join Date: May 2008
Thanks for sharing Joe,

this SDK could indeed get handy in the future for a project I have.
Rgds,
Tilleke
-------------------------------------------------
-AndroidDreamer - watch your Dreambox in streaming.
See: http://forum.xda-developers.com/showthread.php?t=861145
-WMDreamRemote - control and watch your Dreambox remotely.
See: http://forum.xda-developers.com/showthread.php?t=635682
-To stay up-to-date with my programs/apps
See: http://www.tillekesoft.com
 
joe_coolish
Old
#39  
Recognized Developer - OP
Thanks Meter 229
Posts: 753
Join Date: Mar 2010
Location: American Fork

 
DONATE TO ME
Quote:
Originally Posted by tilleke View Post
Thanks for sharing Joe,

this SDK could indeed get handy in the future for a project I have.
Sweet! The SDK in this thread is pretty old. PM me for a newer one if you'd like!
The Following User Says Thank You to joe_coolish For This Useful Post: [ Click to Expand ]
 
needle2k
Old
(Last edited by needle2k; 10th March 2012 at 03:54 PM.)
#40  
needle2k's Avatar
Member
Thanks Meter 0
Posts: 58
Join Date: Feb 2009
Hi,

is there a way to add an own Icon to SenseItem / SenseMoreItems infront of text and center the text ?
since i only get them from Resource, also how can i add transparency to
XFPanelContainer() -> show form backgroundImage , im new to c# so a lttle help would be appreciated


thx

needle

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Moto G 4G Receives Official CyanogenMod 11 Love

When theMoto Gwas initially released to the world in November of last year,very few actually … more

Get Your Tasks Organized on Android Wear with Agenda Wear

Having a checklist of things you need to do is something we all can find useful at … more

Top 5 LG G3 MODs – XDA Developer TV

The LG G3 has been LG’s breakout hit of the summer. Using their knowledge frombuilding some … more

Make Your Calendar Widget Beautiful with Month

For some of us, summer vacation is alreadyover. For those getting ready to school, work, or … more