4 Commits

Author SHA1 Message Date
d2c3041b0a Update v9.4.4: Dialog Contrast & Event Refresh Button 2025-11-25 19:10:08 +00:00
77c417117a Update v9.4.3: Manual Events Refresh & Background Sync 2025-11-25 19:01:21 +00:00
renato97
2c65578bdd Update v9.4.2: Enhanced UI Theme & Visual Consistency
- Incremented version to 9.4.2 (versionCode: 94200)
- Added custom AlertDialog theme with white text styling
- Enhanced visual consistency for all dialog components
- Improved theme overlay for better readability
- Applied custom styling to update and blocked dialogs
- Better contrast and visual hierarchy in dialogs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 00:13:29 +01:00
renato97
6aef195f30 Update v9.4.1: Enhanced Playback & Device Management
- Incremented version to 9.4.1 (versionCode: 94100)
- Added keep screen on functionality during video playback
- Implemented device deletion in dashboard with confirmation
- Enhanced device management with delete capability
- Improved user experience during media playback
- Better device lifecycle management in dashboard
- Added confirmation dialog for device deletion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 00:07:04 +01:00
14 changed files with 223 additions and 35 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "com.streamplayer"
minSdk 21
targetSdk 33
versionCode 94000
versionName "9.4.0"
versionCode 94400
versionName "9.4.4"
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
}

View File

@@ -73,6 +73,21 @@ public class EventRepository {
}).start();
}
public void prefetchEvents(Context context) {
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
new Thread(() -> {
try {
String json = downloadJson();
parseEvents(json);
prefs.edit()
.putString(KEY_JSON, json)
.putLong(KEY_TIMESTAMP, System.currentTimeMillis())
.apply();
} catch (IOException | JSONException ignored) {
}
}).start();
}
private String downloadJson() throws IOException {
URL url = new URL(EVENTS_URL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

View File

@@ -7,11 +7,14 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.text.TextUtils;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
@@ -24,14 +27,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class MainActivity extends AppCompatActivity {
private static final long EVENT_PREFETCH_INTERVAL_MS = TimeUnit.HOURS.toMillis(1);
private RecyclerView sectionList;
private RecyclerView contentList;
private ProgressBar loadingIndicator;
private TextView messageView;
private TextView contentTitle;
private Button eventsRefreshButton;
private ChannelAdapter channelAdapter;
private EventAdapter eventAdapter;
@@ -46,6 +53,9 @@ public class MainActivity extends AppCompatActivity {
private AlertDialog updateDialog;
private AlertDialog blockedDialog;
private DeviceRegistry deviceRegistry;
private Handler eventPrefetchHandler;
private Runnable eventPrefetchRunnable;
private boolean isEventsRefreshing;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -57,6 +67,8 @@ public class MainActivity extends AppCompatActivity {
loadingIndicator = findViewById(R.id.loading_indicator);
messageView = findViewById(R.id.message_view);
contentTitle = findViewById(R.id.content_title);
eventsRefreshButton = findViewById(R.id.events_refresh_button);
eventsRefreshButton.setOnClickListener(v -> manualRefreshEvents());
channelAdapter = new ChannelAdapter(
channel -> openPlayer(channel.getName(), channel.getPageUrl()));
@@ -113,6 +125,8 @@ public class MainActivity extends AppCompatActivity {
}
}
});
startEventPrefetchScheduler();
}
@Override
@@ -138,6 +152,12 @@ public class MainActivity extends AppCompatActivity {
if (deviceRegistry != null) {
deviceRegistry.release();
}
stopEventPrefetchScheduler();
}
@Override
public void onBackPressed() {
closeAppCompletely();
}
private void selectSection(int index) {
@@ -157,6 +177,7 @@ public class MainActivity extends AppCompatActivity {
}
private void showChannels(SectionEntry section) {
updateEventsRefreshVisibility(false);
contentTitle.setText(section.title);
contentList.setLayoutManager(channelLayoutManager);
contentList.setAdapter(channelAdapter);
@@ -172,6 +193,7 @@ public class MainActivity extends AppCompatActivity {
}
private void showEvents() {
updateEventsRefreshVisibility(true);
contentTitle.setText(currentSection != null ? currentSection.title : getString(R.string.section_events));
contentList.setLayoutManager(eventLayoutManager);
contentList.setAdapter(eventAdapter);
@@ -183,6 +205,9 @@ public class MainActivity extends AppCompatActivity {
}
private void loadEvents(boolean forceRefresh) {
if (currentSection != null && currentSection.type == SectionEntry.Type.EVENTS) {
setEventsRefreshing(true);
}
loadingIndicator.setVisibility(View.VISIBLE);
messageView.setVisibility(View.GONE);
eventRepository.loadEvents(this, forceRefresh, new EventRepository.Callback() {
@@ -196,6 +221,7 @@ public class MainActivity extends AppCompatActivity {
} else {
loadingIndicator.setVisibility(View.GONE);
}
setEventsRefreshing(false);
});
}
@@ -205,11 +231,48 @@ public class MainActivity extends AppCompatActivity {
loadingIndicator.setVisibility(View.GONE);
messageView.setVisibility(View.VISIBLE);
messageView.setText(getString(R.string.message_events_error, message));
setEventsRefreshing(false);
});
}
});
}
private void manualRefreshEvents() {
if (isEventsRefreshing) {
return;
}
if (currentSection == null || currentSection.type != SectionEntry.Type.EVENTS) {
return;
}
loadEvents(true);
}
private void updateEventsRefreshVisibility(boolean visible) {
if (eventsRefreshButton == null) {
return;
}
eventsRefreshButton.setVisibility(visible ? View.VISIBLE : View.GONE);
if (visible) {
eventsRefreshButton.setEnabled(!isEventsRefreshing);
eventsRefreshButton.setText(isEventsRefreshing
? getString(R.string.events_refreshing)
: getString(R.string.events_refresh_action));
}
}
private void setEventsRefreshing(boolean refreshing) {
isEventsRefreshing = refreshing;
if (eventsRefreshButton == null) {
return;
}
if (eventsRefreshButton.getVisibility() == View.VISIBLE) {
eventsRefreshButton.setEnabled(!refreshing);
eventsRefreshButton.setText(refreshing
? getString(R.string.events_refreshing)
: getString(R.string.events_refresh_action));
}
}
private void displayEvents() {
loadingIndicator.setVisibility(View.GONE);
if (cachedEvents.isEmpty()) {
@@ -244,7 +307,7 @@ public class MainActivity extends AppCompatActivity {
if (updateDialog != null && updateDialog.isShowing()) {
updateDialog.dismiss();
}
AlertDialog.Builder builder = new AlertDialog.Builder(this)
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ThemeOverlay_StreamPlayer_AlertDialog)
.setTitle(mandatory ? R.string.update_required_title : R.string.update_available_title)
.setMessage(buildUpdateMessage(info))
.setPositiveButton(R.string.update_action_download,
@@ -254,7 +317,7 @@ public class MainActivity extends AppCompatActivity {
if (mandatory) {
builder.setCancelable(false);
builder.setNegativeButton(R.string.update_action_close_app,
(dialog, which) -> finish());
(dialog, which) -> closeAppCompletely());
} else {
builder.setNegativeButton(R.string.update_action_later, null);
}
@@ -333,12 +396,12 @@ public class MainActivity extends AppCompatActivity {
} else {
tokenContainer.setVisibility(View.GONE);
}
AlertDialog.Builder builder = new AlertDialog.Builder(this)
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ThemeOverlay_StreamPlayer_AlertDialog)
.setTitle(R.string.device_blocked_title)
.setView(dialogView)
.setCancelable(false)
.setPositiveButton(R.string.device_blocked_close,
(dialog, which) -> finish());
(dialog, which) -> closeAppCompletely());
if (hasToken) {
builder.setNeutralButton(R.string.device_blocked_copy_token,
(dialog, which) -> copyTokenToClipboard(tokenPart));
@@ -358,6 +421,40 @@ public class MainActivity extends AppCompatActivity {
Toast.makeText(this, R.string.device_blocked_copy_success, Toast.LENGTH_SHORT).show();
}
private void startEventPrefetchScheduler() {
if (eventPrefetchHandler == null) {
eventPrefetchHandler = new Handler(Looper.getMainLooper());
}
if (eventPrefetchRunnable == null) {
eventPrefetchRunnable = new Runnable() {
@Override
public void run() {
if (eventRepository != null) {
eventRepository.prefetchEvents(getApplicationContext());
}
if (eventPrefetchHandler != null) {
eventPrefetchHandler.postDelayed(this, EVENT_PREFETCH_INTERVAL_MS);
}
}
};
} else {
eventPrefetchHandler.removeCallbacks(eventPrefetchRunnable);
}
eventPrefetchHandler.post(eventPrefetchRunnable);
}
private void stopEventPrefetchScheduler() {
if (eventPrefetchHandler != null && eventPrefetchRunnable != null) {
eventPrefetchHandler.removeCallbacks(eventPrefetchRunnable);
}
}
private void closeAppCompletely() {
finishAffinity();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
private int getSpanCount() {
return getResources().getInteger(R.integer.channel_grid_span);
}

View File

@@ -4,6 +4,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -58,6 +59,7 @@ public class PlayerActivity extends AppCompatActivity {
);
setContentView(R.layout.activity_player);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Intent intent = getIntent();
if (intent == null) {
@@ -254,6 +256,7 @@ public class PlayerActivity extends AppCompatActivity {
protected void onDestroy() {
super.onDestroy();
releasePlayer();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
private void toggleOverlay() {

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/dialog_background" />
<corners android:radius="18dp" />
<padding
android:bottom="16dp"
android:left="16dp"
android:right="16dp"
android:top="16dp" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/accent_blue" />
<corners android:radius="20dp" />
<padding
android:bottom="8dp"
android:left="20dp"
android:right="20dp"
android:top="8dp" />
</shape>

View File

@@ -72,14 +72,34 @@
app:layout_constraintStart_toEndOf="@id/divider"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/content_title"
<LinearLayout
android:id="@+id/content_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
tools:text="Canales" />
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/content_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
tools:text="Canales" />
<Button
android:id="@+id/events_refresh_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:background="@drawable/bg_events_refresh_button"
android:textColor="@color/white"
android:text="@string/events_refresh_action"
android:textAllCaps="false"
android:visibility="gone" />
</LinearLayout>
<ProgressBar
android:id="@+id/loading_indicator"

View File

@@ -13,7 +13,7 @@
android:id="@+id/blocked_message_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textColor="@color/white"
android:textSize="16sp" />
<LinearLayout
@@ -29,7 +29,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/device_blocked_token_label"
android:textColor="@android:color/black"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
@@ -40,7 +40,7 @@
android:layout_marginTop="4dp"
android:background="@android:color/transparent"
android:padding="8dp"
android:textColor="@android:color/black"
android:textColor="@color/white"
android:textIsSelectable="true"
android:textSize="16sp" />
</LinearLayout>

View File

@@ -3,4 +3,6 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="text_secondary">#B3FFFFFF</color>
<color name="accent_blue">#FF1E88E5</color>
<color name="dialog_background">#FF121212</color>
</resources>

View File

@@ -46,4 +46,6 @@
<string name="device_blocked_copy_success">Código copiado al portapapeles</string>
<string name="device_blocked_copy_error">No se pudo copiar el código</string>
<string name="device_registry_error">No se pudo registrar el dispositivo (%1$s)</string>
<string name="events_refresh_action">Actualizar ahora</string>
<string name="events_refreshing">Actualizando...</string>
</resources>

View File

@@ -6,4 +6,18 @@
<item name="android:statusBarColor">@color/black</item>
<item name="android:navigationBarColor">@color/black</item>
</style>
</resources>
<style name="ThemeOverlay.StreamPlayer.AlertDialog" parent="ThemeOverlay.AppCompat.Dialog.Alert">
<item name="android:windowBackground">@drawable/bg_dialog_dark</item>
<item name="android:colorBackground">@color/dialog_background</item>
<item name="colorBackgroundFloating">@color/dialog_background</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/text_secondary</item>
<item name="colorAccent">@color/accent_blue</item>
<item name="android:buttonStyle">@style/StreamPlayer.DialogButton</item>
</style>
<style name="StreamPlayer.DialogButton" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="android:textColor">@color/accent_blue</item>
</style>
</resources>

View File

@@ -6,22 +6,21 @@
"model": "SM-S928B",
"manufacturer": "Samsung",
"osVersion": "16 (API 36)",
"appVersionName": "9.3.1",
"appVersionCode": 93100,
"firstSeen": "2025-11-23T20:53:43.615Z",
"lastSeen": "2025-11-23T21:57:09.997Z",
"appVersionName": "9.4.4",
"appVersionCode": 94400,
"firstSeen": "2025-11-23T22:31:13.359Z",
"lastSeen": "2025-11-23T23:11:07.215Z",
"blocked": false,
"notes": "no pagó",
"installs": 14,
"blockedAt": "2025-11-23T20:54:05.413Z",
"notes": "",
"installs": 7,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
"clientPart": "6e05a220abe0ed05",
"adminPart": "19d6ee4c992ee1a0",
"clientPart": "1714c2bb93670c3f",
"adminPart": "9924c7049211c58c",
"status": "verified",
"createdAt": "2025-11-23T21:09:04.607Z",
"verifiedAt": "2025-11-23T21:57:05.081Z"
"createdAt": "2025-11-23T22:31:13.359Z",
"verifiedAt": "2025-11-23T22:33:11.942Z"
}
}
]
]

View File

@@ -45,6 +45,7 @@ function renderTable(devices) {
actions.push('<button data-action="verify" class="primary">Verificar token</button>');
}
actions.push(device.blocked ? '<button data-action="unblock" class="primary">Desbloquear</button>' : '<button data-action="block" class="danger">Bloquear</button>');
actions.push('<button data-action="delete" class="danger ghost">Borrar</button>');
tr.innerHTML = `
<td>
@@ -97,6 +98,19 @@ async function unblockDevice(deviceId) {
await fetchDevices();
}
async function deleteDevice(deviceId) {
const confirmation = confirm('¿Seguro que quieres borrar este dispositivo? Generará un nuevo token cuando se registre de nuevo.');
if (!confirmation) {
return;
}
const response = await fetch(`/api/devices/${encodeURIComponent(deviceId)}`, { method: 'DELETE' });
if (!response.ok) {
alert('No se pudo borrar el dispositivo');
return;
}
await fetchDevices();
}
async function verifyDevice(deviceId) {
const clientTokenPart = prompt('Introduce el token que aparece en el dispositivo:');
if (clientTokenPart === null) {
@@ -154,6 +168,8 @@ tableBody.addEventListener('click', async (event) => {
await updateAlias(deviceId);
} else if (action === 'verify') {
await verifyDevice(deviceId);
} else if (action === 'delete') {
await deleteDevice(deviceId);
}
} catch (error) {
console.error(error);

View File

@@ -1,10 +1,10 @@
{
"versionCode": 93100,
"versionName": "9.3.1",
"versionCode": 94400,
"versionName": "9.4.4",
"minSupportedVersionCode": 91000,
"forceUpdate": false,
"downloadUrl": "https://gitea.cbcren.online/renato97/app/releases/download/v9.3.1/StreamPlayer-v9.3.1.apk",
"fileName": "StreamPlayer-v9.3.1.apk",
"sizeBytes": 5943075,
"notes": "StreamPlayer v9.3.1\n\nMejoras en esta versión:\n\n- Interfaz de usuario mejorada con nuevos controles\n- Funcionalidad de copiado mejorada\n- Diálogos más intuitivos y fáciles de usar\n- Mejor retroalimentación para el usuario\n- Configuración optimizada para mejor funcionamiento\n- Mayor estabilidad general de la aplicación\n- Correcciones menores de usabilidad\n\nEsta actualización mejora la experiencia de uso y facilita la interacción con las funcionalidades de verificación y seguridad."
"downloadUrl": "https://gitea.cbcren.online/renato97/app/releases/download/v9.4.4/StreamPlayer-v9.4.4.apk",
"fileName": "StreamPlayer-v9.4.4.apk",
"sizeBytes": 5948849,
"notes": "StreamPlayer v9.4.4\n\nCorrecciones y mejoras:\n\n- Los botones de actualización y cierre en los diálogos ahora se ven correctamente en temas claros y oscuros.\n- Nuevo estilo oscuro en los diálogos para mejorar el contraste del texto y acciones.\n- Botón \"Actualizar ahora\" de eventos con diseño sólido para que destaque en cualquier fondo.\n- Se mantiene la actualización silenciosa y el caché de eventos para que siempre encuentres la grilla fresca al reiniciar.\n\nRecomendamos actualizar para asegurar la mejor experiencia con la sección de eventos y el sistema de actualizaciones."
}