Commit a36b2210 by Zac Chan

runnable

parent ed1384e8
...@@ -45,7 +45,7 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -45,7 +45,7 @@ public class FluttertoastPlugin implements MethodCallHandler {
final Toast toast = Toast.makeText(ctx, msg, Toast.LENGTH_SHORT); final Toast toast = Toast.makeText(ctx, msg, Toast.LENGTH_SHORT);
//Added to see if new //Added to see if
toast.setText(msg); toast.setText(msg);
...@@ -57,7 +57,18 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -57,7 +57,18 @@ public class FluttertoastPlugin implements MethodCallHandler {
} }
final Handler handler = new Handler(); final Handler handler = new Handler();
final Runnable run = new Runnable() {
@Override
public void run() {
try {
result.success(false);
} catch (Exception e){
e.printStackTrace();
}
}
};
switch (gravity) { switch (gravity) {
...@@ -93,8 +104,15 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -93,8 +104,15 @@ public class FluttertoastPlugin implements MethodCallHandler {
toastView.setOnTouchListener(new View.OnTouchListener() { toastView.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
// handler.removeCallbacks(run); handler.removeCallbacks(run);
result.success(true);
try {
result.success(true);
} catch (Exception e){
e.printStackTrace();
}
return false; return false;
} }
}); });
...@@ -103,34 +121,9 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -103,34 +121,9 @@ public class FluttertoastPlugin implements MethodCallHandler {
text.setTextColor(textcolor.intValue()); text.setTextColor(textcolor.intValue());
} }
// Thread thread = new Thread(){
// @Override
// public void run(){
// try {
// Thread.sleep(toast.getDuration());
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// result
//
// }
// };
toast.show(); toast.show();
handler.postDelayed(new Runnable() { handler.postDelayed(run,4000);
@Override
public void run() {
result.success(true);
}
},35000);
// thread.run();
// result.success("Success");
} else { } else {
result.notImplemented(); result.notImplemented();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment