Skip to content

Commit e2d9d80

Browse files
committed
The web terminal now opens in the Chrome custom tab
1 parent e612cda commit e2d9d80

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313
- Automatically change an interpreter in scripts after changing the environment directory
1414
- Updated built-in busybox to v1.29.2
1515
- Improved Arch Linux bootstrap
16+
- The web terminal now opens in the Chrome custom tab (increases API to 15)
1617

1718
### Fixed
1819
- Fixed problem with UID and GID numeration

app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ android {
66

77
defaultConfig {
88
applicationId 'ru.meefik.linuxdeploy'
9-
minSdkVersion 14
9+
minSdkVersion 15
1010
targetSdkVersion 27
11-
versionCode 241
11+
versionCode 242
1212
versionName "2.2.0"
1313
}
1414
buildTypes {
@@ -25,4 +25,5 @@ android {
2525

2626
dependencies {
2727
implementation 'com.android.support:design:27.1.1'
28+
implementation 'com.android.support:customtabs:27.1.1'
2829
}

app/src/main/java/ru/meefik/linuxdeploy/MainActivity.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
import android.content.Intent;
77
import android.content.pm.PackageManager;
88
import android.content.res.Configuration;
9+
import android.graphics.Color;
910
import android.net.Uri;
1011
import android.net.wifi.WifiManager;
1112
import android.net.wifi.WifiManager.WifiLock;
1213
import android.os.Bundle;
1314
import android.os.Handler;
1415
import android.os.PowerManager;
1516
import android.support.annotation.NonNull;
17+
import android.support.customtabs.CustomTabsIntent;
1618
import android.support.design.widget.NavigationView;
1719
import android.support.v4.app.ActivityCompat;
1820
import android.support.v4.content.ContextCompat;
@@ -162,10 +164,18 @@ public boolean onNavigationItemSelected(MenuItem item) {
162164
openRepository();
163165
break;
164166
case R.id.nav_terminal:
165-
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
166-
Uri.parse("http://127.0.0.1:" + PrefStore.getHttpPort(this) +
167-
"/cgi-bin/terminal?size=" + PrefStore.getFontSize(this)));
168-
startActivity(browserIntent);
167+
String uri = "http://127.0.0.1:" + PrefStore.getHttpPort(this) +
168+
"/cgi-bin/terminal?size=" + PrefStore.getFontSize(this);
169+
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
170+
// startActivity(browserIntent);
171+
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
172+
if (PrefStore.getTheme(this) == R.style.LightTheme) {
173+
builder.setToolbarColor(Color.LTGRAY);
174+
} else {
175+
builder.setToolbarColor(Color.DKGRAY);
176+
}
177+
CustomTabsIntent customTabsIntent = builder.build();
178+
customTabsIntent.launchUrl(this, Uri.parse(uri));
169179
break;
170180
case R.id.nav_settings:
171181
Intent intent_settings = new Intent(this, SettingsActivity.class);

0 commit comments

Comments
 (0)