pingpongboss / StandOut

StandOut lets you easily create floating windows in your Android app.
http://pingpongboss.github.com/StandOut
MIT License
1.24k stars 379 forks source link

Brought projects to current ver. Android Studio and Gradle #40

Open gregko opened 7 years ago

gregko commented 7 years ago

Hello! Thank you for such an elegant and compact, yet powerful and well documented library. I had troubles building it with the old tools, so re-worked projects structure to work with the latest versions of Android Studio and Gradle. The test examples needed to deal with the new way of handling screen overlay permission under Android 6 and higher, which I added to the test app main activity class.

Also made some small code corrections to remove depreciated or removed calls and classes, e.g. using now NotificationCompat.Builder.

Consider merging it into your base fork, may help others quickly start with your library. I need it for my \@Voice Aloud Reader app to make a floating Play/Pause button and maybe a few other buttons on a floating toolbar.

gregko commented 7 years ago

Hi Boss, Please go ahead and do the changes as you see fit, it’s your library. I’m really too busy to make so many small changes. A few quick answers:

AppCompat dependency – the “new Notification()” simply does not work, one has to use NotificationCompat.Builder, and use AppCompat for compatibility with older versions of Android. I did not change anything else in the library code. However I checked now and see that Notification.Builder was added in API 11, and since the minSdkVersion is set to 15, you may change it to just use Notification.Builder instead and remove appcompat. Oh, another problem, Notification.Builder().setVisibility() requires API 21, unless you use NotificationCompat.Builder()

Using application context – good idea, else we may face memory leaks.

“library” module name – my app uses a lot of library projects, so having one of them named simply “library” would be really confusing for me.

Units tests and some XML lines you object to – they are created automatically by Android Studio for each new project, feel free to remove them, but I find unit tests and instrumentation test skeletons handy when a need arises to test something.

Wrong package names in some places – sorry about that. Initially I just wanted to make it work asap. Then refactored the package name under Android Studio, and it missed a few places (e.g. the manifest and build.gradle). I’ll correct these in my GitHub fork.

gregko commented 7 years ago

In a new commit in my fork I corrected the wrong package names, also changed to use app context in creating notifications, removed unnecessary empty layout for the MainActivity, restored the test app to show MutiWindow and WidgetsWindow by default, as in the original, simplified the app build.gradle and made some other small cosmetic changes. Not sending another pull request at this time, as it seems you'll want to tweak the cosmetics more.

pingpongboss commented 7 years ago

Thanks gregko.

Sounds like you don't have time to clean this PR up. Let's leave this PR here for now then. If I get any time, I may take over this PR in the future.

Thanks,