Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Multiple Floating View Support #75

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
OnKeyListener support removed to make other apps work :)
  • Loading branch information
brnogz committed Feb 24, 2018
commit fa7537b5e6264c89457741eac19e688eb0ea0fa3
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,6 @@ public void removeAllViewToWindow() {
mFloatingViewList.clear();
}

public void setOnKeyListener(View.OnKeyListener listener){
mFullscreenObserverView.setOnKeyListener(listener);
}

/**
* FloatingViewを貼り付ける際のオプションを表すクラスです。
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.Build;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
Expand Down Expand Up @@ -63,8 +62,6 @@ class FullscreenObserverView extends View implements ViewTreeObserver.OnGlobalLa
*/
private final Rect mWindowRect;

private OnKeyListener mKeyListener;

static {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1) {
OVERLAY_TYPE = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
Expand All @@ -87,7 +84,8 @@ class FullscreenObserverView extends View implements ViewTreeObserver.OnGlobalLa
mParams.width = 1;
mParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
mParams.type = OVERLAY_TYPE;
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
mParams.format = PixelFormat.TRANSLUCENT;

Expand Down Expand Up @@ -144,17 +142,6 @@ public void onSystemUiVisibilityChange(int visibility) {
}
}

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
return (mKeyListener != null && mKeyListener.onKey(this, event.getKeyCode(), event)) || super.dispatchKeyEvent(event);
}

@Override
public void setOnKeyListener(OnKeyListener l) {
super.setOnKeyListener(l);
mKeyListener = l;
}

/**
* WindowManager.LayoutParams
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ public void onClick(View v) {
}
});

mFloatingViewManager.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
Log.d(TAG, event.getKeyCode() + " " + event.getCharacters());

return true;
}
});

// 常駐起動
startForeground(NOTIFICATION_ID, createNotification(this));

Expand Down