[ANDROID] How to create a background shape with a double border / rounded border with a drop shadow

Usually we use <shape> objects in our .xml drawables meant for the backgrounds of buttons or other View objects.

I came across a situation where such object should appear as if it had been previously selected, and the graphic design choice was to put a thick rounded stroke around the container, while at the same time showing a hint of a dropped shadow.

Android <shape>’s only allow us to define rectangles, curve their <corners>, fill them up with <solid> colors, and to give them a single <stroke> around (dashed or solid). Therefore we can’t think of using 2 strokes.

Luckily drawable resources to be used as View backgrounds can be created using not just shapes, or bitmaps, but <layer-list>’s.

For creating the selected button below

android-how-to-make-background-with-2-borders-gubatron

this is what I did (after over an hour of playing around until I was happy, for some reason UI code takes me the longest to get it right, am I the only one?)

 

android-how-to-make-background-with-colored-border-and-shadow-with-shape

[ANDROID] How to set a custom title View on a DialogPreference extending class.

So you have a FooDialogPreference class which extends DialogPreference, and one of the things you’d like to do to it, is to change the Dialog’s title.

DialogPreference happens to be a bit of a bitch, you can’t just call getDialog() and start playing with its features before it is shown because the Dialog object is only created when DialogPreference.showDialog()is called.

However, there’s ONE entry point where you can make your magic happen.

If we look at the code of
DialogPreference.showDialog()
from the geniuses at the Android project, some gentle soul added a call to
onPrepareDialogBuilder(mBuilder); which is a method you’re meant to override.

Override this method, and then with the builder object you’ve received you will be able to call:

builder.setCustomTitle(myCustomTitleView);

However, there’s a couple of things you need to do:

  1. Instantiate your myCustomTitleView object on the implementation of your onBindDialogView, and keep the reference as a private property of your FooDialogPreference class.

  2. Make sure to detach it from it’s parent ViewGroup, otherwise you will get an IllegalStateException from android.view.ViewGroup.addViewInner() letting you know this view you’re trying to add, cannot have a parent.

This is what I had to do:

[pastacode lang=”java” manual=”final%20ViewGroup%20parent%20%3D%20(ViewGroup)%20myCustomTitleView.getParent()%3B%0Aparent.removeView(myCustomTitleView)%3B%0Abuilder.setCustomTitle(myCustomTitleView)%3B” message=”” highlight=”” provider=”manual”/]

That’s all folks!

OnePlus One unboxing

Charger and phone come in separate boxes.

Charger does not come with a cable. The phone does.

I guess it must be a statement for modularity and perhaps you get to buy only the accesories you need, if you need just a cable, you just buy the cable.

It’s a pretty power adapter, but not very functional, the contacts are not retractable like on many others.

The box was of really good quality material.

Custom shipping box for the phone, had a nice tab at the end of the rope used to open the box.

A white box, containing another box, good material again, but rather wasteful in my humble opinion.

Ta-da!

hopefully people will read the fine print and not get rid of this cover as it contains the devices IMEI and Serial number.

And this is the first Android device I have which I can’t open to remove the battery, so I’ll still be using my external battery for charging, hopefully the battery life will be as good as I expect as the phone didn’t come with a bunch of pre-loaded crap apps you can’t uninstall (dear AT&T and Samsung)

this material feels awesome, and the phone is pretty light.

and has a really cool looking USB cable.

I’m happy, now let’s hope I can find a rugged cover to protect it before it breaks, I tend to go running with my phones as I need gps tracking and like taking a picture here and there while I exercise.

Is there an Android manufacturer for intelligent adults?

I wish there were an Android phone in the market that:

– Let’s me have Admin privileges on my device out of the box (rooted by default)

– Does not start 20+ background processes I don’t want along with a lot of uninstallable apps that just eat on my resources and battery life.

for example:

what the fuck is “Samsung Watch ON”, “PageBuddyNotiSvc”, “Knox Notification Manager”, “Touch Wiz Home”, “Isis Wallet” (I only want my Bitcoin wallet and I can’t uninstall this shit) , Samsung Health crap (I already have my fitness apps, I’d love to uninstall your shit Samsung), Fucking “Lookout” (I don’t want this), Samsung Text-to-speech engine (it sucks, I don’t want it eating my resources), Samsung Push Service (I’ll never use that shit, let me uninstall it), KLMS Agent, Samsung Apps, AT&T Locker… etc. etc. I don’t want any of this shit, I bet my battery life would greatly be improved if none of this crap was running in my phone.

Let’s developers develop. And this one goes to Google (and Apple too), how are we supposed to make a change if you keep blocking access to non-OEM developers from accesing even basic things like SD Card storage, it’s a very dickhead move what Google did to developers accessing the SD Card after their KitKat update, now you can only write to a certain sandboxed folder (ignoring the fact users had already given us permission to write on the SD Card) and when your app is uninstalled files are deleted, also, files can’t be scanned by their multimedia scanner if they are on those folders, so if you have created an app that works with Video/Music you have to pretty much hack around and waste time dealing with their bullshit instead of focusing on making your app better.

How to avoid Android compilation/building issues – Setting up the Eclipse Buildpath correctly

This post is the product of about 48 hours of not being able to work on what I was supposed to be working because I had to deal with build issues in Eclipse.

Hopefully If you follow these steps you will be able to solve some of the issues you may be facing right now with your build.

Some of these issues are:
– Class not found errors, even though your app was built and uploaded to your device.
– R.java not being compiled.
– *.aidl interfaces not generating .java files.

Screen Shot 2013-05-20 at 6.09.53 PM
1. Make sure your project’s compiler is set (as of the current android release) to be Java 1.6 compliant.

If you work on several java projects outside of Android, you may probably need to work with Java 1.7 compiler specs and by mistake you may have set it as the default for all projects.

This may cause a lot of stuff to break on your Android projects, including the generation of .java files out of .aidl files.

Make sure your Android project is using Java 1.6 (which is sadly all of what Android supports as of this writing)

2. Make sure the .jars you want to export are CHECKED in your Java Build Path > Order and Export settings

Screen Shot 2013-05-20 at 6.24.00 PM

After updating my Android SDK tools last friday, I wasted a whole day trying to figure out why on earth my application was giving me runtime Class Not Found errors on classes that exist inside android-support-v4.jar, even though I had all my jars placed on the proper standard “libs/” directory in my project.

The culprit was that the checkboxes along the .jars in my Order and Export tab were not checked.

3. Make sure your source folders are placed in the right order in your Java Build Path > Order and Export settings

Screen Shot 2013-05-21 at 12.13.46 PM

That right order for me has been:
1. My source folders at the top.
2. The “gen” folder right after the source folders.
3. My jars and Android dependencies at the the bottom.
4. Make sure “Android Dependencies” and “Android Private Libraries” are all the way at the bottom. I found out having them before the .jars causes issues when you want to attach source code to your .jars, eclipse will try to browse the .class inside the “Android Private Libraries” which does not allow for source code attachments, therefore not letting you see the source code you’ve attached on the build settings.

3. Make sure the .jar dependencies you need are saved inside the libs/ folder in your project.

That’s all I have for you.
Clean and Rebuild.

My First Raspberry PI Project: DIY ARM Video Game Console.

I got everything on amazon, didn’t pay for shipping (Prime member):

raspberry_pi_diy_game_console_nes_snes_sega_n64

So far I bought:
Raspberry PI ($48)

Raspberry PI case ($14)

Power adapter ($2.25)

SNES-like Controller with USB jack ($10.75)

SanDisk SDHC 16GB class 6 (30mb/s) ($15)

I first intend to install Ubuntu ARM along with several video game console emulators for NES, SNES, SEGA, N64.

People at the Raspberry PI G+ Community have suggested instead to install arch linux and keep it light, I’ll go first for ubuntu since I know it well.

However I’m thinking that a more interesting option, given that it has an ARM processor is to install Android Jelly Bean on it and see if not only I can run game emulators on it, I’ll be running and testing FrostWire for Android on it.

Ever since I started developing FrostWire for Android I’ve thought that Android has everything in it to be a desktop operating system, maybe Raspberry PI’s will be the hardware I’ll use to prove my vision.

The idea is to end up with a nice tutorial on how to do this after I’m done so you can all do it. In the meantime I’ll keep posting updates.

[SOLVED] Kindle Fire HD not being detected by adb

OSX Setup Modify your adb_usb.ini

Open the ~/.android/adb_usb.ini file for editing and add

0x1949
0x0006

Save the file.

Note: Make sure there is only one entry per line. If the file does not exist, create the file and make sure you have the required Android SDK prerequisites configured. Restart the ADB server and confirm your Kindle Fire is detected

Open a terminal shell and execute:
[bash]adb kill-server
adb start-server
adb devices[/bash]

Locate Kindle Fire under the device list.

If your Kindle Fire is not being detected, you may need to reboot your computer or log out and log in for the changes to take effect.

Source: StackOverFlow

Get FrostWire 1.0 for Android

If you are getting an Android device this holiday season, we’ve spent the last 5 months building a must-have app for it.

Install FrostWire via Google Play.

Download the .apk installer.

Here’s a few things you can do with our completely re-designed and easy to use file sharing client and media player.

Improved search that integrates with the cloud.

Search results are faster than ever (instant in most cases) and not only you’ll have the most powerful BitTorrent Deep-Smart search[1] featured in previous versions, now FrostWire integrates with popular cloud services where content creators from all over the world share millions of legally available files[2].

The fastest downloads ever on any FrostWire for Android.

Be it on Wi-Fi, 3G or 4G you will experience in most cases downloads that are so fast you won’t even see the progress bar begin to move, by the time the transfer screen is opened the file will already be on your device. Specially when sharing files with other FrostWire devices (PCs too) on the same Wi-Fi network.

Share files between phones, tablets and computers without any networking know-how

You don’t have to use cables or become a computer guru to share files between your phones, tablets or computers. We’ve also been working on FrostWire for desktop so that when you open FrostWire on your phone or computer you will be able to see every device automatically.

Just make files publicly available by opening padlock icons next to the files and every device running FrostWire will be able to download and even stream music or video from each other.

This makes it great for groups of people (work, school, home, party), now you only need to take only one photo and share it with everybody else next time you’re all connected to the same Wi-Fi hotspot.

Sending documents, music, family videos between your mobile, tablet or computer has never been easier or faster, best of all it doesn’t even matter what Operating system you’re running, Windows, Mac, Linux, it doesn’t matter, all you need is FrostWire and a Wi-Fi router. It just works.

World class Gesture Based Music Player

We’ve redesigned our music player for simplicity and convenience. FrostWire’s music player is the world’s first gesture based music player, we built it thinking of drivers in mind, no need to take your eyes off the road if you want to switch songs or pause/resume playback.

On this version we’ve introduced a beautiful new design with a 3D presentation of the album art currently being played. It also has functionality to share or un-share the file you’re currently listening to without having to browse or find the file on your device.

Easier Navigation

We’ve recreated the navigation system on the application, it now has a beautiful animated and responsive slide in menu that will take you anywhere in the app, with room for future functionality, and if you’re playing a song you will be able to see the album art of the song being played.

We’ve also implemented a custom “Back” history handler so that you can backtrack perfectly the screens you’ve navigated as you used the app. You now have random access navigation through the menu, and sequential access navigation through the Android’s back key.

We’ve added new controls to let you instantly filter your own files and see which are being shared on the Wi-Fi network and which aren’t in just one touch.

Install FrostWire on your Android and spread the word, the more the merrier, it’s absolutely free.

Install FrostWire via Google Play.

Download the .apk installer.

[1] FrostWire's Deep-Smart search uses the most popular torrent indexing services to fetch torrent files, then FrostWire opens these files and searches for the individual files indexed by the torrent. As FrostWire searches it remembers the files it's seen in the past to make your next searches instantaneous.

[2] Only on YouTube.com in 2012 it was announced users had shared over 4 million Creative Commons licensed videos. FrostWire also taps on SoundCloud.com, the internet's biggest sound and music community of content creators, bands, singers and DJs that pay to make their music available for free to the SoundCloud community. If you share your content on YouTube or SoundCloud you're automatically available to the millions of FrostWire users on both Desktop and Android. Integration with more popular cloud services to come in the next releases.

When you download and install FrostWire you must agree that you will not use it for the purpose of copyright infringement otherwise the software won't work. FrostWire condemns copyright infringement. Downloading FrostWire does not constitute permission or a license for obtaining or distributing unauthorized files. It is illegal for you to distribute copyrighted files without permission. If you want to know about legal content you can download and distribute legally please visit FrostClick.com, Vodo.net, ClearBits.net, LegitTorrents.info and CreativeCommons.org

Kindle Fire HD Unboxing, First Impressions, Thoughts about iPad 3 and iPad Mini

Welcome to my unboxing of the new Kindle Fire HD. If you don’t know me, I’m an Android product designer and developer of FrostWire for Android, been an Android user for the last 3 years, as a developer I’ve had the opportunity to try lots of different Android phones and tablets and this year I got fed up with the shitty experience of all the Android tablets and became an iPad 3 owner.

I’ve bought this Kindle Fire HD hoping that Jeff Bezos and his teams have finally made an Android tablet experience not meant for early adopters or developers willing to withstand a shitty experience, a tablet taking into consideration the average Joe and what they expect a tablet to be like.

So far I can say that I’m not disappointed, join me on this unboxing and see if you agree with my first impressions of the product, my suspicions of why Apple had to go against Steve Jobs wishes and release a 7 inch iPad (iPad Mini) ended today as I tried the Kindle Fire HD.


First Kindle, or Amazon packaging I remember that comes in a black box, first statement of the experience. You don’t need a knife to open the package, just tear the band and you’re done, beautiful.


There it is, and you can’t help but pull that arrow, they play with our curiosity to force us to read the only physical instructions that come in the box, they didn’t waste any resources on printing warranty sheets or manuals.

Continue reading