UI updates to make options more clear. Add scroll view to UI.

This commit is contained in:
Cameron Gutman
2014-02-19 19:22:54 -05:00
parent 22ecdd9cf8
commit 839540dc74
4 changed files with 113 additions and 116 deletions

View File

@@ -36,19 +36,17 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>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;

View File

@@ -1,4 +1,4 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@@ -7,6 +7,10 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".Connection" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/hostTextView"
@@ -43,8 +47,9 @@
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/rrGroup"
android:layout_below="@+id/rrGroup"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/streamConfigGroup"
android:layout_marginTop="25dp"
android:orientation="vertical" >
@@ -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)" />
<RadioButton
android:id="@+id/hardwareDec"
@@ -68,56 +73,43 @@
</RadioGroup>
<RadioGroup
android:id="@+id/rrGroup"
android:id="@+id/streamConfigGroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/resolutionGroup"
android:layout_below="@+id/resolutionGroup"
android:layout_marginTop="15dp"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rr30Selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30 FPS" />
<RadioButton
android:id="@+id/rr60Selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="60 FPS (may increase lag)" />
</RadioGroup>
<RadioGroup
android:id="@+id/resolutionGroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageQualityCheckbox"
android:layout_below="@+id/imageQualityCheckbox"
android:layout_marginTop="17dp"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/res720pSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="720p" />
<RadioButton
android:id="@+id/res1080pSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1080p (may increase lag)" />
</RadioGroup>
<CheckBox
android:id="@+id/imageQualityCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/pairButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Prefer image quality over performance" />
android:layout_marginTop="25dp"
android:orientation="vertical" >
</RelativeLayout>
<RadioButton
android:id="@+id/config720p30Selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="720p 30 FPS (Only recommended for poor devices or networks)" />
<RadioButton
android:id="@+id/config720p60Selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="720p 60 FPS (Recommended for most devices and networks)" />
<RadioButton
android:id="@+id/config1080p30Selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="1080p 30 FPS (Recommended for most devices if 1080p streaming is desired)" />
<RadioButton
android:id="@+id/config1080p60Selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="1080p 60 FPS (Requires extremely fast device and network)" />
</RadioGroup>
</RelativeLayout>
</ScrollView>

View File

@@ -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) {

View File

@@ -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();
}
});
}
}