mirror of
https://github.com/akaessens/NoFbEventScraper
synced 2025-06-05 23:29:13 +02:00
restart scraping on activity restore
This commit is contained in:
@ -52,6 +52,25 @@ public class MainActivity extends AppCompatActivity {
|
||||
EventAdapter adapter;
|
||||
LinearLayoutManager linear_layout_manager;
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle state) {
|
||||
super.onRestoreInstanceState(state);
|
||||
|
||||
if (! state.getBoolean("events_empty") ) {
|
||||
startScraping();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle state) {
|
||||
super.onSaveInstanceState(state);
|
||||
|
||||
state.putBoolean("events_empty", events.isEmpty());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -214,11 +233,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
layout_uri_input.setError(null);
|
||||
}
|
||||
|
||||
try {
|
||||
if (scraper != null) {
|
||||
scraper.cancel(true);
|
||||
scraper = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.events.clear();
|
||||
|
Reference in New Issue
Block a user