diff --git a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java index f135903a2..fdf02301e 100644 --- a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java +++ b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java @@ -310,6 +310,8 @@ public class ActionBarHandler { intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(audioStream.url), VideoInfo.getMimeById(audioStream.format)); + intent.putExtra(Intent.EXTRA_TITLE, videoTitle); + intent.putExtra("title", videoTitle); context.startActivity(intent); // HERE !!! } catch (Exception e) { e.printStackTrace(); diff --git a/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java b/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java index 8b2acea81..7f71ef334 100644 --- a/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java +++ b/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java @@ -1,6 +1,8 @@ package org.schabi.newpipe; +import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Resources; @@ -72,6 +74,9 @@ public class PlayVideoActivity extends AppCompatActivity { private boolean isLandscape = true; private boolean hasSoftKeys = false; + private SharedPreferences prefs; + private static final String PREF_IS_LANDSCAPE = "is_landscape"; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -136,12 +141,16 @@ public class PlayVideoActivity extends AppCompatActivity { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + + prefs = getPreferences(Context.MODE_PRIVATE); + if(prefs.getBoolean(PREF_IS_LANDSCAPE, false) && !isLandscape) { + toggleOrientation(); + } } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); - } @Override @@ -179,14 +188,7 @@ public class PlayVideoActivity extends AppCompatActivity { startActivity(Intent.createChooser(intent, getString(R.string.shareDialogTitle))); break; case R.id.menu_item_screen_rotation: - Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); - if(display.getRotation() == Surface.ROTATION_0 - || display.getRotation() == Surface.ROTATION_180) { - setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - } else if(display.getRotation() == Surface.ROTATION_90 - || display.getRotation() == Surface.ROTATION_270) { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - } + toggleOrientation(); break; default: Log.e(TAG, "Error: MenuItem not known"); @@ -319,4 +321,17 @@ public class PlayVideoActivity extends AppCompatActivity { getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels < displayMetrics.widthPixels; } + + private void toggleOrientation() { + if(isLandscape) { + isLandscape = false; + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } else { + isLandscape = true; + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); + } + SharedPreferences.Editor editor = prefs.edit(); + editor.putBoolean(PREF_IS_LANDSCAPE, isLandscape); + editor.commit(); + } } diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java index 0a46ac10e..ce2da6cb3 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java @@ -146,7 +146,6 @@ public class VideoItemListActivity extends AppCompatActivity SettingsActivity.initSettings(this); - // TODO: If exposing deep links into your app, handle intents here. } /** diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4bed65a4e..d72523039 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -35,7 +35,7 @@ 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. - Linkshänder freundliches Layout. + Zeige play button auf der linken seite. Audio Bevorzugtes Audio Format WebM - freies Format diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 93276b23f..0c8849533 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,7 +35,7 @@ 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. - Left hand friendly layout. + Show play button on the left side. Audio Default audio format WebM - free format diff --git a/app/src/main/res/xml/settings_screen.xml b/app/src/main/res/xml/settings_screen.xml index fc707bb15..487532db7 100644 --- a/app/src/main/res/xml/settings_screen.xml +++ b/app/src/main/res/xml/settings_screen.xml @@ -36,7 +36,7 @@