diff --git a/CHANGELOG.md b/CHANGELOG.md index 56134430..5ea5daa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Automatically change an interpreter in scripts after changing the environment directory - Updated built-in busybox to v1.29.2 - Improved Arch Linux bootstrap +- The web terminal now opens in the Chrome custom tab (increases API to 15) ### Fixed - Fixed problem with UID and GID numeration diff --git a/app/build.gradle b/app/build.gradle index c7359a75..11b1a6cf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,9 +6,9 @@ android { defaultConfig { applicationId 'ru.meefik.linuxdeploy' - minSdkVersion 14 + minSdkVersion 15 targetSdkVersion 27 - versionCode 241 + versionCode 242 versionName "2.2.0" } buildTypes { @@ -25,4 +25,5 @@ android { dependencies { implementation 'com.android.support:design:27.1.1' + implementation 'com.android.support:customtabs:27.1.1' } diff --git a/app/src/main/java/ru/meefik/linuxdeploy/MainActivity.java b/app/src/main/java/ru/meefik/linuxdeploy/MainActivity.java index aea41d84..8c35a26e 100644 --- a/app/src/main/java/ru/meefik/linuxdeploy/MainActivity.java +++ b/app/src/main/java/ru/meefik/linuxdeploy/MainActivity.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; +import android.graphics.Color; import android.net.Uri; import android.net.wifi.WifiManager; import android.net.wifi.WifiManager.WifiLock; @@ -13,6 +14,7 @@ import android.os.Handler; import android.os.PowerManager; import android.support.annotation.NonNull; +import android.support.customtabs.CustomTabsIntent; import android.support.design.widget.NavigationView; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; @@ -162,10 +164,18 @@ public boolean onNavigationItemSelected(MenuItem item) { openRepository(); break; case R.id.nav_terminal: - Intent browserIntent = new Intent(Intent.ACTION_VIEW, - Uri.parse("http://127.0.0.1:" + PrefStore.getHttpPort(this) + - "/cgi-bin/terminal?size=" + PrefStore.getFontSize(this))); - startActivity(browserIntent); + String uri = "http://127.0.0.1:" + PrefStore.getHttpPort(this) + + "/cgi-bin/terminal?size=" + PrefStore.getFontSize(this); + // Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); + // startActivity(browserIntent); + CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); + if (PrefStore.getTheme(this) == R.style.LightTheme) { + builder.setToolbarColor(Color.LTGRAY); + } else { + builder.setToolbarColor(Color.DKGRAY); + } + CustomTabsIntent customTabsIntent = builder.build(); + customTabsIntent.launchUrl(this, Uri.parse(uri)); break; case R.id.nav_settings: Intent intent_settings = new Intent(this, SettingsActivity.class);