Mercurial > 510Connectbot
changeset 457:105815cce146 stable-1.9.3-3
minimum version android 5, target and compile version api 28
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 29 Jan 2019 11:21:57 -0800 |
parents | b00031b2d6ac |
children | ad275ce23092 |
files | Makefile app/build.gradle app/src/main/AndroidManifest.xml app/src/main/java/com/five_ten_sg/connectbot/ConsoleActivity.java app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java app/src/main/java/com/five_ten_sg/connectbot/TerminalView.java app/src/main/java/com/five_ten_sg/connectbot/service/ConnectionNotifier.java app/src/main/java/com/five_ten_sg/connectbot/service/TerminalBridge.java app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java app/src/main/java/com/five_ten_sg/connectbot/util/UberColorPickerDialog.java app/src/main/jni/Exec/com_google_ase_Exec.cpp build.gradle |
diffstat | 12 files changed, 83 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sat Nov 10 12:18:05 2018 -0800 +++ b/Makefile Tue Jan 29 11:21:57 2019 -0800 @@ -24,15 +24,17 @@ hg pull; hg update make builder -builder: prep - rm -rf app/build/* - echo -e "$(version)" >app/src/main/res/values/version.xml - cat app/src/main/res/values/version.xml +builder: clean prep ANDROID_HOME=/home/carl/Android/Sdk ANDROID_NDK_HOME=/home/carl/Android/Sdk/ndk-bundle ./gradlew $(task) mv app/build/outputs/apk/arm/$(style)/app-arm-$(style).apk $(apk) ls -al app/build/outputs/apk +clean: + rm -rf app/build/* + rm -rf app/.externalNativeBuild || true + prep: + echo -e "$(version)" >app/src/main/res/values/version.xml (cd help; make) genkey:
--- a/app/build.gradle Sat Nov 10 12:18:05 2018 -0800 +++ b/app/build.gradle Tue Jan 29 11:21:57 2019 -0800 @@ -1,23 +1,3 @@ -task copyDebugLibTask(type: Copy) { - from 'build/intermediates/binaries/debug/arm/lib/armeabi' - into 'src/main/jniLibs/armeabi' -} -task copyReleaseLibTask(type: Copy) { - from 'build/intermediates/binaries/release/arm/lib/armeabi' - into 'src/main/jniLibs/armeabi' -} - -tasks.whenTaskAdded { task -> - if (task.name.contains("merge") && task.name.contains("JniLibFolders")) { - if (task.name.contains("ArmDebug")) { - task.dependsOn copyDebugLibTask - } - if (task.name.contains("ArmRelease")) { - task.dependsOn copyReleaseLibTask - } - } -} - apply plugin: 'com.android.application' @@ -36,11 +16,11 @@ keyAlias = "510Connectbot" } } - compileSdkVersion = 16 + compileSdkVersion = 28 buildTypes { release { minifyEnabled = false - signingConfig = signingConfigs.release + signingConfig = android.signingConfigs.release ndk { debuggable = false abiFilters 'armeabi-v7a' @@ -73,10 +53,11 @@ defaultConfig { applicationId = "com.five_ten_sg.connectbot" - minSdkVersion = 8 - targetSdkVersion = 26 + minSdkVersion = 21 + targetSdkVersion = 28 ndk { moduleName = "com_google_ase_Exec" + abiFilters 'armeabi-v7a' } }
--- a/app/src/main/AndroidManifest.xml Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/AndroidManifest.xml Tue Jan 29 11:21:57 2019 -0800 @@ -17,8 +17,8 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.five_ten_sg.connectbot" - android:versionName="1.9.3-2" - android:versionCode="1932" + android:versionName="1.9.3-3" + android:versionCode="1933" android:installLocation="auto"> <uses-permission android:name="android.permission.INTERNET" />
--- a/app/src/main/java/com/five_ten_sg/connectbot/ConsoleActivity.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/ConsoleActivity.java Tue Jan 29 11:21:57 2019 -0800 @@ -52,7 +52,6 @@ import android.text.InputType; import android.text.method.PasswordTransformationMethod; import android.text.method.SingleLineTransformationMethod; -import android.util.FloatMath; import android.util.Log; import android.view.GestureDetector; import android.view.KeyEvent; @@ -689,8 +688,8 @@ public boolean onTouch(View v, MotionEvent event) { // when copying, highlight the area if (copySource != null && copySource.isSelectingForCopy()) { - int row = (int)FloatMath.floor(event.getY() / copySource.charHeight); - int col = (int)FloatMath.floor(event.getX() / copySource.charWidth); + int row = (int)Math.floor(event.getY() / copySource.charHeight); + int col = (int)Math.floor(event.getX() / copySource.charWidth); SelectionArea area = copySource.getSelectionArea(); switch (event.getAction()) {
--- a/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java Tue Jan 29 11:21:57 2019 -0800 @@ -508,7 +508,7 @@ (new File(fn)).delete(); } catch (Exception e) { - Log.d(TAG, "Deployment scan failed.", e); + Log.d(TAG, "Deployment scan failed."); } }
--- a/app/src/main/java/com/five_ten_sg/connectbot/TerminalView.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/TerminalView.java Tue Jan 29 11:21:57 2019 -0800 @@ -32,15 +32,17 @@ import android.content.pm.ResolveInfo; import android.database.Cursor; import android.graphics.Canvas; +import android.graphics.ColorMatrix; +import android.graphics.ColorMatrixColorFilter; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; -import android.graphics.PixelXorXfermode; import android.graphics.RectF; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import android.view.KeyEvent; +import android.view.ScaleGestureDetector; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.view.accessibility.AccessibilityEvent; @@ -48,7 +50,6 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; -import android.view.ScaleGestureDetector; import android.widget.Toast; import de.mud.terminal.VDUBuffer; @@ -97,6 +98,15 @@ public ScaleGestureDetector mScaleDetector; + private ColorMatrix getColorMatrix() { + return new ColorMatrix(new float[] { + -1, 0, 0, 0, 255, + 0, -1, 0, 0, 255, + 0, 0, -1, 0, 255, + 0, 0, 0, 1, 0 + }); + } + public TerminalView(Context context, TerminalBridge bridge) { super(context); this.context = context; @@ -107,7 +117,8 @@ setFocusableInTouchMode(true); cursorPaint = new Paint(); cursorPaint.setColor(bridge.color[bridge.defaultFg]); - cursorPaint.setXfermode(new PixelXorXfermode(bridge.color[bridge.defaultBg])); + cursorPaint.setColorFilter(new ColorMatrixColorFilter(getColorMatrix())); + //cursorPaint.setXfermode(new PixelXorXfermode(bridge.color[bridge.defaultBg])); cursorPaint.setAntiAlias(true); cursorStrokePaint = new Paint(cursorPaint); cursorStrokePaint.setStrokeWidth(0.1f); @@ -223,14 +234,13 @@ else if ((metaState & TerminalKeyListener.META_CTRL_LOCK) != 0) canvas.drawPath(ctrlCursor, cursorPaint); - // Restore previous clip region - canvas.restore(); + canvas.restore(); // Restore previous clip region } // draw any highlighted area if (bridge.isSelectingForCopy()) { SelectionArea area = bridge.getSelectionArea(); - canvas.save(Canvas.CLIP_SAVE_FLAG); + canvas.save(); canvas.clipRect( area.getLeft() * bridge.charWidth, area.getTop() * bridge.charHeight,
--- a/app/src/main/java/com/five_ten_sg/connectbot/service/ConnectionNotifier.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/service/ConnectionNotifier.java Tue Jan 29 11:21:57 2019 -0800 @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; +import android.graphics.BitmapFactory; /** * @author Kenny Root @@ -43,56 +44,48 @@ return (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); } - protected Notification newNotification(Context context) { - Notification notification = new Notification(); - notification.icon = R.drawable.notification_icon; - notification.when = System.currentTimeMillis(); - return notification; - } - protected Notification newActivityNotification(Context context, HostBean host) { - Notification notification = newNotification(context); + int rgb; + if (HostDatabase.COLOR_RED.equals(host.getColor())) + rgb = Color.RED; + else if (HostDatabase.COLOR_GREEN.equals(host.getColor())) + rgb = Color.GREEN; + else if (HostDatabase.COLOR_BLUE.equals(host.getColor())) + rgb = Color.BLUE; + else + rgb = Color.WHITE; Resources res = context.getResources(); - String contentText = res.getString( - R.string.notification_text, host.getNickname()); Intent notificationIntent = new Intent(context, ConsoleActivity.class); - notificationIntent.setAction(Intent.ACTION_VIEW); - notificationIntent.setData(host.getUri()); - PendingIntent contentIntent = PendingIntent.getActivity(context, 0, - notificationIntent, 0); - notification.setLatestEventInfo(context, res.getString(R.string.app_name), contentText, contentIntent); - notification.flags = Notification.FLAG_AUTO_CANCEL; - notification.flags |= Notification.DEFAULT_LIGHTS; - - if (HostDatabase.COLOR_RED.equals(host.getColor())) - notification.ledARGB = Color.RED; - else if (HostDatabase.COLOR_GREEN.equals(host.getColor())) - notification.ledARGB = Color.GREEN; - else if (HostDatabase.COLOR_BLUE.equals(host.getColor())) - notification.ledARGB = Color.BLUE; - else - notification.ledARGB = Color.WHITE; - - notification.ledOnMS = 300; - notification.ledOffMS = 1000; - notification.flags |= Notification.FLAG_SHOW_LIGHTS; + PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); + Notification notification = new Notification.Builder(context) + .setContentTitle(res.getString(R.string.app_name)) + .setContentText(res.getString(R.string.notification_text, host.getNickname())) + .setContentIntent(contentIntent) + .setWhen(System.currentTimeMillis()) + .setSmallIcon(R.drawable.notification_icon) + .setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.notification_icon)) + .setLights(rgb, 300, 1000) + .build(); + notification.flags |= Notification.FLAG_AUTO_CANCEL; return notification; } protected Notification newRunningNotification(Context context) { - Notification notification = newNotification(context); - notification.flags = Notification.FLAG_ONGOING_EVENT - | Notification.FLAG_NO_CLEAR; - notification.when = 0; - notification.contentIntent = PendingIntent.getActivity(context, - ONLINE_NOTIFICATION, - new Intent(context, ConsoleActivity.class), 0); Resources res = context.getResources(); - notification.setLatestEventInfo(context, - res.getString(R.string.app_name), - res.getString(R.string.app_is_running), - notification.contentIntent); + Intent notificationIntent = new Intent(context, ConsoleActivity.class); + PendingIntent contentIntent = PendingIntent.getActivity(context, ONLINE_NOTIFICATION, notificationIntent, 0); + Notification notification = new Notification.Builder(context) + .setContentTitle(res.getString(R.string.app_name)) + .setContentText(res.getString(R.string.app_is_running)) + .setContentIntent(contentIntent) + .setWhen(0) + .setOngoing(true) + .setSmallIcon(R.drawable.notification_icon) + .setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.notification_icon)) + .build(); + notification.flags |= Notification.FLAG_NO_CLEAR; return notification; + } public void showActivityNotification(Service context, HostBean host) {
--- a/app/src/main/java/com/five_ten_sg/connectbot/service/TerminalBridge.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/service/TerminalBridge.java Tue Jan 29 11:21:57 2019 -0800 @@ -55,7 +55,6 @@ import android.text.ClipboardManager; import android.text.Editable; import android.text.method.CharacterPickerDialog; -import android.util.FloatMath; import android.util.Log; import android.view.KeyEvent; import android.view.View; @@ -450,11 +449,11 @@ fontSize = size; // read new metrics to get exact pixel dimensions FontMetrics fm = defaultPaint.getFontMetrics(); - charTop = (int)FloatMath.ceil(fm.top); + charTop = (int)Math.ceil(fm.top); float[] widths = new float[1]; defaultPaint.getTextWidths("X", widths); - charWidth = (int)FloatMath.ceil(widths[0]); - charHeight = (int)FloatMath.ceil(fm.descent - fm.top); + charWidth = (int)Math.ceil(widths[0]); + charHeight = (int)Math.ceil(fm.descent - fm.top); // refresh any bitmap with new font size if (parent != null) parentChanged(parent); @@ -691,7 +690,7 @@ } // Save the current clip region - canvas.save(Canvas.CLIP_SAVE_FLAG); + canvas.save(); // clear this dirty area with background color defaultPaint.setColor(bg); @@ -800,7 +799,7 @@ float[] widths = new float[1]; defaultPaint.getTextWidths("X", widths); int termWidth = (int)widths[0] * cols; - int termHeight = (int)FloatMath.ceil(fm.descent - fm.top) * rows; + int termHeight = (int)Math.ceil(fm.descent - fm.top) * rows; Log.d("fontsize", String.format("font size %f resulted in %d x %d", size, termWidth, termHeight)); // Check to see if it fits in resolution specified.
--- a/app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java Tue Jan 29 11:21:57 2019 -0800 @@ -26,7 +26,7 @@ public class TerminalMonitor { - public final static String TAG = "ConnectBot.TerminalMonitor"; + public final static String TAG = "ConnectBot.TermMonitor"; public static final char MONITOR_CMD_INIT = 0; public static final char MONITOR_CMD_ACTIVATE = 1; @@ -281,6 +281,7 @@ keymap.put(0x87, vt320.KEY_F24); // vk_f24 // bind to the monitor service Intent intent = new Intent("com.five_ten_sg.connectbot.monitor.MonitorService"); + intent.setPackage("com.five_ten_sg.connectbot.monitor"); parent.bindService(intent, monitor_connection, Context.BIND_AUTO_CREATE); Log.i(TAG, "constructor"); }
--- a/app/src/main/java/com/five_ten_sg/connectbot/util/UberColorPickerDialog.java Sat Nov 10 12:18:05 2018 -0800 +++ b/app/src/main/java/com/five_ten_sg/connectbot/util/UberColorPickerDialog.java Tue Jan 29 11:21:57 2019 -0800 @@ -52,7 +52,6 @@ import android.graphics.drawable.GradientDrawable.Orientation; import android.os.Bundle; import android.util.DisplayMetrics; -import android.util.FloatMath; import android.view.MotionEvent; import android.view.View; @@ -492,8 +491,8 @@ setVerValSlider(); float angle = 2 * PI - mHSV[0] / (180 / 3.1415927f); float radius = mHSV[1] * PALETTE_RADIUS; - mCoord[0] = (int)(FloatMath.cos(angle) * radius); - mCoord[1] = (int)(FloatMath.sin(angle) * radius); + mCoord[0] = (int)(Math.cos(angle) * radius); + mCoord[1] = (int)(Math.sin(angle) * radius); mCoord[2] = PALETTE_DIM - (int)(mHSV[2] * PALETTE_DIM); } @@ -731,7 +730,7 @@ else if (mCoord[1] > PALETTE_RADIUS) mCoord[1] = PALETTE_RADIUS; - float radius = FloatMath.sqrt(mCoord[0] * mCoord[0] + mCoord[1] * mCoord[1]); + float radius = (float)Math.sqrt(mCoord[0] * mCoord[0] + mCoord[1] * mCoord[1]); if (radius > PALETTE_RADIUS) radius = PALETTE_RADIUS; @@ -744,8 +743,8 @@ unit += 1; } - mCoord[0] = round(FloatMath.cos(angle) * radius); - mCoord[1] = round(FloatMath.sin(angle) * radius); + mCoord[0] = round(Math.cos(angle) * radius); + mCoord[1] = round(Math.sin(angle) * radius); int c = interpColor(mSpectrumColorsRev, unit); float[] hsv = new float[3]; Color.colorToHSV(c, hsv); @@ -850,7 +849,7 @@ boolean inSwatchOld = ptInRect(round(x), round(y), mOldSwatchRect); boolean inSwatchNew = ptInRect(round(x), round(y), mNewSwatchRect); //Get the event's distance from the center of the main 2D palette - float radius = FloatMath.sqrt(circlePinnedX * circlePinnedX + circlePinnedY * circlePinnedY); + float radius = (float)Math.sqrt(circlePinnedX * circlePinnedX + circlePinnedY * circlePinnedY); //Is the event in a circle-pinned 2D palette? boolean inOvalPalette = radius <= PALETTE_RADIUS; @@ -896,8 +895,8 @@ unit += 1; } - mCoord[0] = round(FloatMath.cos(angle) * radius); - mCoord[1] = round(FloatMath.sin(angle) * radius); + mCoord[0] = round(Math.cos(angle) * radius); + mCoord[1] = round(Math.sin(angle) * radius); int c = interpColor(mSpectrumColorsRev, unit); float[] hsv = new float[3]; Color.colorToHSV(c, hsv);