diff --git a/app/src/main/java/com/limelight/AdvancedSettings.java b/app/src/main/java/com/limelight/AdvancedSettings.java
index ecaac687..2f493014 100644
--- a/app/src/main/java/com/limelight/AdvancedSettings.java
+++ b/app/src/main/java/com/limelight/AdvancedSettings.java
@@ -1,22 +1,17 @@
package com.limelight;
-import com.limelight.R;
import com.limelight.utils.Dialog;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.widget.CompoundButton;
-import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
-import android.widget.CompoundButton.OnCheckedChangeListener;
public class AdvancedSettings extends Activity {
private SharedPreferences prefs;
- private RadioButton forceSoftDec, autoDec, forceHardDec;
private SeekBar bitrateSlider;
private TextView bitrateLabel;
@@ -45,10 +40,7 @@ public class AdvancedSettings extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_advanced_settings);
-
- this.forceSoftDec = (RadioButton) findViewById(R.id.softwareDec);
- this.autoDec = (RadioButton) findViewById(R.id.autoDec);
- this.forceHardDec = (RadioButton) findViewById(R.id.hardwareDec);
+
this.bitrateLabel = (TextView) findViewById(R.id.bitrateLabel);
this.bitrateSlider = (SeekBar) findViewById(R.id.bitrateSeekBar);
@@ -58,48 +50,6 @@ public class AdvancedSettings extends Activity {
bitrateSlider.setProgress(prefs.getInt(Game.BITRATE_PREF_STRING, Game.DEFAULT_BITRATE));
updateBitrateLabel();
- switch (prefs.getInt(Game.DECODER_PREF_STRING, Game.DEFAULT_DECODER)) {
- case Game.FORCE_SOFTWARE_DECODER:
- forceSoftDec.setChecked(true);
- autoDec.setChecked(false);
- forceHardDec.setChecked(false);
- break;
- case Game.AUTOSELECT_DECODER:
- forceSoftDec.setChecked(false);
- autoDec.setChecked(true);
- forceHardDec.setChecked(false);
- break;
- case Game.FORCE_HARDWARE_DECODER:
- forceSoftDec.setChecked(false);
- autoDec.setChecked(false);
- forceHardDec.setChecked(true);
- break;
- }
-
- OnCheckedChangeListener occl = new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
- if (!isChecked) {
- // Ignore non-checked buttons
- return;
- }
-
- if (buttonView == forceSoftDec) {
- prefs.edit().putInt(Game.DECODER_PREF_STRING, Game.FORCE_SOFTWARE_DECODER).commit();
- }
- else if (buttonView == forceHardDec) {
- prefs.edit().putInt(Game.DECODER_PREF_STRING, Game.FORCE_HARDWARE_DECODER).commit();
- }
- else if (buttonView == autoDec) {
- prefs.edit().putInt(Game.DECODER_PREF_STRING, Game.AUTOSELECT_DECODER).commit();
- }
- }
- };
- forceSoftDec.setOnCheckedChangeListener(occl);
- forceHardDec.setOnCheckedChangeListener(occl);
- autoDec.setOnCheckedChangeListener(occl);
-
this.bitrateSlider.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
diff --git a/app/src/main/java/com/limelight/PcView.java b/app/src/main/java/com/limelight/PcView.java
index c5018887..d3ac2728 100644
--- a/app/src/main/java/com/limelight/PcView.java
+++ b/app/src/main/java/com/limelight/PcView.java
@@ -25,6 +25,7 @@ import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.IBinder;
+import android.preference.PreferenceManager;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
@@ -89,7 +90,10 @@ public class PcView extends Activity {
private void initializeViews() {
setContentView(R.layout.activity_pc_view);
-
+
+ // Set default preferences if we've never been run
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+
// Setup the list view
settingsButton = (Button)findViewById(R.id.settingsButton);
addComputerButton = (Button)findViewById(R.id.manuallyAddPc);
diff --git a/app/src/main/java/com/limelight/StreamSettings.java b/app/src/main/java/com/limelight/StreamSettings.java
index ea8ae2a7..963a513c 100644
--- a/app/src/main/java/com/limelight/StreamSettings.java
+++ b/app/src/main/java/com/limelight/StreamSettings.java
@@ -1,146 +1,26 @@
package com.limelight;
-import com.limelight.R;
-import com.limelight.utils.Dialog;
-
import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.CompoundButton.OnCheckedChangeListener;
-import android.widget.RadioButton;
import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
+import android.preference.PreferenceFragment;
public class StreamSettings extends Activity {
- private Button advancedSettingsButton;
- private SharedPreferences prefs;
- private RadioButton rbutton720p30, rbutton720p60, rbutton1080p30, rbutton1080p60;
- private CheckBox stretchToFill, enableSops, toastsDisabled;
-
- @Override
- protected void onStop() {
- super.onStop();
-
- Dialog.closeDialogs();
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.activity_stream_settings);
-
- this.stretchToFill = (CheckBox) findViewById(R.id.stretchToFill);
- this.enableSops = (CheckBox) findViewById(R.id.enableSops);
- this.toastsDisabled = (CheckBox) findViewById(R.id.disableToasts);
- this.advancedSettingsButton = (Button) findViewById(R.id.advancedSettingsButton);
- this.rbutton720p30 = (RadioButton) findViewById(R.id.config720p30Selected);
- this.rbutton720p60 = (RadioButton) findViewById(R.id.config720p60Selected);
- this.rbutton1080p30 = (RadioButton) findViewById(R.id.config1080p30Selected);
- this.rbutton1080p60 = (RadioButton) findViewById(R.id.config1080p60Selected);
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
- prefs = getSharedPreferences(Game.PREFS_FILE_NAME, Context.MODE_MULTI_PROCESS);
-
- boolean res720p = prefs.getInt(Game.HEIGHT_PREF_STRING, Game.DEFAULT_HEIGHT) == 720;
- boolean fps30 = prefs.getInt(Game.REFRESH_RATE_PREF_STRING, Game.DEFAULT_REFRESH_RATE) == 30;
+ setContentView(R.layout.activity_stream_settings);
+ getFragmentManager().beginTransaction().replace(
+ R.id.stream_settings, new SettingsFragment()
+ ).commit();
+ }
- stretchToFill.setChecked(prefs.getBoolean(Game.STRETCH_PREF_STRING, Game.DEFAULT_STRETCH));
- enableSops.setChecked(prefs.getBoolean(Game.SOPS_PREF_STRING, Game.DEFAULT_SOPS));
- toastsDisabled.setChecked(prefs.getBoolean(Game.DISABLE_TOASTS_PREF_STRING, Game.DEFAULT_DISABLE_TOASTS));
-
- rbutton720p30.setChecked(false);
- rbutton720p60.setChecked(false);
- rbutton1080p30.setChecked(false);
- rbutton1080p60.setChecked(false);
- if (res720p) {
- if (fps30) {
- rbutton720p30.setChecked(true);
- }
- else {
- rbutton720p60.setChecked(true);
- }
- }
- else {
- if (fps30) {
- rbutton1080p30.setChecked(true);
- }
- else {
- rbutton1080p60.setChecked(true);
- }
- }
-
- OnCheckedChangeListener occl = new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
- if (!isChecked) {
- // Ignore non-checked buttons
- return;
- }
-
- if (buttonView == rbutton720p30) {
- prefs.edit().putInt(Game.WIDTH_PREF_STRING, 1280).
- putInt(Game.HEIGHT_PREF_STRING, 720).
- putInt(Game.REFRESH_RATE_PREF_STRING, 30).
- putInt(Game.BITRATE_PREF_STRING, Game.BITRATE_DEFAULT_720_30).commit();
- }
- else if (buttonView == rbutton720p60) {
- prefs.edit().putInt(Game.WIDTH_PREF_STRING, 1280).
- putInt(Game.HEIGHT_PREF_STRING, 720).
- putInt(Game.REFRESH_RATE_PREF_STRING, 60).
- putInt(Game.BITRATE_PREF_STRING, Game.BITRATE_DEFAULT_720_60).commit();
- }
- else if (buttonView == rbutton1080p30) {
- prefs.edit().putInt(Game.WIDTH_PREF_STRING, 1920).
- putInt(Game.HEIGHT_PREF_STRING, 1080).
- putInt(Game.REFRESH_RATE_PREF_STRING, 30).
- putInt(Game.BITRATE_PREF_STRING, Game.BITRATE_DEFAULT_1080_30).commit();
- }
- else if (buttonView == rbutton1080p60) {
- prefs.edit().putInt(Game.WIDTH_PREF_STRING, 1920).
- putInt(Game.HEIGHT_PREF_STRING, 1080).
- putInt(Game.REFRESH_RATE_PREF_STRING, 60).
- putInt(Game.BITRATE_PREF_STRING, Game.BITRATE_DEFAULT_1080_60).commit();
- }
- }
- };
- rbutton720p30.setOnCheckedChangeListener(occl);
- rbutton720p60.setOnCheckedChangeListener(occl);
- rbutton1080p30.setOnCheckedChangeListener(occl);
- rbutton1080p60.setOnCheckedChangeListener(occl);
-
- advancedSettingsButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent i = new Intent(StreamSettings.this, AdvancedSettings.class);
- startActivity(i);
- }
- });
- stretchToFill.setOnCheckedChangeListener(new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
- prefs.edit().putBoolean(Game.STRETCH_PREF_STRING, isChecked).commit();
- }
- });
- enableSops.setOnCheckedChangeListener(new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
- prefs.edit().putBoolean(Game.SOPS_PREF_STRING, isChecked).commit();
- }
- });
- toastsDisabled.setOnCheckedChangeListener(new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
- prefs.edit().putBoolean(Game.DISABLE_TOASTS_PREF_STRING, isChecked).commit();
- }
- });
- }
+ public static class SettingsFragment extends PreferenceFragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.preferences);
+ }
+ }
}
diff --git a/app/src/main/res/layout/activity_advanced_settings.xml b/app/src/main/res/layout/activity_advanced_settings.xml
index eddc0515..7c8eccaa 100644
--- a/app/src/main/res/layout/activity_advanced_settings.xml
+++ b/app/src/main/res/layout/activity_advanced_settings.xml
@@ -11,53 +11,12 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -66,7 +25,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
- android:layout_below="@+id/decoderConfigGroup"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@+id/bitrateLabel" />
diff --git a/app/src/main/res/layout/activity_stream_settings.xml b/app/src/main/res/layout/activity_stream_settings.xml
index 33dde4da..08c39447 100644
--- a/app/src/main/res/layout/activity_stream_settings.xml
+++ b/app/src/main/res/layout/activity_stream_settings.xml
@@ -1,99 +1,12 @@
-
-
-
-
-
-
-
+ android:paddingTop="@dimen/activity_vertical_margin"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:id="@+id/stream_settings"
+ tools:context=".StreamSettings">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
new file mode 100644
index 00000000..2b597539
--- /dev/null
+++ b/app/src/main/res/values/arrays.xml
@@ -0,0 +1,26 @@
+
+
+
+ - 720p 30 FPS
+ - 720p 60 FPS
+ - 1080p 30 FPS
+ - 1080p 60 FPS
+
+
+ - 720p30
+ - 720p60
+ - 1080p30
+ - 1080p60
+
+
+
+ - Force Software Decoding
+ - Auto-select Decoder
+ - Force Hardware Decoding
+
+
+ - software
+ - auto
+ - hardware
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index deff2c1b..3685c47d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -11,21 +11,21 @@
Manually Add PC
-
-
- Streaming Settings
- Advanced Settings
- 720p 30 FPS (Only recommended for poor devices or networks)
- 720p 60 FPS (Recommended for most devices and networks)
- 1080p 30 FPS (Recommended for most devices if 1080p streaming is desired)
- 1080p 60 FPS (Requires extremely fast device and network)
- Stretch video to fill screen
- Allow GFE to modify game settings for optimal streaming
- Disable on-screen connection warning messages"
-
-
- Force Software Decoding
- Auto-select Decoder (Recommended)
- Force Hardware Decoding
-
+
+
+ Basic Settings
+ Select resolution and FPS target
+ Setting values too high for your device may cause lag or crashing
+ Stretch video to full-screen
+
+ Host Settings
+ Optimize game settings
+ Allow GFE to modify game settings for optimal streaming
+ Play audio on PC
+ Play audio from the computer instead of the device
+
+ Advanced Settings
+ Change decoder
+ Disable warning messages
+ Disable on-screen connection warning messages while streaming
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
new file mode 100644
index 00000000..acb04af6
--- /dev/null
+++ b/app/src/main/res/xml/preferences.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file