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;
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue