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.input_url = input_url;
|
||||||
this.events = createEventList();
|
this.events = createEventList();
|
||||||
this.tasks = new ArrayList<>();
|
this.tasks = new ArrayList<>();
|
||||||
|
|
||||||
run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getPageUrl(String url) throws URISyntaxException, MalformedURLException {
|
protected String getPageUrl(String url) throws URISyntaxException, MalformedURLException {
|
||||||
|
|
|
@ -199,17 +199,21 @@ public class MainActivity extends AppCompatActivity {
|
||||||
* via "share to" or "open with"
|
* via "share to" or "open with"
|
||||||
*/
|
*/
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
Uri data = intent.getData();
|
|
||||||
String shared_text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
|
||||||
|
|
||||||
if (data != null) {
|
if (intent.getAction() != null) {
|
||||||
// opening external fb link
|
// only use this intent once, not every onCreate (e.g. rotation)
|
||||||
edit_text_uri_input.setText(data.toString());
|
intent.setAction(null);
|
||||||
startScraping();
|
Uri data = intent.getData();
|
||||||
} else if (shared_text != null) {
|
String shared_text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
//share to nofb
|
if (data != null) {
|
||||||
edit_text_uri_input.setText(shared_text);
|
// opening external fb link
|
||||||
startScraping();
|
edit_text_uri_input.setText(data.toString());
|
||||||
|
startScraping();
|
||||||
|
} else if (shared_text != null) {
|
||||||
|
//share to nofb
|
||||||
|
edit_text_uri_input.setText(shared_text);
|
||||||
|
startScraping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +227,8 @@ public class MainActivity extends AppCompatActivity {
|
||||||
String url = Objects.requireNonNull(edit_text_uri_input.getText()).toString();
|
String url = Objects.requireNonNull(edit_text_uri_input.getText()).toString();
|
||||||
|
|
||||||
scraper = new FbScraper(new WeakReference<>(this), url);
|
scraper = new FbScraper(new WeakReference<>(this), url);
|
||||||
|
|
||||||
|
scraper.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void input_helper(String str, boolean error) {
|
public void input_helper(String str, boolean error) {
|
||||||
|
|
Loading…
Reference in New Issue