Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ca82ea095 | ||
|
|
913c474d32 | ||
|
|
657c270d97 | ||
|
|
7763931035 | ||
|
|
50005bc794 | ||
|
|
96f5ed985a |
@@ -18,8 +18,8 @@ android {
|
|||||||
applicationId "com.termux"
|
applicationId "com.termux"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 23
|
versionCode 25
|
||||||
versionName "0.23"
|
versionName "0.25"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -136,9 +136,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
if (ensureStoragePermissionGranted()) TermuxInstaller.setupStorageSymlinks(TermuxActivity.this);
|
if (ensureStoragePermissionGranted()) TermuxInstaller.setupStorageSymlinks(TermuxActivity.this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (whatToReload == null || "colors".equals(whatToReload)) mTerminalView.checkForColors();
|
mTerminalView.checkForFontAndColors();
|
||||||
if (whatToReload == null || "font".equals(whatToReload)) mTerminalView.checkForTypeface();
|
mSettings.reloadFromProperties(TermuxActivity.this);
|
||||||
if (whatToReload == null || "settings".equals(whatToReload)) mSettings.reloadFromProperties(TermuxActivity.this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -281,14 +280,16 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
findViewById(R.id.new_session_button).setOnClickListener(new OnClickListener() {
|
View newSessionButton = findViewById(R.id.new_session_button);
|
||||||
|
|
||||||
|
newSessionButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
addNewSession(false, null);
|
addNewSession(false, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
findViewById(R.id.new_session_button).setOnLongClickListener(new OnLongClickListener() {
|
newSessionButton.setOnLongClickListener(new OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
@@ -336,8 +337,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
startService(serviceIntent);
|
startService(serviceIntent);
|
||||||
if (!bindService(serviceIntent, this, 0)) throw new RuntimeException("bindService() failed");
|
if (!bindService(serviceIntent, this, 0)) throw new RuntimeException("bindService() failed");
|
||||||
|
|
||||||
mTerminalView.checkForTypeface();
|
mTerminalView.checkForFontAndColors();
|
||||||
mTerminalView.checkForColors();
|
|
||||||
|
|
||||||
mBellSoundId = mBellSoundPool.load(this, R.raw.bell, 1);
|
mBellSoundId = mBellSoundPool.load(this, R.raw.bell, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,5 @@
|
|||||||
package com.termux.view;
|
package com.termux.view;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import com.termux.terminal.EmulatorDebug;
|
|
||||||
import com.termux.terminal.KeyHandler;
|
|
||||||
import com.termux.terminal.TerminalColors;
|
|
||||||
import com.termux.terminal.TerminalEmulator;
|
|
||||||
import com.termux.terminal.TerminalSession;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -30,6 +19,17 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.widget.Scroller;
|
import android.widget.Scroller;
|
||||||
|
|
||||||
|
import com.termux.terminal.EmulatorDebug;
|
||||||
|
import com.termux.terminal.KeyHandler;
|
||||||
|
import com.termux.terminal.TerminalColors;
|
||||||
|
import com.termux.terminal.TerminalEmulator;
|
||||||
|
import com.termux.terminal.TerminalSession;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/** View displaying and interacting with a {@link TerminalSession}. */
|
/** View displaying and interacting with a {@link TerminalSession}. */
|
||||||
public final class TerminalView extends View {
|
public final class TerminalView extends View {
|
||||||
|
|
||||||
@@ -644,13 +644,20 @@ public final class TerminalView extends View {
|
|||||||
if (resultingKeyCode > -1) {
|
if (resultingKeyCode > -1) {
|
||||||
handleKeyCode(resultingKeyCode, 0);
|
handleKeyCode(resultingKeyCode, 0);
|
||||||
} else {
|
} else {
|
||||||
// The below two workarounds are needed on at least Logitech Keyboard k810 on Samsung Galaxy Tab Pro
|
// Work around bluetooth keyboards sending funny unicode characters instead
|
||||||
// (Android 4.4) with the stock Samsung Keyboard. They should be harmless when not used since the need
|
// of the more normal ones from ASCII that terminal programs expect - the
|
||||||
// to input the original characters instead of the new ones using the keyboard should be low.
|
// desire to input the original characters should be low.
|
||||||
// Rewrite U+02DC 'SMALL TILDE' to U+007E 'TILDE' for ~ to work in shells:
|
switch (codePoint) {
|
||||||
if (codePoint == 0x02DC) codePoint = 0x07E;
|
case 0x02DC: // SMALL TILDE.
|
||||||
// Rewrite U+02CB 'MODIFIER LETTER GRAVE ACCENT' to U+0060 'GRAVE ACCENT' for ` (backticks) to work:
|
codePoint = 0x007E; // TILDE (~).
|
||||||
if (codePoint == 0x02CB) codePoint = 0x60;
|
break;
|
||||||
|
case 0x02CB: // MODIFIER LETTER GRAVE ACCENT.
|
||||||
|
codePoint = 0x0060; // GRAVE ACCENT (`).
|
||||||
|
break;
|
||||||
|
case 0x02C6: // MODIFIER LETTER CIRCUMFLEX ACCENT.
|
||||||
|
codePoint = 0x005E; // CIRCUMFLEX ACCENT (^).
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// If left alt, send escape before the code point to make e.g. Alt+B and Alt+F work in readline:
|
// If left alt, send escape before the code point to make e.g. Alt+B and Alt+F work in readline:
|
||||||
mTermSession.writeCodePoint(leftAltDownFromEvent, codePoint);
|
mTermSession.writeCodePoint(leftAltDownFromEvent, codePoint);
|
||||||
@@ -710,67 +717,28 @@ public final class TerminalView extends View {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkForTypeface() {
|
public void checkForFontAndColors() {
|
||||||
new Thread() {
|
try {
|
||||||
@Override
|
File fontFile = new File("/data/data/com.termux/files/home/.termux/font.ttf");
|
||||||
public void run() {
|
File colorsFile = new File("/data/data/com.termux/files/home/.termux/colors.properties");
|
||||||
try {
|
|
||||||
File fontFile = new File("/data/data/com.termux/files/home/.termux/font.ttf");
|
|
||||||
final Typeface newTypeface = fontFile.exists() ? Typeface.createFromFile(fontFile) : Typeface.MONOSPACE;
|
|
||||||
if (newTypeface != mRenderer.mTypeface) {
|
|
||||||
post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
mRenderer = new TerminalRenderer(mRenderer.mTextSize, newTypeface);
|
|
||||||
updateSize();
|
|
||||||
invalidate();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(EmulatorDebug.LOG_TAG, "Error loading font", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(EmulatorDebug.LOG_TAG, "Error loading font", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkForColors() {
|
final Properties props = new Properties();
|
||||||
new Thread() {
|
if (colorsFile.isFile()) {
|
||||||
@Override
|
try (InputStream in = new FileInputStream(colorsFile)) {
|
||||||
public void run() {
|
props.load(in);
|
||||||
try {
|
|
||||||
File colorsFile = new File("/data/data/com.termux/files/home/.termux/colors.properties");
|
|
||||||
final Properties props = colorsFile.isFile() ? new Properties() : null;
|
|
||||||
if (props != null) {
|
|
||||||
try (InputStream in = new FileInputStream(colorsFile)) {
|
|
||||||
props.load(in);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
if (props == null) {
|
|
||||||
TerminalColors.COLOR_SCHEME.reset();
|
|
||||||
} else {
|
|
||||||
TerminalColors.COLOR_SCHEME.updateWith(props);
|
|
||||||
}
|
|
||||||
if (mEmulator != null) mEmulator.mColors.reset();
|
|
||||||
invalidate();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(EmulatorDebug.LOG_TAG, "Setting colors failed: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(EmulatorDebug.LOG_TAG, "Failed colors handling", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
TerminalColors.COLOR_SCHEME.updateWith(props);
|
||||||
|
if (mEmulator != null) mEmulator.mColors.reset();
|
||||||
|
|
||||||
|
final Typeface newTypeface = fontFile.exists() ? Typeface.createFromFile(fontFile) : Typeface.MONOSPACE;
|
||||||
|
mRenderer = new TerminalRenderer(mRenderer.mTextSize, newTypeface);
|
||||||
|
updateSize();
|
||||||
|
|
||||||
|
invalidate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(EmulatorDebug.LOG_TAG, "Error in checkForFontAndColors()", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
90
gradlew.bat
vendored
90
gradlew.bat
vendored
@@ -1,90 +0,0 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windowz variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
goto execute
|
|
||||||
|
|
||||||
:4NT_args
|
|
||||||
@rem Get arguments from the 4NT Shell from JP Software
|
|
||||||
set CMD_LINE_ARGS=%$
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
||||||
BIN
travis.keystore
BIN
travis.keystore
Binary file not shown.
Reference in New Issue
Block a user