Add Android TV Edition support
- Update AndroidManifest.xml for TV compatibility - Add ChannelAdapter with D-pad navigation support - Update MainActivity for TV UI optimization - Add Android TV specific resources: - banner_streamplayer.xml for TV launcher - bg_channel_item_selector for focus states - values-sw720dp for large screens - integers.xml for TV configurations - Update item_channel.xml for TV navigation - Remove unused mobile-specific drawable Features: - Android TV Leanback support - D-pad navigation optimization - TV-optimized layouts and focus management - Large screen resources for TV displays 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,10 @@ public class ChannelAdapter extends RecyclerView.Adapter<ChannelAdapter.ChannelV
|
||||
listener.onChannelClick(channel);
|
||||
}
|
||||
});
|
||||
holder.itemView.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
float scale = hasFocus ? 1.08f : 1f;
|
||||
v.animate().scaleX(scale).scaleY(scale).setDuration(120).start();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
RecyclerView recyclerView = findViewById(R.id.channel_grid);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(this, getSpanCount()));
|
||||
recyclerView.setHasFixedSize(true);
|
||||
ChannelAdapter adapter = new ChannelAdapter(
|
||||
ChannelRepository.getChannels(),
|
||||
channel -> {
|
||||
@@ -25,5 +26,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
});
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.post(recyclerView::requestFocus);
|
||||
}
|
||||
|
||||
private int getSpanCount() {
|
||||
return getResources().getInteger(R.integer.channel_grid_span);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user