+Description
+This application was developed to be used without a facebook account. Therefore it does not use the facebook API. Instead it opens the facebook event URI and downloads the website source code. This source contains the information which is used to create a calendar entry.
+Open Source
+The source code for this application is available at GitHub.
+If you encounter an issue, please report it to me anonymously at the Bugtracker or directly at GitHub.
+Donations
+I develop this application in my free time. If you like it, you can donate at PayPal.
+
\ No newline at end of file
diff --git a/app/src/main/assets/help.html b/app/src/main/assets/help.html
new file mode 100644
index 0000000..aded79a
--- /dev/null
+++ b/app/src/main/assets/help.html
@@ -0,0 +1,15 @@
+
+Help
+What links can be used with this app?
+All facebook subdomains are supported, whether mobile (m.facebook.com) or language-specific (de-de.facebook.com). The link must contain an event ID.
+How to use this application?
+
+ - Paste button: paste a copied link from the clipboard into the URL bar.
+ - Share to: Android's built-in share-function, e.g. from a browser.
+ - Open with: Android's built-in open-with-function, e.g. when clicking on a link in a messenger.
+
+Why does event X not work?
+This app relies on event information that is publicy available. If the event does not offer for example the location without a login, it will not be available in this application. Events with multiple instances are problematic because they do not provide the correct start and end date when scraping from m.facebook.com.
+If you encounter issues with a specific event, please let me know via the anonymous bugtracker or at the GitHub issue page.
+Is this compatible with my calendar app?
+Yes. This application makes use of application independent calendar functions, which makes it compatible to every calendar app. However, i recommend Etar Calendar because it is Open Source.
\ No newline at end of file
diff --git a/app/src/main/java/com/akdev/nofbeventscraper/AboutActivity.java b/app/src/main/java/com/akdev/nofbeventscraper/AboutActivity.java
index 59a7187..74c2fe3 100644
--- a/app/src/main/java/com/akdev/nofbeventscraper/AboutActivity.java
+++ b/app/src/main/java/com/akdev/nofbeventscraper/AboutActivity.java
@@ -1,5 +1,6 @@
package com.akdev.nofbeventscraper;
+import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
@@ -7,6 +8,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
+import android.webkit.WebView;
import android.widget.ImageView;
public class AboutActivity extends AppCompatActivity {
@@ -15,19 +17,14 @@ public class AboutActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
- this.getSupportActionBar().hide();
+ ActionBar action_bar = getSupportActionBar();
+ if (action_bar != null) {
+ action_bar.setDisplayHomeAsUpEnabled(true);
+ }
- ImageView img = (ImageView)findViewById(R.id.paypal_image);
+ WebView webview_about = findViewById(R.id.webview_about);
- img.setOnClickListener(new View.OnClickListener(){
- public void onClick(View v){
- Intent intent = new Intent();
- intent.setAction(Intent.ACTION_VIEW);
- intent.addCategory(Intent.CATEGORY_BROWSABLE);
- intent.setData(Uri.parse("https://www.paypal.me/andreaskaessens"));
- startActivity(intent);
- }
- });
+ webview_about.loadUrl("file:////android_asset/about.html");
}
diff --git a/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java b/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java
index 6835c0d..13511d5 100644
--- a/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java
+++ b/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java
@@ -1,9 +1,12 @@
package com.akdev.nofbeventscraper;
+import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.text.Editable;
import android.text.SpannableStringBuilder;
+import androidx.preference.PreferenceManager;
+
import org.json.JSONException;
import org.json.JSONObject;
import org.jsoup.Jsoup;
@@ -54,12 +57,21 @@ public class FbScraper extends AsyncTask {
// check for url format
new URL(url).toURI();
- Pattern pattern = Pattern.compile("(facebook.com/events/[0-9]*)");
+ String regex = "(facebook.com/events/[0-9]*)(/\\?event_time_id=[0-9]*)?";
+
+ Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(url);
if (matcher.find()) {
+
+ SharedPreferences shared_prefs = PreferenceManager.getDefaultSharedPreferences(main.get());
+ String url_prefix = shared_prefs.getString("url_preference", "m.facebook.com");
// rewrite url to m.facebook and dismiss any query strings or referrals
- return "https://m." + matcher.group(1);
+ String ret = url_prefix + matcher.group(1);
+ if (matcher.group(2) != null) {
+ ret += matcher.group(2);
+ }
+ return ret;
} else {
throw new URISyntaxException(url, "Does not contain event.");
}
diff --git a/app/src/main/java/com/akdev/nofbeventscraper/HelpActivity.java b/app/src/main/java/com/akdev/nofbeventscraper/HelpActivity.java
index ba60e18..4b18c2f 100644
--- a/app/src/main/java/com/akdev/nofbeventscraper/HelpActivity.java
+++ b/app/src/main/java/com/akdev/nofbeventscraper/HelpActivity.java
@@ -1,7 +1,9 @@
package com.akdev.nofbeventscraper;
import android.os.Bundle;
+import android.webkit.WebView;
+import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
public class HelpActivity extends AppCompatActivity {
@@ -10,6 +12,14 @@ public class HelpActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
- this.getSupportActionBar().hide();
+ ActionBar action_bar = getSupportActionBar();
+ if (action_bar != null) {
+ action_bar.setDisplayHomeAsUpEnabled(true);
+ }
+
+ WebView webview_help = findViewById(R.id.webview_help);
+
+ webview_help.loadUrl("file:////android_asset/help.html");
+
}
}
diff --git a/app/src/main/java/com/akdev/nofbeventscraper/MainActivity.java b/app/src/main/java/com/akdev/nofbeventscraper/MainActivity.java
index f1e9ed0..c776a9e 100644
--- a/app/src/main/java/com/akdev/nofbeventscraper/MainActivity.java
+++ b/app/src/main/java/com/akdev/nofbeventscraper/MainActivity.java
@@ -14,6 +14,7 @@ import android.widget.Button;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.appbar.AppBarLayout;
@@ -320,6 +321,12 @@ public class MainActivity extends AppCompatActivity {
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
+
+ if(menu instanceof MenuBuilder){
+ MenuBuilder m = (MenuBuilder) menu;
+ //noinspection RestrictedApi
+ m.setOptionalIconsVisible(true);
+ }
return true;
}
@@ -339,6 +346,10 @@ public class MainActivity extends AppCompatActivity {
startActivity(new Intent(this, HelpActivity.class));
return true;
}
+ if (id == R.id.action_settings) {
+ startActivity(new Intent(this, SettingsActivity.class));
+ return true;
+ }
return super.onOptionsItemSelected(item);
}
diff --git a/app/src/main/java/com/akdev/nofbeventscraper/SettingsActivity.java b/app/src/main/java/com/akdev/nofbeventscraper/SettingsActivity.java
new file mode 100644
index 0000000..9abe29a
--- /dev/null
+++ b/app/src/main/java/com/akdev/nofbeventscraper/SettingsActivity.java
@@ -0,0 +1,31 @@
+package com.akdev.nofbeventscraper;
+
+import android.os.Bundle;
+
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.PreferenceFragmentCompat;
+
+public class SettingsActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.settings_activity);
+ getSupportFragmentManager()
+ .beginTransaction()
+ .replace(R.id.settings, new SettingsFragment())
+ .commit();
+ ActionBar action_bar = getSupportActionBar();
+ if (action_bar != null) {
+ action_bar.setDisplayHomeAsUpEnabled(true);
+ }
+ }
+
+ public static class SettingsFragment extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.root_preferences, rootKey);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_help.xml b/app/src/main/res/drawable/ic_help.xml
new file mode 100644
index 0000000..b57246a
--- /dev/null
+++ b/app/src/main/res/drawable/ic_help.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_info.xml b/app/src/main/res/drawable/ic_info.xml
new file mode 100644
index 0000000..3599bbc
--- /dev/null
+++ b/app/src/main/res/drawable/ic_info.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml
new file mode 100644
index 0000000..74c4188
--- /dev/null
+++ b/app/src/main/res/drawable/ic_settings.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/paypal.png b/app/src/main/res/drawable/paypal.png
deleted file mode 100644
index 59f1840..0000000
Binary files a/app/src/main/res/drawable/paypal.png and /dev/null differ
diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml
index 40d6164..e25fb2e 100644
--- a/app/src/main/res/layout/activity_about.xml
+++ b/app/src/main/res/layout/activity_about.xml
@@ -1,97 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_help.xml b/app/src/main/res/layout/activity_help.xml
index ea958d5..61743fa 100644
--- a/app/src/main/res/layout/activity_help.xml
+++ b/app/src/main/res/layout/activity_help.xml
@@ -1,76 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/settings_activity.xml b/app/src/main/res/layout/settings_activity.xml
new file mode 100644
index 0000000..de6591a
--- /dev/null
+++ b/app/src/main/res/layout/settings_activity.xml
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index 68241f8..c233aeb 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -4,12 +4,17 @@
tools:context="com.akdev.nofbeventscraper.MainActivity">
+
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
new file mode 100644
index 0000000..3ff6f6f
--- /dev/null
+++ b/app/src/main/res/values/arrays.xml
@@ -0,0 +1,13 @@
+
+
+
+ - m.facebook.com
+ - www.facebook.com
+
+
+
+ - https://m.
+ - https://www.
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 976356c..04c205f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2,34 +2,18 @@
NoFb Event Scraper
About
Help
+ Settings
Event link
Paste facebook link to the event.
Add to calendar
Paste from clipboard
- Description
- This application was developed to be used without a facebook account.
- \nTherefore it does not use the facebook API.
- Instead it opens the facebook event URI and downloads the website source code.
- This source contains the information which is used to create a calendar entry.
+
+ Scraper
+
+ Which URL to scrape
+
+ Using m.facebook.com is more stable and faster. Using www.facebook.com gives high-res images and works better with mutiple instance events but will eventually break when facebook disables the classic design.
- Open Source
- The source code for this application can be found at https://github.com/akaessens/NoFbEventScraper .
-
- Report a bug
- If you encounter a bug please report it to me anonymously at https://gitreports.com/issue/akaessens/NoFbEventScraper or directly at Github with the link above.
-
- FAQ
- What links can be used with this app?
- All facebook subdomains are supported, whether mobile (m.facebook.com) or language-specific (de-de.facebook.com). The link must contain an event ID.
- How to use this application?
- You can use the paste button to paste a previously copied link into the URL bar.
- Alternatively you can use the "share" function e.g. from the Android browser.
- A third option is to click on a facebook link and use the "open with"-dialog.
- Why does event X not work?
- Current limitations are events in the past or events with multiple instances. If you find some other event that does not work, please let me know.
-
- Donations
- Click on the PayPal image to send me a coffee if you like :)
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
new file mode 100644
index 0000000..a10c5f6
--- /dev/null
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file