org.solovyev.android
Class Views

java.lang.Object
  extended by org.solovyev.android.Views

public final class Views
extends Object

User: serso Date: 2/2/13 Time: 5:57 PM


Nested Class Summary
static interface Views.ViewProcessor<V>
          Interface to process view.
 
Method Summary
static void addTab(android.content.Context context, android.widget.TabHost tabHost, String tabId, int tabCaptionId, Class<? extends android.app.Activity> activityClass)
          Method adds tab to the tabHost element
static void centerAndWrapTabsFor(android.widget.TabHost tabHost)
          Method center the tabs' contents on specified tabHost elements.
static int getPointerCountFromMotionEvent(android.view.MotionEvent event)
           
static int getScreenOrientation(android.app.Activity activity)
           
static float getXFromMotionEvent(android.view.MotionEvent event, int pointer)
           
static float getYFromMotionEvent(android.view.MotionEvent event, int pointer)
           
static boolean isLayoutSizeAtLeast(int size, android.content.res.Configuration configuration)
           
static void processViews(android.view.View view, Views.ViewProcessor<android.view.View> viewProcessor)
          Method runs through view and all it's children recursively and process them via viewProcessor
static
<T> void
processViewsOfType(android.view.View view, Class<T> viewClass, Views.ViewProcessor<T> viewProcessor)
          Method runs through view and all it's children recursively and process all instances of viewClass via viewProcessor
static int toPixels(android.util.DisplayMetrics dm, float dps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

processViews

public static void processViews(@Nonnull
                                android.view.View view,
                                @Nonnull
                                Views.ViewProcessor<android.view.View> viewProcessor)
Method runs through view and all it's children recursively and process them via viewProcessor

Parameters:
view - parent view to be processed, if view is ViewGroup then all it's children will be processed
viewProcessor - object which processes views

processViewsOfType

public static <T> void processViewsOfType(@Nonnull
                                          android.view.View view,
                                          @Nonnull
                                          Class<T> viewClass,
                                          @Nonnull
                                          Views.ViewProcessor<T> viewProcessor)
Method runs through view and all it's children recursively and process all instances of viewClass via viewProcessor

Parameters:
view - parent view to be processed, if view is ViewGroup then all it's children will be processed
viewClass - only instances of specified class will be processed
viewProcessor - object which processes views

centerAndWrapTabsFor

public static void centerAndWrapTabsFor(@Nonnull
                                        android.widget.TabHost tabHost)
Method center the tabs' contents on specified tabHost elements. This method should be invoked only for tabs with only text on them (and no image) This method checks some known devices/android versions/builds which don't support tab centering and do nothing for them

NOTE: be aware that this method doesn't cover all unsupported cases, for sure don't use this method

Parameters:
tabHost - tabHost element

addTab

public static void addTab(@Nonnull
                          android.content.Context context,
                          @Nonnull
                          android.widget.TabHost tabHost,
                          @Nonnull
                          String tabId,
                          int tabCaptionId,
                          @Nonnull
                          Class<? extends android.app.Activity> activityClass)
Method adds tab to the tabHost element

Parameters:
context - activity which users tabHost
tabHost - tabHost element
tabId - id of tab to be added
tabCaptionId - string id of tab to be added
activityClass - activity class to be invoked if the tab is pressed

toPixels

public static int toPixels(@Nonnull
                           android.util.DisplayMetrics dm,
                           float dps)

getScreenOrientation

public static int getScreenOrientation(@Nonnull
                                       android.app.Activity activity)

isLayoutSizeAtLeast

public static boolean isLayoutSizeAtLeast(int size,
                                          @Nonnull
                                          android.content.res.Configuration configuration)

getPointerCountFromMotionEvent

public static int getPointerCountFromMotionEvent(@Nonnull
                                                 android.view.MotionEvent event)

getXFromMotionEvent

public static float getXFromMotionEvent(@Nonnull
                                        android.view.MotionEvent event,
                                        int pointer)

getYFromMotionEvent

public static float getYFromMotionEvent(@Nonnull
                                        android.view.MotionEvent event,
                                        int pointer)


Copyright © 2014 se.solovyev. All Rights Reserved.