mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-12-11 16:06:01 +00:00
added layout helpers
This commit is contained in:
parent
3e5dbc5fac
commit
1b73648db9
148
.idea/workspace.xml
generated
148
.idea/workspace.xml
generated
@ -9,6 +9,8 @@
|
||||
<list default="true" id="5b626835-6518-4586-bf6c-5bbba32974d2" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/artifacts/jar/emby.apiclient.android.jar" afterPath="$PROJECT_DIR$/out/artifacts/jar/emby.apiclient.android.jar" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/artifacts/jar/emby.apiclient.jar" afterPath="$PROJECT_DIR$/out/artifacts/jar/emby.apiclient.jar" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/model/apiclient/ServerCredentials.java" afterPath="$PROJECT_DIR$/src/mediabrowser/model/apiclient/ServerCredentials.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
</list>
|
||||
<ignored path="MediaBrowser.ApiClient.Java.iws" />
|
||||
@ -48,26 +50,6 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="StreamInfoSorter.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/dlna/StreamInfoSorter.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="391">
|
||||
<caret line="9" column="35" selection-start-line="9" selection-start-column="35" selection-end-line="9" selection-end-column="35" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="StreamInfo.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/dlna/StreamInfo.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="3823" max-vertical-offset="11968">
|
||||
<caret line="459" column="9" selection-start-line="459" selection-start-column="9" selection-end-line="459" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="StreamBuilder.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/dlna/StreamBuilder.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
@ -78,31 +60,6 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="AndroidImageFileRepository.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/sync/data/AndroidImageFileRepository.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="170" max-vertical-offset="493">
|
||||
<caret line="10" column="13" selection-start-line="10" selection-start-column="13" selection-end-line="10" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#374#375#0" expanded="false" />
|
||||
<element signature="e#412#413#0" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="LocalAssetManager.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="7311" max-vertical-offset="11764">
|
||||
<caret line="464" column="46" selection-start-line="464" selection-start-column="39" selection-end-line="464" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Api21Builder.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/profiles/Api21Builder.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
@ -123,11 +80,21 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="AndroidProfile.java" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="AndroidProfile.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/profiles/AndroidProfile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.2336664" vertical-offset="1430" max-vertical-offset="2771">
|
||||
<caret line="107" column="123" selection-start-line="107" selection-start-column="123" selection-end-line="107" selection-end-column="123" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="1430" max-vertical-offset="2771">
|
||||
<caret line="116" column="29" selection-start-line="116" selection-start-column="29" selection-end-line="116" selection-end-column="29" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="ConnectionManager.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.38355112" vertical-offset="9293" max-vertical-offset="12631">
|
||||
<caret line="602" column="64" selection-start-line="602" selection-start-column="64" selection-end-line="602" selection-end-column="64" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -151,7 +118,6 @@
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IUserActionRepository.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IUserRepository.java" />
|
||||
<option value="$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/sync/data/SyncDb.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IItemRepository.java" />
|
||||
@ -192,7 +158,6 @@
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/LocalPlayer.java" />
|
||||
<option value="$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/AndroidNetworkConnection.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/apiclient/ServerCredentials.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java" />
|
||||
<option value="$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/sync/MediaSyncAdapter.java" />
|
||||
<option value="$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/sync/data/ItemRepository.java" />
|
||||
@ -202,6 +167,8 @@
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/dlna/StreamBuilder.java" />
|
||||
<option value="$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/profiles/Api16Builder.java" />
|
||||
<option value="$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/profiles/AndroidProfile.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/dto/ItemLayout.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -815,7 +782,7 @@
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="62" y="1" width="2497" height="1438" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<editor active="false" />
|
||||
<layout>
|
||||
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
@ -870,27 +837,6 @@
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/SecondSyncDataResponse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.09021986" vertical-offset="0" max-vertical-offset="1319">
|
||||
<caret line="10" column="13" selection-start-line="10" selection-start-column="13" selection-end-line="10" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSyncProgress.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.09021986" vertical-offset="0" max-vertical-offset="1319">
|
||||
<caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/sync/LocalItem.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.7937832" vertical-offset="228" max-vertical-offset="1547">
|
||||
<caret line="111" column="5" selection-start-line="111" selection-start-column="5" selection-end-line="111" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/SyncDataInnerResponse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.21379833" vertical-offset="7" max-vertical-offset="1326">
|
||||
@ -1215,6 +1161,7 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="265" max-vertical-offset="1241">
|
||||
<caret line="49" column="24" selection-start-line="49" selection-start-column="24" selection-end-line="49" selection-end-column="24" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -1222,6 +1169,10 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="731">
|
||||
<caret line="38" column="5" selection-start-line="38" selection-start-column="5" selection-end-line="38" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#427#428#0" expanded="false" />
|
||||
<element signature="e#460#461#0" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -1229,6 +1180,7 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="901">
|
||||
<caret line="18" column="11" selection-start-line="18" selection-start-column="11" selection-end-line="18" selection-end-column="11" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -1236,6 +1188,7 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="293" max-vertical-offset="1581">
|
||||
<caret line="50" column="46" selection-start-line="50" selection-start-column="46" selection-end-line="50" selection-end-column="46" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -1243,13 +1196,9 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="1045" max-vertical-offset="2346">
|
||||
<caret line="149" column="9" selection-start-line="149" selection-start-column="9" selection-end-line="149" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="-20.48276" vertical-offset="9402" max-vertical-offset="12631">
|
||||
<caret line="614" column="26" selection-start-line="614" selection-start-column="26" selection-end-line="614" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -1323,7 +1272,7 @@
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="7311" max-vertical-offset="11764">
|
||||
<caret line="464" column="46" selection-start-line="464" selection-start-column="39" selection-end-line="464" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="imports" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@ -1388,8 +1337,43 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/android/src/mediabrowser/apiinteraction/android/profiles/AndroidProfile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.2336664" vertical-offset="1430" max-vertical-offset="2771">
|
||||
<caret line="107" column="123" selection-start-line="107" selection-start-column="123" selection-end-line="107" selection-end-column="123" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="1430" max-vertical-offset="2771">
|
||||
<caret line="116" column="29" selection-start-line="116" selection-start-column="29" selection-end-line="116" selection-end-column="29" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/AppData/Local/Android/sdk/sources/android-21/java/util/AbstractList.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.1829362" vertical-offset="0" max-vertical-offset="11815">
|
||||
<caret line="29" column="22" selection-start-line="29" selection-start-column="22" selection-end-line="29" selection-end-column="22" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/AppData/Local/Android/sdk/sources/android-21/java/util/ArrayList.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.28747118" vertical-offset="0" max-vertical-offset="10897">
|
||||
<caret line="43" column="41" selection-start-line="43" selection-start-column="41" selection-end-line="43" selection-end-column="41" />
|
||||
<folding>
|
||||
<element signature="e#3143#3144#0" expanded="true" />
|
||||
<element signature="e#3184#3185#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/dto/ItemLayout.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.30053803" vertical-offset="0" max-vertical-offset="1309">
|
||||
<caret line="23" column="29" selection-start-line="23" selection-start-column="29" selection-end-line="23" selection-end-column="29" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/ConnectionManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.38355112" vertical-offset="9293" max-vertical-offset="12631">
|
||||
<caret line="602" column="64" selection-start-line="602" selection-start-column="64" selection-end-line="602" selection-end-column="64" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
Binary file not shown.
Binary file not shown.
@ -590,7 +590,7 @@ public class ConnectionManager implements IConnectionManager {
|
||||
|
||||
for(ServerInfo newServer : foundServers){
|
||||
|
||||
ServerInfo existing = credentials.getServer(newServer.getId());
|
||||
ServerInfo existing = credentials.GetServer(newServer.getId());
|
||||
existing.setLastConnectionMode(ConnectionMode.Local);
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@ package mediabrowser.model.apiclient;
|
||||
|
||||
import mediabrowser.model.extensions.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ServerCredentials
|
||||
{
|
||||
private java.util.ArrayList<ServerInfo> Servers;
|
||||
@ -135,17 +133,13 @@ public class ServerCredentials
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ServerInfo getServer(String id){
|
||||
|
||||
ArrayList<ServerInfo> servers = Servers;
|
||||
|
||||
if (servers != null){
|
||||
for (ServerInfo server : servers)
|
||||
public final ServerInfo GetServer(String id)
|
||||
{
|
||||
for (ServerInfo server : getServers())
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(id, server.getId()))
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(id, server.getId()))
|
||||
{
|
||||
return server;
|
||||
}
|
||||
return server;
|
||||
}
|
||||
}
|
||||
|
||||
|
72
src/mediabrowser/model/dto/ItemLayout.java
Normal file
72
src/mediabrowser/model/dto/ItemLayout.java
Normal file
@ -0,0 +1,72 @@
|
||||
package mediabrowser.model.dto;
|
||||
|
||||
public final class ItemLayout
|
||||
{
|
||||
public static Double GetDisplayAspectRatio(BaseItemDto item)
|
||||
{
|
||||
java.util.ArrayList<BaseItemDto> items = new java.util.ArrayList<BaseItemDto>();
|
||||
items.add(item);
|
||||
return GetDisplayAspectRatio(items);
|
||||
}
|
||||
|
||||
public static Double GetDisplayAspectRatio(java.util.List<BaseItemDto> items)
|
||||
{
|
||||
java.util.ArrayList<Double> values = new java.util.ArrayList<Double>();
|
||||
|
||||
for (BaseItemDto item : items)
|
||||
{
|
||||
if (item.getPrimaryImageAspectRatio() != null)
|
||||
{
|
||||
values.add(item.getPrimaryImageAspectRatio());
|
||||
}
|
||||
}
|
||||
|
||||
if (values.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
java.util.Collections.sort(values);
|
||||
|
||||
double halfDouble = values.size();
|
||||
halfDouble /= 2;
|
||||
int half = (int)Math.floor(halfDouble);
|
||||
|
||||
double result;
|
||||
|
||||
if (values.size() % 2 > 0)
|
||||
{
|
||||
result = values.get(half);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (values.get(half - 1) + values.get(half)) / 2.0;
|
||||
}
|
||||
|
||||
// If really close to 2:3 (poster image), just return 2:3
|
||||
if (Math.abs(0.66666666667 - result) <= .15)
|
||||
{
|
||||
return 0.66666666667;
|
||||
}
|
||||
|
||||
// If really close to 16:9 (episode image), just return 16:9
|
||||
if (Math.abs(1.777777778 - result) <= .2)
|
||||
{
|
||||
return 1.777777778;
|
||||
}
|
||||
|
||||
// If really close to 1 (square image), just return 1
|
||||
if (Math.abs(1 - result) <= .15)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
// If really close to 4:3 (poster image), just return 2:3
|
||||
if (Math.abs(1.33333333333 - result) <= .15)
|
||||
{
|
||||
return 1.33333333333;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user