package com.raizlabs.widget;

import android.content.res.Resources;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.widget.TextView;

public class ViewUtils {
	
	/**
	 * Returns the text for a given {@link textView} or else null if
	 * the textView is null or has no text within.
	 * @param textView The textView whose text should be returned
	 * @return the text within the textView or null
	 */
	public static CharSequence getTextOrNull(TextView textView) {
		if (textView == null) return null;
		
	    CharSequence text = textView.getText();
	    return !TextUtils.isEmpty(text) ? text : null;
	}
	
	/**
	 * Overload for #getTextOrNull(TextView) which returns a {@link String}
	 */
	public static String getStringTextOrNull(TextView textView) {
		return (String) getTextOrNull(textView);
	}

	/**
	 * Converts the given value in density-independent pixels into raw pixels
	 * with respect to the metrics of the given {@link View}
	 * @param dips The value in density-independent pixels
	 * @param view The {@link View} whose metrics to use to do the conversion
	 * @return The value in raw pixels
	 */
	public static float dipsToPixels(float dips, View view) {
		return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
				dips, view.getResources().getDisplayMetrics());
	}
	
	/**
	 * Converts the given value in density-independent pixels into raw pixels
	 * with respect to the metrics of the given {@link Resources}
	 * @param dips The value in density-independent pixels
	 * @param resources The {@link Resources} whose metrics to use to do the
	 * conversion
	 * @return The value in raw pixels
	 */
	public static float dipsToPixels(float dips, Resources resources) {
		return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
				dips, resources.getDisplayMetrics()); 
	}
	
	/**
	 * Converts the given value in density-independent pixels into raw pixels
	 * with respect to the given {@link DisplayMetrics}
	 * @param dips The value in density-independent pixels
	 * @param metrics The {@link DisplayMetrics} to use to do the conversion
	 * @return The value in raw pixels
	 */
	public static float dipsToPixels(float dips, DisplayMetrics metrics) {
		return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
				dips, metrics);
	}
}

@@ -688,24 +688,162 @@
 ;%0A%09%7D%0A%09%0A%09/**%0A
+%09 * Returns the a String with the text for a given %7B@link textView%7D %0A%09 * or else null if the textView is null or has no text within.%0A%09 * %0A
 %09 * Overload
@@ -847,16 +847,23 @@
 oad for 
+%7B@link 
 #getText
@@ -878,16 +878,17 @@
 extView)
+%7D
  which r
@@ -911,16 +911,149 @@
 String%7D%0A
+%09 * %0A%09 * @param textView The textView whose text should be returned%0A%09 * @return the a String of the text within the textView or null%0A
 %09 */%0A%09pu

Update ViewUtils Documentaion