mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-10-20 23:36:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db5b7ab867 | ||
|
|
3bcc1c84bb | ||
|
|
d46053f8d6 | ||
|
|
00a5fed9e9 | ||
|
|
b6315a715a | ||
|
|
0da8303468 | ||
|
|
c821c4684f | ||
|
|
6bae33f822 | ||
|
|
08d4ab67a6 | ||
|
|
62203d2f21 | ||
|
|
4968dcc558 | ||
|
|
6d66d1371f | ||
|
|
b87ca71103 | ||
|
|
c251cd2e8f | ||
|
|
593616d2d9 |
No files matched your search
+2
-2
@@ -7,8 +7,8 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionName "8.2"
|
versionName "8.4.1"
|
||||||
versionCode = 199
|
versionCode = 203
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "root"
|
flavorDimensions "root"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.app.Service;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -96,8 +97,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
appGridAdapter = new AppGridAdapter(AppView.this,
|
appGridAdapter = new AppGridAdapter(AppView.this,
|
||||||
PreferenceConfiguration.readPreferences(AppView.this).listMode,
|
PreferenceConfiguration.readPreferences(AppView.this),
|
||||||
PreferenceConfiguration.readPreferences(AppView.this).smallIconMode,
|
|
||||||
computer, localBinder.getUniqueId());
|
computer, localBinder.getUniqueId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -147,6 +147,27 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
|
// If appGridAdapter is initialized, let it know about the configuration change.
|
||||||
|
// If not, it will pick it up when it initializes.
|
||||||
|
if (appGridAdapter != null) {
|
||||||
|
// Update the app grid adapter to create grid items with the correct layout
|
||||||
|
appGridAdapter.updateLayoutWithPreferences(this, PreferenceConfiguration.readPreferences(this));
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Reinflate the app grid itself to pick up the layout change
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.appFragmentContainer, new AdapterFragment())
|
||||||
|
.commitAllowingStateLoss();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void startComputerUpdates() {
|
private void startComputerUpdates() {
|
||||||
// Don't start polling if we're not bound or in the foreground
|
// Don't start polling if we're not bound or in the foreground
|
||||||
if (managerBinder == null || !inForeground) {
|
if (managerBinder == null || !inForeground) {
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
|
|||||||
// Set default preferences if we've never been run
|
// Set default preferences if we've never been run
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
|
|
||||||
|
// Set the correct layout for the PC grid
|
||||||
|
pcGridAdapter.updateLayoutWithPreferences(this, PreferenceConfiguration.readPreferences(this));
|
||||||
|
|
||||||
// Setup the list view
|
// Setup the list view
|
||||||
ImageButton settingsButton = findViewById(R.id.settingsButton);
|
ImageButton settingsButton = findViewById(R.id.settingsButton);
|
||||||
ImageButton addComputerButton = findViewById(R.id.manuallyAddPc);
|
ImageButton addComputerButton = findViewById(R.id.manuallyAddPc);
|
||||||
@@ -223,9 +226,7 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
|
|||||||
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
||||||
Service.BIND_AUTO_CREATE);
|
Service.BIND_AUTO_CREATE);
|
||||||
|
|
||||||
pcGridAdapter = new PcGridAdapter(this,
|
pcGridAdapter = new PcGridAdapter(this, PreferenceConfiguration.readPreferences(this));
|
||||||
PreferenceConfiguration.readPreferences(this).listMode,
|
|
||||||
PreferenceConfiguration.readPreferences(this).smallIconMode);
|
|
||||||
|
|
||||||
initializeViews();
|
initializeViews();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,6 +335,13 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isExternal(InputDevice dev) {
|
private static boolean isExternal(InputDevice dev) {
|
||||||
|
// The ASUS Tinker Board inaccurately reports Bluetooth gamepads as internal,
|
||||||
|
// causing shouldIgnoreBack() to believe it should pass through back as a
|
||||||
|
// navigation event for any attached gamepads.
|
||||||
|
if (Build.MODEL.equals("Tinker Board")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
// Landroid/view/InputDevice;->isExternal()Z is officially public on Android Q
|
// Landroid/view/InputDevice;->isExternal()Z is officially public on Android Q
|
||||||
return dev.isExternal();
|
return dev.isExternal();
|
||||||
@@ -418,6 +425,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
String devName = dev.getName();
|
String devName = dev.getName();
|
||||||
|
|
||||||
LimeLog.info("Creating controller context for device: "+devName);
|
LimeLog.info("Creating controller context for device: "+devName);
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||||
|
LimeLog.info("Vendor ID: "+dev.getVendorId());
|
||||||
|
LimeLog.info("Product ID: "+dev.getProductId());
|
||||||
|
}
|
||||||
LimeLog.info(dev.toString());
|
LimeLog.info(dev.toString());
|
||||||
|
|
||||||
context.name = devName;
|
context.name = devName;
|
||||||
@@ -464,25 +475,45 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
||||||
InputDevice.MotionRange ryRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RY);
|
InputDevice.MotionRange ryRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RY);
|
||||||
if (rxRange != null && ryRange != null && devName != null) {
|
if (rxRange != null && ryRange != null && devName != null) {
|
||||||
if (devName.contains("Xbox") || devName.contains("XBox") || devName.contains("X-Box")) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||||
// Xbox controllers use RX and RY for right stick
|
if (dev.getVendorId() == 0x054c) { // Sony
|
||||||
|
if (dev.hasKeys(KeyEvent.KEYCODE_BUTTON_C)[0]) {
|
||||||
|
LimeLog.info("Detected non-standard DualShock 4 mapping");
|
||||||
|
context.isNonStandardDualShock4 = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LimeLog.info("Detected DualShock 4 (Linux standard mapping)");
|
||||||
|
context.usesLinuxGamepadStandardFaceButtons = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!devName.contains("Xbox") && !devName.contains("XBox") && !devName.contains("X-Box")) {
|
||||||
|
LimeLog.info("Assuming non-standard DualShock 4 mapping on < 4.4");
|
||||||
|
context.isNonStandardDualShock4 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.isNonStandardDualShock4) {
|
||||||
|
// The old DS4 driver uses RX and RY for triggers
|
||||||
|
context.leftTriggerAxis = MotionEvent.AXIS_RX;
|
||||||
|
context.rightTriggerAxis = MotionEvent.AXIS_RY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If it's not a non-standard DS4 controller, it's probably an Xbox controller or
|
||||||
|
// other sane controller that uses RX and RY for right stick and Z and RZ for triggers.
|
||||||
context.rightStickXAxis = MotionEvent.AXIS_RX;
|
context.rightStickXAxis = MotionEvent.AXIS_RX;
|
||||||
context.rightStickYAxis = MotionEvent.AXIS_RY;
|
context.rightStickYAxis = MotionEvent.AXIS_RY;
|
||||||
|
|
||||||
// Xbox controllers use Z and RZ for triggers
|
// While it's likely that Z and RZ are triggers, we may have digital trigger buttons
|
||||||
context.leftTriggerAxis = MotionEvent.AXIS_Z;
|
// instead. We must check that we actually have Z and RZ axes before assigning them.
|
||||||
context.rightTriggerAxis = MotionEvent.AXIS_RZ;
|
if (getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_Z) != null &&
|
||||||
context.triggersIdleNegative = true;
|
getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RZ) != null) {
|
||||||
context.isXboxController = true;
|
context.leftTriggerAxis = MotionEvent.AXIS_Z;
|
||||||
|
context.rightTriggerAxis = MotionEvent.AXIS_RZ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// DS4 controller uses RX and RY for triggers
|
|
||||||
context.leftTriggerAxis = MotionEvent.AXIS_RX;
|
|
||||||
context.rightTriggerAxis = MotionEvent.AXIS_RY;
|
|
||||||
context.triggersIdleNegative = true;
|
|
||||||
|
|
||||||
context.isDualShock4 = true;
|
// Triggers always idle negative on axes that are centered at zero
|
||||||
}
|
context.triggersIdleNegative = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,7 +619,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
// required fixup is ignoring the select button.
|
// required fixup is ignoring the select button.
|
||||||
else if (devName.equals("Xbox Wireless Controller")) {
|
else if (devName.equals("Xbox Wireless Controller")) {
|
||||||
if (gasRange == null) {
|
if (gasRange == null) {
|
||||||
context.isXboxBtController = true;
|
context.isNonStandardXboxBtController = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -767,7 +798,21 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.isDualShock4) {
|
if (context.usesLinuxGamepadStandardFaceButtons) {
|
||||||
|
// Android's Generic.kl swaps BTN_NORTH and BTN_WEST
|
||||||
|
switch (event.getScanCode()) {
|
||||||
|
case 304:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_A;
|
||||||
|
case 305:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_B;
|
||||||
|
case 307:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_Y;
|
||||||
|
case 308:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_X;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.isNonStandardDualShock4) {
|
||||||
switch (event.getScanCode()) {
|
switch (event.getScanCode()) {
|
||||||
case 304:
|
case 304:
|
||||||
return KeyEvent.KEYCODE_BUTTON_X;
|
return KeyEvent.KEYCODE_BUTTON_X;
|
||||||
@@ -812,7 +857,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return KeyEvent.KEYCODE_BUTTON_START;
|
return KeyEvent.KEYCODE_BUTTON_START;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (context.isXboxBtController) {
|
else if (context.isNonStandardXboxBtController) {
|
||||||
switch (event.getScanCode()) {
|
switch (event.getScanCode()) {
|
||||||
case 306:
|
case 306:
|
||||||
return KeyEvent.KEYCODE_BUTTON_X;
|
return KeyEvent.KEYCODE_BUTTON_X;
|
||||||
@@ -1531,9 +1576,9 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
public int hatXAxis = -1;
|
public int hatXAxis = -1;
|
||||||
public int hatYAxis = -1;
|
public int hatYAxis = -1;
|
||||||
|
|
||||||
public boolean isDualShock4;
|
public boolean isNonStandardDualShock4;
|
||||||
public boolean isXboxController;
|
public boolean usesLinuxGamepadStandardFaceButtons;
|
||||||
public boolean isXboxBtController;
|
public boolean isNonStandardXboxBtController;
|
||||||
public boolean isServal;
|
public boolean isServal;
|
||||||
public boolean backIsStart;
|
public boolean backIsStart;
|
||||||
public boolean modeIsSelect;
|
public boolean modeIsSelect;
|
||||||
|
|||||||
@@ -191,10 +191,32 @@ public class UsbDriverService extends Service implements UsbDriverListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean kernelSupportsXboxOne() {
|
||||||
|
String kernelVersion = System.getProperty("os.version");
|
||||||
|
LimeLog.info("Kernel Version: "+kernelVersion);
|
||||||
|
|
||||||
|
if (kernelVersion == null) {
|
||||||
|
// We'll assume this is some newer version of Android
|
||||||
|
// that doesn't let you read the kernel version this way.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (kernelVersion.startsWith("2.") || kernelVersion.startsWith("3.")) {
|
||||||
|
// These are old kernels that definitely don't support Xbox One controllers properly
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (kernelVersion.startsWith("4.4.") || kernelVersion.startsWith("4.9.")) {
|
||||||
|
// These aren't guaranteed to have backported kernel patches for proper Xbox One
|
||||||
|
// support (though some devices will).
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// The next AOSP common kernel is 4.14 which has working Xbox One controller support
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean shouldClaimDevice(UsbDevice device, boolean claimAllAvailable) {
|
public static boolean shouldClaimDevice(UsbDevice device, boolean claimAllAvailable) {
|
||||||
// We always bind to XB1 controllers but only bind to XB360 controllers
|
return ((!kernelSupportsXboxOne() || !isRecognizedInputDevice(device) || claimAllAvailable) && XboxOneController.canClaimDevice(device)) ||
|
||||||
// if we know the kernel isn't already driving this device.
|
|
||||||
return XboxOneController.canClaimDevice(device) ||
|
|
||||||
((!isRecognizedInputDevice(device) || claimAllAvailable) && Xbox360Controller.canClaimDevice(device));
|
((!isRecognizedInputDevice(device) || claimAllAvailable) && Xbox360Controller.canClaimDevice(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,12 @@ public class MediaCodecHelper {
|
|||||||
blacklistedDecoderPrefixes.add("AVCDecoder");
|
blacklistedDecoderPrefixes.add("AVCDecoder");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Never use ffmpeg decoders since they're software decoders
|
// We want to avoid ffmpeg decoders since they're software decoders,
|
||||||
blacklistedDecoderPrefixes.add("OMX.ffmpeg");
|
// but on Android-x86 they might be all we have (and also relatively
|
||||||
|
// performant on a modern x86 processor).
|
||||||
|
if (!Build.BRAND.equals("Android-x86")) {
|
||||||
|
blacklistedDecoderPrefixes.add("OMX.ffmpeg");
|
||||||
|
}
|
||||||
|
|
||||||
// Force these decoders disabled because:
|
// Force these decoders disabled because:
|
||||||
// 1) They are software decoders, so the performance is terrible
|
// 1) They are software decoders, so the performance is terrible
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.limelight.grid;
|
package com.limelight.grid;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.content.Context;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -13,6 +13,7 @@ import com.limelight.grid.assets.DiskAssetLoader;
|
|||||||
import com.limelight.grid.assets.MemoryAssetLoader;
|
import com.limelight.grid.assets.MemoryAssetLoader;
|
||||||
import com.limelight.grid.assets.NetworkAssetLoader;
|
import com.limelight.grid.assets.NetworkAssetLoader;
|
||||||
import com.limelight.nvstream.http.ComputerDetails;
|
import com.limelight.nvstream.http.ComputerDetails;
|
||||||
|
import com.limelight.preferences.PreferenceConfiguration;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -23,15 +24,37 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
private static final int SMALL_WIDTH_DP = 100;
|
private static final int SMALL_WIDTH_DP = 100;
|
||||||
private static final int LARGE_WIDTH_DP = 150;
|
private static final int LARGE_WIDTH_DP = 150;
|
||||||
|
|
||||||
private final CachedAppAssetLoader loader;
|
private final ComputerDetails computer;
|
||||||
|
private final String uniqueId;
|
||||||
|
|
||||||
public AppGridAdapter(Activity activity, boolean listMode, boolean small, ComputerDetails computer, String uniqueId) {
|
private CachedAppAssetLoader loader;
|
||||||
super(activity, listMode ? R.layout.simple_row : (small ? R.layout.app_grid_item_small : R.layout.app_grid_item));
|
|
||||||
|
|
||||||
int dpi = activity.getResources().getDisplayMetrics().densityDpi;
|
public AppGridAdapter(Context context, PreferenceConfiguration prefs, ComputerDetails computer, String uniqueId) {
|
||||||
|
super(context, getLayoutIdForPreferences(prefs));
|
||||||
|
|
||||||
|
this.computer = computer;
|
||||||
|
this.uniqueId = uniqueId;
|
||||||
|
|
||||||
|
updateLayoutWithPreferences(context, prefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getLayoutIdForPreferences(PreferenceConfiguration prefs) {
|
||||||
|
if (prefs.listMode) {
|
||||||
|
return R.layout.simple_row;
|
||||||
|
}
|
||||||
|
else if (prefs.smallIconMode) {
|
||||||
|
return R.layout.app_grid_item_small;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return R.layout.app_grid_item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLayoutWithPreferences(Context context, PreferenceConfiguration prefs) {
|
||||||
|
int dpi = context.getResources().getDisplayMetrics().densityDpi;
|
||||||
int dp;
|
int dp;
|
||||||
|
|
||||||
if (small) {
|
if (prefs.smallIconMode) {
|
||||||
dp = SMALL_WIDTH_DP;
|
dp = SMALL_WIDTH_DP;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -45,10 +68,18 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
}
|
}
|
||||||
LimeLog.info("Art scaling divisor: " + scalingDivisor);
|
LimeLog.info("Art scaling divisor: " + scalingDivisor);
|
||||||
|
|
||||||
|
if (loader != null) {
|
||||||
|
// Cancel operations on the old loader
|
||||||
|
cancelQueuedOperations();
|
||||||
|
}
|
||||||
|
|
||||||
this.loader = new CachedAppAssetLoader(computer, scalingDivisor,
|
this.loader = new CachedAppAssetLoader(computer, scalingDivisor,
|
||||||
new NetworkAssetLoader(context, uniqueId),
|
new NetworkAssetLoader(context, uniqueId),
|
||||||
new MemoryAssetLoader(),
|
new MemoryAssetLoader(),
|
||||||
new DiskAssetLoader(context));
|
new DiskAssetLoader(context));
|
||||||
|
|
||||||
|
// This will trigger the view to reload with the new layout
|
||||||
|
setLayoutId(getLayoutIdForPreferences(prefs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelQueuedOperations() {
|
public void cancelQueuedOperations() {
|
||||||
|
|||||||
@@ -10,22 +10,32 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.limelight.R;
|
import com.limelight.R;
|
||||||
|
import com.limelight.preferences.PreferenceConfiguration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public abstract class GenericGridAdapter<T> extends BaseAdapter {
|
public abstract class GenericGridAdapter<T> extends BaseAdapter {
|
||||||
protected final Context context;
|
protected final Context context;
|
||||||
protected final int layoutId;
|
private int layoutId;
|
||||||
protected final ArrayList<T> itemList = new ArrayList<>();
|
final ArrayList<T> itemList = new ArrayList<>();
|
||||||
protected final LayoutInflater inflater;
|
private final LayoutInflater inflater;
|
||||||
|
|
||||||
public GenericGridAdapter(Context context, int layoutId) {
|
GenericGridAdapter(Context context, int layoutId) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.layoutId = layoutId;
|
this.layoutId = layoutId;
|
||||||
|
|
||||||
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setLayoutId(int layoutId) {
|
||||||
|
if (layoutId != this.layoutId) {
|
||||||
|
this.layoutId = layoutId;
|
||||||
|
|
||||||
|
// Force the view to be redrawn with the new layout
|
||||||
|
notifyDataSetInvalidated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
itemList.clear();
|
itemList.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,32 @@ import com.limelight.PcView;
|
|||||||
import com.limelight.R;
|
import com.limelight.R;
|
||||||
import com.limelight.nvstream.http.ComputerDetails;
|
import com.limelight.nvstream.http.ComputerDetails;
|
||||||
import com.limelight.nvstream.http.PairingManager;
|
import com.limelight.nvstream.http.PairingManager;
|
||||||
|
import com.limelight.preferences.PreferenceConfiguration;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class PcGridAdapter extends GenericGridAdapter<PcView.ComputerObject> {
|
public class PcGridAdapter extends GenericGridAdapter<PcView.ComputerObject> {
|
||||||
|
|
||||||
public PcGridAdapter(Context context, boolean listMode, boolean small) {
|
public PcGridAdapter(Context context, PreferenceConfiguration prefs) {
|
||||||
super(context, listMode ? R.layout.simple_row : (small ? R.layout.pc_grid_item_small : R.layout.pc_grid_item));
|
super(context, getLayoutIdForPreferences(prefs));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getLayoutIdForPreferences(PreferenceConfiguration prefs) {
|
||||||
|
if (prefs.listMode) {
|
||||||
|
return R.layout.simple_row;
|
||||||
|
}
|
||||||
|
else if (prefs.smallIconMode) {
|
||||||
|
return R.layout.pc_grid_item_small;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return R.layout.pc_grid_item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLayoutWithPreferences(Context context, PreferenceConfiguration prefs) {
|
||||||
|
// This will trigger the view to reload with the new layout
|
||||||
|
setLayoutId(getLayoutIdForPreferences(prefs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addComputer(PcView.ComputerObject computer) {
|
public void addComputer(PcView.ComputerObject computer) {
|
||||||
|
|||||||
@@ -68,17 +68,6 @@ public class UiHelper {
|
|||||||
View rootView = activity.findViewById(android.R.id.content);
|
View rootView = activity.findViewById(android.R.id.content);
|
||||||
UiModeManager modeMgr = (UiModeManager) activity.getSystemService(Context.UI_MODE_SERVICE);
|
UiModeManager modeMgr = (UiModeManager) activity.getSystemService(Context.UI_MODE_SERVICE);
|
||||||
|
|
||||||
if (modeMgr.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION)
|
|
||||||
{
|
|
||||||
// Increase view padding on TVs
|
|
||||||
float scale = activity.getResources().getDisplayMetrics().density;
|
|
||||||
int verticalPaddingPixels = (int) (TV_VERTICAL_PADDING_DP*scale + 0.5f);
|
|
||||||
int horizontalPaddingPixels = (int) (TV_HORIZONTAL_PADDING_DP*scale + 0.5f);
|
|
||||||
|
|
||||||
rootView.setPadding(horizontalPaddingPixels, verticalPaddingPixels,
|
|
||||||
horizontalPaddingPixels, verticalPaddingPixels);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
// Allow this non-streaming activity to layout under notches.
|
// Allow this non-streaming activity to layout under notches.
|
||||||
//
|
//
|
||||||
@@ -89,7 +78,16 @@ public class UiHelper {
|
|||||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (modeMgr.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
||||||
|
// Increase view padding on TVs
|
||||||
|
float scale = activity.getResources().getDisplayMetrics().density;
|
||||||
|
int verticalPaddingPixels = (int) (TV_VERTICAL_PADDING_DP*scale + 0.5f);
|
||||||
|
int horizontalPaddingPixels = (int) (TV_HORIZONTAL_PADDING_DP*scale + 0.5f);
|
||||||
|
|
||||||
|
rootView.setPadding(horizontalPaddingPixels, verticalPaddingPixels,
|
||||||
|
horizontalPaddingPixels, verticalPaddingPixels);
|
||||||
|
}
|
||||||
|
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
// Draw under the status bar on Android Q devices
|
// Draw under the status bar on Android Q devices
|
||||||
|
|
||||||
// Using getDecorView() here breaks the translucent status/navigation bar when gestures are disabled
|
// Using getDecorView() here breaks the translucent status/navigation bar when gestures are disabled
|
||||||
|
|||||||
Submodule app/src/main/jni/moonlight-core/moonlight-common-c updated: 438b4f87d3...f988a154a3.
+1
-1
@@ -5,7 +5,7 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
classpath 'com.android.tools.build:gradle:3.5.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
Spiele vom deinem PC auf Android spielen (nur NVIDIA)
|
Spiele von deinem PC auf Android spielen (nur NVIDIA)
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Fixed various UI bugs on foldable Android devices
|
||||||
|
- Fixed connecting to a PC with multiple network connections
|
||||||
|
- Fixed overscan padding on Android TV 10
|
||||||
|
- Fixed gamepad back buttons not working on the ASUS Tinker Board
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Fixed DualShock 4 mapping on devices running 4.14+ kernels
|
||||||
|
- Improved support for wired Xbox 360/One controllers
|
||||||
|
- Fixed crash using certain controllers without analog triggers
|
||||||
|
- Enabled streaming on Android-x86
|
||||||
Reference in new issue
Block a user