fix: v10.1.5 - corregir scroll listener, barra visible y URL única
Problemas corregidos: 1. Scroll Listener Corregido (último evento cortado) - Cambiado de findFirstVisibleItemPosition() a findLastCompletelyVisibleItemPosition() - Ahora el scroll solo se detiene cuando el último elemento está completamente visible - Antes: el último evento aparecía solo a la mitad 2. Barra de Scroll Más Visible - Opacidad aumentada de #4DFFFFFF (30%) a #CCFFFFFF (80%) - Ancho de barra: 8dp (antes no definido) - Estilo cambiado de outsideOverlay a insideInset - scrollbarFadeDuration="0" para siempre visible - Radio de esquinas: 4dp (antes 2dp) 3. URL Única (eliminar bloqueos de ISP) - Eliminado sistema de fallback múltiples URLs - Ahora usa solo: https://streamtp10.com/eventos.json - Eliminado KEY_WORKING_URL y lógica de fallback - Código más simple y eficiente Archivos modificados: - app/src/main/java/com/streamplayer/EventRepository.java (simplificado) - app/src/main/java/com/streamplayer/MainActivity.java (scroll fix) - app/src/main/res/drawable/scrollbar_vertical.xml (más visible) - app/src/main/res/layout/activity_main.xml (scrollbar config) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
48
CHANGELOG-v10.1.5.md
Normal file
48
CHANGELOG-v10.1.5.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# StreamPlayer v10.1.5 - Correcciones Críticas
|
||||
|
||||
## Correcciones Implementadas
|
||||
|
||||
### 1. Scroll Listener Corregido
|
||||
- **Problema**: El último evento aparecía solo a la mitad y requería bajar/subir muchas veces para verlo completo
|
||||
- **Solución**: Cambiado de `findFirstVisibleItemPosition()` a `findLastCompletelyVisibleItemPosition()`
|
||||
- Ahora el scroll solo se detiene cuando el último elemento está COMPLETAMENTE visible
|
||||
|
||||
### 2. Barra de Scroll Más Visible
|
||||
- **Problema**: La barra indicadora no era visible (30% de opacidad)
|
||||
- **Solución**:
|
||||
- Opacidad aumentada de #4DFFFFFF (30%) a #CCFFFFFF (80%)
|
||||
- Ancho de la barra aumentado a 8dp
|
||||
- Radio de esquinas aumentado a 4dp para mejor apariencia
|
||||
- Estilo cambiado de `outsideOverlay` a `insideInset`
|
||||
- Agregado `scrollbarFadeDuration="0"` para que nunca se desvanezca
|
||||
|
||||
### 3. URLs Actualizadas
|
||||
- **Problema**: Ciertos ISP bloquean las URLs viejas
|
||||
- **Solución**: Eliminado sistema de fallback múltiples URLs
|
||||
- Ahora usa únicamente: `https://streamtp10.com/eventos.json`
|
||||
- Código simplificado, más eficiente y sin bloqueos
|
||||
|
||||
## Archivos Modificados
|
||||
|
||||
### EventRepository.java
|
||||
- Simplificado para usar solo streamtp10.com
|
||||
- Eliminado código de fallback no necesario
|
||||
- Eliminado KEY_WORKING_URL y lógica asociada
|
||||
|
||||
### MainActivity.java
|
||||
- Scroll listener corregido para usar `findLastCompletelyVisibleItemPosition()`
|
||||
|
||||
### scrollbar_vertical.xml
|
||||
- Color cambiado a #CCFFFFFF (80% opacidad)
|
||||
- Ancho definido en 8dp
|
||||
- Radio de esquinas a 4dp
|
||||
|
||||
### activity_main.xml
|
||||
- `scrollbarStyle` cambiado a `insideInset`
|
||||
- `scrollbarSize` definido en 8dp
|
||||
- `scrollbarFadeDuration` en 0 (siempre visible)
|
||||
|
||||
## Compatibilidad
|
||||
- Versión mínima de Android: API 21+
|
||||
- Compilado con SDK 34
|
||||
- Probado en Android TV con control remoto
|
||||
@@ -29,17 +29,10 @@ public class EventRepository {
|
||||
private static final String PREFS_NAME = "events_cache";
|
||||
private static final String KEY_JSON = "json";
|
||||
private static final String KEY_TIMESTAMP = "timestamp";
|
||||
private static final String KEY_WORKING_URL = "working_url";
|
||||
private static final long CACHE_DURATION = 24L * 60 * 60 * 1000; // 24 horas
|
||||
|
||||
// Lista de URLs a intentar en orden (con sistema de fallback)
|
||||
private static final String[] EVENT_URLS = {
|
||||
"https://streamtpcloud.com/eventos.json", // URL original
|
||||
"https://streamtp10.com/eventos.json", // URL actual
|
||||
"https://streamtpmedia.com/eventos.json" // URL anterior
|
||||
};
|
||||
|
||||
private static final String DEFAULT_EVENTS_URL = "https://streamtpcloud.com/eventos.json";
|
||||
// URL única para eventos (actualizado para evitar bloqueos de ISP)
|
||||
private static final String EVENTS_URL = "https://streamtp10.com/eventos.json";
|
||||
|
||||
public interface Callback {
|
||||
void onSuccess(List<EventItem> events);
|
||||
@@ -83,39 +76,7 @@ public class EventRepository {
|
||||
}
|
||||
|
||||
private String downloadJson(Context context) throws IOException {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
||||
String savedWorkingUrl = prefs.getString(KEY_WORKING_URL, null);
|
||||
|
||||
// Construir lista de URLs a intentar
|
||||
// Primero la URL que funcionó la última vez, luego el resto
|
||||
List<String> urlsToTry = new ArrayList<>();
|
||||
if (savedWorkingUrl != null && !savedWorkingUrl.isEmpty()) {
|
||||
urlsToTry.add(savedWorkingUrl);
|
||||
}
|
||||
for (String url : EVENT_URLS) {
|
||||
if (!urlsToTry.contains(url)) {
|
||||
urlsToTry.add(url);
|
||||
}
|
||||
}
|
||||
|
||||
IOException lastException = null;
|
||||
|
||||
// Intentar cada URL en orden
|
||||
for (String urlString : urlsToTry) {
|
||||
try {
|
||||
String json = downloadFromUrl(urlString);
|
||||
// Guardar la URL que funcionó
|
||||
prefs.edit().putString(KEY_WORKING_URL, urlString).apply();
|
||||
return json;
|
||||
} catch (IOException e) {
|
||||
lastException = e;
|
||||
// Continuar con la siguiente URL
|
||||
}
|
||||
}
|
||||
|
||||
// Si todas fallaron, lanzar la última excepción
|
||||
throw new IOException("No se pudo conectar a ninguna de las URLs disponibles. Último error: " +
|
||||
(lastException != null ? lastException.getMessage() : "Error desconocido"));
|
||||
return downloadFromUrl(EVENTS_URL);
|
||||
}
|
||||
|
||||
private String downloadFromUrl(String urlString) throws IOException {
|
||||
|
||||
@@ -194,16 +194,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
// Only prevent downward scroll when at the last item
|
||||
// Only prevent downward scroll when at the last COMPLETELY VISIBLE item
|
||||
if (dy > 0) { // Scrolling down
|
||||
int visibleItemCount = eventLayoutManager.getChildCount();
|
||||
int totalItemCount = eventLayoutManager.getItemCount();
|
||||
int firstVisibleItemPosition = eventLayoutManager.findFirstVisibleItemPosition();
|
||||
|
||||
// Check if we're at the last item
|
||||
if (firstVisibleItemPosition + visibleItemCount >= totalItemCount) {
|
||||
// Prevent further scrolling by stopping the scroll
|
||||
recyclerView.stopScroll();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +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="#4DFFFFFF" />
|
||||
<corners android:radius="2dp" />
|
||||
<solid android:color="#CCFFFFFF" />
|
||||
<corners android:radius="4dp" />
|
||||
<size android:width="8dp" />
|
||||
</shape>
|
||||
|
||||
@@ -129,8 +129,10 @@
|
||||
android:layout_weight="1"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="vertical"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:scrollbarStyle="insideInset"
|
||||
android:scrollbarThumbVertical="@drawable/scrollbar_vertical"
|
||||
android:scrollbarSize="8dp"
|
||||
android:scrollbarFadeDuration="0"
|
||||
android:nextFocusLeft="@id/section_list"
|
||||
tools:listitem="@layout/item_channel" />
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user