Skip to content

Commit

Permalink
UI elements for remote snooze
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Sep 26, 2016
1 parent 42b3e2c commit 588a0d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
13 changes: 12 additions & 1 deletion app/src/main/java/com/eveningoutpost/dexdrip/SnoozeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;

import com.eveningoutpost.dexdrip.Models.JoH;
import com.eveningoutpost.dexdrip.Models.UserError.Log;

import android.util.TypedValue;
Expand Down Expand Up @@ -40,6 +42,7 @@ public class SnoozeActivity extends ActivityWithMenu {
Button clearLowDisabled;
Button disableHighAlerts;
Button clearHighDisabled;
Button sendRemoteSnooze;
SharedPreferences prefs;
boolean doMgdl;

Expand Down Expand Up @@ -147,6 +150,8 @@ public void addListenerOnButton() {
//all alerts
disableAlerts = (Button)findViewById(R.id.button_disable_alerts);
clearDisabled = (Button)findViewById(R.id.enable_alerts);
sendRemoteSnooze = (Button)findViewById(R.id.send_remote_snooze);

buttonSnooze.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
int intValue = getTimeFromSnoozeValue(snoozeValue.getValue());
Expand Down Expand Up @@ -321,7 +326,7 @@ void displayStatus() {
}
long now = new Date().getTime();
if(activeBgAlert == null ) {

sendRemoteSnooze.setVisibility(Home.getPreferencesBooleanDefaultFalse("send_snooze_to_remote") ? View.VISIBLE : View.GONE);
if (prefs.getLong("alerts_disabled_until", 0) > now
||
(prefs.getLong("low_alerts_disabled_until", 0) > now
Expand All @@ -337,6 +342,7 @@ void displayStatus() {
buttonSnooze.setVisibility(View.GONE);
snoozeValue.setVisibility(View.GONE);
} else {
sendRemoteSnooze.setVisibility(View.GONE);
if(!aba.ready_to_alarm()) {
status = "Active alert exists named \"" + activeBgAlert.name
+ (aba.is_snoozed?"\" Alert snoozed until ":"\" Alert will rerise at ")
Expand Down Expand Up @@ -373,4 +379,9 @@ void displayStatus() {

}

public void setSendRemoteSnoozeOnClick(View v) {
JoH.static_toast_short("Remote snooze..");
AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1);
}

}
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_snooze.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/re_enable_all_alerts"/>
<Button
android:id="@+id/send_remote_snooze"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="setSendRemoteSnoozeOnClick"
android:text="Send Remote Snooze"
android:backgroundTint="@color/colorPrimaryDark" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<color name="percentile_median">#bce6ff</color>

<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colorPrimaryDark">#303f9f</color>
<color name="colorAccent">#ff4081</color>
<color name="year">#999999</color>
<color name="title">#62a262</color>
</resources>

0 comments on commit 588a0d8

Please sign in to comment.