fix: v10.1.6 - control remoto DPAD_DOWN y barra scroll visible

Problemas corregidos:

1. Control Remoto - Navegación fuera de eventos
   - Problema: Botón abajo del control remoto iba a canales en último evento
   - Solución: Agregado setOnKeyListener interceptando KEYCODE_DPAD_DOWN
   - Combina scroll listener táctil + manejo de teclas de control remoto
   - Import agregado: android.view.KeyEvent

2. Barra de Scroll Más Visible
   - Thumb: Blanco sólido #FFFFFFFF (antes 80% opacidad)
   - Ancho: 12dp (antes 8dp)
   - Radio: 6dp (antes 4dp)
   - Track oscuro agregado: #1A1A1A
   - scrollbarAlwaysDrawVerticalTrack="true"

Archivos modificados:
- MainActivity.java (OnKeyListener + import KeyEvent)
- scrollbar_vertical.xml (blanco sólido, 12dp)
- activity_main.xml (scrollbarSize, track, alwaysDraw)
- colors.xml (scrollbar_track)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Apple
2026-02-09 21:53:23 -03:00
parent 19c31ebf1b
commit 907c97464b
5 changed files with 74 additions and 7 deletions

42
CHANGELOG-v10.1.6.md Normal file
View File

@@ -0,0 +1,42 @@
# StreamPlayer v10.1.6 - Corrección de Control Remoto y Scrollbar
## Correcciones Implementadas
### 1. Control Remoto - Prevención de Navegación
- **Problema**: Al presionar el botón abajo del control remoto en el último evento, se iba a la sección de canales
- **Solución**: Agregado `setOnKeyListener` para interceptar teclas de navegación
- Ahora intercepta `KEYCODE_DPAD_DOWN` cuando está en el último elemento
- Combina scroll listener táctil + manejo de teclas del control remoto
### 2. Barra de Scroll Más Visible
- **Problema**: La barra de seguimiento no era visible
- **Solución**:
- Color del thumb: Blanco sólido (#FFFFFFFF) - antes 80%
- Ancho aumentado a 12dp (antes 8dp)
- Radio de esquinas: 6dp (antes 4dp)
- Track oscuro agregado (#1A1A1A)
- `scrollbarAlwaysDrawVerticalTrack="true"` para siempre visible
## Archivos Modificados
### MainActivity.java
- Import agregado: `android.view.KeyEvent`
- `setOnKeyListener` agregado en `showEvents()` para interceptar DPAD_DOWN
- Combina con scroll listener existente para cobertura completa
### scrollbar_vertical.xml
- Color cambiado a blanco sólido (#FFFFFFFF)
- Ancho: 12dp
- Radio: 6dp
### activity_main.xml
- `scrollbarSize="12dp"` (antes 8dp)
- `scrollbarTrackVertical="@color/scrollbar_track"` agregado
- `scrollbarAlwaysDrawVerticalTrack="true"` agregado
### colors.xml
- Nuevo color: `scrollbar_track` (#1A1A1A)
## Compatibilidad
- Android TV con control remoto
- Versión mínima: API 21+

View File

@@ -7,6 +7,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
@@ -188,18 +189,36 @@ public class MainActivity extends AppCompatActivity {
refreshButton.setVisibility(View.VISIBLE);
contentList.setLayoutManager(eventLayoutManager);
contentList.setAdapter(eventAdapter);
// Add scroll listener to prevent scrolling from Events to Channels section
// Clear existing listeners
contentList.clearOnScrollListeners();
// Prevent navigation out of events section via remote control
contentList.setOnKeyListener((v, keyCode, event) -> {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
int totalItemCount = eventLayoutManager.getItemCount();
if (totalItemCount > 0) {
int lastVisiblePosition = eventLayoutManager.findLastVisibleItemPosition();
// Prevent going down if we're at or near the last item
if (lastVisiblePosition >= totalItemCount - 1) {
// Consume the event to prevent navigation
return true;
}
}
}
}
return false;
});
// Also prevent scroll-based navigation
contentList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
// Only prevent downward scroll when at the last COMPLETELY VISIBLE item
if (dy > 0) { // Scrolling down
int totalItemCount = eventLayoutManager.getItemCount();
if (totalItemCount > 0) {
int lastCompletelyVisiblePosition = eventLayoutManager.findLastCompletelyVisibleItemPosition();
// Only stop scroll if we're at the last completely visible item
if (lastCompletelyVisiblePosition == totalItemCount - 1) {
recyclerView.stopScroll();
}
@@ -207,6 +226,7 @@ public class MainActivity extends AppCompatActivity {
}
}
});
if (cachedEvents.isEmpty()) {
loadEvents(false);
} else {

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#CCFFFFFF" />
<corners android:radius="4dp" />
<size android:width="8dp" />
<solid android:color="#FFFFFFFF" />
<corners android:radius="6dp" />
<size android:width="12dp" />
</shape>

View File

@@ -131,7 +131,9 @@
android:scrollbars="vertical"
android:scrollbarStyle="insideInset"
android:scrollbarThumbVertical="@drawable/scrollbar_vertical"
android:scrollbarSize="8dp"
android:scrollbarTrackVertical="@color/scrollbar_track"
android:scrollbarSize="12dp"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarFadeDuration="0"
android:nextFocusLeft="@id/section_list"
tools:listitem="@layout/item_channel" />

View File

@@ -10,4 +10,7 @@
<color name="refresh_button_focused">#FFC107</color>
<color name="refresh_button_focused_border">#FFD54F</color>
<color name="refresh_button_pressed">#FF9800</color>
<!-- Scrollbar -->
<color name="scrollbar_track">#1A1A1A</color>
</resources>