If launching an http intent fails, then fallback to WebView (because

Android TV doesn't have Chrome, I guess).  This resolves the conundrum of
what to do about the one Samsung Note 7 out there that doesn't have
Chrome, too.
master
Greg Alexander 5 years ago
parent 6a61e61a74
commit bbbbb36795

@ -1011,11 +1011,6 @@ Luckily, even though the list of requirements is long, it is largely
irrelevant or redundant, so I'm just about there.
XXX - android TV support
- doc should start a WebView instead of a URL
- make the backgrounds of the buttons more vividly demonstrate focus
- make nextFocusDown/Left/Right/Up overrides for some buttons
XXX - figure out how to force a refresh on eink devices (onyx boox) when the password is displayed (Roman)
XXX - Tasker on Android 9 can't trigger the new START/STOP intents? (Kumaran)

@ -11,7 +11,8 @@
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<application android:label="SimpleSSHD" android:icon="@drawable/icon"
android:allowBackup="false" android:banner="@drawable/tvbanner">
android:allowBackup="false" android:banner="@drawable/tvbanner"
android:usesCleartextTraffic="true">
<activity android:name="SimpleSSHD" android:label="SimpleSSHD"
android:launchMode="singleTask">
<intent-filter>
@ -28,6 +29,9 @@
</intent-filter>
</activity>
<activity android:name="Settings" android:label="Settings" />
<activity android:name="DocActivity" android:label="Documentation" />
<activity android:name="DocActivityTV" android:label="Documentation"
android:theme="@style/Theme.Leanback" />
<service android:name="SimpleSSHDService"
android:label="SimpleSSHDService" />
<receiver android:name="BootReceiver">

@ -0,0 +1,27 @@
package org.galexander.sshd;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class DocActivity extends Activity
{
public static final String url =
"http://www.galexander.org/software/simplesshd";
private WebView wv = null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.doc);
wv = (WebView)findViewById(R.id.docview);
}
public void onResume() {
super.onResume();
wv.loadUrl(url);
}
public void onPause() {
super.onPause();
}
}

@ -0,0 +1,5 @@
package org.galexander.sshd;
public class DocActivityTV extends DocActivity
{
}

@ -114,19 +114,11 @@ public class SimpleSSHD extends Activity
public void doc_clicked(View v) {
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://www.galexander.org/software/simplesshd"));
i.setData(Uri.parse(DocActivity.url));
startActivity(i);
} catch (Exception e) {
new AlertDialog.Builder(this)
.setCancelable(true)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface di, int which) { }
})
.setIcon(android.R.drawable.ic_dialog_info)
.setTitle("no browser")
.setMessage("YOU: a note 7 owner with no browser installed on your android?\nME: an app developer who keeps getting crash reports and wants to hear your story. email nobrowserdroid@galexander.org")
.show();
startActivity(new Intent(this, (is_tv
? DocActivityTV.class : DocActivity.class)));
}
}
public void about_clicked(View v) {

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/docview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
Loading…
Cancel
Save