package api.ashish.androidactionkit.actions;

import java.util.Map;

import android.content.Context;

public class BrightnessAction 
{
	/**
	 *  Android Context
	 */
	private Context context = null;

	/**
	 * Save the context onCreate
	 * @param context
	 */
	public void onCreate(Context context)
	{
		this.context = context;
	}

	/**
	 * Perform the Brightness action based on incoming data.
	 * 
	 * @param brightnessData
	 */
	public void perform(Map<String, Object> brightnessData)
	{
		// TODO Add different levels of Brightness. Gradient.
		// Change the Brightness
		String action = (String)brightnessData.get("action");
		if ( "HIGH".equals(action) )
		{
			android.provider.Settings.System.putInt(this.context.getContentResolver(),
					android.provider.Settings.System.SCREEN_BRIGHTNESS, 100);
		}
		else if ( "LOW".equals(action) )
		{
			android.provider.Settings.System.putInt(this.context.getContentResolver(),
					android.provider.Settings.System.SCREEN_BRIGHTNESS, 10);
		}
	}

	/**
	 * Events to be done on Destroy.
	 */
	public void onDestroy()
	{
		// Do nothing for now.
	}
}

@@ -95,16 +95,155 @@
 ntext;%0A%0A
+/**%0A * %0A * Action which changes the device brightness at different levels.%0A * %0A *  @author %22Ashish Kalbhor%22 %3Cashish.kalbhor@gmail.com%3E%0A */%0A
 public c

Update BrightnessAction