oak.util
Class OakUtils

java.lang.Object
  extended by oak.util.OakUtils

public class OakUtils
extends Object

Utility Class full of commonly used methods User: derek Date: 8/7/12 Time: 10:06 AM


Method Summary
static void changeFonts(android.view.View root, android.content.Context ctx, String typeface)
          Given a View, this method sets the Typeface on every TextView contained within that View
 android.text.SpannableString getFormattedText(android.content.Context context, String text, String typeface)
          Returns a formatted String to be used in places like an ActionBar
static android.graphics.Typeface getStaticTypeFace(android.content.Context context, String fontFileName)
           
static boolean isPackageInstalled(android.content.Context ctx, String packageName)
          Method that determines whether a specified package is installed on the device
static boolean isValidEmail(String email)
          Method to determine whether string is a valid email address
static boolean isValidPhone(String phone)
          Method to determine whether string is a valid phone number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStaticTypeFace

public static android.graphics.Typeface getStaticTypeFace(android.content.Context context,
                                                          String fontFileName)
Parameters:
context - Context for fetching Typeface
fontFileName - Typeface to fetch. Must match a typeface name in /assets/fonts
Returns:
Typeface

getFormattedText

public android.text.SpannableString getFormattedText(android.content.Context context,
                                                     String text,
                                                     String typeface)
Returns a formatted String to be used in places like an ActionBar

Parameters:
context - Context for fetching Typeface
text - text to be formatted
typeface - typeface to convert the text into.
Returns:
formatted String.

changeFonts

public static void changeFonts(android.view.View root,
                               android.content.Context ctx,
                               String typeface)
Given a View, this method sets the Typeface on every TextView contained within that View

Parameters:
root - View to check
ctx - Context for fetching Typeface
typeface - Typeface to set. Must match a typeface name in /assets/fonts

isPackageInstalled

public static boolean isPackageInstalled(android.content.Context ctx,
                                         String packageName)
Method that determines whether a specified package is installed on the device

Parameters:
ctx - Context for package manager
packageName - Target package name
Returns:
boolean of whether packageName is installed

isValidEmail

public static boolean isValidEmail(String email)
Method to determine whether string is a valid email address


isValidPhone

public static boolean isValidPhone(String phone)
Method to determine whether string is a valid phone number



Copyright © 2011-2014. All Rights Reserved.