Feature: boton para actualizar eventos manualmente (v10.1.1)
This commit is contained in:
@@ -8,6 +8,7 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@@ -32,6 +33,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private ProgressBar loadingIndicator;
|
||||
private TextView messageView;
|
||||
private TextView contentTitle;
|
||||
private Button refreshButton;
|
||||
|
||||
private ChannelAdapter channelAdapter;
|
||||
private EventAdapter eventAdapter;
|
||||
@@ -57,6 +59,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
loadingIndicator = findViewById(R.id.loading_indicator);
|
||||
messageView = findViewById(R.id.message_view);
|
||||
contentTitle = findViewById(R.id.content_title);
|
||||
refreshButton = findViewById(R.id.refresh_button);
|
||||
|
||||
refreshButton.setOnClickListener(v -> {
|
||||
loadEvents(true);
|
||||
Toast.makeText(this, "Actualizando eventos...", Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
channelAdapter = new ChannelAdapter(
|
||||
channel -> openPlayer(channel.getName(), channel.getPageUrl()));
|
||||
@@ -158,6 +166,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void showChannels(SectionEntry section) {
|
||||
contentTitle.setText(section.title);
|
||||
refreshButton.setVisibility(View.GONE);
|
||||
contentList.setLayoutManager(channelLayoutManager);
|
||||
contentList.setAdapter(channelAdapter);
|
||||
loadingIndicator.setVisibility(View.GONE);
|
||||
@@ -173,6 +182,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void showEvents() {
|
||||
contentTitle.setText(currentSection != null ? currentSection.title : getString(R.string.section_events));
|
||||
refreshButton.setVisibility(View.VISIBLE);
|
||||
contentList.setLayoutManager(eventLayoutManager);
|
||||
contentList.setAdapter(eventAdapter);
|
||||
if (cachedEvents.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user