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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user