Skip to content

Commit

Permalink
Handle tasks/ also when launching single shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Nov 20, 2016
1 parent aa5e693 commit b6155c7
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.content.SharedPreferences;
import android.net.Uri;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;

import java.io.File;
Expand Down Expand Up @@ -51,6 +52,15 @@ protected void onResume() {

Intent executeIntent = new Intent(TermuxWidgetProvider.ACTION_EXECUTE, scriptUri);
executeIntent.setClassName("com.termux", TermuxWidgetProvider.TERMUX_SERVICE);
if (clickedFile.getParentFile().getName().equals("tasks")) {
executeIntent.putExtra("com.termux.execute.background", true);
// Show feedback for executed background task.
String message = "Task executed: " + clickedFile.getName();
Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}

startService(executeIntent);
finish();
}
Expand Down

0 comments on commit b6155c7

Please sign in to comment.