forked from termux/termux-app
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added!: Convert extra-keys to agnosticism
The termux `extra-keys` have been moved to `termux-shared` library so that they can be imported and used by other apps for their own needs as long as they comply with GPLv3 license. Almost everything is customizable and has no dependency on termux specific logic. Check the javadocs of files of `com.termux.shared.terminal.io.extrakeys` package for more info, specially, `ExtraKeysView`, `ExtraKeysInfo`, `ExtraKeyButton`, `TerminalExtraKeys` and `TermuxTerminalExtraKeys`. Moreover, you can now long hold on `CTRL`, `ALT`, `SHIFT` and `FN` to lock those control keys. They will not be released when you press another key and will only be released by pressing the respective control key again. Closes termux#2049, Closes termux#1861
- Loading branch information
1 parent
e4fa1ef
commit d936b60
Showing
16 changed files
with
1,470 additions
and
764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/termux/app/terminal/io/TermuxTerminalExtraKeys.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.termux.app.terminal.io; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.view.Gravity; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.drawerlayout.widget.DrawerLayout; | ||
|
||
import com.termux.R; | ||
import com.termux.app.terminal.TermuxTerminalSessionClient; | ||
import com.termux.app.terminal.TermuxTerminalViewClient; | ||
import com.termux.shared.terminal.io.TerminalExtraKeys; | ||
import com.termux.view.TerminalView; | ||
|
||
public class TermuxTerminalExtraKeys extends TerminalExtraKeys { | ||
|
||
|
||
TermuxTerminalViewClient mTermuxTerminalViewClient; | ||
TermuxTerminalSessionClient mTermuxTerminalSessionClient; | ||
|
||
public TermuxTerminalExtraKeys(@NonNull TerminalView terminalView, | ||
TermuxTerminalViewClient termuxTerminalViewClient, | ||
TermuxTerminalSessionClient termuxTerminalSessionClient) { | ||
super(terminalView); | ||
mTermuxTerminalViewClient = termuxTerminalViewClient; | ||
mTermuxTerminalSessionClient = termuxTerminalSessionClient; | ||
} | ||
|
||
@SuppressLint("RtlHardcoded") | ||
@Override | ||
public void onTerminalExtraKeyButtonClick(View view, String key, boolean ctrlDown, boolean altDown, boolean shiftDown, boolean fnDown) { | ||
if ("KEYBOARD".equals(key)) { | ||
if(mTermuxTerminalViewClient != null) | ||
mTermuxTerminalViewClient.onToggleSoftKeyboardRequest(); | ||
} else if ("DRAWER".equals(key)) { | ||
DrawerLayout drawer = view.findViewById(R.id.drawer_layout); | ||
drawer.openDrawer(Gravity.LEFT); | ||
} else if ("PASTE".equals(key)) { | ||
if(mTermuxTerminalSessionClient != null) | ||
mTermuxTerminalSessionClient.onPasteTextFromClipboard(null); | ||
} else { | ||
super.onTerminalExtraKeyButtonClick(view, key, ctrlDown, altDown, shiftDown, fnDown); | ||
} | ||
} | ||
|
||
} |
92 changes: 0 additions & 92 deletions
92
app/src/main/java/com/termux/app/terminal/io/extrakeys/ExtraKeyButton.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.