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

Develop #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.txusballesteros.bubbles.app"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName parent.ext.libraryVersion
}
Expand All @@ -21,6 +21,6 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:appcompat-v7:27.0.2'
compile project(':bubbles')
}
25 changes: 13 additions & 12 deletions app/src/main/java/com/txusballesteros/bubbles/app/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package com.txusballesteros.bubbles.app;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
Expand All @@ -34,7 +34,7 @@
import com.txusballesteros.bubbles.BubblesManager;
import com.txusballesteros.bubbles.OnInitializedCallback;

public class MainActivity extends ActionBarActivity {
public class MainActivity extends AppCompatActivity {

private BubblesManager bubblesManager;

Expand All @@ -54,10 +54,11 @@ public void onClick(View v) {
}

private void addNewBubble() {
BubbleLayout bubbleView = (BubbleLayout)LayoutInflater.from(MainActivity.this).inflate(R.layout.bubble_layout, null);
BubbleLayout bubbleView = (BubbleLayout) LayoutInflater.from(MainActivity.this).inflate(R.layout.bubble_layout, null);
bubbleView.setOnBubbleRemoveListener(new BubbleLayout.OnBubbleRemoveListener() {
@Override
public void onBubbleRemoved(BubbleLayout bubble) { }
public void onBubbleRemoved(BubbleLayout bubble) {
}
});
bubbleView.setOnBubbleClickListener(new BubbleLayout.OnBubbleClickListener() {

Expand All @@ -73,14 +74,14 @@ public void onBubbleClick(BubbleLayout bubble) {

private void initializeBubblesManager() {
bubblesManager = new BubblesManager.Builder(this)
.setTrashLayout(R.layout.bubble_trash_layout)
.setInitializationCallback(new OnInitializedCallback() {
@Override
public void onInitialized() {
addNewBubble();
}
})
.build();
.setTrashLayout(R.layout.bubble_trash_layout)
.setInitializationCallback(new OnInitializedCallback() {
@Override
public void onInitialized() {
addNewBubble();
}
})
.build();
bubblesManager.initialize();
}

Expand Down
6 changes: 3 additions & 3 deletions bubbles/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName version
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
package com.txusballesteros.bubbles;

import android.content.Context;
import android.os.Vibrator;
import android.view.View;
import android.view.WindowManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
import android.app.Service;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -80,7 +79,7 @@ public void run() {

private WindowManager getWindowManager() {
if (windowManager == null) {
windowManager = (WindowManager)getSystemService(WINDOW_SERVICE);
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
}
return windowManager;
}
Expand Down Expand Up @@ -123,10 +122,15 @@ public void run() {
}

private WindowManager.LayoutParams buildLayoutParamsForBubble(int x, int y) {
int typeOverlay = WindowManager.LayoutParams.TYPE_PHONE;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
typeOverlay = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
}

WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
typeOverlay,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSPARENT);
params.gravity = Gravity.TOP | Gravity.START;
Expand All @@ -138,10 +142,16 @@ private WindowManager.LayoutParams buildLayoutParamsForBubble(int x, int y) {
private WindowManager.LayoutParams buildLayoutParamsForTrash() {
int x = 0;
int y = 0;

int typeOverlay = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
typeOverlay = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
}

WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
typeOverlay,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSPARENT);
params.x = x;
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ buildscript {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
Expand All @@ -23,5 +24,6 @@ allprojects {
}
repositories {
jcenter()
google()
}
}