|
6 | 6 | import android.content.Intent; |
7 | 7 | import android.content.pm.PackageManager; |
8 | 8 | import android.content.res.Configuration; |
| 9 | +import android.graphics.Color; |
9 | 10 | import android.net.Uri; |
10 | 11 | import android.net.wifi.WifiManager; |
11 | 12 | import android.net.wifi.WifiManager.WifiLock; |
12 | 13 | import android.os.Bundle; |
13 | 14 | import android.os.Handler; |
14 | 15 | import android.os.PowerManager; |
15 | 16 | import android.support.annotation.NonNull; |
| 17 | +import android.support.customtabs.CustomTabsIntent; |
16 | 18 | import android.support.design.widget.NavigationView; |
17 | 19 | import android.support.v4.app.ActivityCompat; |
18 | 20 | import android.support.v4.content.ContextCompat; |
@@ -162,10 +164,18 @@ public boolean onNavigationItemSelected(MenuItem item) { |
162 | 164 | openRepository(); |
163 | 165 | break; |
164 | 166 | 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)); |
169 | 179 | break; |
170 | 180 | case R.id.nav_settings: |
171 | 181 | Intent intent_settings = new Intent(this, SettingsActivity.class); |
|
0 commit comments