mirror of
https://github.com/akaessens/NoFbEventScraper
synced 2025-02-16 11:31:15 +01:00
restart scraping on activity restore
This commit is contained in:
parent
56300d78a3
commit
85e0d1ff24
@ -52,6 +52,25 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
EventAdapter adapter;
|
EventAdapter adapter;
|
||||||
LinearLayoutManager linear_layout_manager;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -214,11 +233,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
layout_uri_input.setError(null);
|
layout_uri_input.setError(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (scraper != null) {
|
||||||
scraper.cancel(true);
|
scraper.cancel(true);
|
||||||
scraper = null;
|
scraper = null;
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.events.clear();
|
this.events.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user