math entities list activities refactored + categories added

This commit is contained in:
Sergey Solovyev
2011-12-22 01:53:39 +04:00
parent 2db82269b2
commit 5233ba9e18
29 changed files with 1012 additions and 663 deletions

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
* For more information, please, contact se.solovyev@gmail.com
* or visit http://se.solovyev.org
*/
package org.solovyev.android.view.prefs;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TabHost;
import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
/**
* User: serso
* Date: 12/21/11
* Time: 11:54 PM
*/
public final class AndroidUtils {
// not intended for instantiation
private AndroidUtils() {
throw new AssertionError();
}
public static void centerAndWrapTabsFor(@NotNull TabHost tabHost) {
int tabCount = tabHost.getTabWidget().getTabCount();
for (int i = 0; i < tabCount; i++) {
final View view = tabHost.getTabWidget().getChildTabViewAt(i);
if ( view != null ) {
if (view.getLayoutParams().height > 0) {
// reduce height of the tab
view.getLayoutParams().height *= 0.8;
}
// get title text view
final View textView = view.findViewById(android.R.id.title);
if ( textView instanceof TextView) {
// just in case check the type
// center text
((TextView) textView).setGravity(Gravity.CENTER);
// wrap text
((TextView) textView).setSingleLine(false);
// explicitly set layout parameters
textView.getLayoutParams().height = ViewGroup.LayoutParams.FILL_PARENT;
textView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
}
}
}
}
}