- Show video title instead of stream url in vlc/MXPlayer
 - remember rotation
Fix:
 - sensore controlled landscape rotation in the player
This commit is contained in:
Christian Schabesberger 2015-09-25 14:17:43 +02:00
parent d8bdada9db
commit c62ad66f11
6 changed files with 29 additions and 13 deletions

View File

@ -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();

View File

@ -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();
}
}

View File

@ -146,7 +146,6 @@ public class VideoItemListActivity extends AppCompatActivity
SettingsActivity.initSettings(this);
// TODO: If exposing deep links into your app, handle intents here.
}
/**

View File

@ -35,7 +35,7 @@
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&amp;fdid=org.xbmc.kore</string>
<string name="showPlayWithKodiTitle">Zeige \"Mit Kodi abspielen\" Option</string>
<string name="showPlayWithKodiSummary">Zeigt eine Option an, über die man Videos mit dem Kodi Mediacenter abspielen kann.</string>
<string name="leftHandLayoutTitle">Linkshänder freundliches Layout.</string>
<string name="leftPlayButtonTitle">Zeige play button auf der linken seite.</string>
<string name="playAudio">Audio</string>
<string name="defaultAudioFormatTitle">Bevorzugtes Audio Format</string>
<string name="webMAudioDescription">WebM - freies Format</string>

View File

@ -35,7 +35,7 @@
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&amp;fdid=org.xbmc.kore</string>
<string name="showPlayWithKodiTitle">Show \"Play with Kodi\" option</string>
<string name="showPlayWithKodiSummary">Displays an option to play a video via Kodi media center.</string>
<string name="leftHandLayoutTitle">Left hand friendly layout.</string>
<string name="leftPlayButtonTitle">Show play button on the left side.</string>
<string name="playAudio">Audio</string>
<string name="defaultAudioFormatTitle">Default audio format</string>
<string name="webMAudioDescription">WebM - free format</string>

View File

@ -36,7 +36,7 @@
<CheckBoxPreference
android:key="@string/leftHandLayout"
android:title="@string/leftHandLayoutTitle"
android:title="@string/leftPlayButtonTitle"
android:defaultValue="false" />
<ListPreference