com.stringsandints.inventium.khlrooster.widget
Class Widget

java.lang.Object
  extended by AppWidgetProvider
      extended by com.stringsandints.inventium.khlrooster.widget.Widget

public class Widget
extends AppWidgetProvider


Field Summary
static java.lang.String ADD_NOTE
           
private static int LAYOUTID
           
static java.lang.String MANAGE_REMINDERS
           
static java.lang.String SWITCH_SCREEN1
           
static java.lang.String SWITCH_SCREEN2
           
static java.lang.String TAKE_PICTURE
           
 
Constructor Summary
Widget()
           
 
Method Summary
static void buildUpdate(Context context, java.lang.String action)
          This method is called when the screen of the widget should change.
private static void changeColor(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, LessonHour[] hours)
          This method changes the textcolor of the widget lessons if the widgets don't occur this day.
 void onEnabled(Context context)
          This method is called when a widget is added to the home screen.
 void onReceive(Context context, Intent intent)
          This method is used to update the widget when the timeout occurs.
 void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
          This method is called to update the widget.
private static void setListeners(Context context)
          This methods sets the onclick listeners for the elements displayed on the screen
private static void updateScreenFromDatabase(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
          This method fetches the data from the database and puts it in the 2 text elements on the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SWITCH_SCREEN1

public static java.lang.String SWITCH_SCREEN1

SWITCH_SCREEN2

public static java.lang.String SWITCH_SCREEN2

ADD_NOTE

public static final java.lang.String ADD_NOTE
See Also:
Constant Field Values

MANAGE_REMINDERS

public static final java.lang.String MANAGE_REMINDERS
See Also:
Constant Field Values

TAKE_PICTURE

public static java.lang.String TAKE_PICTURE

LAYOUTID

private static int LAYOUTID
Constructor Detail

Widget

public Widget()
Method Detail

onEnabled

public void onEnabled(Context context)
This method is called when a widget is added to the home screen. It sets the listeners on the items and updates the screen with info from the database.


onUpdate

public void onUpdate(Context context,
                     AppWidgetManager appWidgetManager,
                     int[] appWidgetIds)
This method is called to update the widget. The Widget is called when the timeout set in widget.xml occurs.


onReceive

public void onReceive(Context context,
                      Intent intent)
This method is used to update the widget when the timeout occurs.


updateScreenFromDatabase

private static void updateScreenFromDatabase(Context context,
                                             AppWidgetManager appWidgetManager,
                                             int[] appWidgetIds)
This method fetches the data from the database and puts it in the 2 text elements on the screen.

Parameters:
context -
appWidgetManager -
appWidgetIds -

buildUpdate

public static void buildUpdate(Context context,
                               java.lang.String action)
This method is called when the screen of the widget should change. The action tells the method to which screen it should change.

Parameters:
context -
action: - the screen the method should switch to. Either WIDGET_SCREEN1 or WIDGET_SCREEN2

setListeners

private static void setListeners(Context context)
This methods sets the onclick listeners for the elements displayed on the screen

Parameters:
context -

changeColor

private static void changeColor(Context context,
                                AppWidgetManager appWidgetManager,
                                int[] appWidgetIds,
                                LessonHour[] hours)
This method changes the textcolor of the widget lessons if the widgets don't occur this day.

Parameters:
context -
appWidgetManager -
appWidgetIds -
hours: - array of 2 elements with the 2 next LessonHours