Saturday, May 12, 2012

Automatic assignment of custom font in android activity

Custom font in Android is unfortunately not a theme question (correct me if I'm wrong) but is in fact quite simple to implement. In your common base activity overload the setContentView like this:
	public void setContentView(int layoutResId) {
		super.setContentView(layoutResId);
		
		View root = getWindow().getDecorView().getRootView();
		
		if (root instanceof ViewGroup) {
			Typeface font = Typeface.createFromAsset(getAssets(), "<<YOUR FONT FROM ASSETS>>");
			iterateKids(root, font);
		}
	}

	private void iterateKids(View view, Typeface font) {
		if (view instanceof TextView) {
			((TextView)view).setTypeface(font);
		} else if (view instanceof ViewGroup) {
			ViewGroup group = ((ViewGroup)view);
			for (int x=0; x<group.getChildCount(); x++) {
				iterateKids(group.getChildAt(x), font);
			}
		}
	}


it spends aboout 0.3 ~ 2ms on every child in hierarchy (on emulator) so as long as you optimize your layouts to be less than 100 elements a screen it's definitely okay.

Friday, February 17, 2012

Prayer wheel

Disscussion be here

Sunday, January 22, 2012

6

It's done, compiled and packaged but before publishing i'll have some more testing went live!
And yes, it's about synchronizing stuff and no it's not about google docs.
There's one small issue, but not critical so the public testing can start.  Fixed

What to expect? After migrating to the new phone, settings, practices and their counts automatically restore from nagas knows where.

Let's say if no complaints will show up till 28th of January - I'll publish what I currently have.

Important. Online sync works on devices with Android 2.2 and later. If you're lucky owner of 1.6, the tracker will work but no sync. Sorry.


http://dl.dropbox.com/u/137361/MeditationTracker.apk

But. It's not going to be an easy testing.
0. Write down your counters on paper. Hopefully this is the last time. But this is testing and it's 2012.

0.5 If your android version is lower than 2.2 the test is simple. Backup. Install. Run. It works. Done.

I'm using two scenarios after installing the new tracker:
1. First scenario: you've got only one android device
1.0 Common step. Make sure you're on wifi. Data set is not big but android will backup sooner when on wifi. Go to Settings-Accounts and Sync. Make sure you've got "Background data" and "Auto-sync" on.

1.1 Common step. Go to tracker options, change something (not really necessary but still) go back (this is when magic happens). Adding practice is also a good test (magic happens there too).
1.2 Common step. If you're lucky owner of adb you can do "adb shell bmgr backup com.meditationtracker" and then to make sure "adb shell bmgr run"

1.3 Common step. Normally you don't have adb so. Wait for the sync icon in notification panel above to appear and disappear.
1.4 Scary part. Go to Settings-Applications-Manage Applications. Find there Meditation Tracker. Go inside. Click "Erase data". That is the scary step - all your meditation tracker data is gone now. Now click "Uninstall". And let the tracker go.
1.5 Install new tracker again.
1.6 Open it and rejoice. Your practices have been restored.
1.7 Optional step. Complain of something going wrong.

2. Second scenario. Multiple devices with same google account. 
2.1 Read scenario 1.
2.2 If you have or had meditation tracker on your second device (not important one) do there step 1.4. It should be absolutely clean from tracker.
2.3 Do steps 1.0 to 1.3 on your main device.
2.4 Install new tracker on to the other device. Wait for synchronization to complete. Start tracker there. Rejoice seeing practices and counts from main device.
2.5 Optional step 1.7

I've done some UI clean-ups so normal "have a look if everything still works" test is also important.

Fun! Fun! Fun!

Wednesday, November 9, 2011

g+ page

I set up the Mediation Tracker page on google plus. Let's see which one of the three survives

https://plus.google.com/108254980995273600166

Sunday, September 4, 2011

Well, Blogger has no adequate discussion functionality thus I'll be moving somewhere else. You can contact me on google+, btw. Here: Clickety-click

Thursday, July 14, 2011

1021

We've got almost the round 1024 users of Mediation Tracker. Apart from personal pride it's a great sign that people do practice. Emaho!

Friday, May 27, 2011

notebook on the go usability

on a back of the notebook's screen lid I need a pocket where I can put an external hard drive and not worry about placing it somewhere and watching over it while I work on the go.