mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-05 23:46:04 +00:00
Add HDR state to app data in shortcut trampoline
This commit is contained in:
@@ -4,8 +4,10 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.limelight.AppView;
|
||||
import com.limelight.Game;
|
||||
import com.limelight.R;
|
||||
import com.limelight.ShortcutTrampoline;
|
||||
import com.limelight.binding.PlatformBinding;
|
||||
import com.limelight.computers.ComputerManagerService;
|
||||
import com.limelight.nvstream.http.ComputerDetails;
|
||||
@@ -25,6 +27,25 @@ public class ServerHelper {
|
||||
return computer.activeAddress;
|
||||
}
|
||||
|
||||
public static Intent createPcShortcutIntent(Activity parent, ComputerDetails computer) {
|
||||
Intent i = new Intent(parent, ShortcutTrampoline.class);
|
||||
i.putExtra(AppView.NAME_EXTRA, computer.name);
|
||||
i.putExtra(AppView.UUID_EXTRA, computer.uuid);
|
||||
i.setAction(Intent.ACTION_DEFAULT);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static Intent createAppShortcutIntent(Activity parent, ComputerDetails computer, NvApp app) {
|
||||
Intent i = new Intent(parent, ShortcutTrampoline.class);
|
||||
i.putExtra(AppView.NAME_EXTRA, computer.name);
|
||||
i.putExtra(AppView.UUID_EXTRA, computer.uuid);
|
||||
i.putExtra(Game.EXTRA_APP_NAME, app.getAppName());
|
||||
i.putExtra(Game.EXTRA_APP_ID, ""+app.getAppId());
|
||||
i.putExtra(Game.EXTRA_APP_HDR, app.isHdrSupported());
|
||||
i.setAction(Intent.ACTION_DEFAULT);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static Intent createStartIntent(Activity parent, NvApp app, ComputerDetails computer,
|
||||
ComputerManagerService.ComputerManagerBinder managerBinder) {
|
||||
Intent intent = new Intent(parent, Game.class);
|
||||
|
||||
@@ -97,13 +97,8 @@ public class ShortcutHelper {
|
||||
|
||||
public void createAppViewShortcut(ComputerDetails computer, boolean forceAdd, boolean newlyPaired) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
Intent i = new Intent(context, ShortcutTrampoline.class);
|
||||
i.putExtra(AppView.NAME_EXTRA, computer.name);
|
||||
i.putExtra(AppView.UUID_EXTRA, computer.uuid);
|
||||
i.setAction(Intent.ACTION_DEFAULT);
|
||||
|
||||
ShortcutInfo sinfo = new ShortcutInfo.Builder(context, computer.uuid)
|
||||
.setIntent(i)
|
||||
.setIntent(ServerHelper.createPcShortcutIntent(context, computer))
|
||||
.setShortLabel(computer.name)
|
||||
.setLongLabel(computer.name)
|
||||
.setIcon(Icon.createWithResource(context, R.mipmap.ic_pc_scut))
|
||||
@@ -149,13 +144,6 @@ public class ShortcutHelper {
|
||||
public boolean createPinnedGameShortcut(ComputerDetails computer, NvApp app, Bitmap iconBits) {
|
||||
if (sm.isRequestPinShortcutSupported()) {
|
||||
Icon appIcon;
|
||||
Intent i = new Intent(context, ShortcutTrampoline.class);
|
||||
|
||||
i.putExtra(AppView.NAME_EXTRA, computer.name);
|
||||
i.putExtra(AppView.UUID_EXTRA, computer.uuid);
|
||||
i.putExtra(ShortcutTrampoline.APP_NAME_EXTRA, app.getAppName());
|
||||
i.putExtra(ShortcutTrampoline.APP_ID_EXTRA, ""+app.getAppId());
|
||||
i.setAction(Intent.ACTION_DEFAULT);
|
||||
|
||||
if (iconBits != null) {
|
||||
appIcon = Icon.createWithAdaptiveBitmap(iconBits);
|
||||
@@ -164,7 +152,7 @@ public class ShortcutHelper {
|
||||
}
|
||||
|
||||
ShortcutInfo sInfo = new ShortcutInfo.Builder(context, getShortcutIdForGame(computer, app))
|
||||
.setIntent(i)
|
||||
.setIntent(ServerHelper.createAppShortcutIntent(context, computer, app))
|
||||
.setShortLabel(app.getAppName() + " (" + computer.name + ")")
|
||||
.setIcon(appIcon)
|
||||
.build();
|
||||
|
||||
@@ -65,15 +65,11 @@ public class TvChannelHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent i = new Intent(context, ShortcutTrampoline.class);
|
||||
i.putExtra(AppView.NAME_EXTRA, computer.name);
|
||||
i.putExtra(AppView.UUID_EXTRA, computer.uuid);
|
||||
i.setAction(Intent.ACTION_DEFAULT);
|
||||
ChannelBuilder builder = new ChannelBuilder()
|
||||
.setType(TvContract.Channels.TYPE_PREVIEW)
|
||||
.setDisplayName(computer.name)
|
||||
.setInternalProviderId(computer.uuid)
|
||||
.setAppLinkIntent(i);
|
||||
.setAppLinkIntent(ServerHelper.createPcShortcutIntent(context, computer));
|
||||
|
||||
Long channelId = getChannelId(computer.uuid);
|
||||
if (channelId != null) {
|
||||
@@ -125,28 +121,19 @@ public class TvChannelHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
PreviewProgramBuilder builder = new PreviewProgramBuilder();
|
||||
Intent i = new Intent(context, ShortcutTrampoline.class);
|
||||
|
||||
i.putExtra(AppView.NAME_EXTRA, computer.name);
|
||||
i.putExtra(AppView.UUID_EXTRA, computer.uuid);
|
||||
i.putExtra(ShortcutTrampoline.APP_NAME_EXTRA, app.getAppName());
|
||||
i.putExtra(ShortcutTrampoline.APP_ID_EXTRA, ""+app.getAppId());
|
||||
i.setAction(Intent.ACTION_DEFAULT);
|
||||
|
||||
Uri resourceURI = PosterContentProvider.createBoxArtUri(computer.uuid, ""+app.getAppId());
|
||||
|
||||
Long channelId = getChannelId(computer.uuid);
|
||||
if (channelId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
builder.setChannelId(channelId)
|
||||
PreviewProgramBuilder builder = new PreviewProgramBuilder()
|
||||
.setChannelId(channelId)
|
||||
.setType(TYPE_GAME)
|
||||
.setTitle(app.getAppName())
|
||||
.setPosterArtAspectRatio(ASPECT_RATIO_MOVIE_POSTER)
|
||||
.setPosterArtUri(resourceURI)
|
||||
.setIntent(i)
|
||||
.setPosterArtUri(PosterContentProvider.createBoxArtUri(computer.uuid, ""+app.getAppId()))
|
||||
.setIntent(ServerHelper.createAppShortcutIntent(context, computer, app))
|
||||
.setInternalProviderId(""+app.getAppId())
|
||||
// Weight should increase each time we run the game
|
||||
.setWeight((int)((System.currentTimeMillis() - 1500000000000L) / 1000));
|
||||
|
||||
Reference in New Issue
Block a user