Added settings options for allowed network types
This allows the user to select other network connection types, besides WiFi, for downloading media files.
This commit is contained in:
parent
e9cfd1339f
commit
879f941151
|
@ -15,12 +15,24 @@
|
||||||
*/
|
*/
|
||||||
package org.xbmc.kore;
|
package org.xbmc.kore;
|
||||||
|
|
||||||
|
import android.app.DownloadManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
|
|
||||||
|
import org.xbmc.kore.utils.LogUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that contains various constants and the keys for settings stored in shared preferences
|
* Class that contains various constants and the keys for settings stored in shared preferences
|
||||||
*/
|
*/
|
||||||
public class Settings {
|
public class Settings {
|
||||||
|
private static final String TAG = LogUtils.makeLogTag(Settings.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The update interval for the records in the DB. If the last update is older than this value
|
* The update interval for the records in the DB. If the last update is older than this value
|
||||||
* a refresh will be triggered. Applicable to TV Shows and Movies.
|
* a refresh will be triggered. Applicable to TV Shows and Movies.
|
||||||
|
@ -106,4 +118,31 @@ public class Settings {
|
||||||
public static String getNavDrawerItemsPrefKey(int hostId) {
|
public static String getNavDrawerItemsPrefKey(int hostId) {
|
||||||
return Settings.KEY_PREF_NAV_DRAWER_ITEMS + hostId;
|
return Settings.KEY_PREF_NAV_DRAWER_ITEMS + hostId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String KEY_PREF_DOWNLOAD_TYPES = "pref_download_conn_types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the bit flags used by {@link DownloadManager.Request} to correspond to the enabled network connections
|
||||||
|
* from the settings screen.
|
||||||
|
* @return {@link DownloadManager.Request} network types bit flags that are enabled or 0 if none are enabled
|
||||||
|
*/
|
||||||
|
public static int allowedDownloadNetworkTypes(Context context) {
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
Set<String> connPrefs = sharedPref.getStringSet(Settings.KEY_PREF_DOWNLOAD_TYPES,
|
||||||
|
new HashSet<>(Arrays.asList(new String[]{"0"})));
|
||||||
|
int result = 0; // default none
|
||||||
|
for(String pref : connPrefs) {
|
||||||
|
switch( Integer.parseInt(pref) ) {
|
||||||
|
case 0:
|
||||||
|
result |= DownloadManager.Request.NETWORK_WIFI;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
result |= DownloadManager.Request.NETWORK_MOBILE;
|
||||||
|
break;
|
||||||
|
case 2: // currently -1 means all network types in DownloadManager
|
||||||
|
result |= ~0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.xbmc.kore.R;
|
import org.xbmc.kore.R;
|
||||||
|
import org.xbmc.kore.Settings;
|
||||||
import org.xbmc.kore.host.HostInfo;
|
import org.xbmc.kore.host.HostInfo;
|
||||||
import org.xbmc.kore.host.HostManager;
|
import org.xbmc.kore.host.HostManager;
|
||||||
import org.xbmc.kore.jsonrpc.ApiException;
|
import org.xbmc.kore.jsonrpc.ApiException;
|
||||||
|
@ -40,6 +41,8 @@ import org.xbmc.kore.service.SyncUtils;
|
||||||
import org.xbmc.kore.utils.LogUtils;
|
import org.xbmc.kore.utils.LogUtils;
|
||||||
import org.xbmc.kore.utils.UIUtils;
|
import org.xbmc.kore.utils.UIUtils;
|
||||||
|
|
||||||
|
import butterknife.OnClick;
|
||||||
|
import butterknife.Optional;
|
||||||
import de.greenrobot.event.EventBus;
|
import de.greenrobot.event.EventBus;
|
||||||
|
|
||||||
abstract public class AbstractDetailsFragment extends Fragment
|
abstract public class AbstractDetailsFragment extends Fragment
|
||||||
|
@ -89,6 +92,12 @@ abstract public class AbstractDetailsFragment extends Fragment
|
||||||
*/
|
*/
|
||||||
abstract protected SwipeRefreshLayout getSwipeRefreshLayout();
|
abstract protected SwipeRefreshLayout getSwipeRefreshLayout();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the view created in {@link #createView(LayoutInflater, ViewGroup)} contains a button
|
||||||
|
* with resource identifier R.id.download this will be called to initiate the download
|
||||||
|
*/
|
||||||
|
abstract protected void onDownload();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -162,6 +171,16 @@ abstract public class AbstractDetailsFragment extends Fragment
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Optional
|
||||||
|
@OnClick(R.id.download)
|
||||||
|
public void onDownloadClicked(View v) {
|
||||||
|
if (Settings.allowedDownloadNetworkTypes(getActivity()) != 0) {
|
||||||
|
onDownload();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), R.string.no_connection_type_selected, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void startSync(boolean silentRefresh) {
|
protected void startSync(boolean silentRefresh) {
|
||||||
this.silentRefresh = silentRefresh;
|
this.silentRefresh = silentRefresh;
|
||||||
LogUtils.LOGD(TAG, "Starting syc. Silent? " + silentRefresh);
|
LogUtils.LOGD(TAG, "Starting syc. Silent? " + silentRefresh);
|
||||||
|
|
|
@ -27,10 +27,10 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.BaseColumns;
|
import android.provider.BaseColumns;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.CursorLoader;
|
import android.support.v4.content.CursorLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -55,6 +55,7 @@ import org.xbmc.kore.host.HostInfo;
|
||||||
import org.xbmc.kore.host.HostManager;
|
import org.xbmc.kore.host.HostManager;
|
||||||
import org.xbmc.kore.jsonrpc.ApiCallback;
|
import org.xbmc.kore.jsonrpc.ApiCallback;
|
||||||
import org.xbmc.kore.jsonrpc.ApiMethod;
|
import org.xbmc.kore.jsonrpc.ApiMethod;
|
||||||
|
import org.xbmc.kore.jsonrpc.event.MediaSyncEvent;
|
||||||
import org.xbmc.kore.jsonrpc.method.Player;
|
import org.xbmc.kore.jsonrpc.method.Player;
|
||||||
import org.xbmc.kore.jsonrpc.method.Playlist;
|
import org.xbmc.kore.jsonrpc.method.Playlist;
|
||||||
import org.xbmc.kore.jsonrpc.type.PlaylistType;
|
import org.xbmc.kore.jsonrpc.type.PlaylistType;
|
||||||
|
@ -75,7 +76,7 @@ import butterknife.OnClick;
|
||||||
/**
|
/**
|
||||||
* Presents movie details
|
* Presents movie details
|
||||||
*/
|
*/
|
||||||
public class AlbumDetailsFragment extends Fragment
|
public class AlbumDetailsFragment extends AbstractDetailsFragment
|
||||||
implements LoaderManager.LoaderCallbacks<Cursor> {
|
implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
private static final String TAG = LogUtils.makeLogTag(AlbumDetailsFragment.class);
|
private static final String TAG = LogUtils.makeLogTag(AlbumDetailsFragment.class);
|
||||||
|
|
||||||
|
@ -155,14 +156,9 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@TargetApi(21)
|
@TargetApi(21)
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
@Override
|
||||||
|
protected View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
albumId = getArguments().getInt(BUNDLE_KEY_ALBUMID, -1);
|
albumId = getArguments().getInt(BUNDLE_KEY_ALBUMID, -1);
|
||||||
|
|
||||||
if ((container == null) || (albumId == -1)) {
|
if ((container == null) || (albumId == -1)) {
|
||||||
|
@ -209,6 +205,31 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSyncType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSyncID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getSyncItemID() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SwipeRefreshLayout getSwipeRefreshLayout() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated (Bundle savedInstanceState) {
|
public void onActivityCreated (Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
@ -242,11 +263,11 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
case LOADER_ALBUM:
|
case LOADER_ALBUM:
|
||||||
uri = MediaContract.Albums.buildAlbumUri(hostInfo.getId(), albumId);
|
uri = MediaContract.Albums.buildAlbumUri(hostInfo.getId(), albumId);
|
||||||
return new CursorLoader(getActivity(), uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
AlbumDetailsQuery.PROJECTION, null, null, null);
|
AlbumDetailsQuery.PROJECTION, null, null, null);
|
||||||
case LOADER_SONGS:
|
case LOADER_SONGS:
|
||||||
uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId(), albumId);
|
uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId(), albumId);
|
||||||
return new CursorLoader(getActivity(), uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
AlbumSongsListQuery.PROJECTION, null, null, AlbumSongsListQuery.SORT);
|
AlbumSongsListQuery.PROJECTION, null, null, AlbumSongsListQuery.SORT);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +313,7 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
boolean switchToRemote = PreferenceManager
|
boolean switchToRemote = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getActivity())
|
.getDefaultSharedPreferences(getActivity())
|
||||||
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
||||||
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
||||||
if (switchToRemote) {
|
if (switchToRemote) {
|
||||||
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
||||||
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
||||||
|
@ -305,7 +326,7 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -315,10 +336,10 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
addToPlaylist(TYPE_ALBUM, albumId);
|
addToPlaylist(TYPE_ALBUM, albumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.download)
|
@Override
|
||||||
public void onDownloadClicked(View v) {
|
protected void onDownload() {
|
||||||
if ((albumTitle == null) || (albumDisplayArtist == null) ||
|
if ((albumTitle == null) || (albumDisplayArtist == null) ||
|
||||||
(songInfoList == null) || (songInfoList.size() == 0)) {
|
(songInfoList == null) || (songInfoList.size() == 0)) {
|
||||||
// Nothing to download
|
// Nothing to download
|
||||||
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
|
@ -335,45 +356,50 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.download_dir_exists)
|
.setMessage(R.string.download_dir_exists)
|
||||||
.setPositiveButton(R.string.overwrite,
|
.setPositiveButton(R.string.overwrite,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
||||||
songInfoList, FileDownloadHelper.OVERWRITE_FILES,
|
songInfoList, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(R.string.download_with_new_name,
|
.setNeutralButton(R.string.download_with_new_name,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
||||||
songInfoList, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
songInfoList, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.confirm_album_download)
|
.setMessage(R.string.confirm_album_download)
|
||||||
.setPositiveButton(android.R.string.ok,
|
.setPositiveButton(android.R.string.ok,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
||||||
songInfoList, FileDownloadHelper.OVERWRITE_FILES,
|
songInfoList, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSyncProcessEnded(MediaSyncEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isDescriptionExpanded = false;
|
private boolean isDescriptionExpanded = false;
|
||||||
/**
|
/**
|
||||||
* Display the album details
|
* Display the album details
|
||||||
|
@ -412,9 +438,9 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
R.attr.iconCollapse
|
R.attr.iconCollapse
|
||||||
});
|
});
|
||||||
final int iconCollapseResId = styledAttributes.getResourceId(0,
|
final int iconCollapseResId = styledAttributes.getResourceId(0,
|
||||||
R.drawable.ic_expand_less_white_24dp);
|
R.drawable.ic_expand_less_white_24dp);
|
||||||
final int iconExpandResId = styledAttributes.getResourceId(1,
|
final int iconExpandResId = styledAttributes.getResourceId(1,
|
||||||
R.drawable.ic_expand_more_white_24dp);
|
R.drawable.ic_expand_more_white_24dp);
|
||||||
styledAttributes.recycle();
|
styledAttributes.recycle();
|
||||||
|
|
||||||
mediaDescriptionContainer.setOnClickListener(new View.OnClickListener() {
|
mediaDescriptionContainer.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -460,10 +486,10 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
|
|
||||||
private void setMediaYear(String genres, int year) {
|
private void setMediaYear(String genres, int year) {
|
||||||
String label = (year > 0) ?
|
String label = (year > 0) ?
|
||||||
(!TextUtils.isEmpty(genres) ?
|
(!TextUtils.isEmpty(genres) ?
|
||||||
genres + " | " + String.valueOf(year) :
|
genres + " | " + String.valueOf(year) :
|
||||||
String.valueOf(year)) :
|
String.valueOf(year)) :
|
||||||
genres;
|
genres;
|
||||||
mediaYear.setText(label);
|
mediaYear.setText(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +541,7 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -523,12 +549,12 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +563,7 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -573,35 +599,35 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.download_file_exists)
|
.setMessage(R.string.download_file_exists)
|
||||||
.setPositiveButton(R.string.overwrite,
|
.setPositiveButton(R.string.overwrite,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
||||||
songInfo, FileDownloadHelper.OVERWRITE_FILES,
|
songInfo, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(R.string.download_with_new_name,
|
.setNeutralButton(R.string.download_with_new_name,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
||||||
songInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
songInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel,
|
.setNegativeButton(android.R.string.cancel,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) { }
|
public void onClick(DialogInterface dialog, int which) { }
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
FileDownloadHelper.downloadFiles(getActivity(), hostInfo,
|
||||||
songInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
songInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +648,7 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
songInfoList = new ArrayList<FileDownloadHelper.SongInfo>(cursor.getCount());
|
songInfoList = new ArrayList<FileDownloadHelper.SongInfo>(cursor.getCount());
|
||||||
do {
|
do {
|
||||||
View songView = LayoutInflater.from(getActivity())
|
View songView = LayoutInflater.from(getActivity())
|
||||||
.inflate(R.layout.list_item_song, songListView, false);
|
.inflate(R.layout.list_item_song, songListView, false);
|
||||||
TextView songTitle = (TextView)songView.findViewById(R.id.song_title);
|
TextView songTitle = (TextView)songView.findViewById(R.id.song_title);
|
||||||
TextView trackNumber = (TextView)songView.findViewById(R.id.track_number);
|
TextView trackNumber = (TextView)songView.findViewById(R.id.track_number);
|
||||||
TextView duration = (TextView)songView.findViewById(R.id.duration);
|
TextView duration = (TextView)songView.findViewById(R.id.duration);
|
||||||
|
@ -660,7 +686,7 @@ public class AlbumDetailsFragment extends Fragment
|
||||||
R.attr.colorAccent});
|
R.attr.colorAccent});
|
||||||
downloadButton.setColorFilter(
|
downloadButton.setColorFilter(
|
||||||
styledAttributes.getColor(0,
|
styledAttributes.getColor(0,
|
||||||
getActivity().getResources().getColor(R.color.accent_default)));
|
getActivity().getResources().getColor(R.color.accent_default)));
|
||||||
styledAttributes.recycle();
|
styledAttributes.recycle();
|
||||||
} else {
|
} else {
|
||||||
downloadButton.clearColorFilter();
|
downloadButton.clearColorFilter();
|
||||||
|
|
|
@ -271,11 +271,11 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
case LOADER_MOVIE:
|
case LOADER_MOVIE:
|
||||||
uri = MediaContract.Movies.buildMovieUri(getHostInfo().getId(), movieId);
|
uri = MediaContract.Movies.buildMovieUri(getHostInfo().getId(), movieId);
|
||||||
return new CursorLoader(getActivity(), uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
MovieDetailsQuery.PROJECTION, null, null, null);
|
MovieDetailsQuery.PROJECTION, null, null, null);
|
||||||
case LOADER_CAST:
|
case LOADER_CAST:
|
||||||
uri = MediaContract.MovieCast.buildMovieCastListUri(getHostInfo().getId(), movieId);
|
uri = MediaContract.MovieCast.buildMovieCastListUri(getHostInfo().getId(), movieId);
|
||||||
return new CursorLoader(getActivity(), uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
MovieCastListQuery.PROJECTION, null, null, MovieCastListQuery.SORT);
|
MovieCastListQuery.PROJECTION, null, null, MovieCastListQuery.SORT);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
boolean switchToRemote = PreferenceManager
|
boolean switchToRemote = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getActivity())
|
.getDefaultSharedPreferences(getActivity())
|
||||||
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
||||||
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
||||||
if (switchToRemote) {
|
if (switchToRemote) {
|
||||||
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
||||||
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
||||||
|
@ -332,7 +332,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -372,12 +372,12 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -425,8 +425,8 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
setupSeenButton(newPlaycount);
|
setupSeenButton(newPlaycount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.download)
|
@Override
|
||||||
public void onDownloadClicked(View v) {
|
protected void onDownload() {
|
||||||
if (movieDownloadInfo == null) {
|
if (movieDownloadInfo == null) {
|
||||||
// Nothing to download
|
// Nothing to download
|
||||||
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -444,43 +444,43 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.download_file_exists)
|
.setMessage(R.string.download_file_exists)
|
||||||
.setPositiveButton(R.string.overwrite,
|
.setPositiveButton(R.string.overwrite,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
movieDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
movieDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(R.string.download_with_new_name,
|
.setNeutralButton(R.string.download_with_new_name,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
movieDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
movieDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else {
|
||||||
// Confirm that the user really wants to download the file
|
// Confirm that the user really wants to download the file
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.confirm_movie_download)
|
.setMessage(R.string.confirm_movie_download)
|
||||||
.setPositiveButton(android.R.string.ok,
|
.setPositiveButton(android.R.string.ok,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
movieDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
movieDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
setMediaRating(rating);
|
setMediaRating(rating);
|
||||||
String votes = cursor.getString(MovieDetailsQuery.VOTES);
|
String votes = cursor.getString(MovieDetailsQuery.VOTES);
|
||||||
mediaRatingVotes.setText((TextUtils.isEmpty(votes)) ?
|
mediaRatingVotes.setText((TextUtils.isEmpty(votes)) ?
|
||||||
"" : String.format(getString(R.string.votes), votes));
|
"" : String.format(getString(R.string.votes), votes));
|
||||||
} else {
|
} else {
|
||||||
mediaRating.setVisibility(View.INVISIBLE);
|
mediaRating.setVisibility(View.INVISIBLE);
|
||||||
mediaMaxRating.setVisibility(View.INVISIBLE);
|
mediaMaxRating.setVisibility(View.INVISIBLE);
|
||||||
|
@ -531,12 +531,12 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
int posterWidth = resources.getDimensionPixelOffset(R.dimen.now_playing_poster_width);
|
int posterWidth = resources.getDimensionPixelOffset(R.dimen.now_playing_poster_width);
|
||||||
int posterHeight = resources.getDimensionPixelOffset(R.dimen.now_playing_poster_height);
|
int posterHeight = resources.getDimensionPixelOffset(R.dimen.now_playing_poster_height);
|
||||||
UIUtils.loadImageWithCharacterAvatar(getActivity(), getHostManager(),
|
UIUtils.loadImageWithCharacterAvatar(getActivity(), getHostManager(),
|
||||||
cursor.getString(MovieDetailsQuery.THUMBNAIL), movieTitle,
|
cursor.getString(MovieDetailsQuery.THUMBNAIL), movieTitle,
|
||||||
mediaPoster, posterWidth, posterHeight);
|
mediaPoster, posterWidth, posterHeight);
|
||||||
int artHeight = resources.getDimensionPixelOffset(R.dimen.now_playing_art_height);
|
int artHeight = resources.getDimensionPixelOffset(R.dimen.now_playing_art_height);
|
||||||
UIUtils.loadImageIntoImageview(getHostManager(),
|
UIUtils.loadImageIntoImageview(getHostManager(),
|
||||||
cursor.getString(MovieDetailsQuery.FANART),
|
cursor.getString(MovieDetailsQuery.FANART),
|
||||||
mediaArt, displayMetrics.widthPixels, artHeight);
|
mediaArt, displayMetrics.widthPixels, artHeight);
|
||||||
|
|
||||||
// Setup movie download info
|
// Setup movie download info
|
||||||
movieDownloadInfo = new FileDownloadHelper.MovieInfo(
|
movieDownloadInfo = new FileDownloadHelper.MovieInfo(
|
||||||
|
@ -549,7 +549,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
R.attr.colorAccent});
|
R.attr.colorAccent});
|
||||||
downloadButton.setColorFilter(
|
downloadButton.setColorFilter(
|
||||||
styledAttributes.getColor(0,
|
styledAttributes.getColor(0,
|
||||||
getActivity().getResources().getColor(R.color.accent_default)));
|
getActivity().getResources().getColor(R.color.accent_default)));
|
||||||
styledAttributes.recycle();
|
styledAttributes.recycle();
|
||||||
} else {
|
} else {
|
||||||
downloadButton.clearColorFilter();
|
downloadButton.clearColorFilter();
|
||||||
|
@ -563,9 +563,9 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
|
|
||||||
private void setMediaYear(int runtime, int year) {
|
private void setMediaYear(int runtime, int year) {
|
||||||
String durationYear = runtime > 0 ?
|
String durationYear = runtime > 0 ?
|
||||||
String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) +
|
String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) +
|
||||||
" | " + year :
|
" | " + year :
|
||||||
String.valueOf(year);
|
String.valueOf(year);
|
||||||
mediaYear.setText(durationYear);
|
mediaYear.setText(durationYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
TypedArray styledAttributes = theme.obtainStyledAttributes(new int[] {
|
TypedArray styledAttributes = theme.obtainStyledAttributes(new int[] {
|
||||||
R.attr.colorAccent});
|
R.attr.colorAccent});
|
||||||
seenButton.setColorFilter(styledAttributes.getColor(0,
|
seenButton.setColorFilter(styledAttributes.getColor(0,
|
||||||
getActivity().getResources().getColor(R.color.accent_default)));
|
getActivity().getResources().getColor(R.color.accent_default)));
|
||||||
styledAttributes.recycle();
|
styledAttributes.recycle();
|
||||||
} else {
|
} else {
|
||||||
seenButton.clearColorFilter();
|
seenButton.clearColorFilter();
|
||||||
|
@ -597,13 +597,13 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
castArrayList = new ArrayList<VideoType.Cast>(cursor.getCount());
|
castArrayList = new ArrayList<VideoType.Cast>(cursor.getCount());
|
||||||
do {
|
do {
|
||||||
castArrayList.add(new VideoType.Cast(cursor.getString(MovieCastListQuery.NAME),
|
castArrayList.add(new VideoType.Cast(cursor.getString(MovieCastListQuery.NAME),
|
||||||
cursor.getInt(MovieCastListQuery.ORDER),
|
cursor.getInt(MovieCastListQuery.ORDER),
|
||||||
cursor.getString(MovieCastListQuery.ROLE),
|
cursor.getString(MovieCastListQuery.ROLE),
|
||||||
cursor.getString(MovieCastListQuery.THUMBNAIL)));
|
cursor.getString(MovieCastListQuery.THUMBNAIL)));
|
||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
|
|
||||||
UIUtils.setupCastInfo(getActivity(), castArrayList, videoCastList,
|
UIUtils.setupCastInfo(getActivity(), castArrayList, videoCastList,
|
||||||
AllCastActivity.buildLaunchIntent(getActivity(), movieTitle, castArrayList));
|
AllCastActivity.buildLaunchIntent(getActivity(), movieTitle, castArrayList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.melnykov.fab.FloatingActionButton;
|
import com.melnykov.fab.FloatingActionButton;
|
||||||
import com.melnykov.fab.ObservableScrollView;
|
import com.melnykov.fab.ObservableScrollView;
|
||||||
|
|
||||||
import org.xbmc.kore.R;
|
import org.xbmc.kore.R;
|
||||||
import org.xbmc.kore.Settings;
|
import org.xbmc.kore.Settings;
|
||||||
import org.xbmc.kore.jsonrpc.ApiCallback;
|
import org.xbmc.kore.jsonrpc.ApiCallback;
|
||||||
|
@ -246,7 +247,7 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
case LOADER_MUSIC_VIDEO:
|
case LOADER_MUSIC_VIDEO:
|
||||||
uri = MediaContract.MusicVideos.buildMusicVideoUri(getHostInfo().getId(), musicVideoId);
|
uri = MediaContract.MusicVideos.buildMusicVideoUri(getHostInfo().getId(), musicVideoId);
|
||||||
return new CursorLoader(getActivity(), uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
MusicVideoDetailsQuery.PROJECTION, null, null, null);
|
MusicVideoDetailsQuery.PROJECTION, null, null, null);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +287,7 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
boolean switchToRemote = PreferenceManager
|
boolean switchToRemote = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getActivity())
|
.getDefaultSharedPreferences(getActivity())
|
||||||
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
||||||
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
||||||
if (switchToRemote) {
|
if (switchToRemote) {
|
||||||
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
||||||
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
||||||
|
@ -299,7 +300,7 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -331,7 +332,7 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -339,12 +340,12 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,13 +354,13 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.download)
|
@Override
|
||||||
public void onDownloadClicked(View v) {
|
protected void onDownload() {
|
||||||
if (musicVideoDownloadInfo == null) {
|
if (musicVideoDownloadInfo == null) {
|
||||||
// Nothing to download
|
// Nothing to download
|
||||||
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -371,37 +372,37 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.download_file_exists)
|
.setMessage(R.string.download_file_exists)
|
||||||
.setPositiveButton(R.string.overwrite,
|
.setPositiveButton(R.string.overwrite,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
musicVideoDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
musicVideoDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(R.string.download_with_new_name,
|
.setNeutralButton(R.string.download_with_new_name,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
musicVideoDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
musicVideoDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel,
|
.setNegativeButton(android.R.string.cancel,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
musicVideoDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
musicVideoDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,11 +437,11 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
int posterWidth = resources.getDimensionPixelOffset(R.dimen.musicvideodetail_poster_width);
|
int posterWidth = resources.getDimensionPixelOffset(R.dimen.musicvideodetail_poster_width);
|
||||||
int posterHeight = resources.getDimensionPixelOffset(R.dimen.musicvideodetail_poster_width);
|
int posterHeight = resources.getDimensionPixelOffset(R.dimen.musicvideodetail_poster_width);
|
||||||
UIUtils.loadImageWithCharacterAvatar(getActivity(), getHostManager(),
|
UIUtils.loadImageWithCharacterAvatar(getActivity(), getHostManager(),
|
||||||
poster, musicVideoTitle,
|
poster, musicVideoTitle,
|
||||||
mediaPoster, posterWidth, posterHeight);
|
mediaPoster, posterWidth, posterHeight);
|
||||||
UIUtils.loadImageIntoImageview(getHostManager(),
|
UIUtils.loadImageIntoImageview(getHostManager(),
|
||||||
TextUtils.isEmpty(fanart)? poster : fanart,
|
TextUtils.isEmpty(fanart)? poster : fanart,
|
||||||
mediaArt, artWidth, artHeight);
|
mediaArt, artWidth, artHeight);
|
||||||
|
|
||||||
// Setup download info
|
// Setup download info
|
||||||
musicVideoDownloadInfo = new FileDownloadHelper.MusicVideoInfo(
|
musicVideoDownloadInfo = new FileDownloadHelper.MusicVideoInfo(
|
||||||
|
@ -453,7 +454,7 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
R.attr.colorAccent});
|
R.attr.colorAccent});
|
||||||
downloadButton.setColorFilter(
|
downloadButton.setColorFilter(
|
||||||
styledAttributes.getColor(0,
|
styledAttributes.getColor(0,
|
||||||
getActivity().getResources().getColor(R.color.accent_default)));
|
getActivity().getResources().getColor(R.color.accent_default)));
|
||||||
styledAttributes.recycle();
|
styledAttributes.recycle();
|
||||||
} else {
|
} else {
|
||||||
downloadButton.clearColorFilter();
|
downloadButton.clearColorFilter();
|
||||||
|
@ -466,9 +467,9 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
|
|
||||||
private void setMediaYear(int runtime, int year) {
|
private void setMediaYear(int runtime, int year) {
|
||||||
String durationYear = runtime > 0 ?
|
String durationYear = runtime > 0 ?
|
||||||
UIUtils.formatTime(runtime) + " | " +
|
UIUtils.formatTime(runtime) + " | " +
|
||||||
String.valueOf(year) :
|
String.valueOf(year) :
|
||||||
String.valueOf(year);
|
String.valueOf(year);
|
||||||
mediaYear.setText(durationYear);
|
mediaYear.setText(durationYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.melnykov.fab.FloatingActionButton;
|
import com.melnykov.fab.FloatingActionButton;
|
||||||
import com.melnykov.fab.ObservableScrollView;
|
import com.melnykov.fab.ObservableScrollView;
|
||||||
|
|
||||||
import org.xbmc.kore.R;
|
import org.xbmc.kore.R;
|
||||||
import org.xbmc.kore.Settings;
|
import org.xbmc.kore.Settings;
|
||||||
import org.xbmc.kore.jsonrpc.ApiCallback;
|
import org.xbmc.kore.jsonrpc.ApiCallback;
|
||||||
|
@ -222,7 +223,7 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
case LOADER_EPISODE:
|
case LOADER_EPISODE:
|
||||||
uri = MediaContract.Episodes.buildTVShowEpisodeUri(getHostInfo().getId(), tvshowId, episodeId);
|
uri = MediaContract.Episodes.buildTVShowEpisodeUri(getHostInfo().getId(), tvshowId, episodeId);
|
||||||
return new CursorLoader(getActivity(), uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
EpisodeDetailsQuery.PROJECTION, null, null, null);
|
EpisodeDetailsQuery.PROJECTION, null, null, null);
|
||||||
// case LOADER_CAST:
|
// case LOADER_CAST:
|
||||||
// uri = MediaContract.MovieCast.buildMovieCastListUri(hostInfo.getId(), episodeId);
|
// uri = MediaContract.MovieCast.buildMovieCastListUri(hostInfo.getId(), episodeId);
|
||||||
// return new CursorLoader(getActivity(), uri,
|
// return new CursorLoader(getActivity(), uri,
|
||||||
|
@ -269,7 +270,7 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
boolean switchToRemote = PreferenceManager
|
boolean switchToRemote = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getActivity())
|
.getDefaultSharedPreferences(getActivity())
|
||||||
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
.getBoolean(Settings.KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START,
|
||||||
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
Settings.DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START);
|
||||||
if (switchToRemote) {
|
if (switchToRemote) {
|
||||||
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
int cx = (fabButton.getLeft() + fabButton.getRight()) / 2;
|
||||||
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
int cy = (fabButton.getTop() + fabButton.getBottom()) / 2;
|
||||||
|
@ -282,7 +283,7 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -314,7 +315,7 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.item_added_to_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -322,12 +323,12 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.no_suitable_playlist, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +337,7 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Got an error, show toast
|
// Got an error, show toast
|
||||||
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.unable_to_connect_to_xbmc, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
@ -366,8 +367,8 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
setupSeenButton(newPlaycount);
|
setupSeenButton(newPlaycount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.download)
|
@Override
|
||||||
public void onDownloadClicked(View v) {
|
protected void onDownload() {
|
||||||
if (tvshowDownloadInfo == null) {
|
if (tvshowDownloadInfo == null) {
|
||||||
// Nothing to download
|
// Nothing to download
|
||||||
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.no_files_to_download, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -385,43 +386,43 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.download_file_exists)
|
.setMessage(R.string.download_file_exists)
|
||||||
.setPositiveButton(R.string.overwrite,
|
.setPositiveButton(R.string.overwrite,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
tvshowDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
tvshowDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(R.string.download_with_new_name,
|
.setNeutralButton(R.string.download_with_new_name,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
tvshowDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
tvshowDownloadInfo, FileDownloadHelper.DOWNLOAD_WITH_NEW_NAME,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else {
|
||||||
// Confirm that the user really wants to download the file
|
// Confirm that the user really wants to download the file
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(R.string.download)
|
builder.setTitle(R.string.download)
|
||||||
.setMessage(R.string.confirm_episode_download)
|
.setMessage(R.string.confirm_episode_download)
|
||||||
.setPositiveButton(android.R.string.ok,
|
.setPositiveButton(android.R.string.ok,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),
|
||||||
tvshowDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
tvshowDownloadInfo, FileDownloadHelper.OVERWRITE_FILES,
|
||||||
callbackHandler);
|
callbackHandler);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
.setNegativeButton(android.R.string.cancel, noopClickListener)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,13 +438,13 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
|
|
||||||
int runtime = cursor.getInt(EpisodeDetailsQuery.RUNTIME) / 60;
|
int runtime = cursor.getInt(EpisodeDetailsQuery.RUNTIME) / 60;
|
||||||
String durationPremiered = runtime > 0 ?
|
String durationPremiered = runtime > 0 ?
|
||||||
String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) +
|
String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) +
|
||||||
" | " + cursor.getString(EpisodeDetailsQuery.FIRSTAIRED) :
|
" | " + cursor.getString(EpisodeDetailsQuery.FIRSTAIRED) :
|
||||||
cursor.getString(EpisodeDetailsQuery.FIRSTAIRED);
|
cursor.getString(EpisodeDetailsQuery.FIRSTAIRED);
|
||||||
mediaPremiered.setText(durationPremiered);
|
mediaPremiered.setText(durationPremiered);
|
||||||
String season = String.format(getString(R.string.season_episode),
|
String season = String.format(getString(R.string.season_episode),
|
||||||
cursor.getInt(EpisodeDetailsQuery.SEASON),
|
cursor.getInt(EpisodeDetailsQuery.SEASON),
|
||||||
cursor.getInt(EpisodeDetailsQuery.EPISODE));
|
cursor.getInt(EpisodeDetailsQuery.EPISODE));
|
||||||
mediaSeason.setText(season);
|
mediaSeason.setText(season);
|
||||||
|
|
||||||
double rating = cursor.getDouble(EpisodeDetailsQuery.RATING);
|
double rating = cursor.getDouble(EpisodeDetailsQuery.RATING);
|
||||||
|
@ -474,8 +475,8 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
// mediaPoster, posterWidth, posterHeight);
|
// mediaPoster, posterWidth, posterHeight);
|
||||||
int artHeight = resources.getDimensionPixelOffset(R.dimen.now_playing_art_height);
|
int artHeight = resources.getDimensionPixelOffset(R.dimen.now_playing_art_height);
|
||||||
UIUtils.loadImageIntoImageview(getHostManager(),
|
UIUtils.loadImageIntoImageview(getHostManager(),
|
||||||
cursor.getString(EpisodeDetailsQuery.THUMBNAIL),
|
cursor.getString(EpisodeDetailsQuery.THUMBNAIL),
|
||||||
mediaArt, displayMetrics.widthPixels, artHeight);
|
mediaArt, displayMetrics.widthPixels, artHeight);
|
||||||
|
|
||||||
// Setup movie download info
|
// Setup movie download info
|
||||||
tvshowDownloadInfo = new FileDownloadHelper.TVShowInfo(
|
tvshowDownloadInfo = new FileDownloadHelper.TVShowInfo(
|
||||||
|
|
|
@ -133,6 +133,11 @@ public class TVShowEpisodeListFragment extends AbstractDetailsFragment
|
||||||
return swipeRefreshLayout;
|
return swipeRefreshLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDownload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated (Bundle savedInstanceState) {
|
public void onActivityCreated (Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
|
@ -173,6 +173,11 @@ public class TVShowOverviewFragment extends AbstractDetailsFragment
|
||||||
return swipeRefreshLayout;
|
return swipeRefreshLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDownload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated (Bundle savedInstanceState) {
|
public void onActivityCreated (Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.util.Base64;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.xbmc.kore.R;
|
import org.xbmc.kore.R;
|
||||||
|
import org.xbmc.kore.Settings;
|
||||||
import org.xbmc.kore.host.HostInfo;
|
import org.xbmc.kore.host.HostInfo;
|
||||||
import org.xbmc.kore.jsonrpc.ApiCallback;
|
import org.xbmc.kore.jsonrpc.ApiCallback;
|
||||||
import org.xbmc.kore.jsonrpc.HostConnection;
|
import org.xbmc.kore.jsonrpc.HostConnection;
|
||||||
|
@ -375,7 +376,7 @@ public class FileDownloadHelper {
|
||||||
request.addRequestHeader("Authorization", "Basic " + token);
|
request.addRequestHeader("Authorization", "Basic " + token);
|
||||||
}
|
}
|
||||||
request.allowScanningByMediaScanner();
|
request.allowScanningByMediaScanner();
|
||||||
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
|
request.setAllowedNetworkTypes(Settings.allowedDownloadNetworkTypes(context));
|
||||||
request.setTitle(mediaInfo.getDownloadTitle(context));
|
request.setTitle(mediaInfo.getDownloadTitle(context));
|
||||||
request.setDescription(mediaInfo.getDownloadDescrition(context));
|
request.setDescription(mediaInfo.getDownloadDescrition(context));
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,23 @@
|
||||||
<item>@string/addons</item>
|
<item>@string/addons</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Download connection types -->
|
||||||
|
<string-array name="entries_download_media_items">
|
||||||
|
<item>WiFi</item>
|
||||||
|
<item>Mobile</item>
|
||||||
|
<item>Any</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="entry_values_download_media_items">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="default_values_download_media_items">
|
||||||
|
<item>0</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<!-- CAUTION: Keep this synced with the entries ids in NavigationDrawerFragment.java -->
|
<!-- CAUTION: Keep this synced with the entries ids in NavigationDrawerFragment.java -->
|
||||||
<string-array translatable="false" name="entry_values_nav_drawer_items">
|
<string-array translatable="false" name="entry_values_nav_drawer_items">
|
||||||
<item>2</item>
|
<item>2</item>
|
||||||
|
|
|
@ -364,5 +364,6 @@
|
||||||
<string name="pvr_epg">Guide</string>
|
<string name="pvr_epg">Guide</string>
|
||||||
<string name="unable_to_move_item">Unable to move item</string>
|
<string name="unable_to_move_item">Unable to move item</string>
|
||||||
<string name="cannot_move_playing_item">Cannot move currently playing/paused item</string>
|
<string name="cannot_move_playing_item">Cannot move currently playing/paused item</string>
|
||||||
|
<string name="no_connection_type_selected">No connection type selected in settings</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -51,6 +51,14 @@
|
||||||
android:entryValues="@array/entry_values_nav_drawer_items"
|
android:entryValues="@array/entry_values_nav_drawer_items"
|
||||||
android:defaultValue="@array/entry_values_nav_drawer_items"/>
|
android:defaultValue="@array/entry_values_nav_drawer_items"/>
|
||||||
|
|
||||||
|
<MultiSelectListPreference
|
||||||
|
android:key="pref_download_conn_types"
|
||||||
|
android:title="Download network types"
|
||||||
|
android:summary="Allowed network types for media downloads"
|
||||||
|
android:entries="@array/entries_download_media_items"
|
||||||
|
android:entryValues="@array/entry_values_download_media_items"
|
||||||
|
android:defaultValue="@array/default_values_download_media_items"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="pref_about"
|
android:key="pref_about"
|
||||||
android:title="@string/about"/>
|
android:title="@string/about"/>
|
||||||
|
|
Loading…
Reference in New Issue