- Activate for smaller screens and older devices (Samsung Galaxy S Mini, 2.3.6 / API 10).
- Turn off debugging
This commit is contained in:
		| @@ -9,7 +9,6 @@ import android.view.View; | ||||
| import android.view.Window; | ||||
| import android.view.WindowManager; | ||||
|  | ||||
| //import com.triggertrap.seekarc.SeekArc; | ||||
| import net.frakbot.glowpadbackport.GlowPadView; | ||||
|  | ||||
| import java.util.Random; | ||||
| @@ -53,25 +52,6 @@ public class AlarmAlertActivity extends Activity { | ||||
|     public void onStart() { | ||||
|         super.onStart(); | ||||
|  | ||||
|         /* CANCEL SEEKARC | ||||
|         final SeekArc cancelArc = (SeekArc) findViewById(R.id.cancel_dialog_seekArc); | ||||
|         cancelArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() { | ||||
|             volatile Boolean seekFinished = false; | ||||
|             @Override | ||||
|             public void onProgressChanged(SeekArc seekArc, int progress, boolean fromUser) { | ||||
|                 if (progress > 98 && !seekFinished && fromUser) { | ||||
|                     AlarmService.dismissAlarm(alertActivity); | ||||
|                     seekFinished = true; | ||||
|                 } | ||||
|             } | ||||
|             @Override | ||||
|             public void onStartTrackingTouch(SeekArc seekArc) { | ||||
|             } | ||||
|             @Override | ||||
|             public void onStopTrackingTouch(SeekArc seekArc) { | ||||
|             } | ||||
|         }); | ||||
|         */ | ||||
|         final GlowPadView cancelGlowPad = (GlowPadView) findViewById(R.id.cancel_glowpad); | ||||
|         cancelGlowPad.setOnTriggerListener(new GlowPadView.OnTriggerListener() { | ||||
|             @Override | ||||
|   | ||||
| @@ -12,6 +12,7 @@ import android.graphics.BitmapFactory; | ||||
| import android.os.Build; | ||||
| import android.os.IBinder; | ||||
| import android.preference.PreferenceManager; | ||||
| import android.support.v4.app.NotificationCompat; | ||||
| import android.util.Log; | ||||
|  | ||||
| public class AlarmNotify extends Service { | ||||
| @@ -45,71 +46,70 @@ public class AlarmNotify extends Service { | ||||
|  | ||||
|         Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_grey); | ||||
|         final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | ||||
|         if (Build.VERSION.SDK_INT >= 11) { | ||||
|             final Notification.Builder notification = new Notification.Builder(this) | ||||
|                     .setContentTitle(getString(R.string.app_name)) | ||||
|                     .setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(gracePeriod))) | ||||
|                     .setSmallIcon(R.drawable.alarm_notification) | ||||
|                     .setLargeIcon(bm) | ||||
|                     .setOnlyAlertOnce(true) | ||||
|                     .setAutoCancel(false) | ||||
|                     .setPriority(Notification.PRIORITY_HIGH); | ||||
|         final NotificationCompat.Builder notification = new NotificationCompat.Builder(this) | ||||
|                 .setContentTitle(getString(R.string.app_name)) | ||||
|                 .setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(gracePeriod))) | ||||
|                 .setSmallIcon(R.drawable.alarm_notification) | ||||
|                 .setLargeIcon(bm) | ||||
|                 .setOnlyAlertOnce(true) | ||||
|                 .setAutoCancel(false) | ||||
|                 .setPriority(Notification.PRIORITY_HIGH); | ||||
|  | ||||
|             // Set up dismiss action | ||||
|             Intent cancellerIntent = new Intent(getBaseContext(), CancelGraceReceiver.class); | ||||
|             PendingIntent cancellerPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_GRACE_REQUEST, cancellerIntent, PendingIntent.FLAG_CANCEL_CURRENT); | ||||
|         // Set up dismiss action | ||||
|         Intent cancellerIntent = new Intent(getBaseContext(), CancelGraceReceiver.class); | ||||
|         PendingIntent cancellerPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_GRACE_REQUEST, cancellerIntent, PendingIntent.FLAG_CANCEL_CURRENT); | ||||
|  | ||||
|             // Cancel the grace period if the user clears the notification | ||||
|             notification.setDeleteIntent(cancellerPendingIntent); | ||||
|             // Allow the user to cancel by clicking a "Cancel" button | ||||
|             notification.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.notificationCancellation), cancellerPendingIntent); | ||||
|             // Allow the user to cancel by selecting the ContentText or ContentTitle | ||||
|             notification.setContentIntent(cancellerPendingIntent); | ||||
|         // Cancel the grace period if the user clears the notification | ||||
|         notification.setDeleteIntent(cancellerPendingIntent); | ||||
|         // Allow the user to cancel by clicking a "Cancel" button | ||||
|         notification.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.notificationCancellation), cancellerPendingIntent); | ||||
|         // Allow the user to cancel by selecting the ContentText or ContentTitle | ||||
|         notification.setContentIntent(cancellerPendingIntent); | ||||
|  | ||||
|  | ||||
|             nm.cancel(notifyID); | ||||
|             nm.notify(notifyID, notification.build()); | ||||
|         nm.cancel(notifyID); | ||||
|         nm.notify(notifyID, notification.build()); | ||||
|  | ||||
|             new Thread(new Runnable() { | ||||
|                 @Override | ||||
|                 public void run() { | ||||
|                     notificationRunning = true; | ||||
|                     int max = 1000; | ||||
|                     // Count in milliseconds for greater progress resolution | ||||
|                     int milliSecondsLeft = (int) ((AlarmService.graceEndTime - System.currentTimeMillis())); | ||||
|                     int gracePeriodMilliSeconds = gracePeriod * 60 * 1000; | ||||
|                     int progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds; | ||||
|         new Thread(new Runnable() { | ||||
|             @Override | ||||
|             public void run() { | ||||
|                 notificationRunning = true; | ||||
|                 int max = 1000; | ||||
|                 // Count in milliseconds for greater progress resolution | ||||
|                 int milliSecondsLeft = (int) ((AlarmService.graceEndTime - System.currentTimeMillis())); | ||||
|                 int gracePeriodMilliSeconds = gracePeriod * 60 * 1000; | ||||
|                 int progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds; | ||||
|  | ||||
|                     while (progress < max) { | ||||
|                         // Stop the thread if the notification is cancelled elsewhere | ||||
|                         if (!notificationRunning) { | ||||
|                             return; | ||||
|                         } | ||||
|                         int minutesLeft = (milliSecondsLeft / 1000) / 60; | ||||
|                         if (Build.VERSION.SDK_INT >= 11) { | ||||
|                             notification.setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(minutesLeft))); | ||||
|                             notification.setProgress(max, progress, false); | ||||
|                             // Update the notification | ||||
|                             nm.notify(notifyID, notification.build()); | ||||
|                         } | ||||
|                         // Prepare secondsLeft and progress for the next loop | ||||
|                         milliSecondsLeft = milliSecondsLeft - UPDATE_INTERVAL; | ||||
|                         // Multiply each int by 1000 for greater progress resolution | ||||
|                         progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds; | ||||
|                         //Log.d("AlarmNotify", "milliSecondsLeft is " + milliSecondsLeft + " and progress is " + progress + " (gracePeriodMilliSeconds is " + gracePeriodMilliSeconds + ")"); | ||||
|                         //Log.d("AlarmNotify", "progress is " + progress + "; max is "  + max); | ||||
|  | ||||
|                         // Sleep until we need to update again | ||||
|                         try { | ||||
|                             Thread.sleep(UPDATE_INTERVAL); | ||||
|                         } catch (InterruptedException e) { | ||||
|                             Log.d("AlarmNotify", "sleep failure: " + e.toString()); | ||||
|                         } | ||||
|                 while (progress < max) { | ||||
|                     // Stop the thread if the notification is cancelled elsewhere | ||||
|                     if (!notificationRunning) { | ||||
|                         return; | ||||
|                     } | ||||
|                     int minutesLeft = (milliSecondsLeft / 1000) / 60; | ||||
|                     if (Build.VERSION.SDK_INT >= 11) { | ||||
|                         notification.setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(minutesLeft))); | ||||
|                         notification.setProgress(max, progress, false); | ||||
|                         // Update the notification | ||||
|                         nm.notify(notifyID, notification.build()); | ||||
|                     } | ||||
|                     // Prepare secondsLeft and progress for the next loop | ||||
|                     milliSecondsLeft = milliSecondsLeft - UPDATE_INTERVAL; | ||||
|                     // Multiply each int by 1000 for greater progress resolution | ||||
|                     progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds; | ||||
|                     //Log.d("AlarmNotify", "milliSecondsLeft is " + milliSecondsLeft + " and progress is " + progress + " (gracePeriodMilliSeconds is " + gracePeriodMilliSeconds + ")"); | ||||
|                     //Log.d("AlarmNotify", "progress is " + progress + "; max is "  + max); | ||||
|  | ||||
|                     // Sleep until we need to update again | ||||
|                     try { | ||||
|                         Thread.sleep(UPDATE_INTERVAL); | ||||
|                     } catch (InterruptedException e) { | ||||
|                         Log.d("AlarmNotify", "sleep failure: " + e.toString()); | ||||
|                     } | ||||
|                     stopSelf(); // stop notification service | ||||
|                 } | ||||
|             }).start(); | ||||
|         } | ||||
| 		return super.onStartCommand(intent, flags, startId); | ||||
|                 stopSelf(); // stop notification service | ||||
|             } | ||||
|         }).start(); | ||||
|  | ||||
|         return super.onStartCommand(intent, flags, startId); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -16,8 +16,8 @@ import android.util.Log; | ||||
| import java.util.Calendar; | ||||
|  | ||||
| public class AlarmService extends Service { | ||||
|     private static final int SNOOZE_TIME = 1000*60;//60*5; // Snooze for 5 minutes if need be | ||||
|     private static final int ALERT_LIFE  = 1000*10;//60*2; // 2 minutes | ||||
|     private static final int SNOOZE_TIME = 1000*60*5; // Snooze for 5 minutes if need be | ||||
|     private static final int ALERT_LIFE  = 1000*60*1; // 2 minutes | ||||
|     private static AlarmManager alarmManager; | ||||
|     private static Intent alarmServiceIntent, alertActivityIntent, notifyIntent; | ||||
|     public  static Boolean alarmStarted = false; | ||||
|   | ||||
| @@ -77,7 +77,6 @@ public class GraceReceiver extends BroadcastReceiver { | ||||
|     } | ||||
|     private void sendText(Context context) { | ||||
|         SmsManager sms = SmsManager.getDefault(); | ||||
|         // TODO uncomment sendTextMessage | ||||
|         if (!MainActivity.HYPOALARM_DEBUG) { | ||||
|             sms.sendTextMessage(phoneNumber, null, message, null, null); | ||||
|         } | ||||
|   | ||||
| @@ -32,12 +32,14 @@ import android.view.inputmethod.InputMethodManager; | ||||
| import android.widget.AdapterView; | ||||
| import android.widget.ArrayAdapter; | ||||
| import android.widget.Button; | ||||
| import android.widget.CheckBox; | ||||
| import android.widget.CompoundButton; | ||||
| import android.widget.EditText; | ||||
| import android.widget.Spinner; | ||||
| import android.widget.Switch; | ||||
| import android.widget.TimePicker; | ||||
| import android.widget.Toast; | ||||
| import android.widget.ToggleButton; | ||||
|  | ||||
| import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | ||||
| @@ -69,7 +71,7 @@ public class MainActivity extends ActionBarActivity { | ||||
|     private static Button alarmTimeButton; | ||||
|     private static EditText messageButton; | ||||
|  | ||||
|     public static Boolean HYPOALARM_DEBUG = true; | ||||
|     public static Boolean HYPOALARM_DEBUG = false; | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
| @@ -92,7 +94,6 @@ public class MainActivity extends ActionBarActivity { | ||||
|         @Override | ||||
|         public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||
|                                  Bundle savedInstanceState) { | ||||
|  | ||||
|             View rootView = inflater.inflate(R.layout.fragment_main, container, false); | ||||
|             return rootView; | ||||
|         } | ||||
| @@ -104,7 +105,7 @@ public class MainActivity extends ActionBarActivity { | ||||
|  | ||||
|             // Allow alarm to activate | ||||
|             Boolean alarmActive = sharedPref.getBoolean(getString(R.string.AlarmActivePref), true); | ||||
|             Switch alarmActiveSwitch = (Switch) getActivity().findViewById(R.id.alarm_active_switch); | ||||
|             CompoundButton alarmActiveSwitch = (CompoundButton) getActivity().findViewById(R.id.alarm_active_switch); | ||||
|             alarmActiveSwitch.setChecked(alarmActive); | ||||
|             alarmActiveSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | ||||
|                 @Override | ||||
| @@ -145,6 +146,7 @@ public class MainActivity extends ActionBarActivity { | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|  | ||||
|             // Set alarm time | ||||
|             String defaultTimeStr = "09:00"; | ||||
|             String alarmTimeStr = verifyTimeString(sharedPref.getString(getString(R.string.AlarmTimePref), defaultTimeStr)); | ||||
| @@ -512,18 +514,13 @@ public class MainActivity extends ActionBarActivity { | ||||
|     } | ||||
|  | ||||
|     public static String formattedTime(Context context, Calendar cal) { | ||||
|         String pattern; | ||||
|         if (Build.VERSION.SDK_INT >= 18) { | ||||
|             String skeleton = DateFormat.is24HourFormat(context) ? "EHm" : "Ehma"; | ||||
|             pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton); | ||||
|         SimpleDateFormat print; | ||||
|         if (DateFormat.is24HourFormat(context)) { | ||||
|             print = new SimpleDateFormat("E HH:mm"); | ||||
|         } else { | ||||
|             pattern = "EHm"; | ||||
|             print = new SimpleDateFormat("E hh:mm a"); | ||||
|         } | ||||
|         return (String) DateFormat.format(pattern, cal); | ||||
|     } | ||||
|     public static String debugDate(Calendar cal) { | ||||
|         SimpleDateFormat print = new SimpleDateFormat("dd-MM-yyyy HH:mm:ssZ"); | ||||
|         return print.format(cal.getTime()); | ||||
|         return (String) print.format(cal.getTime()); | ||||
|     } | ||||
|  | ||||
|     public static int GracePeriodToMinutes(String gracePeriod) { | ||||
| @@ -569,6 +566,11 @@ public class MainActivity extends ActionBarActivity { | ||||
|         return remMinutes + minStr; | ||||
|     } | ||||
|  | ||||
|     public static String debugDate(Calendar cal) { | ||||
|         SimpleDateFormat print = new SimpleDateFormat("dd-MM-yyyy HH:mm:ssZ"); | ||||
|         return print.format(cal.getTime()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onActivityResult(int requestCode, int resultCode, Intent data) { | ||||
|         super.onActivityResult(requestCode, resultCode, data); | ||||
|   | ||||
| @@ -12,6 +12,7 @@ import android.graphics.BitmapFactory; | ||||
| import android.os.Build; | ||||
| import android.os.IBinder; | ||||
| import android.preference.PreferenceManager; | ||||
| import android.support.v4.app.NotificationCompat; | ||||
| import android.text.format.DateFormat; | ||||
| import android.util.Log; | ||||
|  | ||||
| @@ -47,30 +48,29 @@ public class PreAlarmNotify extends Service { | ||||
|  | ||||
|         Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_grey); | ||||
|         final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | ||||
|         if (Build.VERSION.SDK_INT >= 11) { | ||||
|             final Notification.Builder notification = new Notification.Builder(this) | ||||
|                     .setContentTitle(getString(R.string.preNotificationTitle)) | ||||
|                     .setContentText(alarmTimeStr) | ||||
|                     .setSmallIcon(R.drawable.alarm_notification) | ||||
|                     .setLargeIcon(bm) | ||||
|                     .setOnlyAlertOnce(true) | ||||
|                     .setAutoCancel(false) | ||||
|                     .setPriority(Notification.PRIORITY_HIGH); | ||||
|         final NotificationCompat.Builder notification = new NotificationCompat.Builder(this) | ||||
|                 .setContentTitle(getString(R.string.preNotificationTitle)) | ||||
|                 .setContentText(alarmTimeStr) | ||||
|                 .setSmallIcon(R.drawable.alarm_notification) | ||||
|                 .setLargeIcon(bm) | ||||
|                 .setOnlyAlertOnce(true) | ||||
|                 .setAutoCancel(false) | ||||
|                 .setPriority(Notification.PRIORITY_HIGH); | ||||
|  | ||||
|             // Set up dismiss action | ||||
|             Intent cancelAlarmIntent = new Intent(getBaseContext(), CancelAlarmReceiver.class); | ||||
|             PendingIntent cancelAlarmPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_ALARM_REQUEST, cancelAlarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); | ||||
|         // Set up dismiss action | ||||
|         Intent cancelAlarmIntent = new Intent(getBaseContext(), CancelAlarmReceiver.class); | ||||
|         PendingIntent cancelAlarmPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_ALARM_REQUEST, cancelAlarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); | ||||
|  | ||||
|             // Cancel the grace period if the user clears the notification | ||||
|             notification.setDeleteIntent(cancelAlarmPendingIntent); | ||||
|             // Allow the user to cancel by clicking a "Cancel" button | ||||
|             notification.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.preNotificationCancellation), cancelAlarmPendingIntent); | ||||
|             // Allow the user to cancel by selecting the ContentText or ContentTitle | ||||
|             notification.setContentIntent(cancelAlarmPendingIntent); | ||||
|         // Cancel the grace period if the user clears the notification | ||||
|         notification.setDeleteIntent(cancelAlarmPendingIntent); | ||||
|         // Allow the user to cancel by clicking a "Cancel" button | ||||
|         notification.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.preNotificationCancellation), cancelAlarmPendingIntent); | ||||
|         // Allow the user to cancel by selecting the ContentText or ContentTitle | ||||
|         notification.setContentIntent(cancelAlarmPendingIntent); | ||||
|  | ||||
|         nm.cancel(this.preNotifyID); | ||||
|         nm.notify(this.preNotifyID, notification.build()); | ||||
|  | ||||
|             nm.cancel(this.preNotifyID); | ||||
|             nm.notify(this.preNotifyID, notification.build()); | ||||
|         } | ||||
|         return super.onStartCommand(intent, flags, startId); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										11
									
								
								HypoAlarm/src/main/res/layout-v14/activeswitch.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								HypoAlarm/src/main/res/layout-v14/activeswitch.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
|  | ||||
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" android:layout_height="match_parent"> | ||||
|     <Switch | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:id="@+id/alarm_active_switch" | ||||
|         android:layout_column="1" | ||||
|         android:layout_gravity="left" /> | ||||
| </FrameLayout> | ||||
							
								
								
									
										11
									
								
								HypoAlarm/src/main/res/layout/activeswitch.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								HypoAlarm/src/main/res/layout/activeswitch.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
|  | ||||
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" android:layout_height="match_parent"> | ||||
|     <ToggleButton | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:id="@+id/alarm_active_switch" | ||||
|         android:layout_column="1" | ||||
|         android:layout_gravity="left" /> | ||||
| </FrameLayout> | ||||
| @@ -6,68 +6,6 @@ | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".AlarmNotificationActivity"> | ||||
|     <!-- | ||||
|     xmlns:seekarc="http://schemas.android.com/apk/res-auto" | ||||
|     android:layout_gravity="center" | ||||
|     android:background="#000000" | ||||
|     --> | ||||
|     <!-- SEEKARC | ||||
|             <com.triggertrap.seekarc.SeekArc | ||||
|                 android:id="@+id/cancel_dialog_seekArc" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:padding="100dp" | ||||
|                 android:layout_centerHorizontal="true" | ||||
|                 android:layout_centerVertical="true" | ||||
|                 seekarc:thumb="@drawable/ic_launcher" | ||||
|                 seekarc:clockwise="false" | ||||
|                 seekarc:rotation="0" | ||||
|                 seekarc:startAngle="35" | ||||
|                 seekarc:sweepAngle="295" | ||||
|                 seekarc:arcWidth="10dp" | ||||
|                 seekarc:progressWidth="20dp" | ||||
|                 seekarc:roundEdges="true" | ||||
|                 seekarc:touchInside="true" /> | ||||
|  | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:textAppearance="?android:attr/textAppearanceLarge" | ||||
|                 android:text="HypoAlarm!" | ||||
|                 android:id="@+id/cancel_dialog_title" | ||||
|                 android:layout_centerHorizontal="true" | ||||
|                 android:layout_centerVertical="true" | ||||
|                 android:layout_marginTop="25dp"  /> | ||||
|     --> | ||||
|     <!-- BUTTON | ||||
|             <ImageView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/cancel_dialog_imageView" | ||||
|                 android:src="@drawable/hypoalarm" | ||||
|                 android:layout_alignParentTop="true" | ||||
|                 android:layout_centerHorizontal="true" | ||||
|                 android:layout_marginTop="60dp"/> | ||||
|  | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:textAppearance="?android:attr/textAppearanceLarge" | ||||
|                 android:text="HypoAlarm!" | ||||
|                 android:id="@+id/cancel_dialog_title" | ||||
|                 android:layout_below="@+id/cancel_dialog_imageView" | ||||
|                 android:layout_centerHorizontal="true" | ||||
|                 android:layout_marginTop="25dp"  /> | ||||
|  | ||||
|             <Button | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="I'm awake" | ||||
|                 android:id="@+id/cancel_dialog_button" | ||||
|                 android:layout_marginTop="25dp" | ||||
|                 android:layout_below="@+id/cancel_dialog_title" | ||||
|                 android:layout_centerHorizontal="true" /> | ||||
|     --> | ||||
|  | ||||
|     <TextView | ||||
|         android:layout_width="wrap_content" | ||||
| @@ -77,9 +15,8 @@ | ||||
|         android:id="@+id/cancel_dialog_title" | ||||
|         android:layout_alignParentTop="true" | ||||
|         android:layout_centerHorizontal="true" | ||||
|         android:layout_marginTop="60dp" /> | ||||
|         android:layout_marginTop="@dimen/alarm_widget_vertical_margin" /> | ||||
|  | ||||
|     <!--net.sebastianopoggi.ui.GlowPadBackport.GlowPadView--> | ||||
|     <net.frakbot.glowpadbackport.GlowPadView | ||||
|         android:id="@+id/cancel_glowpad" | ||||
|         android:layout_width="fill_parent" | ||||
|   | ||||
| @@ -1,160 +1,164 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
|  | ||||
| <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="fill_parent" | ||||
|     android:layout_height="fill_parent" | ||||
|     android:stretchColumns="0" | ||||
|     android:shrinkColumns="1" | ||||
|     android:dividerPadding="10dp" | ||||
|     android:paddingLeft="@dimen/activity_horizontal_margin" | ||||
|     android:paddingRight="@dimen/activity_horizontal_margin" | ||||
|     android:paddingTop="@dimen/activity_vertical_margin" | ||||
|     android:paddingBottom="@dimen/activity_vertical_margin"> | ||||
|     android:fillViewport="true" > | ||||
|  | ||||
|     <TableRow | ||||
|     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         android:layout_height="fill_parent" | ||||
|         android:stretchColumns="0" | ||||
|         android:shrinkColumns="1" | ||||
|         android:dividerPadding="10dp" | ||||
|         android:paddingLeft="@dimen/activity_horizontal_margin" | ||||
|         android:paddingRight="@dimen/activity_horizontal_margin" | ||||
|         android:paddingTop="@dimen/activity_vertical_margin" | ||||
|         android:paddingBottom="@dimen/activity_vertical_margin"> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/description" | ||||
|             android:text="@string/description" | ||||
|             android:layout_span="2" | ||||
|             android:layout_column="0" /> | ||||
|     </TableRow> | ||||
|         <TableRow | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/description" | ||||
|                 android:text="@string/description" | ||||
|                 android:layout_span="2" | ||||
|                 android:layout_column="0" /> | ||||
|         </TableRow> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/alarm_active_text" | ||||
|             android:id="@+id/alarm_active_text" | ||||
|             android:layout_column="0" /> | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|  | ||||
|         <Switch | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/alarm_active_switch" | ||||
|             android:layout_column="1" | ||||
|             android:layout_gravity="left" /> | ||||
|     </TableRow> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/alarm_active_text" | ||||
|                 android:id="@+id/alarm_active_text" | ||||
|                 android:layout_column="0" /> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/alarm_time_text" | ||||
|             android:id="@+id/alarm_time_text" | ||||
|             android:layout_column="0" /> | ||||
|             <include | ||||
|                 layout="@layout/activeswitch" /> | ||||
|         </TableRow> | ||||
|  | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/alarm_time_text" | ||||
|                 android:id="@+id/alarm_time_text" | ||||
|                 android:layout_column="0" /> | ||||
|  | ||||
|  | ||||
|         <Button | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/alarm_time" | ||||
|             android:gravity="center_vertical" | ||||
|             style="?android:attr/borderlessButtonStyle" | ||||
|             android:layout_column="1" /> | ||||
|     </TableRow> | ||||
|             <Button | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/alarm_time" | ||||
|                 android:gravity="center_vertical" | ||||
|                 style="?android:attr/borderlessButtonStyle" | ||||
|                 android:layout_column="1" /> | ||||
|         </TableRow> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/grace_period_text" | ||||
|             android:id="@+id/grace_period_text" | ||||
|             android:layout_column="0" /> | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/grace_period_text" | ||||
|                 android:id="@+id/grace_period_text" | ||||
|                 android:layout_column="0" /> | ||||
|  | ||||
|         <Spinner | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/grace_period" | ||||
|             android:entries="@array/grace_period_array" | ||||
|             android:gravity="left" | ||||
|             android:layout_column="1" /> | ||||
|     </TableRow> | ||||
|             <Spinner | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/grace_period" | ||||
|                 android:entries="@array/grace_period_array" | ||||
|                 android:gravity="left" | ||||
|                 android:layout_column="1" /> | ||||
|         </TableRow> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/phone_number_text" | ||||
|             android:id="@+id/phone_number_text" | ||||
|             android:layout_column="0" /> | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/phone_number_text" | ||||
|                 android:id="@+id/phone_number_text" | ||||
|                 android:layout_column="0" /> | ||||
|  | ||||
|         <EditText | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/phone_number" | ||||
|             android:inputType="phone" | ||||
|             android:focusable="false" | ||||
|             android:focusableInTouchMode="false" | ||||
|             android:clickable="true" | ||||
|             android:gravity="left" | ||||
|             android:layout_column="1" /> | ||||
|     </TableRow> | ||||
|             <EditText | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/phone_number" | ||||
|                 android:inputType="phone" | ||||
|                 android:focusable="false" | ||||
|                 android:focusableInTouchMode="false" | ||||
|                 android:clickable="true" | ||||
|                 android:gravity="left" | ||||
|                 android:layout_column="1" /> | ||||
|         </TableRow> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/ringtone_text" | ||||
|             android:id="@+id/ringtone_text" | ||||
|             android:layout_column="0" /> | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/ringtone_text" | ||||
|                 android:id="@+id/ringtone_text" | ||||
|                 android:layout_column="0" /> | ||||
|  | ||||
|         <Button | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/ringtone" | ||||
|             android:focusable="false" | ||||
|             android:focusableInTouchMode="false" | ||||
|             android:clickable="true" | ||||
|             android:gravity="left" | ||||
|             android:layout_column="1" /> | ||||
|     </TableRow> | ||||
|             <Button | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/ringtone" | ||||
|                 android:focusable="false" | ||||
|                 android:focusableInTouchMode="false" | ||||
|                 android:clickable="true" | ||||
|                 android:gravity="left" | ||||
|                 android:layout_column="1" /> | ||||
|         </TableRow> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/message_text" | ||||
|             android:id="@+id/message_text" | ||||
|             android:layout_span="2" | ||||
|             android:layout_column="0" /> | ||||
|     </TableRow> | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/message_text" | ||||
|                 android:id="@+id/message_text" | ||||
|                 android:layout_span="2" | ||||
|                 android:layout_column="0" /> | ||||
|         </TableRow> | ||||
|  | ||||
|     <TableRow | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent"> | ||||
|         <EditText | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:id="@+id/message" | ||||
|             android:focusable="false" | ||||
|             android:focusableInTouchMode="false" | ||||
|             android:clickable="true" | ||||
|             android:layout_span="2" | ||||
|             android:layout_column="0" /> | ||||
|     </TableRow> | ||||
| </TableLayout> | ||||
|         <TableRow | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_width="fill_parent" | ||||
|             android:layout_height="fill_parent"> | ||||
|             <EditText | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:id="@+id/message" | ||||
|                 android:focusable="false" | ||||
|                 android:focusableInTouchMode="false" | ||||
|                 android:clickable="true" | ||||
|                 android:layout_span="2" | ||||
|                 android:layout_column="0" /> | ||||
|         </TableRow> | ||||
|  | ||||
|     </TableLayout> | ||||
|  | ||||
| </ScrollView> | ||||
							
								
								
									
										33
									
								
								HypoAlarm/src/main/res/values-small/dimens.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								HypoAlarm/src/main/res/values-small/dimens.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <!-- Default screen margins, per the Android Design guidelines. --> | ||||
|     <dimen name="activity_horizontal_margin">8dp</dimen> | ||||
|     <dimen name="activity_vertical_margin">8dp</dimen> | ||||
|  | ||||
|  | ||||
|     <!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. --> | ||||
|     <dimen name="glowpadview_target_placement_radius">110dip</dimen> | ||||
|  | ||||
|     <!-- Default glow radius for GlowPadView --> | ||||
|     <dimen name="glowpadview_glow_radius">50dip</dimen> | ||||
|  | ||||
|     <!-- Default distance beyond which GlowPadView snaps to the matching target --> | ||||
|     <dimen name="glowpadview_snap_margin">20dip</dimen> | ||||
|  | ||||
|     <!-- Default distance from each snap target that GlowPadView considers a "hit" --> | ||||
|     <dimen name="glowpadview_inner_radius">10dip</dimen> | ||||
|  | ||||
|     <!-- Size of lockscreen outerring --> | ||||
|     <dimen name="alarm_outerring_diameter">220dp</dimen> | ||||
|  | ||||
|     <!-- Circle size for incoming call widget's each item. --> | ||||
|     <dimen name="alarm_widget_circle_size">72dp</dimen> | ||||
|  | ||||
|     <!-- Margin used for alarm widget's icon for each item. | ||||
|          This should be same as "(alarm_widget_circle_size - icon_size)/2". | ||||
|          Right now answer/decline/reject icons have 38dp width/height. | ||||
|          So, (72 - 38)/2 ==> 17dp --> | ||||
|     <dimen name="alarm_widget_asset_margin">11dp</dimen> | ||||
|  | ||||
|     <dimen name="alarm_widget_vertical_margin">20dp</dimen> | ||||
| </resources> | ||||
| @@ -4,7 +4,6 @@ | ||||
|     <dimen name="activity_horizontal_margin">16dp</dimen> | ||||
|     <dimen name="activity_vertical_margin">16dp</dimen> | ||||
|  | ||||
|  | ||||
|     <!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. --> | ||||
|     <dimen name="glowpadview_target_placement_radius">135dip</dimen> | ||||
|  | ||||
| @@ -29,4 +28,6 @@ | ||||
|          So, (94 - 38)/2 ==> 28dp --> | ||||
|     <dimen name="alarm_widget_asset_margin">11dp</dimen> | ||||
|  | ||||
|     <dimen name="alarm_widget_vertical_margin">60dp</dimen> | ||||
|  | ||||
| </resources> | ||||
| @@ -1,17 +1,6 @@ | ||||
| <resources> | ||||
|  | ||||
|     <!-- Base application theme. --> | ||||
|     <style name="AppTheme" parent="Theme.AppCompat"> | ||||
|         <!-- Customize your theme here. --> | ||||
|     </style> | ||||
|  | ||||
| <!-- | ||||
|     <style name="SeekArc"> | ||||
|         <item name="arcColor">@color/progress_gray_dark</item> | ||||
|     </style> | ||||
|  | ||||
|     <style name="SeekArcLight"> | ||||
|         <item name="arcColor">@color/progress_gray</item> | ||||
|     </style> | ||||
| --> | ||||
| </resources> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user