mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 00:20:32 +00:00
New:
- 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:
parent
d8bdada9db
commit
c62ad66f11
@ -310,6 +310,8 @@ public class ActionBarHandler {
|
|||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(Uri.parse(audioStream.url),
|
intent.setDataAndType(Uri.parse(audioStream.url),
|
||||||
VideoInfo.getMimeById(audioStream.format));
|
VideoInfo.getMimeById(audioStream.format));
|
||||||
|
intent.putExtra(Intent.EXTRA_TITLE, videoTitle);
|
||||||
|
intent.putExtra("title", videoTitle);
|
||||||
context.startActivity(intent); // HERE !!!
|
context.startActivity(intent); // HERE !!!
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@ -72,6 +74,9 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
private boolean isLandscape = true;
|
private boolean isLandscape = true;
|
||||||
private boolean hasSoftKeys = false;
|
private boolean hasSoftKeys = false;
|
||||||
|
|
||||||
|
private SharedPreferences prefs;
|
||||||
|
private static final String PREF_IS_LANDSCAPE = "is_landscape";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -136,12 +141,16 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
|
||||||
|
prefs = getPreferences(Context.MODE_PRIVATE);
|
||||||
|
if(prefs.getBoolean(PREF_IS_LANDSCAPE, false) && !isLandscape) {
|
||||||
|
toggleOrientation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -179,14 +188,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
startActivity(Intent.createChooser(intent, getString(R.string.shareDialogTitle)));
|
startActivity(Intent.createChooser(intent, getString(R.string.shareDialogTitle)));
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_screen_rotation:
|
case R.id.menu_item_screen_rotation:
|
||||||
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
toggleOrientation();
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.e(TAG, "Error: MenuItem not known");
|
Log.e(TAG, "Error: MenuItem not known");
|
||||||
@ -319,4 +321,17 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
return displayMetrics.heightPixels < displayMetrics.widthPixels;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,6 @@ public class VideoItemListActivity extends AppCompatActivity
|
|||||||
|
|
||||||
SettingsActivity.initSettings(this);
|
SettingsActivity.initSettings(this);
|
||||||
|
|
||||||
// TODO: If exposing deep links into your app, handle intents here.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||||
<string name="showPlayWithKodiTitle">Zeige \"Mit Kodi abspielen\" Option</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="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="playAudio">Audio</string>
|
||||||
<string name="defaultAudioFormatTitle">Bevorzugtes Audio Format</string>
|
<string name="defaultAudioFormatTitle">Bevorzugtes Audio Format</string>
|
||||||
<string name="webMAudioDescription">WebM - freies Format</string>
|
<string name="webMAudioDescription">WebM - freies Format</string>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||||
<string name="showPlayWithKodiTitle">Show \"Play with Kodi\" option</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="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="playAudio">Audio</string>
|
||||||
<string name="defaultAudioFormatTitle">Default audio format</string>
|
<string name="defaultAudioFormatTitle">Default audio format</string>
|
||||||
<string name="webMAudioDescription">WebM - free format</string>
|
<string name="webMAudioDescription">WebM - free format</string>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/leftHandLayout"
|
android:key="@string/leftHandLayout"
|
||||||
android:title="@string/leftHandLayoutTitle"
|
android:title="@string/leftPlayButtonTitle"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
Loading…
Reference in New Issue
Block a user