1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| public class MainActivity extends FlutterActivity {
private static final String CHANNEL = "wps.plugin";
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler(new MethodChannel.MethodCallHandler() { @Override public void onMethodCall(MethodCall call, MethodChannel.Result result) { if (call.method.equals("interaction")) { String fileUrl = call.argument("fileUrl"); Bundle bundle = new Bundle(); Object openMode = call.argument("OpenMode"); if (openMode != null) { bundle.putString(WpsModel.OPEN_MODE, String.valueOf(openMode)); }
Object editMode = call.argument("EditMode"); if (editMode != null) { bundle.putBoolean("Edit Mode", Boolean.valueOf(editMode.toString())); }
Object clearTrace = call.argument("ClearTrace"); if (clearTrace != null) { bundle.putBoolean("ClearTrace", Boolean.valueOf(clearTrace.toString())); }
Object autoJump = call.argument("AutoJump"); if (autoJump != null) { bundle.putBoolean("AutoJump", Boolean.valueOf(autoJump.toString())); }
Object showReviewingPaneRightDefault = call.argument("ShowReviewingPaneRightDefault"); if (showReviewingPaneRightDefault != null) { bundle.putBoolean("ShowReviewingPaneRightDefault", Boolean.valueOf(showReviewingPaneRightDefault.toString())); }
Object enterReviseMode = call.argument("EnterReviseMode"); if (enterReviseMode != null) { bundle.putBoolean("EnterReviseMode", 大专栏 flutter实践 - plsyan class="keyword">Boolean.valueOf(enterReviseMode.toString())); }
Object waterMaskText = call.argument("WaterMaskText"); if (waterMaskText != null) { bundle.putString("WaterMaskText", String.valueOf(waterMaskText)); }
Object userName = call.argument("UserName"); if (userName != null) { bundle.putString("UserName", String.valueOf(userName)); }
bundle.putBoolean("SendSaveBroad", true);
Intent intent = new Intent(); File file = new File(fileUrl);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); Uri contentUri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".provider", file); intent.setData(contentUri); intent.putExtras(bundle);
intent.setAction(android.content.Intent.ACTION_VIEW); intent.setClassName(WpsModel.PackageName.PRO, WpsModel.ClassName.NORMAL); MainActivity.this.startActivity(intent);
result.success("success"); } else { result.notImplemented(); } } });
GeneratedPluginRegistrant.registerWith(this); }
}
|