diff --git a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java
index 856e853b1..1be21537f 100644
--- a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java
+++ b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java
@@ -4,7 +4,9 @@ import android.app.DownloadManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.net.Uri;
+import android.preference.Preference;
import android.preference.PreferenceManager;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
@@ -40,6 +42,8 @@ import java.io.File;
public class ActionBarHandler {
private static final String TAG = ActionBarHandler.class.toString();
+ private static final String KORE_PACKET = "org.xbmc.kore";
+
private static ActionBarHandler handler = null;
private Context context = null;
@@ -49,6 +53,8 @@ public class ActionBarHandler {
private int selectedStream = -1;
private String videoTitle = "";
+ SharedPreferences defaultPreferences = null;
+
public static ActionBarHandler getHandler() {
if(handler == null) {
handler = new ActionBarHandler();
@@ -73,7 +79,7 @@ public class ActionBarHandler {
this.streams = streams;
selectedStream = 0;
String[] itemArray = new String[streams.length];
- String defaultResolution = PreferenceManager.getDefaultSharedPreferences(context)
+ String defaultResolution = defaultPreferences
.getString(context.getString(R.string.defaultResolutionPreference),
context.getString(R.string.defaultResolutionListItem));
int defaultResolutionPos = 0;
@@ -104,15 +110,21 @@ public class ActionBarHandler {
// CAUTION set item properties programmatically otherwise it would not be accepted by
// appcompat itemsinflater.inflate(R.menu.videoitem_detail, menu);
+ defaultPreferences = PreferenceManager.getDefaultSharedPreferences(context);
+
inflater.inflate(R.menu.videoitem_detail, menu);
MenuItem playItem = menu.findItem(R.id.menu_item_play);
MenuItem shareItem = menu.findItem(R.id.menu_item_share);
+ MenuItem castItem = menu.findItem(R.id.action_play_with_kodi);
MenuItemCompat.setShowAsAction(playItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS
| MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
MenuItemCompat.setShowAsAction(shareItem, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM
| MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
+ castItem.setVisible(defaultPreferences
+ .getBoolean(context.getString(R.string.showPlayWidthKodiPreference), false));
+
return true;
}
@@ -143,6 +155,10 @@ public class ActionBarHandler {
Intent intent = new Intent(context, SettingsActivity.class);
context.startActivity(intent);
}
+ break;
+ case R.id.action_play_with_kodi:
+ playWithKodi();
+ break;
default:
Log.e(TAG, "Menu Item not known");
}
@@ -216,8 +232,7 @@ public class ActionBarHandler {
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(streams[selectedStream].url));
request.setDestinationUri(Uri.fromFile(new File(
- PreferenceManager.getDefaultSharedPreferences(context)
- .getString("download_path_preference", "/storage/emulated/0/NewPipe")
+ defaultPreferences.getString("download_path_preference", "/storage/emulated/0/NewPipe")
+ "/" + videoTitle + suffix)));
try {
dm.enqueue(request);
@@ -236,4 +251,35 @@ public class ActionBarHandler {
context.startActivity(Intent.createChooser(intent, context.getString(R.string.chooseBrowser)));
}
}
+
+ public void playWithKodi() {
+ if(!videoTitle.isEmpty()) {
+ try {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setPackage(KORE_PACKET);
+ intent.setData(Uri.parse(webisteUrl.replace("https", "http")));
+ context.startActivity(intent);
+ } catch (Exception e) {
+ e.printStackTrace();
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setMessage(R.string.koreNotFound)
+ .setPositiveButton(R.string.installeKore, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_VIEW);
+ intent.setData(Uri.parse(context.getString(R.string.fdroidKoreUrl)));
+ context.startActivity(intent);
+ }
+ })
+ .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+ });
+ builder.create().show();
+ }
+ }
+ }
}
diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java
index 842118490..23ca053f8 100644
--- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java
@@ -156,7 +156,11 @@ public class VideoItemDetailFragment extends Fragment {
ImageView uploaderThumbnailView = (ImageView) a.findViewById(R.id.detailUploaderThumbnailView);
ImageView thumbsUpPic = (ImageView) a.findViewById(R.id.detailThumbsUpImgView);
ImageView thumbsDownPic = (ImageView) a.findViewById(R.id.detailThumbsDownImgView);
+ View textSeperationLine = a.findViewById(R.id.textSeperationLine);
+ if(textSeperationLine != null) {
+ textSeperationLine.setVisibility(View.VISIBLE);
+ }
progressBar.setVisibility(View.GONE);
videoTitleView.setVisibility(View.VISIBLE);
uploaderView.setVisibility(View.VISIBLE);
diff --git a/app/src/main/res/drawable/ai_play.png b/app/src/main/res/drawable/ai_play.png
deleted file mode 100644
index 1d6b62297..000000000
Binary files a/app/src/main/res/drawable/ai_play.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ai_share.png b/app/src/main/res/drawable/ai_share.png
deleted file mode 100644
index cca49170f..000000000
Binary files a/app/src/main/res/drawable/ai_share.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_cast_black.png b/app/src/main/res/drawable/ic_cast_black.png
new file mode 100644
index 000000000..9dbfcd941
Binary files /dev/null and b/app/src/main/res/drawable/ic_cast_black.png differ
diff --git a/app/src/main/res/drawable/ic_play_arrow_black.png b/app/src/main/res/drawable/ic_play_arrow_black.png
new file mode 100644
index 000000000..d12d49562
Binary files /dev/null and b/app/src/main/res/drawable/ic_play_arrow_black.png differ
diff --git a/app/src/main/res/drawable/ic_share_black.png b/app/src/main/res/drawable/ic_share_black.png
new file mode 100644
index 000000000..5a8544ce5
Binary files /dev/null and b/app/src/main/res/drawable/ic_share_black.png differ
diff --git a/app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml b/app/src/main/res/layout-land/fragment_videoitem_detail.xml
similarity index 99%
rename from app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml
rename to app/src/main/res/layout-land/fragment_videoitem_detail.xml
index f59e29844..2f8eb35dc 100644
--- a/app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml
+++ b/app/src/main/res/layout-land/fragment_videoitem_detail.xml
@@ -59,7 +59,7 @@
android:visibility="invisible"
android:text="Herr von Gurken" />
-
+ android:icon="@drawable/ic_play_arrow_black"/>
+ android:icon="@drawable/ic_share_black"/>
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 4e24b42c1..da39d8f3b 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -28,4 +28,10 @@
Automatisch abspielen durch Intent.
Startet ein Video automatisch wenn es von einer anderen App aufgerufen wurde.
Standard Auflösung
+ Mit Kodi abspielen
+ Kore app wurde nicht gefunden. Kore wird benötigt, um Videos mit Kodi wieder zu geben.
+ Kore installieren
+ https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore
+ Zeige \"Mit Kodi abspielen\" Option
+ Zeigt eine Option an, über die man Videos mit dem Kodi Mediacenter abspielen kann.
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
deleted file mode 100644
index 7ce840eb6..000000000
--- a/app/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index 464207fb6..5ad6be083 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -11,4 +11,5 @@
- 144p
360p
+ show_play_with_kodi_preference
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9eb05d869..40d964e90 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -28,4 +28,10 @@
Autoplay through Intent
Automatically starts a video when it was called from another app.
Default Resolution
+ Play with Kodi
+ Kore app not found. Kore is needed to play videos with Kodi media center.
+ Install Kore
+ https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore
+ Show \"Play with Kodi\" option
+ Displays an option to play a video via Kodi media center.
diff --git a/app/src/main/res/xml/settings_screen.xml b/app/src/main/res/xml/settings_screen.xml
index e453128bc..a20d21711 100644
--- a/app/src/main/res/xml/settings_screen.xml
+++ b/app/src/main/res/xml/settings_screen.xml
@@ -28,4 +28,10 @@
android:entryValues="@array/resolutionList"
android:defaultValue="@string/defaultResolutionListItem"/>
+
+
\ No newline at end of file