Skip to content

Commit

Permalink
If the snooze dialog was not pressed after 120 seconds it will be rem…
Browse files Browse the repository at this point in the history
…oved from the screen.

Signed-off-by: Tzachi Dar <[email protected]>
  • Loading branch information
tzachi-dar committed Dec 7, 2016
1 parent b36671f commit e005607
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/src/main/java/com/eveningoutpost/dexdrip/GcmActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.support.v4.content.LocalBroadcastManager;
Expand Down Expand Up @@ -366,8 +367,29 @@ public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
final AlertDialog alert = builder.create();
alert.show();
// Hide after some seconds
final Handler handler = new Handler();
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (alert.isShowing()) {
alert.dismiss();
}
}
};

alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
handler.removeCallbacks(runnable);
}
});

handler.postDelayed(runnable, 120000);


}

public static void sendMotionUpdate(final long timestamp, final int activity) {
Expand Down

0 comments on commit e005607

Please sign in to comment.