mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
More layout and manifest changes for Android TV
This commit is contained in:
parent
3e6f5ff11c
commit
9c48850bb7
@ -2,7 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.limelight"
|
||||
android:versionCode="36"
|
||||
android:versionName="2.5.6.1" >
|
||||
android:versionName="2.5.7" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
@ -23,16 +23,32 @@
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
|
||||
<!-- Launcher for traditional devices -->
|
||||
<activity
|
||||
android:name="com.limelight.PcView"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||
android:label="@string/app_name" >
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="tv.ouya.intent.category.APP" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Launcher for Android TV devices -->
|
||||
<activity
|
||||
android:name="com.limelight.PcViewTv"
|
||||
android:logo="@drawable/atv_banner"
|
||||
android:icon="@drawable/atv_banner"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.limelight.AppView"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||
|
@ -18,9 +18,6 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>na
|
||||
*/
|
||||
public static final int buttonBarStyle=0x7f010000;
|
||||
}
|
||||
public static final class color {
|
||||
public static final int black_overlay=0x7f040000;
|
||||
}
|
||||
public static final class dimen {
|
||||
/** Default screen margins, per the Android Design guidelines.
|
||||
|
||||
@ -28,8 +25,8 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>na
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||
|
||||
*/
|
||||
public static final int activity_horizontal_margin=0x7f050000;
|
||||
public static final int activity_vertical_margin=0x7f050001;
|
||||
public static final int activity_horizontal_margin=0x7f040000;
|
||||
public static final int activity_vertical_margin=0x7f040001;
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int app_icon=0x7f020000;
|
||||
@ -39,32 +36,32 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>na
|
||||
public static final int ouya_icon=0x7f020004;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int addPc=0x7f080001;
|
||||
public static final int advancedSettingsButton=0x7f080015;
|
||||
public static final int advancedSettingsText=0x7f080002;
|
||||
public static final int appListText=0x7f08000a;
|
||||
public static final int autoDec=0x7f080005;
|
||||
public static final int bitrateLabel=0x7f080007;
|
||||
public static final int bitrateSeekBar=0x7f080008;
|
||||
public static final int config1080p30Selected=0x7f080013;
|
||||
public static final int config1080p60Selected=0x7f080014;
|
||||
public static final int config720p30Selected=0x7f080011;
|
||||
public static final int config720p60Selected=0x7f080012;
|
||||
public static final int decoderConfigGroup=0x7f080003;
|
||||
public static final int disableToasts=0x7f080016;
|
||||
public static final int discoveryText=0x7f08000c;
|
||||
public static final int enableSops=0x7f080018;
|
||||
public static final int hardwareDec=0x7f080006;
|
||||
public static final int hostTextView=0x7f080000;
|
||||
public static final int manuallyAddPc=0x7f08000d;
|
||||
public static final int pcListView=0x7f080009;
|
||||
public static final int rowTextView=0x7f080019;
|
||||
public static final int settingsButton=0x7f08000e;
|
||||
public static final int softwareDec=0x7f080004;
|
||||
public static final int streamConfigGroup=0x7f080010;
|
||||
public static final int streamSettingsText=0x7f08000f;
|
||||
public static final int stretchToFill=0x7f080017;
|
||||
public static final int surfaceView=0x7f08000b;
|
||||
public static final int addPc=0x7f070001;
|
||||
public static final int advancedSettingsButton=0x7f070015;
|
||||
public static final int advancedSettingsText=0x7f070002;
|
||||
public static final int appListText=0x7f07000a;
|
||||
public static final int autoDec=0x7f070005;
|
||||
public static final int bitrateLabel=0x7f070007;
|
||||
public static final int bitrateSeekBar=0x7f070008;
|
||||
public static final int config1080p30Selected=0x7f070013;
|
||||
public static final int config1080p60Selected=0x7f070014;
|
||||
public static final int config720p30Selected=0x7f070011;
|
||||
public static final int config720p60Selected=0x7f070012;
|
||||
public static final int decoderConfigGroup=0x7f070003;
|
||||
public static final int disableToasts=0x7f070016;
|
||||
public static final int discoveryText=0x7f07000d;
|
||||
public static final int enableSops=0x7f070018;
|
||||
public static final int hardwareDec=0x7f070006;
|
||||
public static final int hostTextView=0x7f070000;
|
||||
public static final int manuallyAddPc=0x7f07000e;
|
||||
public static final int pcListView=0x7f070009;
|
||||
public static final int rowTextView=0x7f070019;
|
||||
public static final int settingsButton=0x7f07000c;
|
||||
public static final int softwareDec=0x7f070004;
|
||||
public static final int streamConfigGroup=0x7f070010;
|
||||
public static final int streamSettingsText=0x7f07000f;
|
||||
public static final int stretchToFill=0x7f070017;
|
||||
public static final int surfaceView=0x7f07000b;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int activity_add_computer_manually=0x7f030000;
|
||||
@ -76,8 +73,8 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>na
|
||||
public static final int simplerow=0x7f030006;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f060000;
|
||||
public static final int title_activity_game=0x7f060001;
|
||||
public static final int app_name=0x7f050000;
|
||||
public static final int title_activity_game=0x7f050001;
|
||||
}
|
||||
public static final class style {
|
||||
/**
|
||||
@ -98,13 +95,13 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>na
|
||||
|
||||
API 14 theme customizations can go here.
|
||||
*/
|
||||
public static final int AppBaseTheme=0x7f070000;
|
||||
public static final int AppBaseTheme=0x7f060000;
|
||||
/** Application theme.
|
||||
*/
|
||||
public static final int AppTheme=0x7f070001;
|
||||
public static final int ButtonBar=0x7f070003;
|
||||
public static final int ButtonBarButton=0x7f070004;
|
||||
public static final int FullscreenTheme=0x7f070002;
|
||||
public static final int AppTheme=0x7f060001;
|
||||
public static final int ButtonBar=0x7f060003;
|
||||
public static final int ButtonBarButton=0x7f060004;
|
||||
public static final int FullscreenTheme=0x7f060002;
|
||||
}
|
||||
public static final class styleable {
|
||||
/**
|
||||
|
55
res/layout-land/activity_pc_view.xml
Normal file
55
res/layout-land/activity_pc_view.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".PcView" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/pcListView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/settingsButton"
|
||||
android:background="@drawable/list_view_unselected"
|
||||
android:fastScrollEnabled="true"
|
||||
android:longClickable="false"
|
||||
android:stackFromBottom="false" >
|
||||
|
||||
</ListView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/discoveryText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBaseline="@+id/settingsButton"
|
||||
android:text="PC List" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/settingsButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/pcListView"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:text="Streaming Settings" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/manuallyAddPc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignRight="@+id/pcListView"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:text="Add PC Manually" />
|
||||
|
||||
</RelativeLayout>
|
@ -32,7 +32,7 @@
|
||||
android:layout_below="@+id/manuallyAddPc"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="Discovered PC List" />
|
||||
android:text="PC List" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/settingsButton"
|
@ -1,5 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<color name="black_overlay">#66000000</color>
|
||||
|
||||
</resources>
|
@ -21,6 +21,7 @@ import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.view.ContextMenu;
|
||||
@ -72,59 +73,58 @@ public class PcView extends Activity {
|
||||
}
|
||||
};
|
||||
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
// Reinitialize views just in case orientation changed
|
||||
initializeViews();
|
||||
}
|
||||
|
||||
private final static int APP_LIST_ID = 1;
|
||||
private final static int PAIR_ID = 2;
|
||||
private final static int UNPAIR_ID = 3;
|
||||
private final static int WOL_ID = 4;
|
||||
private final static int DELETE_ID = 5;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
private void initializeViews() {
|
||||
setContentView(R.layout.activity_pc_view);
|
||||
|
||||
// Bind to the computer manager service
|
||||
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
||||
Service.BIND_AUTO_CREATE);
|
||||
|
||||
// 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);
|
||||
pcList.setAdapter(pcListAdapter);
|
||||
pcList.setItemsCanFocus(true);
|
||||
pcList.setOnItemClickListener(new OnItemClickListener() {
|
||||
pcList.setAdapter(pcListAdapter);
|
||||
pcList.setItemsCanFocus(true);
|
||||
pcList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
||||
long id) {
|
||||
ComputerObject computer = (ComputerObject) pcListAdapter.getItem(pos);
|
||||
if (computer.details == null) {
|
||||
// Placeholder item; no context menu for it
|
||||
return;
|
||||
}
|
||||
else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||
// Open the context menu if a PC is offline
|
||||
ComputerObject computer = (ComputerObject) pcListAdapter.getItem(pos);
|
||||
if (computer.details == null) {
|
||||
// Placeholder item; no context menu for it
|
||||
return;
|
||||
}
|
||||
else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||
// Open the context menu if a PC is offline
|
||||
openContextMenu(arg1);
|
||||
}
|
||||
else if (computer.details.pairState != PairState.PAIRED) {
|
||||
// Pair an unpaired machine by default
|
||||
doPair(computer.details);
|
||||
}
|
||||
else {
|
||||
doAppList(computer.details);
|
||||
}
|
||||
}
|
||||
else if (computer.details.pairState != PairState.PAIRED) {
|
||||
// Pair an unpaired machine by default
|
||||
doPair(computer.details);
|
||||
}
|
||||
else {
|
||||
doAppList(computer.details);
|
||||
}
|
||||
}
|
||||
});
|
||||
registerForContextMenu(pcList);
|
||||
settingsButton.setOnClickListener(new OnClickListener() {
|
||||
});
|
||||
registerForContextMenu(pcList);
|
||||
settingsButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(PcView.this, StreamSettings.class));
|
||||
}
|
||||
});
|
||||
});
|
||||
addComputerButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -132,8 +132,27 @@ public class PcView extends Activity {
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
addListPlaceholder();
|
||||
|
||||
if (pcListAdapter.isEmpty()) {
|
||||
addListPlaceholder();
|
||||
}
|
||||
else {
|
||||
pcListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Bind to the computer manager service
|
||||
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
||||
Service.BIND_AUTO_CREATE);
|
||||
|
||||
pcListAdapter = new ArrayAdapter<ComputerObject>(this, R.layout.simplerow, R.id.rowTextView);
|
||||
pcListAdapter.setNotifyOnChange(false);
|
||||
|
||||
initializeViews();
|
||||
}
|
||||
|
||||
private void startComputerUpdates() {
|
||||
|
6
src/com/limelight/PcViewTv.java
Normal file
6
src/com/limelight/PcViewTv.java
Normal file
@ -0,0 +1,6 @@
|
||||
package com.limelight;
|
||||
|
||||
/* This is a dummy class to allow for a separate icon
|
||||
* and launcher for TV.
|
||||
*/
|
||||
public class PcViewTv extends PcView {}
|
Loading…
x
Reference in New Issue
Block a user