Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3650a6776 |
@@ -19,8 +19,8 @@ android {
|
|||||||
applicationId = "de.fojadrachi.playtube"
|
applicationId = "de.fojadrachi.playtube"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 2
|
versionCode = 3
|
||||||
versionName = "1.1.0"
|
versionName = "1.1.1"
|
||||||
|
|
||||||
// Update-Quelle: eigener Gitea-Server (kein GitHub/Google Play).
|
// Update-Quelle: eigener Gitea-Server (kein GitHub/Google Play).
|
||||||
buildConfigField("String", "UPDATE_SERVER", "\"https://git.fojadrachi.de\"")
|
buildConfigField("String", "UPDATE_SERVER", "\"https://git.fojadrachi.de\"")
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ Java_de_fojadrachi_playtube_DiscordPresence_nativeUpdate(JNIEnv* env, jobject, j
|
|||||||
|
|
||||||
discordpp::Activity activity;
|
discordpp::Activity activity;
|
||||||
activity.SetType(discordpp::ActivityTypes::Listening);
|
activity.SetType(discordpp::ActivityTypes::Listening);
|
||||||
|
// Statuszeile "Hoert <Titel> zu" statt des Namens der Discord-Anwendung.
|
||||||
|
activity.SetStatusDisplayType(discordpp::StatusDisplayTypes::Details);
|
||||||
activity.SetDetails(textOrNone(toString(env, details)));
|
activity.SetDetails(textOrNone(toString(env, details)));
|
||||||
activity.SetState(textOrNone(toString(env, state)));
|
activity.SetState(textOrNone(toString(env, state)));
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.webkit.WebSettingsCompat
|
import androidx.webkit.WebSettingsCompat
|
||||||
import androidx.webkit.WebViewCompat
|
import androidx.webkit.WebViewCompat
|
||||||
import androidx.webkit.WebViewFeature
|
import androidx.webkit.WebViewFeature
|
||||||
@@ -48,6 +51,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
webView = findViewById(R.id.webView)
|
webView = findViewById(R.id.webView)
|
||||||
progress = findViewById(R.id.progress)
|
progress = findViewById(R.id.progress)
|
||||||
|
keepContentBetweenSystemBars()
|
||||||
|
|
||||||
configureWebView()
|
configureWebView()
|
||||||
onBackPressedDispatcher.addCallback(
|
onBackPressedDispatcher.addCallback(
|
||||||
@@ -84,6 +88,21 @@ class MainActivity : AppCompatActivity() {
|
|||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ab Android 15 zeichnet jede App unter Status- und Navigationsleiste. Die Seite bekommt deshalb
|
||||||
|
* Abstand oben/unten (und fuer die Tastatur); dahinter bleiben schwarze Balken stehen.
|
||||||
|
*/
|
||||||
|
private fun keepContentBetweenSystemBars() {
|
||||||
|
val insetsController = WindowCompat.getInsetsController(window, window.decorView)
|
||||||
|
insetsController.isAppearanceLightStatusBars = false
|
||||||
|
insetsController.isAppearanceLightNavigationBars = false
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.root)) { view, insets ->
|
||||||
|
val space = insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime())
|
||||||
|
view.setPadding(space.left, space.top, space.right, space.bottom)
|
||||||
|
WindowInsetsCompat.CONSUMED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
handler.removeCallbacksAndMessages(null)
|
handler.removeCallbacksAndMessages(null)
|
||||||
PlaybackHub.commandHandler = null
|
PlaybackHub.commandHandler = null
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ data class PresencePlan(
|
|||||||
/** Schwankung des Startzeitpunkts durch die 1,5-s-Abfrage, die noch kein Spulen ist. */
|
/** Schwankung des Startzeitpunkts durch die 1,5-s-Abfrage, die noch kein Spulen ist. */
|
||||||
const val SEEK_TOLERANCE_MS = 4_000L
|
const val SEEK_TOLERANCE_MS = 4_000L
|
||||||
|
|
||||||
|
/** Discord akzeptiert Bildadressen nur bis 300 Zeichen. */
|
||||||
|
const val MAX_IMAGE_URL_LENGTH = 300
|
||||||
|
|
||||||
/** null = nichts anzeigen (nichts laeuft oder Pause). */
|
/** null = nichts anzeigen (nichts laeuft oder Pause). */
|
||||||
fun from(info: NowPlaying, nowMs: Long): PresencePlan? {
|
fun from(info: NowPlaying, nowMs: Long): PresencePlan? {
|
||||||
if (!info.hasTrack || !info.playing) return null
|
if (!info.hasTrack || !info.playing) return null
|
||||||
@@ -28,7 +31,7 @@ data class PresencePlan(
|
|||||||
return PresencePlan(
|
return PresencePlan(
|
||||||
details = info.title,
|
details = info.title,
|
||||||
state = info.artist,
|
state = info.artist,
|
||||||
artworkUrl = info.artworkUrl,
|
artworkUrl = info.artworkUrl?.takeIf { it.length <= MAX_IMAGE_URL_LENGTH },
|
||||||
startMs = start,
|
startMs = start,
|
||||||
endMs = if (info.durationMs > 0) start + info.durationMs else 0L,
|
endMs = if (info.durationMs > 0) start + info.durationMs else 0L,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background">
|
android:background="@color/system_bars">
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/webView"
|
android:id="@+id/webView"
|
||||||
|
|||||||
@@ -14,13 +14,14 @@
|
|||||||
<string name="update_later">Später</string>
|
<string name="update_later">Später</string>
|
||||||
|
|
||||||
<color name="background">#0F0F0F</color>
|
<color name="background">#0F0F0F</color>
|
||||||
|
<color name="system_bars">#000000</color>
|
||||||
<color name="brand_from">#7C3AED</color>
|
<color name="brand_from">#7C3AED</color>
|
||||||
<color name="brand_to">#EC4899</color>
|
<color name="brand_to">#EC4899</color>
|
||||||
|
|
||||||
<style name="Theme.Playtube" parent="Theme.AppCompat.NoActionBar">
|
<style name="Theme.Playtube" parent="Theme.AppCompat.NoActionBar">
|
||||||
<item name="android:windowBackground">@color/background</item>
|
<item name="android:windowBackground">@color/background</item>
|
||||||
<item name="android:statusBarColor">@color/background</item>
|
<item name="android:statusBarColor">@color/system_bars</item>
|
||||||
<item name="android:navigationBarColor">@color/background</item>
|
<item name="android:navigationBarColor">@color/system_bars</item>
|
||||||
<item name="colorPrimary">@color/brand_from</item>
|
<item name="colorPrimary">@color/brand_from</item>
|
||||||
<item name="colorAccent">@color/brand_to</item>
|
<item name="colorAccent">@color/brand_to</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
## Playtube für Android – YouTube Music mit Hintergrundwiedergabe und Discord
|
## Playtube für Android 1.1.1
|
||||||
|
|
||||||
Die Android-Version von Playtube: **nur YouTube Music**, ohne YouTube-Tab und Stream-Dock-Fernsteuerung.
|
- **Korrektur:** Die App liegt nicht mehr unter Status- und Navigationsleiste, oben und unten sind
|
||||||
|
schwarze Balken (Android 15+ zeichnet sonst bis an den Bildschirmrand).
|
||||||
|
- Discord: in der Statuszeile steht jetzt der Songtitel („Hört … zu"), zu lange Cover-Adressen werden
|
||||||
|
nicht mehr an Discord geschickt.
|
||||||
|
|
||||||
- **Neu: Discord Rich Presence** – Discord zeigt „Hört Playtube" mit Titel, Interpret, Cover und
|
Alles Weitere wie in 1.1.0: nur YouTube Music, Hintergrundwiedergabe, Sperrbildschirm-Steuerung,
|
||||||
Fortschritt (offizielles Discord Social SDK, braucht die Discord-App auf dem Handy, keine Anmeldung).
|
Discord Rich Presence, Updates über diese Releases. Ein vorhandenes Playtube wird beim Installieren
|
||||||
- Musik läuft im Hintergrund und bei ausgeschaltetem Bildschirm weiter.
|
aktualisiert. Voraussetzung: Android 8.0 oder neuer.
|
||||||
- Medien-Benachrichtigung und Sperrbildschirm-Steuerung mit Titel, Interpret und Cover.
|
|
||||||
- **Eigene, hochgeladene Songs** lassen sich abspielen.
|
|
||||||
- Updates über diese Releases (Tag `…-android`), kein GitHub, kein Play Store.
|
|
||||||
|
|
||||||
### Installieren
|
|
||||||
1. `Playtube-Android-vX.Y.Z.apk` herunterladen und öffnen (eine vorhandene 1.0.0 wird aktualisiert).
|
|
||||||
2. Einmalig „Unbekannte Apps installieren" für den Browser/Dateimanager erlauben.
|
|
||||||
3. Beim ersten Start Benachrichtigungen erlauben.
|
|
||||||
|
|
||||||
Voraussetzung: Android 8.0 oder neuer (ARM 32/64 Bit). Bei Akku-Optimierung des Herstellers Playtube
|
|
||||||
ausnehmen, sonst kann Android die Hintergrundwiedergabe beenden.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user