Skip to content

Commit

Permalink
Put task notification toast at top of screen
Browse files Browse the repository at this point in the history
To avoid blocking toasts shown from tasks using termux-toast we instead
put our toast notifications at the top of the screen.

Fixes #33.
  • Loading branch information
fornwall committed Aug 4, 2019
1 parent e2f8c7d commit 8011bd8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ public void onReceive(Context context, Intent intent) {
// Show feedback for executed background task.
String message = "Task executed: " + clickedFile.getName();
Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
// Put the toast at the top of the screen, to avoid blocking eventual
// toasts made from the task with termux-toast.
// See https://github.com/termux/termux-widget/issues/33
toast.setGravity(Gravity.TOP, 0, 0);
toast.show();
}
startTermuxService(context, executeIntent);
Expand Down

0 comments on commit 8011bd8

Please sign in to comment.