diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2352c3bb..9ba989ce 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,28 +7,44 @@ - - - - - - + + + + + + + android:icon="@drawable/ic_launcher" + android:theme="@style/AppTheme"> - - - + + + + + @@ -37,30 +53,30 @@ + android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"> + android:label="Streaming Settings"> + android:label="Add Computer Manually"> + android:theme="@style/StreamTheme"> @@ -75,6 +91,8 @@ + + - + \ No newline at end of file diff --git a/app/src/main/java/com/limelight/HelpActivity.java b/app/src/main/java/com/limelight/HelpActivity.java new file mode 100644 index 00000000..dad85053 --- /dev/null +++ b/app/src/main/java/com/limelight/HelpActivity.java @@ -0,0 +1,19 @@ +package com.limelight; + +import android.app.Activity; +import android.os.Bundle; +import android.webkit.WebView; + +public class HelpActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + WebView webView = new WebView(this); + setContentView(webView); + + webView.getSettings().setJavaScriptEnabled(true); + webView.loadUrl(getIntent().getData().toString()); + } +} diff --git a/app/src/main/java/com/limelight/PcView.java b/app/src/main/java/com/limelight/PcView.java index 47d70ef2..4715031f 100644 --- a/app/src/main/java/com/limelight/PcView.java +++ b/app/src/main/java/com/limelight/PcView.java @@ -23,6 +23,7 @@ import com.limelight.preferences.StreamSettings; import com.limelight.ui.AdapterFragment; import com.limelight.ui.AdapterFragmentCallbacks; import com.limelight.utils.Dialog; +import com.limelight.utils.HelpLauncher; import com.limelight.utils.ServerHelper; import com.limelight.utils.ShortcutHelper; import com.limelight.utils.UiHelper; @@ -111,6 +112,7 @@ public class PcView extends Activity implements AdapterFragmentCallbacks { // Setup the list view ImageButton settingsButton = (ImageButton) findViewById(R.id.settingsButton); ImageButton addComputerButton = (ImageButton) findViewById(R.id.manuallyAddPc); + ImageButton helpButton = (ImageButton) findViewById(R.id.helpButton); settingsButton.setOnClickListener(new OnClickListener() { @Override @@ -125,6 +127,12 @@ public class PcView extends Activity implements AdapterFragmentCallbacks { startActivity(i); } }); + helpButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + HelpLauncher.launchSetupGuide(PcView.this); + } + }); getFragmentManager().beginTransaction() .replace(R.id.pcFragmentContainer, new AdapterFragment()) diff --git a/app/src/main/java/com/limelight/utils/Dialog.java b/app/src/main/java/com/limelight/utils/Dialog.java index 4f132dea..66d1ddb9 100644 --- a/app/src/main/java/com/limelight/utils/Dialog.java +++ b/app/src/main/java/com/limelight/utils/Dialog.java @@ -5,6 +5,9 @@ import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; +import android.widget.Button; + +import com.limelight.R; public class Dialog implements Runnable { private final String title; @@ -55,7 +58,7 @@ public class Dialog implements Runnable { alert.setCancelable(false); alert.setCanceledOnTouchOutside(false); - alert.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { + alert.setButton(AlertDialog.BUTTON_POSITIVE, activity.getResources().getText(android.R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { synchronized (rundownDialogs) { rundownDialogs.remove(Dialog.this); @@ -67,6 +70,31 @@ public class Dialog implements Runnable { } } }); + alert.setButton(AlertDialog.BUTTON_NEUTRAL, activity.getResources().getText(R.string.help), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + synchronized (rundownDialogs) { + rundownDialogs.remove(Dialog.this); + alert.dismiss(); + } + + if (endAfterDismiss) { + activity.finish(); + } + + HelpLauncher.launchTroubleshooting(activity); + } + }); + alert.setOnShowListener(new DialogInterface.OnShowListener(){ + + @Override + public void onShow(DialogInterface dialog) { + // Set focus to the OK button by default + Button button = alert.getButton(AlertDialog.BUTTON_POSITIVE); + button.setFocusable(true); + button.setFocusableInTouchMode(true); + button.requestFocus(); + } + }); synchronized (rundownDialogs) { rundownDialogs.add(this); diff --git a/app/src/main/java/com/limelight/utils/HelpLauncher.java b/app/src/main/java/com/limelight/utils/HelpLauncher.java new file mode 100644 index 00000000..f27b0bde --- /dev/null +++ b/app/src/main/java/com/limelight/utils/HelpLauncher.java @@ -0,0 +1,35 @@ +package com.limelight.utils; + +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; + +import com.limelight.HelpActivity; + +public class HelpLauncher { + + private static void launchUrl(Context context, String url) { + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + + // Try to launch the default browser + try { + context.startActivity(i); + } catch (ActivityNotFoundException e) { + // This platform has no browser (possibly a leanback device) + // We'll launch our WebView activity + i = new Intent(context, HelpActivity.class); + i.setData(Uri.parse(url)); + context.startActivity(i); + } + } + + public static void launchSetupGuide(Context context) { + launchUrl(context, "https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide"); + } + + public static void launchTroubleshooting(Context context) { + launchUrl(context, "https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"); + } +} diff --git a/app/src/main/res/drawable/ic_help.xml b/app/src/main/res/drawable/ic_help.xml new file mode 100644 index 00000000..58640f07 --- /dev/null +++ b/app/src/main/res/drawable/ic_help.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout-land/activity_pc_view.xml b/app/src/main/res/layout-land/activity_pc_view.xml index 77c577c2..0b0c3f43 100644 --- a/app/src/main/res/layout-land/activity_pc_view.xml +++ b/app/src/main/res/layout-land/activity_pc_view.xml @@ -9,41 +9,40 @@ tools:context=".PcView" > - - - - - + android:layout_toEndOf="@+id/settingsButton"> + + + + + + + + + diff --git a/app/src/main/res/layout-port/activity_pc_view.xml b/app/src/main/res/layout-port/activity_pc_view.xml index fe961396..e2646f3d 100644 --- a/app/src/main/res/layout-port/activity_pc_view.xml +++ b/app/src/main/res/layout-port/activity_pc_view.xml @@ -9,41 +9,44 @@ tools:context=".PcView" > - - - - - + > + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ade1f97c..59abefda 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -64,6 +64,7 @@ Yes No Lost connection to PC + Help Apps on