fix oncreate scraping multiple events with same intent
This commit is contained in:
parent
626128b5dc
commit
5e7d9bc4dc
|
@ -36,8 +36,6 @@ public class FbScraper {
|
|||
this.input_url = input_url;
|
||||
this.events = createEventList();
|
||||
this.tasks = new ArrayList<>();
|
||||
|
||||
run();
|
||||
}
|
||||
|
||||
protected String getPageUrl(String url) throws URISyntaxException, MalformedURLException {
|
||||
|
|
|
@ -199,9 +199,12 @@ public class MainActivity extends AppCompatActivity {
|
|||
* via "share to" or "open with"
|
||||
*/
|
||||
Intent intent = getIntent();
|
||||
|
||||
if (intent.getAction() != null) {
|
||||
// only use this intent once, not every onCreate (e.g. rotation)
|
||||
intent.setAction(null);
|
||||
Uri data = intent.getData();
|
||||
String shared_text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
|
||||
if (data != null) {
|
||||
// opening external fb link
|
||||
edit_text_uri_input.setText(data.toString());
|
||||
|
@ -212,6 +215,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
startScraping();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* launch the FbScraper asynchronous task with the current text in the input text field.
|
||||
|
@ -223,6 +227,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
String url = Objects.requireNonNull(edit_text_uri_input.getText()).toString();
|
||||
|
||||
scraper = new FbScraper(new WeakReference<>(this), url);
|
||||
|
||||
scraper.run();
|
||||
}
|
||||
|
||||
public void input_helper(String str, boolean error) {
|
||||
|
|
Loading…
Reference in New Issue