package com.RSen.Commandr.builtincommands;
import android.content.Context;
import android.provider.Settings;
import com.RSen.Commandr.R;
import com.RSen.Commandr.core.MostWantedCommand;
/**
* @author Ryan Senanayake
* Commandr for Google Now
* FlashlightCommand.java
* @version 1.0
* 5/28/14
*/
public class RotationLockOffCommand extends MostWantedCommand {
private static String TITLE;
private static String DEFAULT_PHRASE;
public RotationLockOffCommand(Context ctx) {
DEFAULT_PHRASE = ctx.getString(R.string.rotation_lock_off_phrase);
TITLE = ctx.getString(R.string.rotation_lock_off_title);
}
/**
* Execute this command (turn on flashlight)
*/
@Override
public void execute(Context context, String predicate) {
Settings.System.putInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1);
}
/**
* It is enabled if the phone has a flash feature
*/
@Override
public boolean isAvailable(Context context) {
return true;
}
@Override
public String getTitle() {
return TITLE;
}
@Override
public String getDefaultPhrase() {
return DEFAULT_PHRASE;
}
}