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

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gregko
Copy link

@gregko gregko commented May 26, 2017

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.

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

@pingpongboss pingpongboss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! First of all, thanks for this PR. This will really modernize this library which hasn't been receiving a lot of love in recent years.

I hope you're willing to work with me through this PR. The main theme of my review will be to minimize the number of changes you make. Things like unnecessary package name changes, folder structure changes, gradle configurations, etc, will be reverted so we get a fairly clean PR. Let me know if you have any questions.

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a contentious subject, but I'd like to remove all of the contents of .idea and make it gitignored. This is especially true now that you've helpfully made the project gradle friendly.

@@ -0,0 +1,33 @@
apply plugin: 'com.android.library'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you've renamed library/ to StandOutLib/

please rename back to library/ to keep the directory structure as before

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the library need an appcompat dependency?

Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(c, contentTitle, contentText,
contentIntent);
Notification notification = new NotificationCompat.Builder(this)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the application context unless using this solves some issue. Same below.

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to set a content view when the activity isn't meant to display anything?

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this file be removed?

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these used anywhere? Can they be removed?

Same question for all other values you've added under res/

@@ -0,0 +1,17 @@
package hyperionics.com.standouttest;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not relevant, remove

@@ -0,0 +1 @@
include ':app', ':StandOutLib'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll want to add floatingfolders here when you make it a module

@gregko
Copy link
Author

gregko commented May 27, 2017 via email

Also using application context in creating notifications, to avoid possible memory leaks, restored the test app to show MultiWindow and WidgetsWindow by default (as in the original project), simplified build.gradle, some cosmetic changes.
@gregko
Copy link
Author

gregko commented May 27, 2017

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
Copy link
Owner

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,

Made displayWidth and displayHeight static, added updateScreenSize(context) method, to be called from StandOutWindow service upon configuration change.
ACTION_TOGGLE_VIS and the code to handle it is for toggling visibility from the persisten notification alternative, instead of having additional notification to show the window. To disable hidden notification, slightly modified the code to ignore it, if the overwritten getHiddenNotificationIntent() returns null.

To handle orientation changes, added onConfigurationChanged() call, which calls Window.updateScreenSize().
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.

2 participants