Skip to content

Commit

Permalink
Center toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Jul 30, 2015
1 parent e0988c3 commit 9f5d2b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/com/termux/api/ToastAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.view.Gravity;
import android.widget.Toast;

import com.termux.api.util.ResultReturner;
Expand All @@ -18,14 +19,14 @@ public static void onReceive(TermuxApiReceiver receiver, final Context context,

final Handler handler = new Handler();

TermuxApiLogger.info("duration=" + durationExtra);
ResultReturner.returnData(context, intent, new ResultReturner.WithStringInput() {
@Override
public void writeResult(PrintWriter out) throws Exception {
handler.post(new Runnable() {
@Override
public void run() {
Toast toast = Toast.makeText(context, inputString, durationExtra);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
});
Expand Down

0 comments on commit 9f5d2b3

Please sign in to comment.