Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
c43911fc77 | |||
3cbfc9b9c1 | |||
71169dae76 | |||
5b412733b4 | |||
a3f2990c61 | |||
1c112f3e4e | |||
2faf8aa003 | |||
643ac62788 | |||
d5e12c4d88 | |||
320d1787aa | |||
c7a4d9b027 | |||
bb1e7579d8 | |||
ba2ec36666 | |||
81fd1f3ebb | |||
8b5263db63 | |||
76f56434e8 | |||
9540b252a5 | |||
7a44e467f0 | |||
1570742462 | |||
0950da98e1 | |||
15ef35ba6c | |||
55e7ad44d8 | |||
2d3d2a2ab6 | |||
dd36c1fb00 | |||
268a6bc650 | |||
f9a711300e | |||
793a9e3549 | |||
ec62cb6347 | |||
023b7f951a | |||
4e319d3807 | |||
41eac31dba | |||
6c0c2d23fe | |||
16d390094e | |||
05f3ba9a33 | |||
57b00e2e57 |
40
CHANGELOG.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Changelog
|
||||
## v0.3.3 (9)
|
||||
- Update about section with download and changelog information.
|
||||
- Improve high-res preview scraping.
|
||||
- Fix potential crash on calendar intent.
|
||||
## v0.3.2 (8)
|
||||
- Add german translation.
|
||||
- Decrease MinSDK to 23 (Android 6.0).
|
||||
- Replace Date implementation.
|
||||
- Enable Dark Mode for WebViews.
|
||||
- Add high-res preview for www prefix.
|
||||
## v0.3.1 (7)
|
||||
- Fix invalid default uri.
|
||||
- Update about section.
|
||||
## v0.3.0 (6)
|
||||
- Rework help and about.
|
||||
- Add settings with URL prefix selector.
|
||||
- Add Maps button for location.
|
||||
- Disable text field inputs - all fields can be edited in the calendar app.
|
||||
- Change date/time format to RFC standard.
|
||||
- Minor interface changes.
|
||||
- Code cleanup and refactoring.
|
||||
- Add code documentation.
|
||||
## v0.2.2 (5)
|
||||
- Fix for event links with querystrings.
|
||||
- New icon and banner as default toolbar image.
|
||||
## v0.2.1 (4)
|
||||
- Fixes for new design.
|
||||
- New button layout.
|
||||
- Improve input error display.
|
||||
## v0.2.0 (3)
|
||||
- Fix for timezone calculation.
|
||||
- Material design Interface, will be improved further.
|
||||
- Display the event picture in the toolbar.
|
||||
## v0.1.1 (2)
|
||||
- Added help and reports section.
|
||||
- Fix for some locations not scraped correctly.
|
||||
- Resolve fb-internal links.
|
||||
## v0.1.0 (1)
|
||||
- Initial release.
|
33
README.md
@ -1,18 +1,37 @@
|
||||

|
||||
[](https://github.com/akaessens/NoFbEventScraper/actions)
|
||||
[](https://github.com/akaessens/NoFbEventScraper/blob/master/LICENSE)
|
||||
[](https://github.com/akaessens/NoFbEventScraper/releases/latest)
|
||||
[](https://f-droid.org/en/packages/com.akdev.nofbeventscraper)
|
||||
|
||||
# NoFb Event Scraper
|
||||
|
||||
This application was developed to be used without a facebook account.
|
||||
<img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/featureGraphic.png" alt="Feature Graphic" width="max-width">
|
||||
|
||||
Therefore it does not use the facebook API.
|
||||
Instead it opens the facebook event URI and downloads the website source code.
|
||||
# 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.
|
||||
|
||||
# Download
|
||||
Currently this application is in the submitting process to FDroid. see also [#2](/../../issues/2).
|
||||
|
||||
Until it is published at FDroid, use [release v0.2.2](https://github.com/akaessens/NoFbEventScraper/releases/download/v0.2.2/app-release.apk).
|
||||
<a href="https://f-droid.org/en/packages/com.akdev.nofbeventscraper">
|
||||
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="75">
|
||||
</a>
|
||||
|
||||
# Building
|
||||
|
||||
This Android app is written in Java and is using the Gradle build system. To compile it, i recommend using Android Studio.
|
||||
```
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
# Screenshots
|
||||
|
||||
<img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" alt="Screenshot 1" width="200"> <img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" alt="Screenshot 2" width="200"> <img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" alt="Screenshot 3" width="200"> <img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" alt="Screenshot 4" width="200">
|
||||
|
||||
# Donations
|
||||
I develop this application in my free time. If you like it, you can donate at <a href="https://www.paypal.me/andreaskaessens">PayPal</a>.
|
||||
|
||||
<a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png" height="75" /></a>
|
@ -6,10 +6,10 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.akdev.nofbeventscraper"
|
||||
minSdkVersion 26
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 5
|
||||
versionName "0.2.2"
|
||||
versionCode 9
|
||||
versionName "0.3.3"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -30,7 +30,6 @@ dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
||||
|
||||
@ -38,8 +37,11 @@ dependencies {
|
||||
implementation 'org.jsoup:jsoup:1.13.1'
|
||||
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
|
||||
implementation "androidx.webkit:webkit:1.3.0"
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
}
|
||||
|
@ -1,110 +0,0 @@
|
||||
package com.akdev.nofbeventscraper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Instrumentation;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class MainActivityUnitTest {
|
||||
|
||||
@Test
|
||||
public void TestSubdomainUrl() {
|
||||
|
||||
|
||||
Instrumentation mInstrumentation = getInstrumentation();
|
||||
// We register our interest in the activity
|
||||
Instrumentation.ActivityMonitor monitor = mInstrumentation.addMonitor(MainActivity.class.getName(), null, false);
|
||||
// We launch it
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setClassName(mInstrumentation.getTargetContext(), MainActivity.class.getName());
|
||||
mInstrumentation.startActivitySync(intent);
|
||||
|
||||
MainActivity mainActivity = (MainActivity) getInstrumentation().waitForMonitor(monitor);
|
||||
|
||||
// We register our interest in the next activity from the sequence in this use case
|
||||
mInstrumentation.removeMonitor(monitor);
|
||||
|
||||
|
||||
final String exp = "https://m.facebook.com/events/261145401687844";
|
||||
|
||||
String url = "https://www.facebook.com/events/261145401687844";
|
||||
String act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
|
||||
url = "https://de-de.facebook.com/events/261145401687844";
|
||||
act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
|
||||
url = "https://m.facebook.com/events/261145401687844";
|
||||
act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
|
||||
url = "https://www.facebook.com/events/261145401687844/?active_tab=discussion";
|
||||
act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
|
||||
url = "https://www.facebook.com/events/261145401687844?reflink_something";
|
||||
act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTimeToEpoch() {
|
||||
|
||||
|
||||
Instrumentation mInstrumentation = getInstrumentation();
|
||||
// We register our interest in the activity
|
||||
Instrumentation.ActivityMonitor monitor = mInstrumentation.addMonitor(MainActivity.class.getName(), null, false);
|
||||
// We launch it
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setClassName(mInstrumentation.getTargetContext(), MainActivity.class.getName());
|
||||
mInstrumentation.startActivitySync(intent);
|
||||
|
||||
MainActivity mainActivity = (MainActivity) getInstrumentation().waitForMonitor(monitor);
|
||||
|
||||
// We register our interest in the next activity from the sequence in this use case
|
||||
mInstrumentation.removeMonitor(monitor);
|
||||
|
||||
|
||||
String in = "2020-07-29T12:00:00+00:00";
|
||||
|
||||
Long exp = new Long(1596024000);
|
||||
exp = exp* 1000;
|
||||
Long act = mainActivity.convertTimeToEpoch(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
|
||||
in = "2020-07-29T12:00:00+02:00";
|
||||
exp = new Long(1596016800);
|
||||
exp = exp* 1000;
|
||||
act = mainActivity.convertTimeToEpoch(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
|
||||
in = "1970-01-01T00:00:00+00:00";
|
||||
exp = new Long(0);
|
||||
exp = exp* 1000;
|
||||
act = mainActivity.convertTimeToEpoch(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
in = "1970-01-01T02:00:00+02:00";
|
||||
exp = new Long(0);
|
||||
exp = exp* 1000;
|
||||
act = mainActivity.convertTimeToEpoch(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -5,13 +5,19 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ScraperUnitTest {
|
||||
|
||||
@Test
|
||||
public void TestLocation() {
|
||||
public void testLocation() {
|
||||
|
||||
|
||||
FbScraper scraper = new FbScraper(null, "");
|
||||
|
||||
@ -32,37 +38,51 @@ public class ScraperUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTimezone() {
|
||||
public void testTimezone() {
|
||||
|
||||
FbScraper scraper = new FbScraper(null, "");
|
||||
|
||||
String exp = "2020-10-23T05:00:00+02:00";
|
||||
String in = "2020-10-23T05:00:00+0200";
|
||||
String act = scraper.fixTimezone(in);
|
||||
String in = "2020-01-01T12:00:00+0100";
|
||||
String exp = "Mi., 01 Jan. 2020 12:00 MEZ";
|
||||
|
||||
String act = FbEvent.dateTimeToString(scraper.parseToDate(in));
|
||||
assertEquals(exp, act);
|
||||
|
||||
|
||||
exp = "";
|
||||
in = "";
|
||||
act = scraper.fixTimezone(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
String act2 = FbEvent.dateTimeToString(scraper.parseToDate(in));
|
||||
assertEquals(exp, act2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestLinks() {
|
||||
public void testDescriptionLinks() {
|
||||
|
||||
FbScraper scraper = new FbScraper(null, "");
|
||||
|
||||
String in = "foo @[152580919265:274:MagentaMusik 360] bar";
|
||||
String exp = "foo MagentaMusik 360 [m.facebook.com/152580919265] bar";
|
||||
String act = scraper.fixLinks(in);
|
||||
String act = scraper.fixDescriptionLinks(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
in = "foo @[152580919265:274:MagentaMusik 360] bar @[666666666666:274:NoOfTheBeast]";
|
||||
exp = "foo MagentaMusik 360 [m.facebook.com/152580919265] bar NoOfTheBeast [m.facebook.com/666666666666]";
|
||||
act = scraper.fixLinks(in);
|
||||
act = scraper.fixDescriptionLinks(in);
|
||||
assertEquals(exp, act);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testURI() throws MalformedURLException, URISyntaxException {
|
||||
|
||||
FbScraper scraper = new FbScraper(null, "");
|
||||
|
||||
String in = "https://www.facebook.com/events/1234324522341432?refsomething";
|
||||
String exp = "https://m.facebook.com/events/1234324522341432";
|
||||
String act = scraper.fixURI(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
in = "https://de-de.facebook.com/events/1234324522341432/?active_tab=discussion";
|
||||
act = scraper.fixURI(in);
|
||||
assertEquals(exp, act);
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,31 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".AboutActivity"></activity>
|
||||
<activity android:name=".HelpActivity"></activity>
|
||||
|
||||
<activity android:name=".SettingsActivity"
|
||||
android:label="@string/action_settings" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".MainActivity"/>
|
||||
</activity>
|
||||
<activity android:name=".HelpActivity"
|
||||
android:label="@string/action_help" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".MainActivity"/>
|
||||
</activity>
|
||||
<activity android:name=".AboutActivity"
|
||||
android:label="@string/action_about" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".MainActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.akdev.nofbeventscraper;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.webkit.WebSettingsCompat;
|
||||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
public class AboutActivity extends AppCompatActivity {
|
||||
|
||||
@ -15,19 +15,21 @@ 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);
|
||||
int night_mode_flags = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (night_mode_flags == Configuration.UI_MODE_NIGHT_YES) {
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
|
||||
WebSettingsCompat.setForceDark(webview_about.getSettings(),
|
||||
WebSettingsCompat.FORCE_DARK_ON);
|
||||
}
|
||||
});
|
||||
}
|
||||
webview_about.loadUrl("file:///android_res/raw/about.html");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,14 +1,27 @@
|
||||
package com.akdev.nofbeventscraper;
|
||||
|
||||
public class FbEvent {
|
||||
public String name;
|
||||
public String start_date;
|
||||
public String end_date;
|
||||
public String description;
|
||||
public String location;
|
||||
public String image_url;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public FbEvent (String name, String start_date, String end_date, String description, String location, String image_url) {
|
||||
/**
|
||||
* Objects of this class store immutable information about
|
||||
* a single event that was created by the FbScraper.
|
||||
*/
|
||||
public class FbEvent {
|
||||
|
||||
public final String url;
|
||||
public final String name;
|
||||
public final Date start_date;
|
||||
public final Date end_date;
|
||||
public final String description;
|
||||
public final String location;
|
||||
public final String image_url;
|
||||
|
||||
|
||||
public FbEvent(String url, String name, Date start_date, Date end_date,
|
||||
String description, String location, String image_url) {
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
this.start_date = start_date;
|
||||
this.end_date = end_date;
|
||||
@ -16,4 +29,34 @@ public class FbEvent {
|
||||
this.location = location;
|
||||
this.image_url = image_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts datetime to epoch.
|
||||
*
|
||||
* @param date Date object
|
||||
* @return Event begin time in milliseconds from the epoch for calendar intent or null
|
||||
*/
|
||||
static Long dateTimeToEpoch(Date date) {
|
||||
try {
|
||||
return date.getTime();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a locally formatted String representation of a Date
|
||||
*
|
||||
* @param date
|
||||
* @return locally formatted String of date or empty String
|
||||
*/
|
||||
static String dateTimeToString(Date date) {
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm z",
|
||||
Locale.getDefault());
|
||||
return formatter.format(date);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
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;
|
||||
@ -11,70 +11,150 @@ import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* This class can asynchronously scrape public facebook events
|
||||
* and gather the most important information. It is stored in a FbEvent object.
|
||||
*/
|
||||
public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private String url;
|
||||
private String error;
|
||||
private MainActivity main;
|
||||
private int error;
|
||||
private String input_url;
|
||||
private WeakReference<MainActivity> main; // no context leak with WeakReference
|
||||
private FbEvent event;
|
||||
|
||||
FbScraper(MainActivity main, String url) {
|
||||
this.url = url;
|
||||
/**
|
||||
* Constructor with WeakReference to the main activity, to update it's text fields.
|
||||
*
|
||||
* @param main WeakReference of main activity to prevent context leak
|
||||
* @param input_url Input url to scrape from
|
||||
*/
|
||||
FbScraper(WeakReference<MainActivity> main, String input_url) {
|
||||
this.main = main;
|
||||
this.input_url = input_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the facebook event link of the input url.
|
||||
*
|
||||
* @param url input url
|
||||
* @return facebook event url String if one was found
|
||||
* @throws URISyntaxException if event not found
|
||||
* @throws MalformedURLException
|
||||
*/
|
||||
protected String fixURI(String url) throws URISyntaxException, MalformedURLException {
|
||||
|
||||
// check for url format
|
||||
new URL(url).toURI();
|
||||
|
||||
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()) {
|
||||
|
||||
String url_prefix = "https://m.";
|
||||
if (main != null) {
|
||||
SharedPreferences shared_prefs = PreferenceManager.getDefaultSharedPreferences(main.get());
|
||||
url_prefix = shared_prefs.getString("url_preference", url_prefix);
|
||||
}
|
||||
|
||||
// rewrite url to m.facebook and dismiss any query strings or referrals
|
||||
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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the event location from the json string.
|
||||
* This can be a name only or a complete postal address.
|
||||
*
|
||||
* @param location_json JSON formatted string
|
||||
* @return String representation of the location.
|
||||
*/
|
||||
protected String fixLocation(String location_json) {
|
||||
|
||||
String name = "";
|
||||
String location_name = "";
|
||||
|
||||
try {
|
||||
JSONObject reader = new JSONObject(location_json);
|
||||
|
||||
name = reader.getString("name");
|
||||
location_name = reader.getString("name");
|
||||
JSONObject address = reader.getJSONObject("address");
|
||||
|
||||
String type = address.getString("@type");
|
||||
|
||||
if (type.equals("PostalAddress"))
|
||||
{
|
||||
if (type.equals("PostalAddress")) {
|
||||
String postal_code = address.getString("postalCode");
|
||||
String address_locality = address.getString("addressLocality");
|
||||
String address_country = address.getString("addressCountry");
|
||||
String street_address = address.getString("streetAddress");
|
||||
// included in locality
|
||||
//String address_country = address.getString("addressCountry");
|
||||
|
||||
return name + ", " + street_address + ", " + postal_code + " " + address_locality;
|
||||
return location_name + ", "
|
||||
+ street_address + ", "
|
||||
+ postal_code + " "
|
||||
+ address_locality;
|
||||
} else {
|
||||
return location_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
return name;
|
||||
return location_name;
|
||||
}
|
||||
}
|
||||
|
||||
protected String fixTimezone(String time_in) {
|
||||
/**
|
||||
* Parses a time string from the facebook event into a Date
|
||||
*
|
||||
* @param time_in time string from the event
|
||||
* @return Date parsed from input or null
|
||||
*/
|
||||
protected Date parseToDate(String time_in) {
|
||||
|
||||
try {
|
||||
// parse e.g. 2011-12-03T10:15:30+0100
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.getDefault());
|
||||
|
||||
Editable editable = new SpannableStringBuilder(time_in);
|
||||
|
||||
return editable.insert(22, ":").toString();
|
||||
return sdf.parse(time_in);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String fixLinks(String description_in) {
|
||||
/**
|
||||
* Replaces all occurrences of a facebook internal links in
|
||||
* an event description into an actual URL.
|
||||
*
|
||||
* @param description_in description string from the event
|
||||
* @return corrected String with internal links resolved
|
||||
*/
|
||||
protected String fixDescriptionLinks(String description_in) {
|
||||
try {
|
||||
// @[152580919265:274:MagentaMusik 360] -> m.facebook.com/152580919265
|
||||
return description_in.replaceAll("@\\[([0-9]{10,}):[0-9]{3}:([^\\]]*)\\]",
|
||||
/* @[152580919265:274:SiteDescription]
|
||||
* to
|
||||
* SiteDescription [m.facebook.com/152580919265] */
|
||||
|
||||
return description_in.replaceAll("@\\[([0-9]{10,}):[0-9]{3}:([^]]*)]",
|
||||
"$2 [m.facebook.com/$1]");
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -83,63 +163,82 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a single field from a JSONObject
|
||||
*
|
||||
* @param reader JSONObject to read from
|
||||
* @param field Which field to read
|
||||
* @return String of the value of the field or empty string
|
||||
*/
|
||||
private String readFromJson(JSONObject reader, String field) {
|
||||
try {
|
||||
return reader.getString(field);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Started by scraper.execute().
|
||||
* Gets the HTML doc from the input string and scrapes the event information from it.
|
||||
*
|
||||
* @param voids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
|
||||
Document document = null;
|
||||
|
||||
try {
|
||||
document = Jsoup.connect(url).userAgent("Mozilla").get();
|
||||
String url = fixURI(input_url);
|
||||
// use default android user agent
|
||||
String user_agent = "Mozilla/5.0 (X11; Linux x86_64)";
|
||||
Document document = Jsoup.connect(url).userAgent(user_agent).get();
|
||||
|
||||
if (document == null) {
|
||||
throw new IOException();
|
||||
}
|
||||
String json = document
|
||||
.select("script[type = application/ld+json]")
|
||||
.first().data();
|
||||
|
||||
JSONObject reader = new JSONObject(json);
|
||||
|
||||
|
||||
String name = readFromJson(reader, "name");
|
||||
Date start_date = parseToDate(readFromJson(reader, "startDate"));
|
||||
Date end_date = parseToDate(readFromJson(reader, "endDate"));
|
||||
String description = fixDescriptionLinks(readFromJson(reader, "description"));
|
||||
String location = fixLocation(readFromJson(reader, "location"));
|
||||
|
||||
String image_url = readFromJson(reader, "image"); // get from json
|
||||
|
||||
try {
|
||||
String json = document.select("script[type = application/ld+json]").first().data();
|
||||
|
||||
JSONObject reader = new JSONObject(json);
|
||||
|
||||
String event_name = readFromJson(reader, "name");
|
||||
String event_start = fixTimezone(readFromJson(reader, "startDate"));
|
||||
String event_end = fixTimezone(readFromJson(reader, "endDate"));
|
||||
|
||||
String event_description = fixLinks(readFromJson(reader, "description"));
|
||||
String location = fixLocation(readFromJson(reader, "location"));
|
||||
|
||||
String image_url = "";
|
||||
|
||||
try {
|
||||
image_url = readFromJson(reader, "image"); // get from json
|
||||
|
||||
// get from event header
|
||||
image_url = document.getElementsByClass("scaledImageFitWidth").first().attr("src");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.error = "Error: no image found";
|
||||
}
|
||||
|
||||
if (event_name == null) {
|
||||
this.event = null;
|
||||
throw new Exception();
|
||||
} else {
|
||||
this.event = new FbEvent(event_name, event_start, event_end, event_description, location, image_url);
|
||||
//this.event = new FbEvent("", "", "", "", "", "");
|
||||
}
|
||||
// possibly get higher res image from event header
|
||||
image_url = document.select("div[id=event_header_primary]")
|
||||
.select("img").first().attr("src");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.error = "Error: Scraping event data failed";
|
||||
// ignore
|
||||
}
|
||||
|
||||
event = new FbEvent(url, name, start_date, end_date, description, location, image_url);
|
||||
|
||||
|
||||
} catch (URISyntaxException | MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
this.error = R.string.error_url;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
this.error = R.string.error_scraping;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
this.error = R.string.error_connection;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.error = "Error: URL not available";
|
||||
this.error = R.string.error_unknown;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -148,15 +247,22 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||
super.onPreExecute();
|
||||
}
|
||||
|
||||
/**
|
||||
* When scraping is finished, main activity will be updated.
|
||||
* If an error occurred, main activity is given an error string.
|
||||
*
|
||||
* @param aVoid
|
||||
*/
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
|
||||
if (this.event != null) {
|
||||
this.main.update(event);
|
||||
}
|
||||
else {
|
||||
main.error(error);
|
||||
this.main.clear(false);
|
||||
if (main != null) {
|
||||
if (this.event != null) {
|
||||
main.get().update(event);
|
||||
} else {
|
||||
main.get().error(error);
|
||||
main.get().clear(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
package com.akdev.nofbeventscraper;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.webkit.WebSettingsCompat;
|
||||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
public class HelpActivity extends AppCompatActivity {
|
||||
|
||||
@ -10,6 +15,24 @@ 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);
|
||||
|
||||
int night_mode_flags = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (night_mode_flags == Configuration.UI_MODE_NIGHT_YES) {
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
|
||||
WebSettingsCompat.setForceDark(webview_help.getSettings(),
|
||||
WebSettingsCompat.FORCE_DARK_ON);
|
||||
}
|
||||
}
|
||||
|
||||
webview_help.loadUrl("file:////android_res/raw/help.html");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,11 @@
|
||||
package com.akdev.nofbeventscraper;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.provider.CalendarContract;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
@ -19,30 +14,41 @@ import android.view.View;
|
||||
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;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.net.URL;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.akdev.nofbeventscraper.FbEvent.dateTimeToEpoch;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Button paste_button;
|
||||
private Button ok_button;
|
||||
protected Button ok_button;
|
||||
protected Button paste_button;
|
||||
|
||||
private TextInputEditText field_uri_input;
|
||||
private TextInputEditText field_event_name;
|
||||
private TextInputEditText field_event_start;
|
||||
private TextInputEditText field_event_end;
|
||||
private TextInputEditText field_event_location;
|
||||
private TextInputEditText field_event_description;
|
||||
private ImageView toolbar_image_view;
|
||||
private CollapsingToolbarLayout toolbar_layout;
|
||||
private TextInputLayout input_layout;
|
||||
protected TextInputEditText edit_text_uri_input;
|
||||
protected TextInputEditText edit_text_event_name;
|
||||
protected TextInputEditText edit_text_event_start;
|
||||
protected TextInputEditText edit_text_event_end;
|
||||
protected TextInputEditText edit_text_event_location;
|
||||
protected TextInputEditText edit_text_event_description;
|
||||
|
||||
private FbScraper scraper;
|
||||
protected TextInputLayout layout_uri_input;
|
||||
protected TextInputLayout layout_event_location;
|
||||
|
||||
protected ImageView image_view_toolbar;
|
||||
protected CollapsingToolbarLayout layout_toolbar;
|
||||
|
||||
protected FbScraper scraper;
|
||||
protected FbEvent event;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -54,108 +60,134 @@ public class MainActivity extends AppCompatActivity {
|
||||
ok_button = (Button) findViewById(R.id.ok_button);
|
||||
paste_button = (Button) findViewById(R.id.paste_button);
|
||||
|
||||
field_uri_input = (TextInputEditText) findViewById(R.id.field_uri_input);
|
||||
input_layout = (TextInputLayout) findViewById(R.id.textInputLayout);
|
||||
field_event_name = (TextInputEditText) findViewById(R.id.field_event_name);
|
||||
field_event_start = (TextInputEditText) findViewById(R.id.field_event_start);
|
||||
field_event_end = (TextInputEditText) findViewById(R.id.field_event_end);
|
||||
field_event_location = (TextInputEditText) findViewById(R.id.field_event_location);
|
||||
field_event_description = (TextInputEditText) findViewById(R.id.field_event_description);
|
||||
toolbar_image_view = (ImageView) findViewById(R.id.image_view);
|
||||
toolbar_layout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
|
||||
edit_text_uri_input = (TextInputEditText) findViewById(R.id.edit_text_uri_input);
|
||||
edit_text_event_name = (TextInputEditText) findViewById(R.id.edit_text_event_name);
|
||||
edit_text_event_start = (TextInputEditText) findViewById(R.id.edit_text_event_start);
|
||||
edit_text_event_end = (TextInputEditText) findViewById(R.id.edit_text_event_end);
|
||||
edit_text_event_location = (TextInputEditText) findViewById(R.id.edit_text_event_location);
|
||||
edit_text_event_description = (TextInputEditText) findViewById(R.id.edit_text_event_description);
|
||||
|
||||
layout_uri_input = (TextInputLayout) findViewById(R.id.layout_uri_input);
|
||||
layout_event_location = (TextInputLayout) findViewById(R.id.layout_event_location);
|
||||
layout_toolbar = (CollapsingToolbarLayout) findViewById(R.id.layout_toolbar);
|
||||
image_view_toolbar = (ImageView) findViewById(R.id.image_view);
|
||||
|
||||
|
||||
/*
|
||||
* Default view settings
|
||||
*/
|
||||
ok_button.setEnabled(false);
|
||||
layout_event_location.setEndIconVisible(false);
|
||||
image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);
|
||||
|
||||
toolbar_image_view.setImageResource(R.drawable.ic_banner_foreground);
|
||||
|
||||
/*
|
||||
* Display title only when toolbar is collapsed
|
||||
*/
|
||||
AppBarLayout app_bar_layout = (AppBarLayout) findViewById(R.id.app_bar);
|
||||
app_bar_layout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
boolean isShow = true;
|
||||
int scrollRange = -1;
|
||||
boolean show = true;
|
||||
int scroll_range = -1;
|
||||
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||
if (scrollRange == -1) {
|
||||
scrollRange = appBarLayout.getTotalScrollRange();
|
||||
public void onOffsetChanged(AppBarLayout app_bar_layout, int vertical_offset) {
|
||||
if (scroll_range == -1) {
|
||||
scroll_range = app_bar_layout.getTotalScrollRange();
|
||||
}
|
||||
if (scrollRange + verticalOffset == 0) {
|
||||
toolbar_layout.setTitle(getString(R.string.app_name));
|
||||
isShow = true;
|
||||
} else if(isShow) {
|
||||
toolbar_layout.setTitle(" ");
|
||||
isShow = false;
|
||||
if (scroll_range + vertical_offset == 0) {
|
||||
layout_toolbar.setTitle(getString(R.string.app_name));
|
||||
show = true;
|
||||
} else if (show) {
|
||||
layout_toolbar.setTitle(" ");
|
||||
show = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Paste button: get last entry from clipboard
|
||||
*/
|
||||
paste_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
try {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String str = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
|
||||
String str = Objects.requireNonNull(clipboard.getPrimaryClip())
|
||||
.getItemAt(0).getText().toString();
|
||||
|
||||
clear(true);
|
||||
field_uri_input.setText(str);
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
edit_text_uri_input.setText(str);
|
||||
|
||||
startScraping();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
error("Error: Clipboard empty");
|
||||
error(R.string.error_clipboard_empty);
|
||||
}
|
||||
startScraping();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
input_layout.setEndIconOnClickListener(new View.OnClickListener() {
|
||||
/*
|
||||
* Clear button: delete all text in all fields
|
||||
*/
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
clear(true);
|
||||
}
|
||||
});
|
||||
input_layout.setErrorIconOnClickListener(new View.OnClickListener() {
|
||||
};
|
||||
layout_uri_input.setEndIconOnClickListener(listener);
|
||||
layout_uri_input.setErrorIconOnClickListener(listener);
|
||||
|
||||
/*
|
||||
* Maps button: launch maps intent
|
||||
*/
|
||||
layout_event_location.setEndIconOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
clear(true);
|
||||
String map_search = "geo:0,0?q=" + edit_text_event_location.getText();
|
||||
|
||||
Uri intent_uri = Uri.parse(map_search);
|
||||
Intent map_intent = new Intent(Intent.ACTION_VIEW, intent_uri);
|
||||
if (map_intent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(map_intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Add to calendar button: launch calendar application
|
||||
*/
|
||||
ok_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
try {
|
||||
Long start_epoch = convertTimeToEpoch(field_event_start.getText().toString());
|
||||
Long end_epoch = convertTimeToEpoch(field_event_end.getText().toString());
|
||||
|
||||
String name = parseField(field_event_name);
|
||||
Long start_epoch = dateTimeToEpoch(event.start_date);
|
||||
Long end_epoch = dateTimeToEpoch(event.end_date);
|
||||
|
||||
String location = parseField(field_event_location);
|
||||
String description = parseField(field_event_description);
|
||||
String uri = parseField(field_uri_input);
|
||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
||||
intent.setType("vnd.android.cursor.item/event");
|
||||
intent.putExtra(CalendarContract.Events.TITLE, event.name);
|
||||
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start_epoch);
|
||||
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end_epoch);
|
||||
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, event.location);
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
||||
intent.setType("vnd.android.cursor.item/event");
|
||||
intent.putExtra(CalendarContract.Events.TITLE, name);
|
||||
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start_epoch);
|
||||
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end_epoch);
|
||||
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, location);
|
||||
intent.putExtra(CalendarContract.Events.DESCRIPTION, uri + "\n\n" + description);
|
||||
// prepend url in description
|
||||
String desc = event.url + "\n\n" + event.description;
|
||||
intent.putExtra(CalendarContract.Events.DESCRIPTION, desc);
|
||||
|
||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(intent);
|
||||
}
|
||||
catch (Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
field_uri_input.setOnKeyListener(new View.OnKeyListener() {
|
||||
public boolean onKey(View view, int keyCode, KeyEvent keyevent) {
|
||||
//If the keyevent is a key-down event on the "enter" button
|
||||
if ((keyevent.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
|
||||
/*
|
||||
* Enter button in uri input: start scraping
|
||||
*/
|
||||
edit_text_uri_input.setOnKeyListener(new View.OnKeyListener() {
|
||||
public boolean onKey(View view, int keycode, KeyEvent keyevent) {
|
||||
//If the key event is a key-down event on the "enter" button
|
||||
if ((keyevent.getAction() == KeyEvent.ACTION_DOWN) && (keycode == KeyEvent.KEYCODE_ENTER)) {
|
||||
startScraping();
|
||||
return true;
|
||||
}
|
||||
@ -163,172 +195,150 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
//get data from deep link
|
||||
|
||||
/*
|
||||
* Get data from intent: if launched by other application
|
||||
* via "share to" or "open with"
|
||||
*/
|
||||
Intent intent = getIntent();
|
||||
Uri data = intent.getData();
|
||||
String shared_text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
|
||||
if (data != null) {
|
||||
// opening external fb link
|
||||
field_uri_input.setText(data.toString());
|
||||
edit_text_uri_input.setText(data.toString());
|
||||
startScraping();
|
||||
}
|
||||
else if (shared_text != null) {
|
||||
} else if (shared_text != null) {
|
||||
//share to nofb
|
||||
field_uri_input.setText(shared_text);
|
||||
edit_text_uri_input.setText(shared_text);
|
||||
startScraping();
|
||||
}
|
||||
|
||||
}
|
||||
private String parseField(TextInputEditText field) {
|
||||
try {
|
||||
return field.getText().toString();
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Long convertTimeToEpoch(String time_str) {
|
||||
try {
|
||||
ZonedDateTime datetime = ZonedDateTime.parse(time_str, DateTimeFormatter.ISO_DATE_TIME);
|
||||
|
||||
return datetime.toEpochSecond() * 1000;
|
||||
} catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String checkURI(String str)
|
||||
{
|
||||
try {
|
||||
|
||||
// check for a valid uri
|
||||
new URL(str).toURI();
|
||||
|
||||
if (str.matches(".*(facebook.com/events/[0-9]*).*")) {
|
||||
return str.replaceAll(".*(facebook.com/events/[0-9]*).*",
|
||||
"https://m.$1");
|
||||
}
|
||||
else {
|
||||
error("Error: Invalid URL");
|
||||
clear(false);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
error("Error: Invalid URL");
|
||||
clear(false);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* launch the FbScraper asynchronous task with the current text in the input text field.
|
||||
*/
|
||||
public void startScraping() {
|
||||
|
||||
error(null);
|
||||
|
||||
String url = Objects.requireNonNull(edit_text_uri_input.getText()).toString();
|
||||
scraper = new FbScraper(new WeakReference<>(this), url);
|
||||
scraper.execute();
|
||||
}
|
||||
|
||||
public void error(Integer resId) {
|
||||
if (resId != null) {
|
||||
layout_uri_input.setError(getString(resId));
|
||||
} else {
|
||||
layout_uri_input.setError(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all event text field strings and errors and also the input field depending if wanted.
|
||||
* Loads the default banner into the toolbar image view and disables unneeded buttons.
|
||||
*
|
||||
* @param clear_uri Choose whether to clear the input uri field, too
|
||||
*/
|
||||
public void clear(boolean clear_uri) {
|
||||
|
||||
if (clear_uri) {
|
||||
edit_text_uri_input.setText("");
|
||||
layout_uri_input.setError(null);
|
||||
}
|
||||
edit_text_event_name.setText("");
|
||||
edit_text_event_start.setText("");
|
||||
edit_text_event_end.setText("");
|
||||
edit_text_event_location.setText("");
|
||||
edit_text_event_description.setText("");
|
||||
|
||||
edit_text_event_name.setError(null);
|
||||
edit_text_event_start.setError(null);
|
||||
edit_text_event_end.setError(null);
|
||||
edit_text_event_location.setError(null);
|
||||
edit_text_event_description.setError(null);
|
||||
|
||||
try {
|
||||
String str = checkURI(field_uri_input.getText().toString());
|
||||
|
||||
|
||||
if (!str.equals(""))
|
||||
{
|
||||
field_uri_input.setText(str);
|
||||
scraper = new FbScraper(this, field_uri_input.getText().toString());
|
||||
scraper.execute();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
error("Error: Invalid URL");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void error(String str) {
|
||||
//Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
|
||||
input_layout.setError(str);
|
||||
}
|
||||
public void clear(boolean clearUri) {
|
||||
if (clearUri) {
|
||||
field_uri_input.setText("");
|
||||
}
|
||||
field_event_name.setText("");
|
||||
field_event_name.setError(null);
|
||||
field_event_start.setText("");
|
||||
field_event_start.setError(null);
|
||||
field_event_end.setText("");
|
||||
field_event_end.setError(null);
|
||||
field_event_location.setText("");
|
||||
field_event_location.setError(null);
|
||||
field_event_description.setText("");
|
||||
field_event_description.setError(null);
|
||||
toolbar_image_view.setImageDrawable(null);
|
||||
|
||||
if (scraper!=null)
|
||||
{
|
||||
scraper.cancel(true);
|
||||
scraper = null;
|
||||
}
|
||||
ok_button.setEnabled(false);
|
||||
toolbar_image_view.setImageResource(R.drawable.ic_banner_foreground);
|
||||
}
|
||||
|
||||
public void update(FbEvent event) {
|
||||
field_event_name.setText(event.name);
|
||||
input_layout.setError(null);
|
||||
|
||||
if (event.name.equals(""))
|
||||
{
|
||||
field_event_name.setError("no event name detected");
|
||||
}
|
||||
field_event_start.setText(event.start_date);
|
||||
|
||||
if (event.start_date.equals(""))
|
||||
{
|
||||
field_event_start.setError("no event start date detected");
|
||||
}
|
||||
field_event_end.setText(event.end_date);
|
||||
|
||||
if (event.end_date.equals(""))
|
||||
{
|
||||
field_event_end.setError("no event end date detected");
|
||||
}
|
||||
|
||||
field_event_location.setText(event.location);
|
||||
|
||||
if (event.location.equals(""))
|
||||
{
|
||||
field_event_location.setError("no event location detected");
|
||||
}
|
||||
field_event_description.setText(event.description);
|
||||
|
||||
if (event.description.equals(""))
|
||||
{
|
||||
field_event_description.setError("no event description detected");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Picasso.get().load(event.image_url).into(toolbar_image_view);
|
||||
} catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
ok_button.setEnabled(false);
|
||||
layout_event_location.setEndIconVisible(false);
|
||||
image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the text fields with the event information provided.
|
||||
* If something is missing, the corresponding test field will show an error.
|
||||
*
|
||||
* @param scraped_event the event information that was scraped by FbScraper
|
||||
*/
|
||||
public void update(FbEvent scraped_event) {
|
||||
|
||||
this.event = scraped_event;
|
||||
|
||||
edit_text_uri_input.setText(event.url);
|
||||
|
||||
if (event.name.equals("")) {
|
||||
edit_text_event_name.setError(getString(R.string.error_no_name));
|
||||
} else {
|
||||
edit_text_event_name.setText(event.name);
|
||||
}
|
||||
|
||||
if (event.start_date == null) {
|
||||
edit_text_event_start.setError(getString(R.string.error_no_start_date));
|
||||
} else {
|
||||
String str = FbEvent.dateTimeToString(event.start_date);
|
||||
edit_text_event_start.setText(str);
|
||||
}
|
||||
|
||||
if (event.end_date == null) {
|
||||
edit_text_event_end.setError(getString(R.string.error_no_end_date));
|
||||
} else {
|
||||
String str = FbEvent.dateTimeToString(event.end_date);
|
||||
edit_text_event_end.setText(str);
|
||||
}
|
||||
|
||||
if (event.location.equals("")) {
|
||||
edit_text_event_location.setError(getString(R.string.error_no_location));
|
||||
} else {
|
||||
edit_text_event_location.setText(event.location);
|
||||
layout_event_location.setEndIconVisible(true);
|
||||
}
|
||||
|
||||
if (event.description.equals("")) {
|
||||
edit_text_event_description.setError(getString(R.string.error_no_description));
|
||||
} else {
|
||||
edit_text_event_description.setText(event.description);
|
||||
}
|
||||
|
||||
Picasso.get()
|
||||
.load(event.image_url)
|
||||
.placeholder(R.drawable.ic_banner_foreground)
|
||||
.into(image_view_toolbar);
|
||||
|
||||
ok_button.setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
@ -348,6 +358,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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
9
app/src/main/res/drawable/ic_add_location.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,2C8.14,2 5,5.14 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.86 -3.14,-7 -7,-7zM16,10h-3v3h-2v-3L8,10L8,8h3L11,5h2v3h3v2z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_help.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_info.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_settings.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
Before Width: | Height: | Size: 13 KiB |
@ -1,97 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".AboutActivity">
|
||||
|
||||
<ScrollView
|
||||
<WebView
|
||||
android:id="@+id/webview_about"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/description_heading"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/description_text"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/open_source_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/open_source_heading"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/open_source_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:text="@string/open_source_text"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issues_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/issues_heading"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issues_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:text="@string/issues_text"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/donate_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/donate_heading"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/changelog_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:text="@string/donate_text"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/paypal_image"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="PayPal Donate"
|
||||
android:scaleType="fitStart"
|
||||
android:src="@drawable/paypal" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RelativeLayout>
|
@ -1,76 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".HelpActivity">
|
||||
|
||||
<ScrollView
|
||||
<WebView
|
||||
android:id="@+id/webview_help"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/faq_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/faq_heading"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/faq_0q"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:text="@string/faq_0q"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
<TextView
|
||||
android:id="@+id/faq_0a"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/faq_0a"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/faq_1q"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:text="@string/faq_1q"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
<TextView
|
||||
android:id="@+id/faq_1a"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/faq_1a"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/faq_2q"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:text="@string/faq_2q"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
<TextView
|
||||
android:id="@+id/faq_2a"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/faq_2a"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RelativeLayout>
|
@ -3,6 +3,7 @@
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
@ -16,7 +17,7 @@
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
android:id="@+id/layout_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
@ -58,12 +59,14 @@
|
||||
app:layout_anchor="@id/app_bar"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:icon="@drawable/ic_content_paste"
|
||||
android:text="@string/paste_button"/>
|
||||
android:text="@android:string/paste"
|
||||
android:tooltipText="@string/tooltip_paste"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
<com.google.android.material.bottomappbar.BottomAppBar
|
||||
android:id="@+id/bottomButtonLayout"
|
||||
android:id="@+id/bottom_appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
@ -79,7 +82,7 @@
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="12dp"
|
||||
android:text="@string/add_to_calendar"
|
||||
android:text="@string/button_add"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="24dp"
|
||||
app:icon="@drawable/ic_event_available"
|
||||
|
@ -1,183 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/nested_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="false"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".MainActivity"
|
||||
tools:showIn="@layout/activity_main"
|
||||
android:id="@+id/nested_scroll_view" >
|
||||
tools:showIn="@layout/activity_main">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraint_layout"
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInputLayout"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:id="@+id/layout_uri_input"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_marginEnd="16dp"
|
||||
app:endIconCheckable="false"
|
||||
app:endIconDrawable="@drawable/ic_backspace_black"
|
||||
app:endIconMode="custom"
|
||||
app:errorIconDrawable="@drawable/ic_backspace_black"
|
||||
app:helperText="@string/add_link_helper"
|
||||
app:helperTextEnabled="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout4">
|
||||
app:endIconMode="custom"
|
||||
|
||||
app:helperText="@string/helper_add_link"
|
||||
app:helperTextEnabled="true">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_uri_input"
|
||||
android:id="@+id/edit_text_uri_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:hint="@string/add_link_hint"
|
||||
android:hint="@string/hint_add_link"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"
|
||||
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/scrollView"
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/spacer"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textInputLayout">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_text_event_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
android:focusable="false"
|
||||
android:cursorVisible="false"
|
||||
android:hint="@string/hint_event_name"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"
|
||||
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_event_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:hint="Event name"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"
|
||||
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_text_event_start"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:cursorVisible="false"
|
||||
android:hint="@string/hint_event_start"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_event_start"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:hint="Event start"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_text_event_end"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:cursorVisible="false"
|
||||
android:hint="@string/hint_event_end"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_event_end"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:hint="Event end"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/layout_event_location"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:endIconDrawable="@drawable/ic_add_location"
|
||||
app:endIconMode="custom">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_text_event_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:cursorVisible="false"
|
||||
android:hint="@string/hint_event_location"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_event_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="map"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:hint="Event location"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_text_event_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:focusable="false"
|
||||
android:cursorVisible="false"
|
||||
android:hint="@string/hint_event_description"
|
||||
android:inputType="textNoSuggestions|textMultiLine"
|
||||
android:singleLine="false"
|
||||
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_event_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:hint="Event description"
|
||||
android:inputType="textNoSuggestions|textMultiLine"
|
||||
android:singleLine="false"
|
||||
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:id="@+id/spacer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/constraint_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
9
app/src/main/res/layout/settings_activity.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
@ -4,12 +4,17 @@
|
||||
tools:context="com.akdev.nofbeventscraper.MainActivity">
|
||||
<item
|
||||
android:id="@+id/action_about"
|
||||
android:icon="@android:drawable/ic_menu_info_details"
|
||||
android:icon="@drawable/ic_info"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_about" />
|
||||
<item
|
||||
android:id="@+id/action_help"
|
||||
android:icon="@android:drawable/ic_menu_info_details"
|
||||
android:icon="@drawable/ic_help"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_help" />
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings" />
|
||||
</menu>
|
||||
|
14
app/src/main/res/raw-de/about.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<h3>Beschreibung</h3>
|
||||
<p>Diese Anwendung wurde entwickelt, um ohne ein Facebook-Konto verwendet werden zu können. Daher verwendet sie nicht die Facebook-API. Stattdessen öffnet sie die URI der Facebook-Veranstaltung und lädt den Quellcode der Website herunter. Dieser Quellcode enthält die Informationen, die zum Erstellen eines Kalendereintrags verwendet werden.</p>
|
||||
<h3>Open Source</h3>
|
||||
<p>Der Quellcode für diese Anwendung ist bei <a href=" https://github.com/akaessens/NoFbEventScraper">GitHub</a> verfügbar.<strong><br /></strong></p>
|
||||
<p>Wenn Sie auf ein Problem stoßen, melden Sie es mir bitte anonym über den <a href="https://gitreports.com/issue/akaessens/NoFbEventScraper">Bugtracker</a> oder direkt bei <a href="https://github.com/akaessens/NoFbEventScraper/issues">GitHub</a>.</p>
|
||||
<h3>Updates</h3>
|
||||
<p>Diese App ist bei <a href="https://f-droid.org/de/packages/com.akdev.nofbeventscraper">F-Droid</a> zum Download verfügbar. Das Änderungsprotokoll ist auf <a href="https://github.com/akaessens/NoFbEventScraper/blob/master/CHANGELOG.md">GitHub</a> verfügbar.</p>
|
||||
<p><a href="https://f-droid.org/en/packages/com.akdev.nofbeventscraper"> <img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="75" /> </a></p>
|
||||
<h3>Rechtliches</h3>
|
||||
<p>Diese Anwendung ist für das Speichern einzelner, öffentlich zugänglicher Veranstaltungen in einem persönlichen Kalender vorgesehen. Verwenden Sie sie nicht zur automatischen Datenerfassung und halten Sie sich an die <a href="http://www.facebook.com/apps/site_scraping_tos_terms.php">Bedingungen für die automatische Datenerfassung</a> von Facebook.</p>
|
||||
<h3>Spenden</h3>
|
||||
<p>Ich entwickle diese Anwendung in meiner Freizeit. Wenn sie Ihnen gefällt, können Sie bei <a href="https://www.paypal.me/andreaskaessens">PayPal</a> spenden.</p>
|
||||
<p><a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png" height="75" /></a></p>
|
14
app/src/main/res/raw-de/help.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<h3>Welche Links können mit dieser App verwendet werden?</h3>
|
||||
<p>Alle Facebook-Subdomains werden unterstützt, ob mobil (m.facebook.com) oder sprachspezifisch (de-de.facebook.com). Der Link muss eine Ereignis-ID enthalten.<br />Wie kann diese Anwendung verwendet werden?</p>
|
||||
<h3>Wie kann diese Anwendung verwendet werden?</h3>
|
||||
<ul>
|
||||
<li><strong>Einfügen-Knopf</strong>: Fügen Sie einen kopierten Link aus der Zwischenablage in die URL-Leiste ein.</li>
|
||||
<li><strong>Teilen mit</strong>: Eingebaute Android-Freigabefunktion, z.B. von einem Browser aus.</li>
|
||||
<li><strong>Öffnen mit</strong>: Die in Android eingebaute öffnen-mit-Funktion, z.B. beim Klicken auf einen Link in einem Messenger.</li>
|
||||
</ul>
|
||||
<h3>Warum funktioniert die Veranstaltung X nicht?</h3>
|
||||
<p>Diese Anwendung greift auf öffentlich zugängliche Ereignisinformationen zu. Wenn die Veranstaltung z.B. den Ort ohne Login nicht anbietet, ist dies in dieser Anwendung nicht verfügbar. Auch bieten einige Veranstaltungen die Informationen einfach nicht in einem maschinenlesbaren Format an. Veranstaltungen mit mehreren Instanzen sind problematisch, da sie beim Scraping von m.facebook.com nicht das korrekte Start- und Enddatum angeben.</p>
|
||||
<p>Wenn Sie Probleme mit einem bestimmten Ereignis haben, lassen Sie es mich bitte über den <a href="https://gitreports.com/issue/akaessens/NoFbEventScraper">anonymen Bugtracker</a> oder auf der <a href="https://github.com/akaessens/NoFbEventScraper/issues/">GitHub Problemseite</a>.</p>
|
||||
<h3>Ist diese App kompatibel mit meinem Kalender?</h3>
|
||||
<p>Ja. Diese Anwendung verwendet anwendungsunabhängige Kalenderfunktionen, wodurch sie mit jeder Kalenderanwendung kompatibel ist. Ich empfehle jedoch den <a href="https://play.google.com/store/apps/details?id=ws.xsoh.etar">Etar Kalender</a>, da er Open Source ist. </p>
|
14
app/src/main/res/raw/about.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<h3>Description</h3>
|
||||
<p>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.</p>
|
||||
<h3>Open Source</h3>
|
||||
<p>The source code for this application is available at <a href=" https://github.com/akaessens/NoFbEventScraper">GitHub</a>.<strong><br /></strong></p>
|
||||
<p>If you encounter an issue, please report it to me anonymously at the <a href="https://gitreports.com/issue/akaessens/NoFbEventScraper">Bugtracker</a> or directly at <a href="https://github.com/akaessens/NoFbEventScraper/issues">GitHub</a>.</p>
|
||||
<h3>Updates</h3>
|
||||
<p>This application is available for download at <a href="https://f-droid.org/de/packages/com.akdev.nofbeventscraper">F-Droid</a>. The changelog is at <a href="https://github.com/akaessens/NoFbEventScraper/blob/master/CHANGELOG.md">GitHub</a>.</p>
|
||||
<p><a href="https://f-droid.org/en/packages/com.akdev.nofbeventscraper"> <img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="75" /> </a></p>
|
||||
<h3>Legal</h3>
|
||||
<p>This application is intended for saving single, publicly available events into a personal calendar. Do not use it to automatically collect data and comply with Facebook's <a href="http://www.facebook.com/apps/site_scraping_tos_terms.php">Automated Data Collection Terms</a>.</p>
|
||||
<h3>Donations</h3>
|
||||
<p>I develop this application in my free time. If you like it, you can donate at <a href="https://www.paypal.me/andreaskaessens">PayPal</a>.</p>
|
||||
<p><a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png" height="75" /></a></p>
|
14
app/src/main/res/raw/help.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<h3>What links can be used with this app?</h3>
|
||||
<p>All facebook subdomains are supported, whether mobile (m.facebook.com) or language-specific (de-de.facebook.com). The link must contain an event ID.</p>
|
||||
<h3>How to use this application?</h3>
|
||||
<ul>
|
||||
<li><strong>Paste button</strong>: paste a copied link from the clipboard into the URL bar.</li>
|
||||
<li><strong>Share to</strong>: Android's built-in share-function, e.g. from a browser.</li>
|
||||
<li><strong>Open with</strong>: Android's built-in open-with-function, e.g. when clicking on a link in a messenger.</li>
|
||||
</ul>
|
||||
<h3>Why does event X not work?</h3>
|
||||
<p>This app relies on event information that is publicly available. If the event does not offer for example the location without a login, it will not be available in this application. Also, some events just do not provide the information in a machine readable format. Events with multiple instances are problematic because they do not provide the correct start and end date when scraping from m.facebook.com.</p>
|
||||
<p>If you encounter issues with a specific event, please let me know via the <a href="https://gitreports.com/issue/akaessens/NoFbEventScraper">anonymous bugtracker</a> or at the <a href="https://github.com/akaessens/NoFbEventScraper/issues/">GitHub issue page</a>.</p>
|
||||
<h3>Is this compatible with my calendar app?</h3>
|
||||
<p>Yes. This application makes use of application independent calendar functions, which makes it compatible to every calendar app. However, i recommend <a href="https://play.google.com/store/apps/details?id=ws.xsoh.etar">Etar Calendar</a> because it is Open Source.</p>
|
28
app/src/main/res/values-de/strings.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">NoFb Event Scraper</string>
|
||||
<string name="action_about">Über</string>
|
||||
<string name="action_help">Hilfe</string>
|
||||
<string name="action_settings">Einstellungen</string>
|
||||
<string name="hint_add_link">Veranstaltungslink</string>
|
||||
<string name="hint_event_name">Veranstaltungsname</string>
|
||||
<string name="hint_event_start">Veranstaltungsbeginn</string>
|
||||
<string name="hint_event_end">Veranstantungsende</string>
|
||||
<string name="hint_event_location">Veranstaltungsort</string>
|
||||
<string name="hint_event_description">Veranstaltungsbeschreibung</string>
|
||||
<string name="helper_add_link">Facebook-Link zur Veranstaltung einfügen</string>
|
||||
<string name="button_add">Zum Kalender hinzufügen</string>
|
||||
<string name="tooltip_paste">Einfügen von Inhalten aus der Zwischenablage in das URL-Eingabefeld</string>
|
||||
<string name="preferences_url_setting">Welcher URL-Präfix ist zu verwenden?</string>
|
||||
<string name="preferences_url_setting_summary">Die Nutzung von m.facebook.com ist stabiler und schneller. Die Verwendung von www.facebook.com funktioniert besser bei Ereignissen mit mehreren Instanzen und zeigt eine hochauflösende Vorschau an, geht aber irgendwann kaputt, wenn Facebook das klassische Design deaktiviert.</string>
|
||||
<string name="error_clipboard_empty">Fehler: Zwischenablage leer</string>
|
||||
<string name="error_no_name">Fehler: Veranstaltungsname nicht verfügbar</string>
|
||||
<string name="error_no_start_date">Fehler: Veranstaltungsbeginn nicht verfügbar</string>
|
||||
<string name="error_no_end_date">Fehler: Veranstaltungsende nicht verfügbar</string>
|
||||
<string name="error_no_location">Fehler: Veranstaltungsort nicht verfügbar</string>
|
||||
<string name="error_no_description">Fehler: Veranstaltungsbeschreibung nicht verfügbar</string>
|
||||
<string name="error_scraping">Fehler: Veranstaltungsdaten nicht gefunden</string>
|
||||
<string name="error_url">Fehler: URL ungültig</string>
|
||||
<string name="error_connection">Fehler: Keine Verbindung möglich</string>
|
||||
<string name="error_unknown">Fehler: Unbekannter Fehler</string>
|
||||
</resources>
|
13
app/src/main/res/values/arrays.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<resources>
|
||||
<!-- Reply Preference -->
|
||||
<string-array name="url_to_scrape">
|
||||
<item>m.facebook.com</item>
|
||||
<item>www.facebook.com</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="url_prefix">
|
||||
<item>https://m.</item>
|
||||
<item>https://www.</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -1,35 +1,42 @@
|
||||
<resources>
|
||||
<string name="app_name">NoFb Event Scraper</string>
|
||||
|
||||
<!-- Action names -->
|
||||
<string name="action_about">About</string>
|
||||
<string name="action_help">Help</string>
|
||||
<string name="add_link_hint">Event link</string>
|
||||
<string name="add_link_helper">Paste facebook link to the event.</string>
|
||||
<string name="add_to_calendar">Add to calendar</string>
|
||||
<string name="paste_button">Paste from clipboard</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
<string name="description_heading">Description</string>
|
||||
<string name="description_text">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.
|
||||
</string>
|
||||
<string name="open_source_heading"> Open Source </string>
|
||||
<string name="open_source_text"> The source code for this application can be found at https://github.com/akaessens/NoFbEventScraper .</string>
|
||||
<!-- Input hints -->
|
||||
<string name="hint_add_link">Event link</string>
|
||||
<string name="hint_event_name">Event name</string>
|
||||
<string name="hint_event_start">Event start</string>
|
||||
<string name="hint_event_end">Event end</string>
|
||||
<string name="hint_event_location">Event location</string>
|
||||
<string name="hint_event_description">Event description</string>
|
||||
|
||||
<string name="issues_heading" > Report a bug</string>
|
||||
<string name="issues_text" >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.</string>
|
||||
|
||||
<string name="faq_heading"> FAQ </string>
|
||||
<string name="faq_0q"> What links can be used with this app? </string>
|
||||
<string name="faq_0a"> All facebook subdomains are supported, whether mobile (m.facebook.com) or language-specific (de-de.facebook.com). The link must contain an event ID.</string>
|
||||
<string name="faq_1q"> How to use this application? </string>
|
||||
<string name="faq_1a"> 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. </string>
|
||||
<string name="faq_2q"> Why does event X not work? </string>
|
||||
<string name="faq_2a"> 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.</string>
|
||||
<string name="helper_add_link">Paste Facebook link to the event</string>
|
||||
<string name="button_add">Add to calendar</string>
|
||||
<string name="tooltip_paste">Paste content from clipboard into the URL input box</string>
|
||||
|
||||
<!-- Errors -->
|
||||
<string name="error_clipboard_empty">Error: clipboard empty</string>
|
||||
<string name="error_no_name">Error: Event name unavailable</string>
|
||||
<string name="error_no_start_date">Error: Event start date unavailable</string>
|
||||
<string name="error_no_end_date">Error: Event end date unavailable</string>
|
||||
<string name="error_no_location">Error: Event location unavailable</string>
|
||||
<string name="error_no_description">Error: Event description unavailable</string>
|
||||
<string name="error_scraping">Error: Scraping event data failed</string>
|
||||
<string name="error_url">Error: URL invalid</string>
|
||||
<string name="error_connection">Error: Unable to connect</string>
|
||||
<string name="error_unknown">Error: Unknown Error</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
<string name="preferences_scraper_header" translatable="false">Scraper</string>
|
||||
|
||||
<string name="preferences_url_setting">Which URL prefix to use</string>
|
||||
<string name="preferences_url_setting_summary">"Using m.facebook.com is more stable and faster. Using www.facebook.com works better with multiple instance events and will display a high resolution preview but will eventually break when Facebook disables the classic design. "</string>
|
||||
|
||||
|
||||
<string name="donate_heading"> Donations </string>
|
||||
<string name="donate_text">Click on the PayPal image to send me a coffee if you like :) </string>
|
||||
|
||||
</resources>
|
||||
|
21
app/src/main/res/xml/root_preferences.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory app:title="@string/preferences_scraper_header">
|
||||
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="https://m."
|
||||
app:entries="@array/url_to_scrape"
|
||||
app:entryValues="@array/url_prefix"
|
||||
app:key="url_preference"
|
||||
app:title="@string/preferences_url_setting"
|
||||
android:summary="@string/preferences_url_setting_summary"/>
|
||||
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
||||
</PreferenceScreen>
|
21
create_changelog.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
changelog_location="fastlane/metadata/android/en-US/changelogs"
|
||||
count_txt=$(ls -r $changelog_location/*.txt | wc -l)
|
||||
count_tag=$(git tag | wc -l)
|
||||
|
||||
if (( count_txt != count_tag )); then
|
||||
echo "Tag count and txt-file count not matching."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# Changelog" > CHANGELOG.md
|
||||
|
||||
for i in $(seq "$count_txt" -1 1)
|
||||
do
|
||||
tag=$(git tag | sed "$i!d")
|
||||
|
||||
echo "## $tag ($i)" >> CHANGELOG.md
|
||||
cat $changelog_location/"$i".txt >> CHANGELOG.md
|
||||
|
||||
done
|
4
fastlane/metadata/android/de/full_description.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Diese Anwendung wurde entwickelt, um ohne ein Facebook-Konto verwendet werden zu können.
|
||||
Daher verwendet sie nicht die Facebook-API.
|
||||
Stattdessen öffnet sie die URI der Facebook-Veranstaltung und lädt den Quellcode der Website herunter.
|
||||
Dieser Quellcode enthält die Informationen, die zum Erstellen eines Kalendereintrags verwendet werden.
|
1
fastlane/metadata/android/de/short_description.txt
Normal file
@ -0,0 +1 @@
|
||||
Diese App durchsucht Facebook-Veranstaltungslinks und fügt sie zu deinem Kalender hinzu.
|
@ -1 +1 @@
|
||||
Initial release.
|
||||
- Initial release.
|
||||
|
@ -1,3 +1,3 @@
|
||||
Added help and reports section.
|
||||
Fix for some locations not scraped correctly.
|
||||
Resolve fb-internal links.
|
||||
- Added help and reports section.
|
||||
- Fix for some locations not scraped correctly.
|
||||
- Resolve fb-internal links.
|
||||
|
@ -1,3 +1,3 @@
|
||||
Fix for timezone calculation.
|
||||
Material design Interface, will be improved further.
|
||||
Display the event picture in the toolbar.
|
||||
- Fix for timezone calculation.
|
||||
- Material design Interface, will be improved further.
|
||||
- Display the event picture in the toolbar.
|
||||
|
@ -1,3 +1,3 @@
|
||||
Fixes for new design.
|
||||
New button layout.
|
||||
Improve input error display.
|
||||
- Fixes for new design.
|
||||
- New button layout.
|
||||
- Improve input error display.
|
||||
|
@ -1,2 +1,2 @@
|
||||
Fix for event links with querystrings.
|
||||
New icon and banner as default toolbar image.
|
||||
- Fix for event links with querystrings.
|
||||
- New icon and banner as default toolbar image.
|
||||
|
8
fastlane/metadata/android/en-US/changelogs/6.txt
Normal file
@ -0,0 +1,8 @@
|
||||
- Rework help and about.
|
||||
- Add settings with URL prefix selector.
|
||||
- Add Maps button for location.
|
||||
- Disable text field inputs - all fields can be edited in the calendar app.
|
||||
- Change date/time format to RFC standard.
|
||||
- Minor interface changes.
|
||||
- Code cleanup and refactoring.
|
||||
- Add code documentation.
|
2
fastlane/metadata/android/en-US/changelogs/7.txt
Normal file
@ -0,0 +1,2 @@
|
||||
- Fix invalid default uri.
|
||||
- Update about section.
|
5
fastlane/metadata/android/en-US/changelogs/8.txt
Normal file
@ -0,0 +1,5 @@
|
||||
- Add german translation.
|
||||
- Decrease MinSDK to 23 (Android 6.0).
|
||||
- Replace Date implementation.
|
||||
- Enable Dark Mode for WebViews.
|
||||
- Add high-res preview for www prefix.
|
3
fastlane/metadata/android/en-US/changelogs/9.txt
Normal file
@ -0,0 +1,3 @@
|
||||
- Update about section with download and changelog information.
|
||||
- Improve high-res preview scraping.
|
||||
- Fix potential crash on calendar intent.
|
@ -1,4 +1,4 @@
|
||||
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 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.
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 412 KiB After Width: | Height: | Size: 629 KiB |
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 84 KiB |
@ -1 +1 @@
|
||||
This app scrapes facebook event links and adds the event to your calendar.
|
||||
This app scrapes Facebook event links and adds the event to your calendar.
|
||||
|