import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
+import android.os.SystemProperties;
import android.provider.Settings;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.CheckBox;
-
+import android.media.AudioManager;
import java.util.Calendar;
import java.text.DateFormatSymbols;
private MenuItem mToggleClockItem;
private ListView mAlarmsList;
private Cursor mCursor;
-
+ private static boolean volumeAdjustable;
private String mAm, mPm;
/**
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
-
+ volumeAdjustable=SystemProperties.getBoolean("ro.alarm.volume.adjustable",false);
+ AlarmClock.setVolumeControlForPlatform(this);
+
String[] ampm = new DateFormatSymbols().getAmPmStrings();
mAm = ampm[0];
mPm = ampm[1];
private void saveClockVisibility() {
mPrefs.edit().putBoolean(PREF_SHOW_CLOCK, getClockVisibility()).commit();
}
+ public static void setVolumeControlForPlatform(Activity context){
+ if (isVolumeAdjustable()){
+ context.setVolumeControlStream(AudioManager.STREAM_ALARM);
+ }else{
+ //Use default stream type,the default type use a fixed volume
+ context.setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
+ }
+ }
+ public static boolean isVolumeAdjustable(){
+ return volumeAdjustable;
+ }
}