diff --git a/gen/com/limelight/R.java b/gen/com/limelight/R.java index 3362315f..0f98dead 100644 --- a/gen/com/limelight/R.java +++ b/gen/com/limelight/R.java @@ -36,19 +36,17 @@ or to a theme attribute in the form "?[package:][type:]na } public static final class id { public static final int autoDec=0x7f080005; + public static final int config1080p30Selected=0x7f080009; + public static final int config1080p60Selected=0x7f08000a; + public static final int config720p30Selected=0x7f080007; + public static final int config720p60Selected=0x7f080008; public static final int hardwareDec=0x7f080006; public static final int hostTextView=0x7f080000; - public static final int imageQualityCheckbox=0x7f08000a; public static final int pairButton=0x7f080002; - public static final int res1080pSelected=0x7f08000c; - public static final int res720pSelected=0x7f08000b; - public static final int resolutionGroup=0x7f080007; - public static final int rr30Selected=0x7f080008; - public static final int rr60Selected=0x7f080009; - public static final int rrGroup=0x7f080003; public static final int softwareDec=0x7f080004; public static final int statusButton=0x7f080001; - public static final int surfaceView=0x7f08000d; + public static final int streamConfigGroup=0x7f080003; + public static final int surfaceView=0x7f08000b; } public static final class layout { public static final int activity_connection=0x7f030000; diff --git a/res/layout/activity_connection.xml b/res/layout/activity_connection.xml index ba580c54..2e46ace5 100644 --- a/res/layout/activity_connection.xml +++ b/res/layout/activity_connection.xml @@ -1,4 +1,4 @@ - + + @@ -58,7 +63,7 @@ android:id="@+id/autoDec" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Auto-select Decoder" /> + android:text="Auto-select Decoder (Recommended)" /> - - - - - - - - - - - - - - + android:layout_marginTop="25dp" + android:orientation="vertical" > - + + + + + + + + + + + + diff --git a/src/com/limelight/Connection.java b/src/com/limelight/Connection.java index 68e35375..ed5a99eb 100644 --- a/src/com/limelight/Connection.java +++ b/src/com/limelight/Connection.java @@ -16,7 +16,6 @@ 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; @@ -31,8 +30,7 @@ public class Connection extends Activity { private Button statusButton, pairButton; private TextView hostText; private SharedPreferences prefs; - private CheckBox qualityCheckbox; - private RadioButton rbutton720p, rbutton1080p, rbutton30fps, rbutton60fps; + private RadioButton rbutton720p30, rbutton720p60, rbutton1080p30, rbutton1080p60; private RadioButton forceSoftDec, autoDec, forceHardDec; private static final String DEFAULT_HOST = ""; @@ -57,35 +55,39 @@ public class Connection extends Activity { this.statusButton = (Button) findViewById(R.id.statusButton); this.pairButton = (Button) findViewById(R.id.pairButton); this.hostText = (TextView) findViewById(R.id.hostTextView); - this.qualityCheckbox = (CheckBox) findViewById(R.id.imageQualityCheckbox); - this.rbutton720p = (RadioButton) findViewById(R.id.res720pSelected); - this.rbutton1080p = (RadioButton) findViewById(R.id.res1080pSelected); - this.rbutton30fps = (RadioButton) findViewById(R.id.rr30Selected); - this.rbutton60fps = (RadioButton) findViewById(R.id.rr60Selected); + 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); this.forceSoftDec = (RadioButton) findViewById(R.id.softwareDec); this.autoDec = (RadioButton) findViewById(R.id.autoDec); this.forceHardDec = (RadioButton) findViewById(R.id.hardwareDec); prefs = getSharedPreferences(Game.PREFS_FILE_NAME, Context.MODE_MULTI_PROCESS); this.hostText.setText(prefs.getString(Connection.HOST_KEY, Connection.DEFAULT_HOST)); - this.qualityCheckbox.setChecked(prefs.getBoolean(Game.QUALITY_PREF_STRING, false)); - if (prefs.getInt(Game.HEIGHT_PREF_STRING, Game.DEFAULT_HEIGHT) == 720) { - rbutton720p.setChecked(true); - rbutton1080p.setChecked(false); + 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; + + rbutton720p30.setChecked(false); + rbutton720p60.setChecked(false); + rbutton1080p30.setChecked(false); + rbutton1080p60.setChecked(false); + if (res720p) { + if (fps30) { + rbutton720p30.setChecked(true); + } + else { + rbutton720p60.setChecked(true); + } } else { - rbutton1080p.setChecked(true); - rbutton720p.setChecked(false); - } - - if (prefs.getInt(Game.REFRESH_RATE_PREF_STRING, Game.DEFAULT_REFRESH_RATE) == 30) { - rbutton30fps.setChecked(true); - rbutton60fps.setChecked(false); - } - else { - rbutton60fps.setChecked(true); - rbutton30fps.setChecked(false); + if (fps30) { + rbutton1080p30.setChecked(true); + } + else { + rbutton1080p60.setChecked(true); + } } switch (prefs.getInt(Game.DECODER_PREF_STRING, Game.DEFAULT_DECODER)) { @@ -115,19 +117,25 @@ public class Connection extends Activity { return; } - if (buttonView == rbutton30fps) { - prefs.edit().putInt(Game.REFRESH_RATE_PREF_STRING, 30).commit(); - } - else if (buttonView == rbutton60fps) { - prefs.edit().putInt(Game.REFRESH_RATE_PREF_STRING, 60).commit(); - } - else if (buttonView == rbutton720p) { + if (buttonView == rbutton720p30) { prefs.edit().putInt(Game.WIDTH_PREF_STRING, 1280). - putInt(Game.HEIGHT_PREF_STRING, 720).commit(); + putInt(Game.HEIGHT_PREF_STRING, 720). + putInt(Game.REFRESH_RATE_PREF_STRING, 30).commit(); } - else if (buttonView == rbutton1080p) { + 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).commit(); + } + else if (buttonView == rbutton1080p30) { prefs.edit().putInt(Game.WIDTH_PREF_STRING, 1920). - putInt(Game.HEIGHT_PREF_STRING, 1080).commit(); + putInt(Game.HEIGHT_PREF_STRING, 1080). + putInt(Game.REFRESH_RATE_PREF_STRING, 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).commit(); } else if (buttonView == forceSoftDec) { prefs.edit().putInt(Game.DECODER_PREF_STRING, Game.FORCE_SOFTWARE_DECODER).commit(); @@ -140,23 +148,14 @@ public class Connection extends Activity { } } }; - rbutton720p.setOnCheckedChangeListener(occl); - rbutton1080p.setOnCheckedChangeListener(occl); - rbutton30fps.setOnCheckedChangeListener(occl); - rbutton60fps.setOnCheckedChangeListener(occl); + rbutton720p30.setOnCheckedChangeListener(occl); + rbutton720p60.setOnCheckedChangeListener(occl); + rbutton1080p30.setOnCheckedChangeListener(occl); + rbutton1080p60.setOnCheckedChangeListener(occl); forceSoftDec.setOnCheckedChangeListener(occl); forceHardDec.setOnCheckedChangeListener(occl); autoDec.setOnCheckedChangeListener(occl); - this.qualityCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) { - SharedPreferences.Editor editor = prefs.edit(); - editor.putBoolean(Game.QUALITY_PREF_STRING, isChecked); - editor.commit(); - } - }); - this.statusButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { diff --git a/src/com/limelight/Game.java b/src/com/limelight/Game.java index ab9ee03f..be50170b 100644 --- a/src/com/limelight/Game.java +++ b/src/com/limelight/Game.java @@ -10,6 +10,7 @@ import com.limelight.nvstream.input.ControllerPacket; import com.limelight.utils.Dialog; import com.limelight.utils.SpinnerDialog; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; @@ -49,15 +50,14 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi public static final String PREFS_FILE_NAME = "gameprefs"; - public static final String QUALITY_PREF_STRING = "Quality"; - public static final String WIDTH_PREF_STRING = "Width"; - public static final String HEIGHT_PREF_STRING = "Height"; - public static final String REFRESH_RATE_PREF_STRING = "RefreshRate"; + public static final String WIDTH_PREF_STRING = "ResH"; + public static final String HEIGHT_PREF_STRING = "ResV"; + public static final String REFRESH_RATE_PREF_STRING = "FPS"; public static final String DECODER_PREF_STRING = "Decoder"; public static final int DEFAULT_WIDTH = 1280; public static final int DEFAULT_HEIGHT = 720; - public static final int DEFAULT_REFRESH_RATE = 30; + public static final int DEFAULT_REFRESH_RATE = 60; public static final int DEFAULT_DECODER = 0; public static final int FORCE_HARDWARE_DECODER = -1; @@ -95,9 +95,6 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi // Read the stream preferences SharedPreferences prefs = getSharedPreferences(PREFS_FILE_NAME, Context.MODE_MULTI_PROCESS); int drFlags = 0; - if (prefs.getBoolean(QUALITY_PREF_STRING, false)) { - drFlags |= VideoDecoderRenderer.FLAG_PREFER_QUALITY; - } switch (prefs.getInt(Game.DECODER_PREF_STRING, Game.DEFAULT_DECODER)) { case Game.FORCE_SOFTWARE_DECODER: drFlags |= VideoDecoderRenderer.FLAG_FORCE_SOFTWARE_DECODING; @@ -129,10 +126,11 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi { ConnectivityManager mgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (mgr.isActiveNetworkMetered()) { - displayMessage("Warning: Your active network connection is metered!"); + displayTransientMessage("Warning: Your active network connection is metered!"); } } + @SuppressLint("InlinedApi") private void hideSystemUi() { runOnUiThread(new Runnable() { @Override @@ -567,4 +565,14 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi } }); } + + @Override + public void displayTransientMessage(final String message) { + runOnUiThread(new Runnable() { + @Override + public void run() { + Toast.makeText(Game.this, message, Toast.LENGTH_LONG).show(); + } + }); + } }