Skip to content

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

Open
gregko wants to merge 4 commits intopingpongboss:masterfrom
gregko:master
Open

Brought projects to current ver. Android Studio and Gradle#40
gregko wants to merge 4 commits intopingpongboss:masterfrom
gregko:master

Conversation

@gregko
Copy link
Copy Markdown

@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
Copy Markdown
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.

Comment thread .idea/compiler.xml
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Copy Markdown
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.

Comment thread StandOutLib/build.gradle
@@ -0,0 +1,33 @@
apply plugin: 'com.android.library'
Copy link
Copy Markdown
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

Comment thread StandOutLib/build.gradle
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
Copy link
Copy Markdown
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

Comment thread StandOutLib/build.gradle
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Owner

Choose a reason for hiding this comment

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

not relevant, remove

Comment thread settings.gradle
@@ -0,0 +1 @@
include ':app', ':StandOutLib'
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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,

gregko added 2 commits June 1, 2017 15:33
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