Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Application::copyToClipboard for iOS #16

Merged
merged 4 commits into from
Aug 20, 2019

Conversation

mrexodia
Copy link
Contributor

Usage:

App()->copyToClipboard("Hello clipboard");

Currently I do not have enough disk space to test on an emulator on Android unfortunately. I will try to make space and implement it for Android and OSX too. I'll sign the CLA in a separate PR once that's applicable.

@gitoby gitoby requested review from Maddimax and removed request for Maddimax July 24, 2019 14:27
@gitoby
Copy link
Contributor

gitoby commented Jul 25, 2019

See my comments on #14

@mrexodia
Copy link
Contributor Author

mrexodia commented Aug 7, 2019

I implemented the interface for every platform, but I have no idea how to get the information from Java to copy to the clipboard. Some direction would be appreciated!

@Maddimax
Copy link
Contributor

Maddimax commented Aug 8, 2019

I found this SO answer: https://stackoverflow.com/questions/19253786/how-to-copy-text-to-clip-board-in-android

The easiest way would be to add a function to NativeRootActivity.java ( probably a public static function ), then make that function available to C++ via android/NativeRootActivity.h and call it from android/UIApplication.cpp

@mrexodia
Copy link
Contributor Author

mrexodia commented Aug 8, 2019

Yeah that’s what I did, but you need getSystemService which is a member function so it cannot be called from my static method...

@Maddimax
Copy link
Contributor

You can use NativeRootActivity.getRootActivity() to access the main activity object.
NativeRootActivity.getRootActivitiy().getSystemService(...) should get you there.

@mrexodia
Copy link
Contributor Author

Thanks, I will look into it @Maddimax!

@mrexodia
Copy link
Contributor Author

Alright, I implemented and tested Application::copyToClipboard for all platforms and rebased on the latest master. Locally I have modifications to bodendemo with a button to test the function, should I add that too?

Is there a way to have AndroidStudio show the cpp/java files like Xcode? It was lagging horribly and I couldn't get it to work, so I just ran ./boden build instead for testing Android.

@gitoby
Copy link
Contributor

gitoby commented Aug 19, 2019

Yes, a test button in the demo app would be nice!

You should be able to see the cpp/java files in Android Studio. If you can't find them, double press Shift and it should bring up a quick open dialog (similar to Ctrl/Cmd+P in Sublime). If you enter the filename there, it should show up.

Regarding the Android Studio and lagging: Yes, that's an issue. It's usually caused by Gradle sync and it's worse when the project is first opened. We found that it gets better if you generate a single target only (using boden open -t bodendemo). It should get faster once the initial indexing/sync is completed. Unfortunately there doesn't seem to be much else we can do about it right now.

@mrexodia
Copy link
Contributor Author

Alright, I re-added the page, hopefully everything is done now :)

@Maddimax Maddimax merged commit b834f92 into AshampooSystems:master Aug 20, 2019
@Maddimax
Copy link
Contributor

Thanks a lot for the time and effort you put into this!

@mrexodia mrexodia deleted the clipboard branch August 21, 2019 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants