From 87f72caa68ffb699682e0dd832507cbb76b7e0b3 Mon Sep 17 00:00:00 2001 From: Hilledkinged Date: Tue, 20 Apr 2021 22:17:36 +0300 Subject: [PATCH 1/4] Add support for Android studio 4.1.3 Compiles and deploys an apk --- app/build.gradle | 1 + app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt | 1 + build.gradle | 9 ++++++--- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0817575..ef42f3f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' android { compileSdkVersion rootProject.ext.android.COMPILE_SDK_VERSION diff --git a/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt b/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt index 9e41167..52d06cd 100644 --- a/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt +++ b/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt @@ -7,6 +7,7 @@ import android.content.* import android.content.pm.PackageManager import android.content.res.Configuration import android.os.Bundle +import android.os.Handler import android.os.IBinder import android.preference.PreferenceManager import android.support.v4.app.ActivityCompat diff --git a/build.gradle b/build.gradle index 4f7b250..af0bfb6 100644 --- a/build.gradle +++ b/build.gradle @@ -21,10 +21,11 @@ buildscript { return "" } + ext.kotlin_version = '1.3.50' ext.android = [ ANDROID_SUPPORT_VERSION: '27.0.2', - KOTLIN_VERSION : '1.2.51', + KOTLIN_VERSION : '1.3.50', MIN_SDK_VERSION : 21, @@ -42,7 +43,7 @@ buildscript { "appcompat-v7" : "com.android.support:appcompat-v7:${ext.android.ANDROID_SUPPORT_VERSION}", "design" : "com.android.support:design:${ext.android.ANDROID_SUPPORT_VERSION}", "cardview-v7" : "com.android.support:cardview-v7:${ext.android.ANDROID_SUPPORT_VERSION}", - "kotlin-stdlib" : "org.jetbrains.kotlin:kotlin-stdlib-jre7:${ext.android.KOTLIN_VERSION}", + "kotlin-stdlib" : "org.jetbrains.kotlin:kotlin-stdlib:${ext.android.KOTLIN_VERSION}", "kotlin-gradle-plugin": "org.jetbrains.kotlin:kotlin-gradle-plugin:${ext.android.KOTLIN_VERSION}", "junit" : "junit:junit:${ext.android.JUNIT_VERSION}" ] @@ -54,7 +55,8 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.5.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath rootProject.ext.deps["kotlin-gradle-plugin"] classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' @@ -71,6 +73,7 @@ allprojects { maven { url 'https://dl.google.com/dl/android/maven2/' } mavenCentral() maven { url "https://jitpack.io" } + google() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4b1859f..933e9e1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Nov 08 23:25:07 CST 2018 +#Tue Apr 20 22:03:06 EEST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip From 87cf19099209a87c44c441d68d9ec449b20e6974 Mon Sep 17 00:00:00 2001 From: Hilledkinged Date: Tue, 20 Apr 2021 22:24:53 +0300 Subject: [PATCH 2/4] Fixed bad url's For setup and in NeoTermPath --- app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt | 2 +- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt b/app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt index e4de795..79ded73 100644 --- a/app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt +++ b/app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt @@ -25,7 +25,7 @@ object NeoTermPath { const val SOURCE_FILE = "$USR_PATH/etc/apt/sources.list" const val PACKAGE_LIST_DIR = "$USR_PATH/var/lib/apt/lists" - private const val SOURCE = "http://120.79.193.152" + private const val SOURCE = "http://120.79.193.152/neoterm" val DEFAULT_MAIN_PACKAGE_SOURCE: String diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 63b4922..6774f68 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -168,7 +168,7 @@ Dangerous Zone You will have to re-setup later, confirm? - http://120.79.193.152 + http://120.79.193.152/neoterm sh From acad5c1608a122add7d71b0b8af686d06a82e9c8 Mon Sep 17 00:00:00 2001 From: Hilledkinged Date: Tue, 20 Apr 2021 23:21:51 +0300 Subject: [PATCH 3/4] Refactored to AndroidX + target and compile sdk 28 + Side fixes that were needed All of these changes were needed to get app compiling after refactoring --- NeoTermBridge/build.gradle | 5 +- .../bridge/ExampleInstrumentedTest.java | 4 +- NeoTermBridgeExample/build.gradle | 6 +- .../example/ExampleInstrumentedTest.java | 4 +- .../src/main/res/values/styles.xml | 2 +- Xorg/build.gradle | 4 +- .../io/neoterm/ExampleInstrumentedTest.java | 4 +- .../main/java/io/neoterm/Accelerometer.java | 21 ++---- .../main/java/io/neoterm/MainActivity.java | 4 +- .../main/java/io/neoterm/SettingsMenu.java | 51 +-------------- .../java/io/neoterm/SettingsMenuKeyboard.java | 56 +++------------- .../java/io/neoterm/SettingsMenuMisc.java | 64 ++++--------------- .../java/io/neoterm/SettingsMenuMouse.java | 55 +++------------- app/build.gradle | 12 ++-- app/src/main/java/io/neoterm/App.kt | 2 +- .../component/session/SessionComponent.kt | 4 +- .../neoterm/frontend/config/NeoPermission.kt | 12 ++-- .../frontend/floating/TerminalDialog.kt | 2 +- .../java/io/neoterm/frontend/logging/NLog.kt | 4 +- .../neoterm/frontend/session/xorg/XSession.kt | 4 +- .../extrakey/button/RepeatableButton.kt | 3 +- .../io/neoterm/services/NeoTermService.kt | 5 +- .../main/java/io/neoterm/setup/SetupHelper.kt | 6 +- .../java/io/neoterm/setup/SetupThread.java | 6 +- .../java/io/neoterm/ui/bonus/BonusActivity.kt | 2 +- .../java/io/neoterm/ui/crash/CrashActivity.kt | 2 +- .../ui/customize/BaseCustomizeActivity.kt | 4 +- .../ui/customize/ColorSchemeActivity.kt | 8 +-- .../neoterm/ui/customize/CustomizeActivity.kt | 4 +- .../neoterm/ui/pm/PackageManagerActivity.kt | 16 ++--- .../neoterm/ui/pm/view/RecyclerTabLayout.java | 12 ++-- .../ui/settings/BasePreferenceActivity.kt | 6 +- .../ui/settings/GeneralSettingsActivity.kt | 2 +- .../java/io/neoterm/ui/setup/SetupActivity.kt | 4 +- .../io/neoterm/ui/support/AboutActivity.kt | 4 +- .../java/io/neoterm/ui/support/Donation.kt | 6 +- .../io/neoterm/ui/support/HelpActivity.kt | 2 +- .../io/neoterm/ui/term/NeoTermActivity.kt | 21 +++--- .../neoterm/ui/term/NeoTermRemoteInterface.kt | 7 +- .../java/io/neoterm/ui/term/tab/TermTab.kt | 2 +- .../java/io/neoterm/utils/FullScreenHelper.kt | 6 +- .../java/io/neoterm/utils/TerminalUtils.kt | 4 +- app/src/main/res/layout/ui_about.xml | 42 ++++++------ app/src/main/res/layout/ui_color_scheme.xml | 2 +- app/src/main/res/layout/ui_crash.xml | 2 +- app/src/main/res/layout/ui_customize.xml | 6 +- app/src/main/res/layout/ui_faq.xml | 10 +-- app/src/main/res/layout/ui_main.xml | 2 +- app/src/main/res/layout/ui_pm.xml | 4 +- app/src/main/res/layout/ui_pm_single_tab.xml | 2 +- app/src/main/res/menu/menu_pm.xml | 2 +- build.gradle | 10 ++- chrome-tabs/build.gradle | 4 +- .../mrapp/android/tabswitcher/Animation.java | 4 +- .../android/tabswitcher/PeekAnimation.java | 4 +- .../android/tabswitcher/RevealAnimation.java | 4 +- .../android/tabswitcher/SwipeAnimation.java | 4 +- .../de/mrapp/android/tabswitcher/Tab.java | 14 ++-- .../android/tabswitcher/TabCloseListener.java | 2 +- .../tabswitcher/TabPreviewListener.java | 2 +- .../android/tabswitcher/TabSwitcher.java | 26 ++++---- .../tabswitcher/TabSwitcherDecorator.java | 4 +- .../tabswitcher/TabSwitcherListener.java | 4 +- .../drawable/TabSwitcherDrawable.java | 6 +- .../iterator/AbstractTabItemIterator.java | 2 +- .../iterator/ArrayTabItemIterator.java | 2 +- .../tabswitcher/iterator/TabItemIterator.java | 2 +- .../layout/AbstractDragHandler.java | 4 +- .../layout/AbstractTabSwitcherLayout.java | 14 ++-- .../tabswitcher/layout/Arithmetics.java | 2 +- .../layout/ChildRecyclerAdapter.java | 4 +- .../tabswitcher/layout/TabSwitcherLayout.java | 4 +- .../layout/phone/PhoneArithmetics.java | 4 +- .../layout/phone/PhoneDragHandler.java | 6 +- .../layout/phone/PhoneRecyclerAdapter.java | 12 ++-- .../layout/phone/PhoneTabSwitcherLayout.java | 10 +-- .../layout/phone/PreviewDataBinder.java | 8 +-- .../android/tabswitcher/model/Model.java | 14 ++-- .../android/tabswitcher/model/Restorable.java | 4 +- .../android/tabswitcher/model/TabItem.java | 4 +- .../tabswitcher/model/TabSwitcherModel.java | 16 ++--- .../mrapp/android/tabswitcher/model/Tag.java | 2 +- .../tabswitcher/view/TabSwitcherButton.java | 9 ++- .../src/main/res/layout-land/phone_tab.xml | 3 +- chrome-tabs/src/main/res/layout/phone_tab.xml | 3 +- .../src/main/res/layout/phone_toolbar.xml | 2 +- .../src/main/res/values-v21/styles.xml | 2 +- gradle.properties | 2 + 88 files changed, 293 insertions(+), 454 deletions(-) diff --git a/NeoTermBridge/build.gradle b/NeoTermBridge/build.gradle index efbda8c..a8edc21 100644 --- a/NeoTermBridge/build.gradle +++ b/NeoTermBridge/build.gradle @@ -13,7 +13,7 @@ android { versionCode libraryVersionCode versionName libraryVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } @@ -27,7 +27,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { + implementation 'androidx.appcompat:appcompat:1.0.0' + androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' }) testImplementation rootProject.ext.deps["junit"] diff --git a/NeoTermBridge/src/androidTest/java/io/neoterm/bridge/ExampleInstrumentedTest.java b/NeoTermBridge/src/androidTest/java/io/neoterm/bridge/ExampleInstrumentedTest.java index 3f02033..4a2741e 100644 --- a/NeoTermBridge/src/androidTest/java/io/neoterm/bridge/ExampleInstrumentedTest.java +++ b/NeoTermBridge/src/androidTest/java/io/neoterm/bridge/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package io.neoterm.bridge; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/NeoTermBridgeExample/build.gradle b/NeoTermBridgeExample/build.gradle index bfd4313..fa6b705 100644 --- a/NeoTermBridgeExample/build.gradle +++ b/NeoTermBridgeExample/build.gradle @@ -12,7 +12,7 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } @@ -28,7 +28,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation project(':NeoTermBridge') } diff --git a/NeoTermBridgeExample/src/androidTest/java/io/neoterm/bridge/example/ExampleInstrumentedTest.java b/NeoTermBridgeExample/src/androidTest/java/io/neoterm/bridge/example/ExampleInstrumentedTest.java index 100d570..51e42c0 100644 --- a/NeoTermBridgeExample/src/androidTest/java/io/neoterm/bridge/example/ExampleInstrumentedTest.java +++ b/NeoTermBridgeExample/src/androidTest/java/io/neoterm/bridge/example/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package io.neoterm.bridge.example; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/NeoTermBridgeExample/src/main/res/values/styles.xml b/NeoTermBridgeExample/src/main/res/values/styles.xml index 9785e0c..766ab99 100644 --- a/NeoTermBridgeExample/src/main/res/values/styles.xml +++ b/NeoTermBridgeExample/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ - diff --git a/Xorg/build.gradle b/Xorg/build.gradle index a997dc3..cff007d 100644 --- a/Xorg/build.gradle +++ b/Xorg/build.gradle @@ -10,7 +10,7 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } @@ -34,7 +34,7 @@ dependencies { implementation rootProject.ext.deps["appcompat-v7"] testImplementation rootProject.ext.deps["junit"] - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' }) } diff --git a/Xorg/src/androidTest/java/io/neoterm/ExampleInstrumentedTest.java b/Xorg/src/androidTest/java/io/neoterm/ExampleInstrumentedTest.java index 7a04745..7db9ed8 100644 --- a/Xorg/src/androidTest/java/io/neoterm/ExampleInstrumentedTest.java +++ b/Xorg/src/androidTest/java/io/neoterm/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package io.neoterm; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/Xorg/src/main/java/io/neoterm/Accelerometer.java b/Xorg/src/main/java/io/neoterm/Accelerometer.java index c236c1d..c2fe2e4 100644 --- a/Xorg/src/main/java/io/neoterm/Accelerometer.java +++ b/Xorg/src/main/java/io/neoterm/Accelerometer.java @@ -22,21 +22,14 @@ freely, subject to the following restrictions: package io.neoterm; -import android.app.Activity; import android.content.Context; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.KeyEvent; -import android.view.Window; -import android.view.WindowManager; -import android.os.Vibrator; -import android.hardware.SensorManager; -import android.hardware.SensorEventListener; import android.hardware.Sensor; import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import androidx.appcompat.app.AppCompatActivity; import android.util.Log; -import android.widget.TextView; -import android.os.Build; + import java.util.Arrays; @@ -294,12 +287,12 @@ class AccelerometerReader implements SensorEventListener public void onAccuracyChanged(Sensor s, int a) { } - public boolean available(Activity context) + public boolean available(AppCompatActivity context) { SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); return ( manager != null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null ); } - public void registerListener(Activity context, SensorEventListener l) + public void registerListener(AppCompatActivity context, SensorEventListener l) { SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); if ( manager == null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) == null ) @@ -308,7 +301,7 @@ class AccelerometerReader implements SensorEventListener Globals.AppUsesOrientationSensor ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME); } - public void unregisterListener(Activity context,SensorEventListener l) + public void unregisterListener(AppCompatActivity context, SensorEventListener l) { SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); if ( manager == null ) diff --git a/Xorg/src/main/java/io/neoterm/MainActivity.java b/Xorg/src/main/java/io/neoterm/MainActivity.java index d7b082f..f9e461f 100644 --- a/Xorg/src/main/java/io/neoterm/MainActivity.java +++ b/Xorg/src/main/java/io/neoterm/MainActivity.java @@ -24,7 +24,6 @@ package io.neoterm; import android.Manifest; import android.annotation.SuppressLint; -import android.app.Activity; import android.app.KeyguardManager; import android.app.ProgressDialog; import android.app.UiModeManager; @@ -40,6 +39,7 @@ import android.inputmethodservice.Keyboard; import android.inputmethodservice.KeyboardView; import android.os.Bundle; import android.os.SystemClock; +import androidx.appcompat.app.AppCompatActivity; import android.text.InputType; import android.text.SpannedString; import android.util.DisplayMetrics; @@ -72,7 +72,7 @@ import io.neoterm.xorg.NeoXorgViewClient; import io.neoterm.xorg.R; -public class MainActivity extends Activity implements NeoXorgViewClient { +public class MainActivity extends AppCompatActivity implements NeoXorgViewClient { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/Xorg/src/main/java/io/neoterm/SettingsMenu.java b/Xorg/src/main/java/io/neoterm/SettingsMenu.java index 8db572c..f9804ea 100644 --- a/Xorg/src/main/java/io/neoterm/SettingsMenu.java +++ b/Xorg/src/main/java/io/neoterm/SettingsMenu.java @@ -22,57 +22,10 @@ freely, subject to the following restrictions: package io.neoterm; -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.KeyEvent; -import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; -import android.util.Log; -import java.io.*; -import android.app.AlertDialog; import android.content.DialogInterface; -import android.os.Environment; -import android.os.StatFs; -import java.util.Locale; +import androidx.appcompat.app.AlertDialog; + import java.util.ArrayList; -import java.util.Arrays; -import java.util.zip.GZIPInputStream; -import java.util.Collections; -import android.content.Context; -import android.content.res.Configuration; -import android.content.res.Resources; -import java.lang.String; -import android.graphics.Matrix; -import android.graphics.RectF; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.FrameLayout; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.TextView; -import android.widget.EditText; -import android.widget.ScrollView; -import android.widget.Button; -import android.view.View; -import android.widget.LinearLayout; -import android.text.Editable; -import android.text.SpannedString; -import android.content.Intent; -import android.app.PendingIntent; -import android.app.AlarmManager; -import android.util.DisplayMetrics; -import android.net.Uri; -import java.util.concurrent.Semaphore; -import java.util.Arrays; -import android.graphics.Color; -import android.hardware.SensorEventListener; -import android.hardware.SensorEvent; -import android.hardware.Sensor; -import android.widget.Toast; import io.neoterm.xorg.R; diff --git a/Xorg/src/main/java/io/neoterm/SettingsMenuKeyboard.java b/Xorg/src/main/java/io/neoterm/SettingsMenuKeyboard.java index dcb7732..e6c1e5d 100644 --- a/Xorg/src/main/java/io/neoterm/SettingsMenuKeyboard.java +++ b/Xorg/src/main/java/io/neoterm/SettingsMenuKeyboard.java @@ -22,57 +22,21 @@ freely, subject to the following restrictions: package io.neoterm; -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.KeyEvent; -import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; -import android.util.Log; -import java.io.*; -import android.app.AlertDialog; import android.content.DialogInterface; -import android.os.Environment; -import android.os.StatFs; -import java.util.Locale; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.zip.GZIPInputStream; -import java.util.Collections; -import android.content.Context; -import android.content.res.Configuration; -import android.content.res.Resources; -import java.lang.String; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.RectF; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.FrameLayout; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.TextView; -import android.widget.EditText; -import android.widget.ScrollView; -import android.widget.Button; -import android.view.View; -import android.widget.LinearLayout; -import android.text.Editable; -import android.text.SpannedString; -import android.content.Intent; -import android.app.PendingIntent; -import android.app.AlarmManager; +import androidx.appcompat.app.AlertDialog; import android.util.DisplayMetrics; -import android.net.Uri; -import java.util.concurrent.Semaphore; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.ImageView; + import java.util.Arrays; -import android.graphics.Color; -import android.hardware.SensorEventListener; -import android.hardware.SensorEvent; -import android.hardware.Sensor; -import android.widget.Toast; import io.neoterm.xorg.R; diff --git a/Xorg/src/main/java/io/neoterm/SettingsMenuMisc.java b/Xorg/src/main/java/io/neoterm/SettingsMenuMisc.java index 67e4a89..dc71e4f 100644 --- a/Xorg/src/main/java/io/neoterm/SettingsMenuMisc.java +++ b/Xorg/src/main/java/io/neoterm/SettingsMenuMisc.java @@ -22,60 +22,24 @@ freely, subject to the following restrictions: package io.neoterm; -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.KeyEvent; -import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; -import android.util.Log; -import java.io.*; -import android.app.AlertDialog; import android.content.DialogInterface; -import android.os.Environment; -import android.os.StatFs; -import java.util.Locale; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.zip.GZIPInputStream; -import java.util.Collections; -import android.content.Context; -import android.content.res.Configuration; -import android.content.res.Resources; -import java.lang.String; -import android.graphics.Matrix; -import android.graphics.RectF; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.FrameLayout; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.TextView; -import android.widget.EditText; -import android.widget.ScrollView; -import android.widget.Button; -import android.widget.Scroller; -import android.view.View; -import android.view.Gravity; -import android.widget.LinearLayout; -import android.text.Editable; -import android.text.SpannedString; import android.content.Intent; -import android.app.PendingIntent; -import android.app.AlarmManager; -import android.util.DisplayMetrics; import android.net.Uri; -import java.util.concurrent.Semaphore; -import java.util.Arrays; -import android.graphics.Color; -import android.hardware.SensorEventListener; -import android.hardware.SensorEvent; -import android.hardware.Sensor; -import android.widget.Toast; +import android.os.StatFs; +import androidx.appcompat.app.AlertDialog; import android.text.InputType; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.Locale; import io.neoterm.xorg.R; diff --git a/Xorg/src/main/java/io/neoterm/SettingsMenuMouse.java b/Xorg/src/main/java/io/neoterm/SettingsMenuMouse.java index fc68434..438340c 100644 --- a/Xorg/src/main/java/io/neoterm/SettingsMenuMouse.java +++ b/Xorg/src/main/java/io/neoterm/SettingsMenuMouse.java @@ -22,57 +22,20 @@ freely, subject to the following restrictions: package io.neoterm; -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.KeyEvent; -import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; -import android.util.Log; -import java.io.*; -import android.app.AlertDialog; import android.content.DialogInterface; -import android.os.Environment; -import android.os.StatFs; -import java.util.Locale; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.zip.GZIPInputStream; -import java.util.Collections; -import android.content.Context; -import android.content.res.Configuration; -import android.content.res.Resources; -import java.lang.String; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.RectF; +import androidx.appcompat.app.AlertDialog; +import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; -import android.widget.FrameLayout; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.TextView; -import android.widget.EditText; -import android.widget.ScrollView; -import android.widget.Button; -import android.view.View; -import android.widget.LinearLayout; -import android.text.Editable; -import android.text.SpannedString; -import android.content.Intent; -import android.app.PendingIntent; -import android.app.AlarmManager; -import android.util.DisplayMetrics; -import android.net.Uri; -import java.util.concurrent.Semaphore; -import java.util.Arrays; -import android.graphics.Color; -import android.hardware.SensorEventListener; -import android.hardware.SensorEvent; -import android.hardware.Sensor; -import android.widget.Toast; + +import java.util.ArrayList; import io.neoterm.xorg.R; diff --git a/app/build.gradle b/app/build.gradle index ef42f3f..dd0d0ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ android { targetSdkVersion rootProject.ext.android.TARGET_SDK_VERSION versionCode 37 versionName "2.1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' resConfigs "zh-rCN", "zh-rTW" externalNativeBuild { cmake { @@ -56,16 +56,10 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) testImplementation rootProject.ext.deps["junit"] androidTestImplementation project(path: ':NeoLang') implementation rootProject.ext.deps["kotlin-stdlib"] - implementation rootProject.ext.deps["design"] - implementation rootProject.ext.deps["cardview-v7"] - implementation rootProject.ext.deps["appcompat-v7"] implementation 'org.greenrobot:eventbus:3.0.0' implementation 'com.github.wrdlbrnft:modular-adapter:0.2.0.6' @@ -73,6 +67,10 @@ dependencies { implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.16' implementation 'de.psdev.licensesdialog:licensesdialog:1.8.3' implementation 'com.github.GrenderG:Color-O-Matic:1.1.5' + implementation 'androidx.annotation:annotation:1.2.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.appcompat:appcompat-resources:1.2.0' implementation project(':chrome-tabs') implementation project(':NeoLang') diff --git a/app/src/main/java/io/neoterm/App.kt b/app/src/main/java/io/neoterm/App.kt index 007945e..d6620cc 100644 --- a/app/src/main/java/io/neoterm/App.kt +++ b/app/src/main/java/io/neoterm/App.kt @@ -1,7 +1,7 @@ package io.neoterm import android.annotation.SuppressLint -import android.app.AlertDialog +import androidx.appcompat.app.AlertDialog import android.app.Application import android.content.Context import android.content.Intent diff --git a/app/src/main/java/io/neoterm/component/session/SessionComponent.kt b/app/src/main/java/io/neoterm/component/session/SessionComponent.kt index b028728..de18134 100644 --- a/app/src/main/java/io/neoterm/component/session/SessionComponent.kt +++ b/app/src/main/java/io/neoterm/component/session/SessionComponent.kt @@ -1,7 +1,7 @@ package io.neoterm.component.session import android.annotation.SuppressLint -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.Context import io.neoterm.Globals import io.neoterm.frontend.component.NeoComponent @@ -85,7 +85,7 @@ class SessionComponent : NeoComponent { } fun createSession(context: Context, parameter: XParameter): XSession { - if (context is Activity) { + if (context is AppCompatActivity) { if (!checkLibrariesLoaded()) { throw RuntimeException("Cannot load libraries!") } diff --git a/app/src/main/java/io/neoterm/frontend/config/NeoPermission.kt b/app/src/main/java/io/neoterm/frontend/config/NeoPermission.kt index 661fdb4..428e3a9 100644 --- a/app/src/main/java/io/neoterm/frontend/config/NeoPermission.kt +++ b/app/src/main/java/io/neoterm/frontend/config/NeoPermission.kt @@ -1,14 +1,14 @@ package io.neoterm.frontend.config import android.Manifest -import android.app.Activity -import android.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.app.AlertDialog import android.content.ActivityNotFoundException import android.content.DialogInterface import android.content.pm.PackageManager import android.os.Build -import android.support.v4.app.ActivityCompat -import android.support.v4.content.ContextCompat +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat /** * @author kiva @@ -16,7 +16,7 @@ import android.support.v4.content.ContextCompat object NeoPermission { const val REQUEST_APP_PERMISSION = 10086 - fun initAppPermission(context: Activity, requestCode: Int) { + fun initAppPermission(context: AppCompatActivity, requestCode: Int) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return } @@ -39,7 +39,7 @@ object NeoPermission { } } - private fun doRequestPermission(context: Activity, requestCode: Int) { + private fun doRequestPermission(context: AppCompatActivity, requestCode: Int) { try { ActivityCompat.requestPermissions(context, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), diff --git a/app/src/main/java/io/neoterm/frontend/floating/TerminalDialog.kt b/app/src/main/java/io/neoterm/frontend/floating/TerminalDialog.kt index 9b15146..6e50717 100644 --- a/app/src/main/java/io/neoterm/frontend/floating/TerminalDialog.kt +++ b/app/src/main/java/io/neoterm/frontend/floating/TerminalDialog.kt @@ -1,6 +1,6 @@ package io.neoterm.frontend.floating -import android.app.AlertDialog +import androidx.appcompat.app.AlertDialog import android.content.Context import android.content.DialogInterface import io.neoterm.R diff --git a/app/src/main/java/io/neoterm/frontend/logging/NLog.kt b/app/src/main/java/io/neoterm/frontend/logging/NLog.kt index f9fd804..0278569 100644 --- a/app/src/main/java/io/neoterm/frontend/logging/NLog.kt +++ b/app/src/main/java/io/neoterm/frontend/logging/NLog.kt @@ -1,7 +1,7 @@ package io.neoterm.frontend.logging import android.content.Context -import android.support.annotation.IntDef +import androidx.annotation.IntDef import android.util.Log import java.io.* import java.text.SimpleDateFormat @@ -21,7 +21,7 @@ object NLog { const val E = Log.ERROR const val A = Log.ASSERT - @IntDef(V.toLong(), D.toLong(), I.toLong(), W.toLong(), E.toLong(), A.toLong()) + @IntDef(V.toLong().toInt(), D.toLong().toInt(), I.toLong().toInt(), W.toLong().toInt(), E.toLong().toInt(), A.toLong().toInt()) @Retention(AnnotationRetention.SOURCE) private annotation class TYPE diff --git a/app/src/main/java/io/neoterm/frontend/session/xorg/XSession.kt b/app/src/main/java/io/neoterm/frontend/session/xorg/XSession.kt index ad38f6b..37616fa 100644 --- a/app/src/main/java/io/neoterm/frontend/session/xorg/XSession.kt +++ b/app/src/main/java/io/neoterm/frontend/session/xorg/XSession.kt @@ -1,6 +1,6 @@ package io.neoterm.frontend.session.xorg -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.app.UiModeManager import android.content.Context import android.content.pm.ActivityInfo @@ -24,7 +24,7 @@ import java.util.* * @author kiva */ -class XSession constructor(private val mActivity: Activity, val mSessionData: XSessionData) : NeoXorgViewClient { +class XSession constructor(private val mActivity: AppCompatActivity, val mSessionData: XSessionData) : NeoXorgViewClient { var mSessionName = ""; init { diff --git a/app/src/main/java/io/neoterm/frontend/terminal/extrakey/button/RepeatableButton.kt b/app/src/main/java/io/neoterm/frontend/terminal/extrakey/button/RepeatableButton.kt index be58776..1b88c0c 100644 --- a/app/src/main/java/io/neoterm/frontend/terminal/extrakey/button/RepeatableButton.kt +++ b/app/src/main/java/io/neoterm/frontend/terminal/extrakey/button/RepeatableButton.kt @@ -3,6 +3,7 @@ package io.neoterm.frontend.terminal.extrakey.button import android.content.Context import android.os.Handler import android.os.Looper +import androidx.appcompat.widget.AppCompatButton import android.util.AttributeSet import android.view.MotionEvent import android.widget.Button @@ -18,7 +19,7 @@ open class RepeatableButton(buttonText: String) : ControlButton(buttonText) { } private class RepeatableButtonWidget(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) - : Button(context, attrs, defStyleAttr) { + : AppCompatButton(context!!, attrs, defStyleAttr) { /** * Milliseconds how long we trigger an action diff --git a/app/src/main/java/io/neoterm/services/NeoTermService.kt b/app/src/main/java/io/neoterm/services/NeoTermService.kt index a8a519c..3c7f8a2 100644 --- a/app/src/main/java/io/neoterm/services/NeoTermService.kt +++ b/app/src/main/java/io/neoterm/services/NeoTermService.kt @@ -9,7 +9,8 @@ import android.os.Binder import android.os.Build import android.os.IBinder import android.os.PowerManager -import android.support.v4.app.NotificationCompat +import androidx.core.app.NotificationCompat +import androidx.appcompat.app.AppCompatActivity import io.neoterm.R import io.neoterm.backend.EmulatorDebug import io.neoterm.backend.TerminalSession @@ -92,7 +93,7 @@ class NeoTermService : Service() { return indexOfRemoved } - fun createXSession(activity: Activity, parameter: XParameter): XSession { + fun createXSession(activity: AppCompatActivity, parameter: XParameter): XSession { val session = TerminalUtils.createSession(activity, parameter) mXSessions.add(session) updateNotification() diff --git a/app/src/main/java/io/neoterm/setup/SetupHelper.kt b/app/src/main/java/io/neoterm/setup/SetupHelper.kt index baf5f8d..713eadb 100644 --- a/app/src/main/java/io/neoterm/setup/SetupHelper.kt +++ b/app/src/main/java/io/neoterm/setup/SetupHelper.kt @@ -1,7 +1,7 @@ package io.neoterm.setup -import android.app.Activity -import android.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.app.AlertDialog import android.app.ProgressDialog import android.content.Context import android.os.Build @@ -20,7 +20,7 @@ object SetupHelper { return !PREFIX_FILE.isDirectory } - fun setup(activity: Activity, connection: SourceConnection, + fun setup(activity: AppCompatActivity, connection: SourceConnection, resultListener: ResultListener) { if (!needSetup()) { resultListener.onResult(null) diff --git a/app/src/main/java/io/neoterm/setup/SetupThread.java b/app/src/main/java/io/neoterm/setup/SetupThread.java index 71222b6..5d3dac1 100644 --- a/app/src/main/java/io/neoterm/setup/SetupThread.java +++ b/app/src/main/java/io/neoterm/setup/SetupThread.java @@ -1,7 +1,7 @@ package io.neoterm.setup; -import android.app.Activity; import android.app.ProgressDialog; +import androidx.appcompat.app.AppCompatActivity; import android.system.Os; import android.util.Pair; @@ -26,11 +26,11 @@ import io.neoterm.frontend.logging.NLog; final class SetupThread extends Thread { private final SourceConnection sourceConnection; private final File prefixPath; - private final Activity activity; + private final AppCompatActivity activity; private final ResultListener resultListener; private final ProgressDialog progressDialog; - public SetupThread(Activity activity, SourceConnection sourceConnection, + public SetupThread(AppCompatActivity activity, SourceConnection sourceConnection, File prefixPath, ResultListener resultListener, ProgressDialog progressDialog) { this.activity = activity; diff --git a/app/src/main/java/io/neoterm/ui/bonus/BonusActivity.kt b/app/src/main/java/io/neoterm/ui/bonus/BonusActivity.kt index ad651c9..2c806e5 100644 --- a/app/src/main/java/io/neoterm/ui/bonus/BonusActivity.kt +++ b/app/src/main/java/io/neoterm/ui/bonus/BonusActivity.kt @@ -12,7 +12,7 @@ import android.graphics.drawable.RippleDrawable import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.OvalShape import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.* import android.view.animation.PathInterpolator import android.widget.FrameLayout diff --git a/app/src/main/java/io/neoterm/ui/crash/CrashActivity.kt b/app/src/main/java/io/neoterm/ui/crash/CrashActivity.kt index 729c49b..d0d6cff 100644 --- a/app/src/main/java/io/neoterm/ui/crash/CrashActivity.kt +++ b/app/src/main/java/io/neoterm/ui/crash/CrashActivity.kt @@ -2,7 +2,7 @@ package io.neoterm.ui.crash import android.os.Build import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.widget.TextView import io.neoterm.R import java.io.ByteArrayOutputStream diff --git a/app/src/main/java/io/neoterm/ui/customize/BaseCustomizeActivity.kt b/app/src/main/java/io/neoterm/ui/customize/BaseCustomizeActivity.kt index e3da301..e30ee5e 100644 --- a/app/src/main/java/io/neoterm/ui/customize/BaseCustomizeActivity.kt +++ b/app/src/main/java/io/neoterm/ui/customize/BaseCustomizeActivity.kt @@ -1,8 +1,8 @@ package io.neoterm.ui.customize import android.annotation.SuppressLint -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.Toolbar +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.widget.Toolbar import android.view.MenuItem import io.neoterm.R import io.neoterm.backend.TerminalSession diff --git a/app/src/main/java/io/neoterm/ui/customize/ColorSchemeActivity.kt b/app/src/main/java/io/neoterm/ui/customize/ColorSchemeActivity.kt index 9e1c1cd..73644ae 100644 --- a/app/src/main/java/io/neoterm/ui/customize/ColorSchemeActivity.kt +++ b/app/src/main/java/io/neoterm/ui/customize/ColorSchemeActivity.kt @@ -1,9 +1,9 @@ package io.neoterm.ui.customize -import android.app.AlertDialog +import androidx.appcompat.app.AlertDialog import android.os.Bundle -import android.support.v7.widget.LinearLayoutManager -import android.support.v7.widget.RecyclerView +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView import android.text.Editable import android.text.TextWatcher import android.view.KeyEvent @@ -59,7 +59,7 @@ class ColorSchemeActivity : BaseCustomizeActivity() { showItemEditor(model) } }) - val recyclerView = findViewById(R.id.custom_color_color_list) + val recyclerView = findViewById(R.id.custom_color_color_list) recyclerView.setHasFixedSize(true) recyclerView.layoutManager = LinearLayoutManager(this) recyclerView.adapter = adapter diff --git a/app/src/main/java/io/neoterm/ui/customize/CustomizeActivity.kt b/app/src/main/java/io/neoterm/ui/customize/CustomizeActivity.kt index bd8ea2f..76e91a7 100644 --- a/app/src/main/java/io/neoterm/ui/customize/CustomizeActivity.kt +++ b/app/src/main/java/io/neoterm/ui/customize/CustomizeActivity.kt @@ -1,6 +1,6 @@ package io.neoterm.ui.customize -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.Intent import android.os.Bundle import android.view.MenuItem @@ -104,7 +104,7 @@ class CustomizeActivity : BaseCustomizeActivity() { } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (resultCode == Activity.RESULT_OK && data != null) { + if (resultCode == AppCompatActivity.RESULT_OK && data != null) { val selected = MediaUtils.getPath(this, data.data) if (selected != null && selected.isNotEmpty()) { when (requestCode) { diff --git a/app/src/main/java/io/neoterm/ui/pm/PackageManagerActivity.kt b/app/src/main/java/io/neoterm/ui/pm/PackageManagerActivity.kt index 052e907..6299525 100644 --- a/app/src/main/java/io/neoterm/ui/pm/PackageManagerActivity.kt +++ b/app/src/main/java/io/neoterm/ui/pm/PackageManagerActivity.kt @@ -2,13 +2,13 @@ package io.neoterm.ui.pm import android.annotation.SuppressLint import android.os.Bundle -import android.support.v4.view.MenuItemCompat -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.LinearLayoutManager -import android.support.v7.widget.RecyclerView -import android.support.v7.widget.SearchView -import android.support.v7.widget.Toolbar +import androidx.core.view.MenuItemCompat +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import androidx.appcompat.widget.SearchView +import androidx.appcompat.widget.Toolbar import android.view.LayoutInflater import android.view.Menu import android.view.MenuItem @@ -39,7 +39,7 @@ class PackageManagerActivity : AppCompatActivity(), SearchView.OnQueryTextListen } .build() - lateinit var recyclerView: RecyclerView + lateinit var recyclerView: androidx.recyclerview.widget.RecyclerView lateinit var adapter: PackageAdapter lateinit var models: ArrayList diff --git a/app/src/main/java/io/neoterm/ui/pm/view/RecyclerTabLayout.java b/app/src/main/java/io/neoterm/ui/pm/view/RecyclerTabLayout.java index bd2d707..44d27c0 100644 --- a/app/src/main/java/io/neoterm/ui/pm/view/RecyclerTabLayout.java +++ b/app/src/main/java/io/neoterm/ui/pm/view/RecyclerTabLayout.java @@ -22,12 +22,12 @@ import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; -import android.support.v4.view.ViewCompat; -import android.support.v4.view.ViewPager; -import android.support.v7.content.res.AppCompatResources; -import android.support.v7.widget.AppCompatTextView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.core.view.ViewCompat; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; import android.util.AttributeSet; import android.view.Gravity; diff --git a/app/src/main/java/io/neoterm/ui/settings/BasePreferenceActivity.kt b/app/src/main/java/io/neoterm/ui/settings/BasePreferenceActivity.kt index 7256d29..a245c88 100644 --- a/app/src/main/java/io/neoterm/ui/settings/BasePreferenceActivity.kt +++ b/app/src/main/java/io/neoterm/ui/settings/BasePreferenceActivity.kt @@ -18,9 +18,9 @@ package io.neoterm.ui.settings import android.content.res.Configuration import android.os.Bundle import android.preference.PreferenceActivity -import android.support.annotation.LayoutRes -import android.support.v7.app.ActionBar -import android.support.v7.app.AppCompatDelegate +import androidx.annotation.LayoutRes +import androidx.appcompat.app.ActionBar +import androidx.appcompat.app.AppCompatDelegate import android.view.MenuInflater import android.view.View import android.view.ViewGroup diff --git a/app/src/main/java/io/neoterm/ui/settings/GeneralSettingsActivity.kt b/app/src/main/java/io/neoterm/ui/settings/GeneralSettingsActivity.kt index b035a83..f889aa2 100644 --- a/app/src/main/java/io/neoterm/ui/settings/GeneralSettingsActivity.kt +++ b/app/src/main/java/io/neoterm/ui/settings/GeneralSettingsActivity.kt @@ -1,6 +1,6 @@ package io.neoterm.ui.settings -import android.app.AlertDialog +import androidx.appcompat.app.AlertDialog import android.os.Bundle import android.view.MenuItem import io.neoterm.R diff --git a/app/src/main/java/io/neoterm/ui/setup/SetupActivity.kt b/app/src/main/java/io/neoterm/ui/setup/SetupActivity.kt index 8bc6d43..8245e08 100644 --- a/app/src/main/java/io/neoterm/ui/setup/SetupActivity.kt +++ b/app/src/main/java/io/neoterm/ui/setup/SetupActivity.kt @@ -1,11 +1,11 @@ package io.neoterm.ui.setup -import android.app.AlertDialog +import androidx.appcompat.app.AlertDialog import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.LayoutInflater import android.view.View import android.widget.* diff --git a/app/src/main/java/io/neoterm/ui/support/AboutActivity.kt b/app/src/main/java/io/neoterm/ui/support/AboutActivity.kt index ae03400..ca9ef4c 100644 --- a/app/src/main/java/io/neoterm/ui/support/AboutActivity.kt +++ b/app/src/main/java/io/neoterm/ui/support/AboutActivity.kt @@ -4,8 +4,8 @@ import android.content.Intent import android.content.pm.PackageManager import android.net.Uri import android.os.Bundle -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity import android.view.MenuItem import android.view.View import android.widget.TextView diff --git a/app/src/main/java/io/neoterm/ui/support/Donation.kt b/app/src/main/java/io/neoterm/ui/support/Donation.kt index b64fe5c..f6ed6c7 100644 --- a/app/src/main/java/io/neoterm/ui/support/Donation.kt +++ b/app/src/main/java/io/neoterm/ui/support/Donation.kt @@ -1,6 +1,6 @@ package io.neoterm.ui.support -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.ActivityNotFoundException import android.content.Intent import java.net.URISyntaxException @@ -12,11 +12,11 @@ object Donation { "%3Dweb-other&_t=1472443966571#Intent;" + "scheme=alipayqr;package=com.eg.android.AlipayGphone;end" - fun donateByAlipay(activity: Activity, payCode: String): Boolean { + fun donateByAlipay(activity: AppCompatActivity, payCode: String): Boolean { return startIntentUrl(activity, INTENT_URL_FORMAT.replace("{payCode}", payCode)) } - private fun startIntentUrl(activity: Activity, intentFullUrl: String): Boolean { + private fun startIntentUrl(activity: AppCompatActivity, intentFullUrl: String): Boolean { return try { val intent = Intent.parseUri( intentFullUrl, diff --git a/app/src/main/java/io/neoterm/ui/support/HelpActivity.kt b/app/src/main/java/io/neoterm/ui/support/HelpActivity.kt index 69ee0b1..64a65c0 100644 --- a/app/src/main/java/io/neoterm/ui/support/HelpActivity.kt +++ b/app/src/main/java/io/neoterm/ui/support/HelpActivity.kt @@ -1,7 +1,7 @@ package io.neoterm.ui.support import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.MenuItem import io.neoterm.R diff --git a/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt b/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt index 52d06cd..76a7695 100644 --- a/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt +++ b/app/src/main/java/io/neoterm/ui/term/NeoTermActivity.kt @@ -1,8 +1,8 @@ package io.neoterm.ui.term import android.Manifest -import android.app.Activity -import android.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.app.AlertDialog import android.content.* import android.content.pm.PackageManager import android.content.res.Configuration @@ -10,12 +10,11 @@ import android.os.Bundle import android.os.Handler import android.os.IBinder import android.preference.PreferenceManager -import android.support.v4.app.ActivityCompat -import android.support.v4.content.ContextCompat -import android.support.v4.view.OnApplyWindowInsetsListener -import android.support.v4.view.ViewCompat -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.Toolbar +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat +import androidx.core.view.OnApplyWindowInsetsListener +import androidx.core.view.ViewCompat +import androidx.appcompat.widget.Toolbar import android.view.* import android.view.inputmethod.InputMethodManager import android.widget.ImageButton @@ -354,8 +353,8 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference when (requestCode) { REQUEST_SETUP -> { when (resultCode) { - Activity.RESULT_OK -> enterMain() - Activity.RESULT_CANCELED -> { + AppCompatActivity.RESULT_OK -> enterMain() + AppCompatActivity.RESULT_CANCELED -> { setSystemShellMode(true) forceAddSystemSession() } @@ -365,7 +364,7 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference super.onActivityResult(requestCode, resultCode, data) } - override fun onConfigurationChanged(newConfig: Configuration?) { + override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) if (newConfig == null) { return diff --git a/app/src/main/java/io/neoterm/ui/term/NeoTermRemoteInterface.kt b/app/src/main/java/io/neoterm/ui/term/NeoTermRemoteInterface.kt index 0a9dcf0..394e52b 100644 --- a/app/src/main/java/io/neoterm/ui/term/NeoTermRemoteInterface.kt +++ b/app/src/main/java/io/neoterm/ui/term/NeoTermRemoteInterface.kt @@ -1,14 +1,13 @@ package io.neoterm.ui.term -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.ComponentName import android.content.Intent import android.content.ServiceConnection import android.net.Uri import android.os.Bundle import android.os.IBinder -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AlertDialog import android.widget.ArrayAdapter import android.widget.ListView import io.neoterm.App @@ -200,7 +199,7 @@ class NeoTermRemoteInterface : AppCompatActivity(), ServiceConnection { val data = Intent() data.putExtra(EXTRA_SESSION_ID, session.mHandle) - setResult(Activity.RESULT_OK, data) + setResult(AppCompatActivity.RESULT_OK, data) if (foreground) { // Set current session to our new one diff --git a/app/src/main/java/io/neoterm/ui/term/tab/TermTab.kt b/app/src/main/java/io/neoterm/ui/term/tab/TermTab.kt index 7a4a304..fd24446 100644 --- a/app/src/main/java/io/neoterm/ui/term/tab/TermTab.kt +++ b/app/src/main/java/io/neoterm/ui/term/tab/TermTab.kt @@ -1,7 +1,7 @@ package io.neoterm.ui.term.tab import android.content.Context -import android.support.v7.widget.Toolbar +import androidx.appcompat.widget.Toolbar import android.view.inputmethod.InputMethodManager import io.neoterm.component.colorscheme.ColorSchemeComponent import io.neoterm.frontend.component.ComponentManager diff --git a/app/src/main/java/io/neoterm/utils/FullScreenHelper.kt b/app/src/main/java/io/neoterm/utils/FullScreenHelper.kt index ff48709..f571ee5 100644 --- a/app/src/main/java/io/neoterm/utils/FullScreenHelper.kt +++ b/app/src/main/java/io/neoterm/utils/FullScreenHelper.kt @@ -1,6 +1,6 @@ package io.neoterm.utils -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.graphics.Rect import android.view.View import android.widget.FrameLayout @@ -9,7 +9,7 @@ import android.widget.FrameLayout * Helper class to "adjustResize" Activity when we are in full screen mode and check IME status. * Android Bug 5497: https://code.google.com/p/android/issues/detail?id=5497 */ -class FullScreenHelper private constructor(activity: Activity, var fullScreen: Boolean, private var shouldSkipFirst: Boolean) { +class FullScreenHelper private constructor(activity: AppCompatActivity, var fullScreen: Boolean, private var shouldSkipFirst: Boolean) { interface KeyBoardListener { /** @@ -111,7 +111,7 @@ class FullScreenHelper private constructor(activity: Activity, var fullScreen: B } companion object { - fun injectActivity(activity: Activity, fullScreen: Boolean, recreate: Boolean): FullScreenHelper { + fun injectActivity(activity: AppCompatActivity, fullScreen: Boolean, recreate: Boolean): FullScreenHelper { return FullScreenHelper(activity, fullScreen, recreate) } diff --git a/app/src/main/java/io/neoterm/utils/TerminalUtils.kt b/app/src/main/java/io/neoterm/utils/TerminalUtils.kt index f7b4171..fca3ada 100644 --- a/app/src/main/java/io/neoterm/utils/TerminalUtils.kt +++ b/app/src/main/java/io/neoterm/utils/TerminalUtils.kt @@ -1,6 +1,6 @@ package io.neoterm.utils -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.Context import io.neoterm.backend.TerminalSession import io.neoterm.component.font.FontComponent @@ -40,7 +40,7 @@ object TerminalUtils { return sessionComponent.createSession(context, parameter) } - fun createSession(activity: Activity, parameter: XParameter) : XSession { + fun createSession(activity: AppCompatActivity, parameter: XParameter) : XSession { val sessionComponent = ComponentManager.getComponent() return sessionComponent.createSession(activity, parameter) } diff --git a/app/src/main/res/layout/ui_about.xml b/app/src/main/res/layout/ui_about.xml index 4d600de..48682a4 100644 --- a/app/src/main/res/layout/ui_about.xml +++ b/app/src/main/res/layout/ui_about.xml @@ -7,7 +7,7 @@ android:orientation="vertical" tools:ignore="UseCompoundDrawables,ContentDescription"> - - + app:srcCompat="@mipmap/about_logo" /> + app:srcCompat="@drawable/ic_info" /> + app:srcCompat="@drawable/ic_person" /> + app:srcCompat="@drawable/ic_description" /> + app:srcCompat="@drawable/ic_description" /> + app:srcCompat="@drawable/ic_github" /> + app:srcCompat="@drawable/ic_donate" /> - + - + app:srcCompat="@mipmap/ic_danger" /> + app:srcCompat="@drawable/ic_info" /> - + diff --git a/app/src/main/res/layout/ui_color_scheme.xml b/app/src/main/res/layout/ui_color_scheme.xml index 8103698..6c9e09d 100644 --- a/app/src/main/res/layout/ui_color_scheme.xml +++ b/app/src/main/res/layout/ui_color_scheme.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - + app:srcCompat="@drawable/ic_install_white_36" /> + app:srcCompat="@drawable/ic_install_white_36" /> - - - + diff --git a/app/src/main/res/layout/ui_main.xml b/app/src/main/res/layout/ui_main.xml index 8bfd46a..11fc20a 100644 --- a/app/src/main/res/layout/ui_main.xml +++ b/app/src/main/res/layout/ui_main.xml @@ -6,7 +6,7 @@ android:background="@color/terminal_background" android:orientation="vertical"> - - - - @@ -32,7 +33,7 @@ License. android:layout_gravity="center_vertical" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@null" - android:src="@drawable/phone_close_tab_icon"/> + app:srcCompat="@drawable/phone_close_tab_icon"/> @@ -42,7 +43,7 @@ License. android:layout_gravity="center_vertical" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@null" - android:src="@drawable/phone_close_tab_icon"/> + app:srcCompat="@drawable/phone_close_tab_icon"/> diff --git a/chrome-tabs/src/main/res/layout/phone_toolbar.xml b/chrome-tabs/src/main/res/layout/phone_toolbar.xml index 507b1d7..30efddb 100755 --- a/chrome-tabs/src/main/res/layout/phone_toolbar.xml +++ b/chrome-tabs/src/main/res/layout/phone_toolbar.xml @@ -13,7 +13,7 @@ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, e implied. See the License for the specific language governing permissions and limitations under the License. --> -@dimen/tab_title_drawable_padding marquee 1 - sans-serif-medium + sans-serif-medium @color/tab_title_text_color diff --git a/gradle.properties b/gradle.properties index aac7c9b..9e6fce1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. From 30f413c53fbf22fc997096bfae23c346f9c2d8df Mon Sep 17 00:00:00 2001 From: Hilledkinged Date: Wed, 21 Apr 2021 11:38:04 +0300 Subject: [PATCH 4/4] Add usesCleartextTraffic to get pass of setup error --- app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 99a317f..25510e3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,6 +25,7 @@ android:fullBackupContent="@xml/backup_config" android:icon="@mipmap/ic_launcher_neoterm_round" android:label="@string/app_name" + android:usesCleartextTraffic="true" android:resizeableActivity="true" android:roundIcon="@mipmap/ic_launcher_neoterm_round" android:supportsRtl="true"