Files
termux-app/terminal-view/src/main/java/com/termux/view/TerminalViewClient.java
agnostic-apollo 682ce08314 Create termux-shared library package for all termux constants and shared utils
The termux plugins should use this library instead of hardcoding "com.termux" values in their source code.

The library can be included as a dependency by plugins and third party apps by including the following line in the build.gradle where x.xxx is the version number, once its published.

`implementation 'com.termux:termux-shared:x.xxx'`

The `TermuxConstants` class has been updated to `v0.17.0`, `TermuxPreferenceConstants` to `v0.9.0` and `TermuxPropertyConstants` to `v0.6.0`. Check their Changelog sections for info on changes.

Some typos and redundant code has also been fixed.
2021-04-07 11:31:30 +05:00

75 lines
1.8 KiB
Java

package com.termux.view;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import com.termux.terminal.TerminalSession;
/**
* The interface for communication between {@link TerminalView} and its client. It allows for getting
* various configuration options from the client and for sending back data to the client like logs,
* key events, both hardware and IME (which makes it different from that available with
* {@link View#setOnKeyListener(View.OnKeyListener)}, etc. It must be set for the
* {@link TerminalView} through {@link TerminalView#setTerminalViewClient(TerminalViewClient)}.
*/
public interface TerminalViewClient {
/**
* Callback function on scale events according to {@link ScaleGestureDetector#getScaleFactor()}.
*/
float onScale(float scale);
/**
* On a single tap on the terminal if terminal mouse reporting not enabled.
*/
void onSingleTapUp(MotionEvent e);
boolean shouldBackButtonBeMappedToEscape();
boolean shouldEnforceCharBasedInput();
boolean shouldUseCtrlSpaceWorkaround();
void copyModeChanged(boolean copyMode);
boolean onKeyDown(int keyCode, KeyEvent e, TerminalSession session);
boolean onKeyUp(int keyCode, KeyEvent e);
boolean onLongPress(MotionEvent event);
boolean readControlKey();
boolean readAltKey();
boolean onCodePoint(int codePoint, boolean ctrlDown, TerminalSession session);
void logError(String tag, String message);
void logWarn(String tag, String message);
void logInfo(String tag, String message);
void logDebug(String tag, String message);
void logVerbose(String tag, String message);
void logStackTraceWithMessage(String tag, String message, Exception e);
void logStackTrace(String tag, Exception e);
}