Skip to content

Commit

Permalink
Fix for back button not calling disconnect on Android TV.
Browse files Browse the repository at this point in the history
  • Loading branch information
iiordanov committed Mar 31, 2024
1 parent 16edbf9 commit 26351e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import com.undatech.opaque.RemoteClientLibConstants;
import com.undatech.opaque.dialogs.SelectTextElementFragment;
import com.undatech.opaque.util.FileUtils;
import com.undatech.opaque.util.GeneralUtils;
import com.undatech.opaque.util.OnTouchViewMover;
import com.undatech.opaque.util.RemoteToolbar;
import com.undatech.remoteClientUi.R;
Expand Down Expand Up @@ -1381,6 +1382,7 @@ private void setInputHandler(TouchInputHandler input) {
inputListener = new RemoteClientsInputListener(
this,
remoteConnection,
remoteConnection,
touchInputHandler,
this::resetOnScreenKeys,
connection.getUseDpadAsArrows()
Expand Down Expand Up @@ -1588,6 +1590,9 @@ private boolean isMasterPasswordEnabled() {

@Override
public void onBackPressed() {
if (GeneralUtils.isTv(this)) {
disconnectAndFinishActivity();
}
if (inputListener != null) {
inputListener.onKey(canvas, KeyEvent.KEYCODE_BACK, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.iiordanov.bVNC.input;

import android.view.KeyEvent;

public interface PointerInputHandler {
boolean onKeyDownEvent(int keyCode, KeyEvent event);

boolean onKeyUpEvent(int keyCode, KeyEvent event);
}

0 comments on commit 26351e1

Please sign in to comment.