- Activate for smaller screens and older devices (Samsung Galaxy S Mini, 2.3.6 / API 10).
- Turn off debugging
This commit is contained in:
parent
e6266d4ed6
commit
66e615bb20
@ -11,7 +11,10 @@
|
|||||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||||
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -9,7 +9,6 @@ import android.view.View;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
//import com.triggertrap.seekarc.SeekArc;
|
|
||||||
import net.frakbot.glowpadbackport.GlowPadView;
|
import net.frakbot.glowpadbackport.GlowPadView;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -53,25 +52,6 @@ public class AlarmAlertActivity extends Activity {
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.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);
|
final GlowPadView cancelGlowPad = (GlowPadView) findViewById(R.id.cancel_glowpad);
|
||||||
cancelGlowPad.setOnTriggerListener(new GlowPadView.OnTriggerListener() {
|
cancelGlowPad.setOnTriggerListener(new GlowPadView.OnTriggerListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ import android.graphics.BitmapFactory;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class AlarmNotify extends Service {
|
public class AlarmNotify extends Service {
|
||||||
@ -45,71 +46,70 @@ public class AlarmNotify extends Service {
|
|||||||
|
|
||||||
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_grey);
|
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_grey);
|
||||||
final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
final NotificationCompat.Builder notification = new NotificationCompat.Builder(this)
|
||||||
final Notification.Builder notification = new Notification.Builder(this)
|
.setContentTitle(getString(R.string.app_name))
|
||||||
.setContentTitle(getString(R.string.app_name))
|
.setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(gracePeriod)))
|
||||||
.setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(gracePeriod)))
|
.setSmallIcon(R.drawable.alarm_notification)
|
||||||
.setSmallIcon(R.drawable.alarm_notification)
|
.setLargeIcon(bm)
|
||||||
.setLargeIcon(bm)
|
.setOnlyAlertOnce(true)
|
||||||
.setOnlyAlertOnce(true)
|
.setAutoCancel(false)
|
||||||
.setAutoCancel(false)
|
.setPriority(Notification.PRIORITY_HIGH);
|
||||||
.setPriority(Notification.PRIORITY_HIGH);
|
|
||||||
|
|
||||||
// Set up dismiss action
|
// Set up dismiss action
|
||||||
Intent cancellerIntent = new Intent(getBaseContext(), CancelGraceReceiver.class);
|
Intent cancellerIntent = new Intent(getBaseContext(), CancelGraceReceiver.class);
|
||||||
PendingIntent cancellerPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_GRACE_REQUEST, cancellerIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent cancellerPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_GRACE_REQUEST, cancellerIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
|
|
||||||
// Cancel the grace period if the user clears the notification
|
// Cancel the grace period if the user clears the notification
|
||||||
notification.setDeleteIntent(cancellerPendingIntent);
|
notification.setDeleteIntent(cancellerPendingIntent);
|
||||||
// Allow the user to cancel by clicking a "Cancel" button
|
// 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);
|
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
|
// Allow the user to cancel by selecting the ContentText or ContentTitle
|
||||||
notification.setContentIntent(cancellerPendingIntent);
|
notification.setContentIntent(cancellerPendingIntent);
|
||||||
|
|
||||||
|
|
||||||
nm.cancel(notifyID);
|
nm.cancel(notifyID);
|
||||||
nm.notify(notifyID, notification.build());
|
nm.notify(notifyID, notification.build());
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
notificationRunning = true;
|
notificationRunning = true;
|
||||||
int max = 1000;
|
int max = 1000;
|
||||||
// Count in milliseconds for greater progress resolution
|
// Count in milliseconds for greater progress resolution
|
||||||
int milliSecondsLeft = (int) ((AlarmService.graceEndTime - System.currentTimeMillis()));
|
int milliSecondsLeft = (int) ((AlarmService.graceEndTime - System.currentTimeMillis()));
|
||||||
int gracePeriodMilliSeconds = gracePeriod * 60 * 1000;
|
int gracePeriodMilliSeconds = gracePeriod * 60 * 1000;
|
||||||
int progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds;
|
int progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds;
|
||||||
|
|
||||||
while (progress < max) {
|
while (progress < max) {
|
||||||
// Stop the thread if the notification is cancelled elsewhere
|
// Stop the thread if the notification is cancelled elsewhere
|
||||||
if (!notificationRunning) {
|
if (!notificationRunning) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int minutesLeft = (milliSecondsLeft / 1000) / 60;
|
int minutesLeft = (milliSecondsLeft / 1000) / 60;
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
notification.setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(minutesLeft)));
|
notification.setContentText(String.format(getString(R.string.notificationText), MainActivity.MinutesToGracePeriodStr(minutesLeft)));
|
||||||
notification.setProgress(max, progress, false);
|
notification.setProgress(max, progress, false);
|
||||||
// Update the notification
|
// Update the notification
|
||||||
nm.notify(notifyID, notification.build());
|
nm.notify(notifyID, notification.build());
|
||||||
}
|
}
|
||||||
// Prepare secondsLeft and progress for the next loop
|
// Prepare secondsLeft and progress for the next loop
|
||||||
milliSecondsLeft = milliSecondsLeft - UPDATE_INTERVAL;
|
milliSecondsLeft = milliSecondsLeft - UPDATE_INTERVAL;
|
||||||
// Multiply each int by 1000 for greater progress resolution
|
// Multiply each int by 1000 for greater progress resolution
|
||||||
progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds;
|
progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds;
|
||||||
//Log.d("AlarmNotify", "milliSecondsLeft is " + milliSecondsLeft + " and progress is " + progress + " (gracePeriodMilliSeconds is " + gracePeriodMilliSeconds + ")");
|
//Log.d("AlarmNotify", "milliSecondsLeft is " + milliSecondsLeft + " and progress is " + progress + " (gracePeriodMilliSeconds is " + gracePeriodMilliSeconds + ")");
|
||||||
//Log.d("AlarmNotify", "progress is " + progress + "; max is " + max);
|
//Log.d("AlarmNotify", "progress is " + progress + "; max is " + max);
|
||||||
|
|
||||||
// Sleep until we need to update again
|
// Sleep until we need to update again
|
||||||
try {
|
try {
|
||||||
Thread.sleep(UPDATE_INTERVAL);
|
Thread.sleep(UPDATE_INTERVAL);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.d("AlarmNotify", "sleep failure: " + e.toString());
|
Log.d("AlarmNotify", "sleep failure: " + e.toString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
stopSelf(); // stop notification service
|
|
||||||
}
|
}
|
||||||
}).start();
|
stopSelf(); // stop notification service
|
||||||
}
|
}
|
||||||
return super.onStartCommand(intent, flags, startId);
|
}).start();
|
||||||
|
|
||||||
|
return super.onStartCommand(intent, flags, startId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ import android.util.Log;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
public class AlarmService extends Service {
|
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 SNOOZE_TIME = 1000*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 ALERT_LIFE = 1000*60*1; // 2 minutes
|
||||||
private static AlarmManager alarmManager;
|
private static AlarmManager alarmManager;
|
||||||
private static Intent alarmServiceIntent, alertActivityIntent, notifyIntent;
|
private static Intent alarmServiceIntent, alertActivityIntent, notifyIntent;
|
||||||
public static Boolean alarmStarted = false;
|
public static Boolean alarmStarted = false;
|
||||||
|
@ -77,7 +77,6 @@ public class GraceReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
private void sendText(Context context) {
|
private void sendText(Context context) {
|
||||||
SmsManager sms = SmsManager.getDefault();
|
SmsManager sms = SmsManager.getDefault();
|
||||||
// TODO uncomment sendTextMessage
|
|
||||||
if (!MainActivity.HYPOALARM_DEBUG) {
|
if (!MainActivity.HYPOALARM_DEBUG) {
|
||||||
sms.sendTextMessage(phoneNumber, null, message, null, null);
|
sms.sendTextMessage(phoneNumber, null, message, null, null);
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,14 @@ import android.view.inputmethod.InputMethodManager;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TimePicker;
|
import android.widget.TimePicker;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -69,7 +71,7 @@ public class MainActivity extends ActionBarActivity {
|
|||||||
private static Button alarmTimeButton;
|
private static Button alarmTimeButton;
|
||||||
private static EditText messageButton;
|
private static EditText messageButton;
|
||||||
|
|
||||||
public static Boolean HYPOALARM_DEBUG = true;
|
public static Boolean HYPOALARM_DEBUG = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -92,7 +94,6 @@ public class MainActivity extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
@ -104,7 +105,7 @@ public class MainActivity extends ActionBarActivity {
|
|||||||
|
|
||||||
// Allow alarm to activate
|
// Allow alarm to activate
|
||||||
Boolean alarmActive = sharedPref.getBoolean(getString(R.string.AlarmActivePref), true);
|
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.setChecked(alarmActive);
|
||||||
alarmActiveSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
alarmActiveSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -145,6 +146,7 @@ public class MainActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Set alarm time
|
// Set alarm time
|
||||||
String defaultTimeStr = "09:00";
|
String defaultTimeStr = "09:00";
|
||||||
String alarmTimeStr = verifyTimeString(sharedPref.getString(getString(R.string.AlarmTimePref), defaultTimeStr));
|
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) {
|
public static String formattedTime(Context context, Calendar cal) {
|
||||||
String pattern;
|
SimpleDateFormat print;
|
||||||
if (Build.VERSION.SDK_INT >= 18) {
|
if (DateFormat.is24HourFormat(context)) {
|
||||||
String skeleton = DateFormat.is24HourFormat(context) ? "EHm" : "Ehma";
|
print = new SimpleDateFormat("E HH:mm");
|
||||||
pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton);
|
|
||||||
} else {
|
} else {
|
||||||
pattern = "EHm";
|
print = new SimpleDateFormat("E hh:mm a");
|
||||||
}
|
}
|
||||||
return (String) DateFormat.format(pattern, cal);
|
return (String) print.format(cal.getTime());
|
||||||
}
|
|
||||||
public static String debugDate(Calendar cal) {
|
|
||||||
SimpleDateFormat print = new SimpleDateFormat("dd-MM-yyyy HH:mm:ssZ");
|
|
||||||
return print.format(cal.getTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GracePeriodToMinutes(String gracePeriod) {
|
public static int GracePeriodToMinutes(String gracePeriod) {
|
||||||
@ -569,6 +566,11 @@ public class MainActivity extends ActionBarActivity {
|
|||||||
return remMinutes + minStr;
|
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
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
@ -12,6 +12,7 @@ import android.graphics.BitmapFactory;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -47,30 +48,29 @@ public class PreAlarmNotify extends Service {
|
|||||||
|
|
||||||
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_grey);
|
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_grey);
|
||||||
final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
final NotificationCompat.Builder notification = new NotificationCompat.Builder(this)
|
||||||
final Notification.Builder notification = new Notification.Builder(this)
|
.setContentTitle(getString(R.string.preNotificationTitle))
|
||||||
.setContentTitle(getString(R.string.preNotificationTitle))
|
.setContentText(alarmTimeStr)
|
||||||
.setContentText(alarmTimeStr)
|
.setSmallIcon(R.drawable.alarm_notification)
|
||||||
.setSmallIcon(R.drawable.alarm_notification)
|
.setLargeIcon(bm)
|
||||||
.setLargeIcon(bm)
|
.setOnlyAlertOnce(true)
|
||||||
.setOnlyAlertOnce(true)
|
.setAutoCancel(false)
|
||||||
.setAutoCancel(false)
|
.setPriority(Notification.PRIORITY_HIGH);
|
||||||
.setPriority(Notification.PRIORITY_HIGH);
|
|
||||||
|
|
||||||
// Set up dismiss action
|
// Set up dismiss action
|
||||||
Intent cancelAlarmIntent = new Intent(getBaseContext(), CancelAlarmReceiver.class);
|
Intent cancelAlarmIntent = new Intent(getBaseContext(), CancelAlarmReceiver.class);
|
||||||
PendingIntent cancelAlarmPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_ALARM_REQUEST, cancelAlarmIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent cancelAlarmPendingIntent = PendingIntent.getBroadcast(getBaseContext(), MainActivity.CANCEL_ALARM_REQUEST, cancelAlarmIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
|
|
||||||
// Cancel the grace period if the user clears the notification
|
// Cancel the grace period if the user clears the notification
|
||||||
notification.setDeleteIntent(cancelAlarmPendingIntent);
|
notification.setDeleteIntent(cancelAlarmPendingIntent);
|
||||||
// Allow the user to cancel by clicking a "Cancel" button
|
// 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);
|
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
|
// Allow the user to cancel by selecting the ContentText or ContentTitle
|
||||||
notification.setContentIntent(cancelAlarmPendingIntent);
|
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);
|
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_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".AlarmNotificationActivity">
|
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
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -77,9 +15,8 @@
|
|||||||
android:id="@+id/cancel_dialog_title"
|
android:id="@+id/cancel_dialog_title"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_centerHorizontal="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
|
<net.frakbot.glowpadbackport.GlowPadView
|
||||||
android:id="@+id/cancel_glowpad"
|
android:id="@+id/cancel_glowpad"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -1,160 +1,164 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:stretchColumns="0"
|
android:fillViewport="true" >
|
||||||
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">
|
|
||||||
|
|
||||||
<TableRow
|
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
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
|
<TableRow
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="fill_parent">
|
||||||
android:id="@+id/description"
|
|
||||||
android:text="@string/description"
|
|
||||||
android:layout_span="2"
|
|
||||||
android:layout_column="0" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
<TextView
|
||||||
android:layout_marginTop="10dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="fill_parent">
|
android:id="@+id/description"
|
||||||
|
android:text="@string/description"
|
||||||
|
android:layout_span="2"
|
||||||
|
android:layout_column="0" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
<TextView
|
<TableRow
|
||||||
android:layout_width="wrap_content"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/alarm_active_text"
|
android:layout_height="fill_parent">
|
||||||
android:id="@+id/alarm_active_text"
|
|
||||||
android:layout_column="0" />
|
|
||||||
|
|
||||||
<Switch
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/alarm_active_switch"
|
android:text="@string/alarm_active_text"
|
||||||
android:layout_column="1"
|
android:id="@+id/alarm_active_text"
|
||||||
android:layout_gravity="left" />
|
android:layout_column="0" />
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
<include
|
||||||
android:layout_marginTop="10dp"
|
layout="@layout/activeswitch" />
|
||||||
android:layout_width="fill_parent"
|
</TableRow>
|
||||||
android:layout_height="fill_parent">
|
|
||||||
<TextView
|
<TableRow
|
||||||
android:layout_width="wrap_content"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/alarm_time_text"
|
android:layout_height="fill_parent">
|
||||||
android:id="@+id/alarm_time_text"
|
<TextView
|
||||||
android:layout_column="0" />
|
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
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/alarm_time"
|
android:id="@+id/alarm_time"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
android:layout_column="1" />
|
android:layout_column="1" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/grace_period_text"
|
android:text="@string/grace_period_text"
|
||||||
android:id="@+id/grace_period_text"
|
android:id="@+id/grace_period_text"
|
||||||
android:layout_column="0" />
|
android:layout_column="0" />
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/grace_period"
|
android:id="@+id/grace_period"
|
||||||
android:entries="@array/grace_period_array"
|
android:entries="@array/grace_period_array"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:layout_column="1" />
|
android:layout_column="1" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/phone_number_text"
|
android:text="@string/phone_number_text"
|
||||||
android:id="@+id/phone_number_text"
|
android:id="@+id/phone_number_text"
|
||||||
android:layout_column="0" />
|
android:layout_column="0" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/phone_number"
|
android:id="@+id/phone_number"
|
||||||
android:inputType="phone"
|
android:inputType="phone"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:focusableInTouchMode="false"
|
android:focusableInTouchMode="false"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:layout_column="1" />
|
android:layout_column="1" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/ringtone_text"
|
android:text="@string/ringtone_text"
|
||||||
android:id="@+id/ringtone_text"
|
android:id="@+id/ringtone_text"
|
||||||
android:layout_column="0" />
|
android:layout_column="0" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/ringtone"
|
android:id="@+id/ringtone"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:focusableInTouchMode="false"
|
android:focusableInTouchMode="false"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:layout_column="1" />
|
android:layout_column="1" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/message_text"
|
android:text="@string/message_text"
|
||||||
android:id="@+id/message_text"
|
android:id="@+id/message_text"
|
||||||
android:layout_span="2"
|
android:layout_span="2"
|
||||||
android:layout_column="0" />
|
android:layout_column="0" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/message"
|
android:id="@+id/message"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:focusableInTouchMode="false"
|
android:focusableInTouchMode="false"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:layout_span="2"
|
android:layout_span="2"
|
||||||
android:layout_column="0" />
|
android:layout_column="0" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
|
||||||
|
</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_horizontal_margin">16dp</dimen>
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
<!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
|
<!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
|
||||||
<dimen name="glowpadview_target_placement_radius">135dip</dimen>
|
<dimen name="glowpadview_target_placement_radius">135dip</dimen>
|
||||||
|
|
||||||
@ -29,4 +28,6 @@
|
|||||||
So, (94 - 38)/2 ==> 28dp -->
|
So, (94 - 38)/2 ==> 28dp -->
|
||||||
<dimen name="alarm_widget_asset_margin">11dp</dimen>
|
<dimen name="alarm_widget_asset_margin">11dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="alarm_widget_vertical_margin">60dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -1,17 +1,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat">
|
<style name="AppTheme" parent="Theme.AppCompat">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</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>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user