mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 19:42:45 +00:00
Add GFE settings optimization checkbox. Move Add PC button to the main screen.
This commit is contained in:
parent
e1e4ccf318
commit
887dd9aa21
@ -59,7 +59,7 @@
|
||||
android:label="Add Computer Manually" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.limelight.StreamSettings" />
|
||||
android:value="com.limelight.PcView" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.limelight.Game"
|
||||
|
@ -39,26 +39,27 @@ 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 addPc=0x7f080001;
|
||||
public static final int advancedSettingsButton=0x7f080012;
|
||||
public static final int advancedSettingsButton=0x7f080013;
|
||||
public static final int appListText=0x7f080009;
|
||||
public static final int autoDec=0x7f080004;
|
||||
public static final int bitrateLabel=0x7f080006;
|
||||
public static final int bitrateSeekBar=0x7f080007;
|
||||
public static final int config1080p30Selected=0x7f080010;
|
||||
public static final int config1080p60Selected=0x7f080011;
|
||||
public static final int config720p30Selected=0x7f08000e;
|
||||
public static final int config720p60Selected=0x7f08000f;
|
||||
public static final int config1080p30Selected=0x7f080011;
|
||||
public static final int config1080p60Selected=0x7f080012;
|
||||
public static final int config720p30Selected=0x7f08000f;
|
||||
public static final int config720p60Selected=0x7f080010;
|
||||
public static final int decoderConfigGroup=0x7f080002;
|
||||
public static final int discoveryText=0x7f08000b;
|
||||
public static final int enableSops=0x7f080014;
|
||||
public static final int hardwareDec=0x7f080005;
|
||||
public static final int hostTextView=0x7f080000;
|
||||
public static final int manuallyAddPc=0x7f080014;
|
||||
public static final int manuallyAddPc=0x7f08000c;
|
||||
public static final int pcListView=0x7f080008;
|
||||
public static final int rowTextView=0x7f080015;
|
||||
public static final int settingsButton=0x7f08000c;
|
||||
public static final int rowTextView=0x7f080016;
|
||||
public static final int settingsButton=0x7f08000d;
|
||||
public static final int softwareDec=0x7f080003;
|
||||
public static final int streamConfigGroup=0x7f08000d;
|
||||
public static final int stretchToFill=0x7f080013;
|
||||
public static final int streamConfigGroup=0x7f08000e;
|
||||
public static final int stretchToFill=0x7f080015;
|
||||
public static final int surfaceView=0x7f08000a;
|
||||
}
|
||||
public static final class layout {
|
||||
|
Binary file not shown.
@ -29,7 +29,7 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="Applications" />
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_below="@+id/settingsButton"
|
||||
android:paddingTop="20dp"
|
||||
android:layout_below="@+id/manuallyAddPc"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="Discovered PC List" />
|
||||
|
||||
@ -42,4 +42,12 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="Streaming Settings" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/manuallyAddPc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/settingsButton"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Add PC Manually" />
|
||||
|
||||
</RelativeLayout>
|
@ -54,19 +54,11 @@
|
||||
android:id="@+id/advancedSettingsButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/stretchToFill"
|
||||
android:layout_below="@+id/enableSops"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Advanced Settings" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/manuallyAddPc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/advancedSettingsButton"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Add PC Manually" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/stretchToFill"
|
||||
android:layout_width="wrap_content"
|
||||
@ -75,6 +67,14 @@
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Stretch video to fill screen" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/enableSops"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/stretchToFill"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Allow GFE to modify game settings for optimal streaming" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
@ -39,6 +39,7 @@ public class AppView extends Activity {
|
||||
|
||||
private final static int RESUME_ID = 1;
|
||||
private final static int QUIT_ID = 2;
|
||||
private final static int CANCEL_ID = 3;
|
||||
|
||||
public final static String ADDRESS_EXTRA = "Address";
|
||||
public final static String UNIQUEID_EXTRA = "UniqueId";
|
||||
@ -80,8 +81,8 @@ public class AppView extends Activity {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only open the context menu if it's running, otherwise start it
|
||||
if (app.app.getIsRunning()) {
|
||||
// Only open the context menu if something is running, otherwise start it
|
||||
if (getRunningAppId() != -1) {
|
||||
openContextMenu(arg1);
|
||||
}
|
||||
else {
|
||||
@ -108,12 +109,43 @@ public class AppView extends Activity {
|
||||
updateAppList();
|
||||
}
|
||||
|
||||
private int getRunningAppId() {
|
||||
int runningAppId = -1;
|
||||
for (int i = 0; i < appListAdapter.getCount(); i++) {
|
||||
AppObject app = appListAdapter.getItem(i);
|
||||
if (app.app == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (app.app.getIsRunning()) {
|
||||
runningAppId = app.app.getAppId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return runningAppId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
|
||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||
AppObject selectedApp = (AppObject) appListAdapter.getItem(info.position);
|
||||
if (selectedApp == null || selectedApp.app == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int runningAppId = getRunningAppId();
|
||||
if (runningAppId != -1) {
|
||||
if (runningAppId == selectedApp.app.getAppId()) {
|
||||
menu.add(Menu.NONE, RESUME_ID, 1, "Resume Session");
|
||||
menu.add(Menu.NONE, QUIT_ID, 2, "Quit Session");
|
||||
}
|
||||
else {
|
||||
menu.add(Menu.NONE, RESUME_ID, 1, "Quit Current Game and Start");
|
||||
menu.add(Menu.NONE, CANCEL_ID, 2, "Cancel");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,6 +167,9 @@ public class AppView extends Activity {
|
||||
doQuit(app.app);
|
||||
return true;
|
||||
|
||||
case CANCEL_ID:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
public static final String DECODER_PREF_STRING = "Decoder";
|
||||
public static final String BITRATE_PREF_STRING = "Bitrate";
|
||||
public static final String STRETCH_PREF_STRING = "Stretch";
|
||||
public static final String SOPS_PREF_STRING = "Sops";
|
||||
|
||||
public static final int BITRATE_DEFAULT_720_30 = 5;
|
||||
public static final int BITRATE_DEFAULT_720_60 = 10;
|
||||
@ -92,6 +93,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
public static final int DEFAULT_DECODER = 0;
|
||||
public static final int DEFAULT_BITRATE = BITRATE_DEFAULT_720_60;
|
||||
public static final boolean DEFAULT_STRETCH = false;
|
||||
public static final boolean DEFAULT_SOPS = true;
|
||||
|
||||
public static final int FORCE_HARDWARE_DECODER = -1;
|
||||
public static final int AUTOSELECT_DECODER = 0;
|
||||
@ -148,10 +150,12 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
}
|
||||
|
||||
int refreshRate, bitrate;
|
||||
boolean sops;
|
||||
width = prefs.getInt(WIDTH_PREF_STRING, DEFAULT_WIDTH);
|
||||
height = prefs.getInt(HEIGHT_PREF_STRING, DEFAULT_HEIGHT);
|
||||
refreshRate = prefs.getInt(REFRESH_RATE_PREF_STRING, DEFAULT_REFRESH_RATE);
|
||||
bitrate = prefs.getInt(BITRATE_PREF_STRING, DEFAULT_BITRATE);
|
||||
sops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS);
|
||||
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
display.getSize(screenSize);
|
||||
@ -186,7 +190,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
// Start the connection
|
||||
conn = new NvConnection(host, uniqueId, Game.this,
|
||||
new StreamConfiguration(app, width, height, refreshRate, bitrate * 1000,
|
||||
enableLargePackets ? 1460 : 1024), PlatformBinding.getCryptoProvider(this));
|
||||
enableLargePackets ? 1460 : 1024, sops), PlatformBinding.getCryptoProvider(this));
|
||||
keybTranslator = new KeyboardTranslator(conn);
|
||||
controllerHandler = new ControllerHandler(conn);
|
||||
decoderRenderer = new ConfigurableDecoderRenderer();
|
||||
|
@ -37,7 +37,7 @@ import android.widget.Toast;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
|
||||
public class PcView extends Activity {
|
||||
private Button settingsButton;
|
||||
private Button settingsButton, addComputerButton;
|
||||
private ListView pcList;
|
||||
private ArrayAdapter<ComputerObject> pcListAdapter;
|
||||
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
||||
@ -85,6 +85,8 @@ public class PcView extends Activity {
|
||||
|
||||
// Setup the list view
|
||||
settingsButton = (Button)findViewById(R.id.settingsButton);
|
||||
addComputerButton = (Button)findViewById(R.id.manuallyAddPc);
|
||||
|
||||
pcList = (ListView)findViewById(R.id.pcListView);
|
||||
pcListAdapter = new ArrayAdapter<ComputerObject>(this, R.layout.simplerow, R.id.rowTextView);
|
||||
pcListAdapter.setNotifyOnChange(false);
|
||||
@ -119,6 +121,13 @@ public class PcView extends Activity {
|
||||
startActivity(new Intent(PcView.this, StreamSettings.class));
|
||||
}
|
||||
});
|
||||
addComputerButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(PcView.this, AddComputerManually.class);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
addListPlaceholder();
|
||||
}
|
||||
@ -494,7 +503,7 @@ public class PcView extends Activity {
|
||||
private void addListPlaceholder() {
|
||||
pcListAdapter.add(new ComputerObject("Discovery is running. No computers found yet. " +
|
||||
"If your PC doesn't show up in about 15 seconds, " +
|
||||
"make sure your computer is running GFE or add your PC manually on the settings page.", null));
|
||||
"make sure your computer is running GFE or add your PC manually using the button above.", null));
|
||||
}
|
||||
|
||||
private void removeListView(ComputerDetails details) {
|
||||
|
@ -16,10 +16,10 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class StreamSettings extends Activity {
|
||||
private Button advancedSettingsButton, addComputerButton;
|
||||
private Button advancedSettingsButton;
|
||||
private SharedPreferences prefs;
|
||||
private RadioButton rbutton720p30, rbutton720p60, rbutton1080p30, rbutton1080p60;
|
||||
private CheckBox stretchToFill;
|
||||
private CheckBox stretchToFill, enableSops;
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
@ -35,8 +35,8 @@ public class StreamSettings extends Activity {
|
||||
setContentView(R.layout.activity_stream_settings);
|
||||
|
||||
this.stretchToFill = (CheckBox) findViewById(R.id.stretchToFill);
|
||||
this.enableSops = (CheckBox) findViewById(R.id.enableSops);
|
||||
this.advancedSettingsButton = (Button) findViewById(R.id.advancedSettingsButton);
|
||||
this.addComputerButton = (Button) findViewById(R.id.manuallyAddPc);
|
||||
this.rbutton720p30 = (RadioButton) findViewById(R.id.config720p30Selected);
|
||||
this.rbutton720p60 = (RadioButton) findViewById(R.id.config720p60Selected);
|
||||
this.rbutton1080p30 = (RadioButton) findViewById(R.id.config1080p30Selected);
|
||||
@ -48,6 +48,7 @@ public class StreamSettings extends Activity {
|
||||
boolean fps30 = prefs.getInt(Game.REFRESH_RATE_PREF_STRING, Game.DEFAULT_REFRESH_RATE) == 30;
|
||||
|
||||
stretchToFill.setChecked(prefs.getBoolean(Game.STRETCH_PREF_STRING, Game.DEFAULT_STRETCH));
|
||||
enableSops.setChecked(prefs.getBoolean(Game.SOPS_PREF_STRING, Game.DEFAULT_SOPS));
|
||||
|
||||
rbutton720p30.setChecked(false);
|
||||
rbutton720p60.setChecked(false);
|
||||
@ -117,13 +118,6 @@ public class StreamSettings extends Activity {
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
addComputerButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(StreamSettings.this, AddComputerManually.class);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
stretchToFill.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
@ -131,5 +125,12 @@ public class StreamSettings extends Activity {
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user