Files
XoséandClaude Opus 5.5 666a7eb8cd Podlite 1.12: a build for Android 4.1 (Xperia J) with ExoPlayer, speed and skip silences
- One build per Android level, as in Tenda and Plexamp Lite: build/Podlite.apk (Android 2.2+, versionCode 1308) and
  build/Podlite-api16.apk (Android 4.1+, 1316), from shared src/ plus platform/api8 or platform/api16; build.sh now
  runs on the local toolchain (aapt2, dx or R8, signapk.py; the JKS key converted for the run).
- Android 4.1 build: ExoPlayer 2.18.7 behind an Engine interface, with playback speed (player header) and skipping
  silences (Settings), a 3-minute buffer and MediaPlayer as fallback for audio it can't decode; a notification and
  lock screen with the cover and buttons; Holo; a menu button on phones without a Menu key; metered networks for
  "download on Wi-Fi only".
- Both builds: tlskit's Http.abort fix (a finished response's pooled connection is no longer closed under a later
  request); the lock screen's and newer headsets' play/pause keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:56:18 +01:00

64 lines
2.6 KiB
Java

package com.miniabs;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* What differs between Podlite's builds, for Android 2.2 and later (the Galaxy Mini). platform/api16 has the same
* methods for Android 4.1 and later; the rest of the app is shared and calls these. Keep the two in step.
*/
final class Platform {
private Platform() {}
/** The Android level this build is for: its minSdkVersion. */
static final int API = 8;
/** The player can change speed and skip silences (Android 2.x's can't). */
static final boolean SPEED = false;
/** Size the cover is loaded at for the notification and lock screen. */
static final int COVER_PX = 64;
/** At the start of each screen and service (main thread). */
static void init(Context c) {}
/** The player for an episode. {@code fallback}: the episode failed to decode in the usual one. */
static Engine newEngine(Context c, boolean fallback) {
return new MediaPlayerEngine(c);
}
/** On a network that doesn't cost by the megabyte (for "download only on Wi-Fi"): here, Wi-Fi. */
static boolean unmetered(Context c) {
ConnectivityManager cm = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm == null ? null : cm.getActiveNetworkInfo();
return ni != null && ni.isConnected() && ni.getType() == ConnectivityManager.TYPE_WIFI;
}
/** The phone has no Menu key, so screens need a ⋮ button. Android 2.x phones all have one. */
static boolean needsMenuButton(Context c) {
return false;
}
/** The playback notification. Android 2.x: title and state; its notifications can't have buttons. */
@SuppressWarnings("deprecation")
static Notification playerNotification(Context c, Episode ep, String what, Bitmap cover, int state, boolean ongoing) {
Notification n = new Notification(R.drawable.ic_stat, null, 0);
n.flags |= ongoing ? Notification.FLAG_ONGOING_EVENT : 0;
n.setLatestEventInfo(c, ep.title, Util.join(what, ep.show), openPlayer(c));
return n;
}
static PendingIntent openPlayer(Context c) {
Intent i = new Intent(c, PlayerActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(c, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
}
/** The lock screen's player (null episode or IDLE: take it away). Android 2.x has none. */
static void lockScreen(Context c, Episode ep, Bitmap cover, int state) {}
}