1
0
mirror of https://github.com/akaessens/NoFbEventScraper synced 2025-06-05 23:29:13 +02:00

54 Commits

Author SHA1 Message Date
37627a43d0 prepare v0.4.1 2020-10-04 12:04:06 +02:00
b94fa6be60 allow page scrape minimum 1 2020-10-04 11:58:09 +02:00
23f431f535 add fb.me shortener intent filter 2020-10-04 11:39:51 +02:00
404b8e1086 fix OOB creating incorrect error message, closes #26 2020-10-04 11:36:54 +02:00
f067076752 manually remove focus from input after enter, closes #24 2020-10-03 22:16:46 +02:00
748cf3c074 add shortener redirection, replace m. with mbasic. 2020-10-03 21:45:38 +02:00
2479cd9c72 add share-to icon 2020-10-03 20:37:27 +02:00
9e81e3d74a fix event info hiding after activity restore (closes #23), add comments 2020-10-03 20:12:24 +02:00
ce790763fd Update changelog 2020-09-27 14:22:02 +00:00
b4b57f68b8 prepare v0.4.0 2020-09-27 16:20:48 +02:00
fea21a4c82 fix pages with events < maxevents 2020-09-27 15:18:48 +02:00
3ba50f3df7 add error message as description 2020-09-27 15:09:34 +02:00
f579094cec display event image and title even on failure 2020-09-27 15:04:10 +02:00
43913ccd21 scrape more events from pages 2020-09-27 14:23:45 +02:00
e549ca7676 add undo function for clear events 2020-09-27 13:30:29 +02:00
8335ffeada remove possibly fragile task counter dependent output 2020-09-27 13:18:14 +02:00
a8baabdb5f create intent receiver to fix share issues 2020-09-27 12:46:19 +02:00
85f68f35ac Create changelog-generate.yml 2020-09-27 00:27:57 +02:00
d3ade66878 add page links: broaden intent filter 2020-09-26 23:08:49 +02:00
2e1b20051a fix nullptr crash on killing asyncs 2020-09-26 23:00:23 +02:00
5e7d9bc4dc fix oncreate scraping multiple events with same intent 2020-09-26 22:55:39 +02:00
626128b5dc pagelinks are supported, currently limited to 5 events 2020-09-26 21:54:20 +02:00
af504084fe add animation for new event 2020-09-26 19:58:37 +02:00
a30756a873 prepare event page scraping, better error/result handling 2020-09-26 19:16:21 +02:00
2750ad86e8 do not display empty information or placeholders 2020-09-26 15:45:49 +02:00
6977fad449 add image fullscreen 2020-09-26 15:20:14 +02:00
63de4b4a4f add shared prefs, cleanup 2020-09-26 14:04:43 +02:00
0506b5dfa0 re-add banner 2020-09-24 23:28:32 +02:00
551a3c21a9 update items, cleanup, add intents 2020-09-24 22:00:57 +02:00
3c5876f6bc update card design 2020-09-20 23:03:43 +02:00
3c73ea2d77 vertical scrolling for cards 2020-09-19 12:19:25 +02:00
fecf4ae4e8 add cards design 2020-09-19 12:05:57 +02:00
85e0d1ff24 restart scraping on activity restore 2020-09-05 17:58:13 +02:00
56300d78a3 use scroll view instead of card, re-add maps intent and fix soft keyboard 2020-09-05 17:14:06 +02:00
85e9c15f5e include card view, add app bars 2020-09-04 15:53:32 +02:00
926c2c612a first recyclerview with multiple events prototype 2020-09-04 13:24:28 +02:00
c43911fc77 prepare v0.3.3 2020-08-31 21:33:01 +02:00
3cbfc9b9c1 add changelog.md 2020-08-31 21:17:57 +02:00
71169dae76 update README 2020-08-31 18:31:47 +02:00
5b412733b4 Merge branch 'master' of github.com:akaessens/NoFbEventScraper into master 2020-08-31 18:28:51 +02:00
a3f2990c61 update about 2020-08-31 18:25:21 +02:00
1c112f3e4e Update README.md 2020-08-31 17:59:12 +02:00
2faf8aa003 get high-res preview also from videos 2020-08-31 17:10:10 +02:00
643ac62788 prevent activityNotFound crash on calendar intent 2020-08-31 16:45:34 +02:00
d5e12c4d88 Merge branch 'master' of github.com:akaessens/NoFbEventScraper into master 2020-08-31 16:13:53 +02:00
320d1787aa improve high-res image url scraping 2020-08-31 16:13:43 +02:00
c7a4d9b027 Update README.md
closes #13
2020-08-31 15:26:11 +02:00
bb1e7579d8 prepare v0.3.2 2020-08-31 14:45:13 +02:00
ba2ec36666 add german error translation 2020-08-31 12:05:24 +02:00
81fd1f3ebb enable dark mode for help and about webviews 2020-08-31 11:32:22 +02:00
8b5263db63 MinSdk down to 23, replace ZonedDateTime with Date 2020-08-30 21:41:58 +02:00
76f56434e8 add german translation 2020-08-30 20:20:52 +02:00
9540b252a5 move html to res/raw to enable localization 2020-08-30 19:09:44 +02:00
7a44e467f0 add high res image preview, fix reset on activity return 2020-08-30 19:03:17 +02:00
59 changed files with 1693 additions and 725 deletions

View File

@ -0,0 +1,24 @@
name: changelog-generate
on:
push:
tags:
- '*'
jobs:
run-script:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: '0' # get tags
ref: 'master'
- name: run-script
shell: bash
run: $GITHUB_WORKSPACE/create_changelog.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update changelog

47
CHANGELOG.md Normal file
View File

@ -0,0 +1,47 @@
# Changelog
## v0.4.0 (10)
- Support pages with upcoming events *beta*
- Display events in a scrollable card-based view
- Improve intent handling
- Add history for scraped events
- Tap image preview to open fullscreen
- Scrape name and image even if no event data found
## 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.

View File

@ -1,20 +1,37 @@
![Android CI](https://github.com/akaessens/NoFbEventScraper/workflows/Android%20CI/badge.svg)
[![Android CI](https://github.com/akaessens/NoFbEventScraper/workflows/Android%20CI/badge.svg)](https://github.com/akaessens/NoFbEventScraper/actions)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/akaessens/NoFbEventScraper/blob/master/LICENSE)
[![Release](https://img.shields.io/github/release/akaessens/nofbeventscraper.svg?logo=github)](https://github.com/akaessens/NoFbEventScraper/releases/latest)
[![F-Droid](https://img.shields.io/f-droid/v/com.akdev.nofbeventscraper.svg)](https://f-droid.org/en/packages/com.akdev.nofbeventscraper)
<img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/featureGraphic.png" alt="Feature Graphic" width="max-width">
# NoFb Event Scraper
# Description
This application was developed to be used without a facebook account.
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.
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.3.1](https://github.com/akaessens/NoFbEventScraper/releases/download/v0.3.1/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>

View File

@ -6,10 +6,10 @@ android {
defaultConfig {
applicationId "com.akdev.nofbeventscraper"
minSdkVersion 26
minSdkVersion 23
targetSdkVersion 29
versionCode 7
versionName "0.3.1"
versionCode 11
versionName "0.4.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -24,22 +24,32 @@ android {
}
dependencies {
'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
// androidx
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.preference:preference:1.1.1'
implementation "androidx.webkit:webkit:1.3.0"
// jsoup HTML parser library @ https://jsoup.org/
// JSON save/restore shared preference
implementation 'com.google.code.gson:gson:2.8.5'
// Theme
implementation 'com.google.android.material:material:1.2.1'
// Scraping
implementation 'org.jsoup:jsoup:1.13.1'
// Image loading and transforming
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.preference:preference:1.1.1'
// animations and transformations
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation 'jp.wasabeef:recyclerview-animators:3.0.0'
// tests
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

View File

@ -42,15 +42,16 @@ public class ScraperUnitTest {
FbScraper scraper = new FbScraper(null, "");
String exp = "2020-10-23T05:00+02:00";
String in = "2020-10-23T05:00:00+0200";
String act = scraper.toZonedDateTime(in).toString();
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 = null;
exp = "";
in = "";
ZonedDateTime act2 = scraper.toZonedDateTime(in);
String act2 = FbEvent.dateTimeToString(scraper.parseToDate(in));
assertEquals(exp, act2);
}

View File

@ -11,59 +11,66 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".IntentReceiver">
<!-- Accepts open with -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*.facebook.com"
android:scheme="https" />
<data
android:host="facebook.com"
android:scheme="https" />
<data
android:host="*.fb.me"
android:scheme="https" />
<data
android:host="fb.me"
android:scheme="https" />
</intent-filter>
<activity android:name=".SettingsActivity"
android:label="@string/action_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
<!-- Accepts share intents -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name=".HelpActivity"
android:label="@string/action_help" >
<activity
android:name=".SettingsActivity"
android:label="@string/action_settings">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
android:value=".MainActivity" />
</activity>
<activity android:name=".AboutActivity"
android:label="@string/action_about" >
<activity
android:name=".HelpActivity"
android:label="@string/action_help">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
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:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateVisible|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "https://*.facebook.com/events” -->
<data
android:host="*.facebook.com"
android:pathPrefix="/events"
android:scheme="https" />
<!-- Accepts URIs that begin with "https://facebook.com/events” -->
<data
android:host="facebook.com"
android:pathPrefix="/events"
android:scheme="https" />
</intent-filter>
<!-- Accepts share intents” -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
</application>

View File

@ -1,15 +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.appcompat.widget.Toolbar;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import androidx.webkit.WebSettingsCompat;
import androidx.webkit.WebViewFeature;
public class AboutActivity extends AppCompatActivity {
@ -24,7 +22,14 @@ public class AboutActivity extends AppCompatActivity {
WebView webview_about = findViewById(R.id.webview_about);
webview_about.loadUrl("file:////android_asset/about.html");
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");
}

View File

@ -0,0 +1,262 @@
package com.akdev.nofbeventscraper;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.CalendarContract;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import java.util.List;
import jp.wasabeef.picasso.transformations.CropCircleTransformation;
import static com.akdev.nofbeventscraper.FbEvent.dateTimeToEpoch;
public class EventAdapter extends
RecyclerView.Adapter<EventAdapter.ViewHolder> {
private List<FbEvent> events;
// Pass in the contact array into the constructor
public EventAdapter(List<FbEvent> events) {
this.events = events;
}
@Override
public EventAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int view_type) {
final Context context = parent.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
// Inflate the custom layout
View view = inflater.inflate(R.layout.item_event, parent, false);
// Return a new holder instance
final ViewHolder holder = new ViewHolder(view);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final EventAdapter.ViewHolder holder, int position) {
// Get the data model based on position
final FbEvent event = events.get(position);
// Set item views based on your views and data model
holder.text_view_event_name.setText(event.name);
/*
* initialize all text views with event information
* hide fields and image views if no information is available
*/
if (!event.location.equals("")) {
holder.text_view_event_location.setText(event.location);
} else {
holder.text_view_event_location.setVisibility(View.GONE);
holder.image_view_event_location.setVisibility(View.GONE);
}
if (event.start_date != null) {
String str = FbEvent.dateTimeToString(event.start_date);
holder.text_view_event_start.setText(str);
} else {
holder.text_view_event_start.setVisibility(View.GONE);
if (event.end_date == null) {
holder.image_view_event_time.setVisibility(View.GONE);
}
}
if (event.end_date != null) {
String str = FbEvent.dateTimeToString(event.end_date);
holder.text_view_event_end.setText(str);
} else {
holder.text_view_event_end.setVisibility(View.GONE);
}
if (!event.description.equals("")) {
holder.text_view_event_description.setText(event.description);
} else {
holder.text_view_event_description.setVisibility(View.GONE);
}
try {
Picasso.get()
.load(event.image_url)
.placeholder(R.mipmap.ic_launcher)
.transform(new CropCircleTransformation())
.into(holder.image_view_event_image);
} catch (Exception e) {
e.printStackTrace();
}
/*
* Maps button: launch maps intent
*/
View.OnClickListener location_click_listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
String map_search = "geo:0,0?q=" + event.location;
Uri intent_uri = Uri.parse(map_search);
Intent map_intent = new Intent(Intent.ACTION_VIEW, intent_uri);
if (map_intent.resolveActivity(view.getContext().getPackageManager()) != null) {
view.getContext().startActivity(map_intent);
}
}
};
holder.image_view_event_location.setOnClickListener(location_click_listener);
holder.text_view_event_location.setOnClickListener(location_click_listener);
/*
* Add to calendar button: launch calendar application with current event
*/
holder.button_add_to_calendar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// calendar event intent expects epoch time format
Long start_epoch = dateTimeToEpoch(event.start_date);
Long end_epoch = dateTimeToEpoch(event.end_date);
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);
// prepend url in description
String desc = event.url + "\n\n" + event.description;
intent.putExtra(CalendarContract.Events.DESCRIPTION, desc);
if (intent.resolveActivity(view.getContext().getPackageManager()) != null) {
view.getContext().startActivity(intent);
}
}
});
/*
* Expand and collapse description
*/
holder.text_view_event_description.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (holder.description_collapsed) {
holder.description_collapsed = false;
holder.text_view_event_description.setMaxLines(Integer.MAX_VALUE);
} else {
holder.description_collapsed = true;
holder.text_view_event_description.setMaxLines(5);
}
}
});
/*
* Image preview click creates fullscreen dialog
*/
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
final Dialog dialog = new Dialog(view.getContext(), android.R.style.Theme_Translucent_NoTitleBar);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_image);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
ImageView image = (ImageView) dialog.findViewById(R.id.image_view_event_image_fullscreen);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
Picasso.get()
.load(event.image_url)
.into(image, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
dialog.show();
}
@Override
public void onError(Exception e) {
dialog.dismiss();
}
});
}
};
holder.image_view_event_image.setOnClickListener(listener);
holder.image_view_share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent share_intent = new Intent(android.content.Intent.ACTION_SEND);
share_intent.setType("text/plain");
share_intent.putExtra(Intent.EXTRA_TEXT, event.url);
view.getContext().startActivity(Intent.createChooser(share_intent, null));
}
});
}
// Returns the total count of items in the list
@Override
public int getItemCount() {
return events.size();
}
/**
* access item view elements via holder class
*/
public static class ViewHolder extends RecyclerView.ViewHolder {
protected TextView text_view_event_name;
protected TextView text_view_event_start;
protected TextView text_view_event_end;
protected TextView text_view_event_location;
protected TextView text_view_event_description;
protected ImageView image_view_event_image;
protected ImageView image_view_event_location;
protected ImageView image_view_event_time;
protected ImageView image_view_share;
protected Button button_add_to_calendar;
protected boolean description_collapsed = true;
public ViewHolder(View item_view) {
super(item_view);
text_view_event_name = item_view.findViewById(R.id.text_view_event_name);
text_view_event_start = item_view.findViewById(R.id.text_view_event_start);
text_view_event_end = item_view.findViewById(R.id.text_view_event_end);
text_view_event_location = item_view.findViewById(R.id.text_view_event_location);
text_view_event_description = item_view.findViewById(R.id.text_view_event_description);
image_view_event_image = item_view.findViewById(R.id.image_view_event_image);
image_view_event_location = item_view.findViewById(R.id.image_view_event_location);
image_view_event_time = item_view.findViewById(R.id.image_view_event_time);
image_view_share = item_view.findViewById(R.id.image_view_share);
button_add_to_calendar = item_view.findViewById(R.id.button_add_to_calendar);
}
}
}

View File

@ -1,8 +1,9 @@
package com.akdev.nofbeventscraper;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
/**
* Objects of this class store immutable information about
@ -12,14 +13,23 @@ public class FbEvent {
public final String url;
public final String name;
public final ZonedDateTime start_date;
public final ZonedDateTime end_date;
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() {
url = "";
name= "";
start_date = null;
end_date = null;
description = "";
location = "";
image_url = null;
}
public FbEvent(String url, String name, ZonedDateTime start_date, ZonedDateTime end_date,
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;
@ -30,31 +40,36 @@ public class FbEvent {
this.image_url = image_url;
}
public static ArrayList<FbEvent> createEventList() {
return new ArrayList<>();
}
/**
* Converts datetime to epoch.
*
* @param zoned_date_time ZonedDateTime object
* @param date Date object
* @return Event begin time in milliseconds from the epoch for calendar intent or null
*/
static Long dateTimeToEpoch(ZonedDateTime zoned_date_time) {
static Long dateTimeToEpoch(Date date) {
try {
return zoned_date_time.toEpochSecond() * 1000;
return date.getTime();
} catch (Exception e) {
return null;
}
}
/**
* Returns a RFC formatted String representation of a ZonedDateTime
* Returns a locally formatted String representation of a Date
*
* @param zoned_date_time
* @return RFC-1123 formatted String of zoned_date_time or empty String
* @param date
* @return locally formatted String of date or empty String
*/
static String dateTimeToString(ZonedDateTime zoned_date_time) {
static String dateTimeToString(Date date) {
try {
return DateTimeFormatter
.RFC_1123_DATE_TIME
.format(zoned_date_time);
SimpleDateFormat formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm z",
Locale.getDefault());
return formatter.format(date);
} catch (Exception e) {
return "";
}

View File

@ -0,0 +1,222 @@
package com.akdev.nofbeventscraper;
import android.os.AsyncTask;
import org.json.JSONException;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
* This class can asynchronously scrape public facebook events
* and gather the most important information. It is stored in a FbEvent object.
*/
public class FbEventScraper extends AsyncTask<Void, Void, Void> {
private FbScraper scraper;
private int error;
private String url;
private FbEvent event;
/**
* Constructor with reference to scraper to return results.
*
* @param scraper Reference to FbScraper
* @param input_url Input url to scrape from
*/
FbEventScraper(FbScraper scraper, String input_url) {
this.scraper = scraper;
this.url = input_url;
this.error = 0;
}
/**
* 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 location_name = "";
try {
JSONObject reader = new JSONObject(location_json);
location_name = reader.getString("name");
JSONObject address = reader.getJSONObject("address");
String type = address.getString("@type");
if (type.equals("PostalAddress")) {
String postal_code = address.getString("postalCode");
String address_locality = address.getString("addressLocality");
String street_address = address.getString("streetAddress");
// included in locality
//String address_country = address.getString("addressCountry");
return location_name + ", "
+ street_address + ", "
+ postal_code + " "
+ address_locality;
} else {
return location_name;
}
} catch (JSONException e) {
e.printStackTrace();
return location_name;
}
}
/**
* 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());
return sdf.parse(time_in);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 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: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) {
e.printStackTrace();
return description_in;
}
}
/**
* 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) {
e.printStackTrace();
return "";
}
}
/**
* Started by 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) {
try {
// 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 name = "", location = "", description = "", image_url = "";
Date start_date = null, end_date = null;
try {
String json = document
.select("script[type = application/ld+json]")
.first().data();
JSONObject reader = new JSONObject(json);
// get all fields from json event information
name = readFromJson(reader, "name");
start_date = parseToDate(readFromJson(reader, "startDate"));
end_date = parseToDate(readFromJson(reader, "endDate"));
description = fixDescriptionLinks(readFromJson(reader, "description"));
location = fixLocation(readFromJson(reader, "location"));
image_url = readFromJson(reader, "image");
// try to find a high-res image
try {
image_url = document.select("div[id=event_header_primary]")
.select("img").first().attr("src");
} catch (Exception ignored) {
}
} catch (JSONException | NullPointerException e) {
// json event information mot found. get at least title and image
name = document.title();
description = scraper.main.get().getString(R.string.error_scraping);
try {
image_url = document.select("div[id*=event_header]")
.select("img").first().attr("src");
} catch (Exception ignored) {
}
}
this.event = new FbEvent(url, name, start_date, end_date, description, location, image_url);
} catch (IOException e) {
e.printStackTrace();
this.error = R.string.error_connection;
} catch (Exception e) {
e.printStackTrace();
this.error = R.string.error_unknown;
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
/**
* When scraping is finished, the scraper callback will receive the event.
*
* @param aVoid
*/
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
this.scraper.scrapeEventResultCallback(this.event, this.error);
}
}

View File

@ -0,0 +1,133 @@
package com.akdev.nofbeventscraper;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import androidx.preference.PreferenceManager;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* This class can asynchronously scrape public facebook pages for event ids
* It returns a String list of event urls
*/
public class FbPageScraper extends AsyncTask<Void, Void, Void> {
private FbScraper scraper;
private int error;
private String url;
private List<String> event_links = new ArrayList<>();
/**
* Constructor with reference to scraper to return results.
*
* @param scraper Reference to FbScraper
* @param page_url Input url to scrape from
*/
FbPageScraper(FbScraper scraper, String page_url) {
this.scraper = scraper;
this.url = page_url;
this.error = 0;
}
/**
* Started by execute().
* Gets the HTML doc from the input string and scrapes the event links from it.
*
* @param voids
* @return
*/
@Override
protected Void doInBackground(Void... voids) {
do {
try {
// 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();
}
/*
* get all event id's from current url and add to the list
*/
String regex = "(/events/[0-9]*)(/\\?event_time_id=[0-9]*)?";
List<String> event_links_href = document
.getElementsByAttributeValueMatching("href", Pattern.compile(regex))
.eachAttr("href");
for (String event_id : event_links_href) {
this.event_links.add("https://mbasic.facebook.com" + event_id);
}
/*
* check if more events should be scraped
*/
SharedPreferences shared_prefs = PreferenceManager
.getDefaultSharedPreferences(scraper.main.get());
int max = shared_prefs.getInt("page_event_max", 5);
if (event_links.size() < max) {
// find "next page
try {
String next_url = document
.getElementsByAttributeValueMatching("href", "has_more=1")
.first().attr("href");
this.url = "https://mbasic.facebook.com" + next_url;
} catch (NullPointerException e) {
url = null;
}
} else {
url = null;
event_links = event_links.subList(0, max);
}
} catch (IOException e) {
e.printStackTrace();
this.error = R.string.error_connection;
} catch (Exception e) {
e.printStackTrace();
this.error = R.string.error_unknown;
}
} while (url != null);
if (this.event_links.size() == 0) {
this.error = R.string.error_no_events;
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
/**
* When scraping is finished, the scraper callback will receive the link list.
*
* @param aVoid
*/
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
this.scraper.scrapePageResultCallback(this.event_links, this.error);
}
}

View File

@ -0,0 +1,40 @@
package com.akdev.nofbeventscraper;
import android.os.AsyncTask;
import java.net.HttpURLConnection;
import java.net.URL;
public class FbRedirectionResolver extends AsyncTask<Void, Void, Void> {
private String input_url;
private FbScraper scraper;
private String redirected_url;
public FbRedirectionResolver (FbScraper scraper, String input_url) {
this.input_url = input_url;
this.scraper = scraper;
}
protected Void doInBackground(Void... voids) {
try {
HttpURLConnection con = (HttpURLConnection) new URL(input_url).openConnection();
con.setInstanceFollowRedirects(false);
con.connect();
redirected_url = con.getHeaderField("Location");
} catch (Exception e) {
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
scraper.redirectionResultCallback(redirected_url);
}
}

View File

@ -2,57 +2,102 @@ package com.akdev.nofbeventscraper;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.text.Editable;
import android.text.SpannableStringBuilder;
import androidx.preference.PreferenceManager;
import org.json.JSONException;
import org.json.JSONObject;
import org.jsoup.Jsoup;
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.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
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> {
public class FbScraper {
private String error;
protected List<AsyncTask> tasks;
protected WeakReference<MainActivity> main; // no context leak with WeakReference
url_type_enum url_type = url_type_enum.EVENT;
private String input_url;
private WeakReference<MainActivity> main; // no context leak with WeakReference
private FbEvent event;
/**
* Constructor with WeakReference to the main activity, to update it's text fields.
* Constructor with WeakReference to the main activity, to add events.
*
* @param main WeakReference of main activity to prevent context leak
* @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;
this.tasks = new ArrayList<>();
}
protected String getShortened(String url) throws IOException, URISyntaxException {
// check for url format
new URL(url).toURI();
String regex = "(fb.me/)(e/)?([^/?]*)|(facebook.com/event_invite/[a-zA-Z0-9]*)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(url);
if (matcher.find()) {
//only mbasic does have event ids displayed in HTML
String url_prefix = "https://mbasic.";
// create URL
return url_prefix + matcher.group();
} else {
throw new URISyntaxException(url, "Does not contain page.");
}
}
/**
* Strips the facebook event link of the input url.
* Checks if valid URL,
* strips the facebook page id from the input link and create an URL that can be scraped from.
*
* @param url input URL
* @return new mbasic url that can be scraped for event id's
* @throws URISyntaxException if page not found
* @throws MalformedURLException
*/
protected String getPageUrl(String url) throws URISyntaxException, MalformedURLException {
// check for url format
new URL(url).toURI();
String regex = "(facebook.com/)(pg/)?([^/?]*)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(url);
if (matcher.find()) {
//only mbasic does have event ids displayed in HTML
String url_prefix = "https://mbasic.facebook.com/";
String url_suffix = "?v=events";
// create URL
return url_prefix + matcher.group(3) + url_suffix;
} else {
throw new URISyntaxException(url, "Does not contain page.");
}
}
/**
* Strips the facebook event link from the input event url.
*
* @param url input url
* @return facebook event url String if one was found
* @throws URISyntaxException if event not found
* @throws URISyntaxException if event not found
* @throws MalformedURLException
*/
protected String fixURI(String url) throws URISyntaxException, MalformedURLException {
protected String getEventUrl(String url) throws URISyntaxException, MalformedURLException {
// check for url format
new URL(url).toURI();
@ -65,7 +110,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
if (matcher.find()) {
String url_prefix = "https://m.";
if (main != null){
if (main != null) {
SharedPreferences shared_prefs = PreferenceManager.getDefaultSharedPreferences(main.get());
url_prefix = shared_prefs.getString("url_preference", url_prefix);
}
@ -73,9 +118,10 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
// rewrite url to m.facebook and dismiss any query strings or referrals
String ret = url_prefix + matcher.group(1);
if (matcher.group(2) != null) {
// add event time identifier
ret += matcher.group(2);
}
return ret;
return ret;
} else {
throw new URISyntaxException(url, "Does not contain event.");
}
@ -83,176 +129,136 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
}
/**
* 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.
* cancel vestigial async tasks
*/
protected String fixLocation(String location_json) {
void killAllTasks() {
String location_name = "";
try {
JSONObject reader = new JSONObject(location_json);
location_name = reader.getString("name");
JSONObject address = reader.getJSONObject("address");
String type = address.getString("@type");
if (type.equals("PostalAddress")) {
String postal_code = address.getString("postalCode");
String address_locality = address.getString("addressLocality");
String street_address = address.getString("streetAddress");
// included in locality
//String address_country = address.getString("addressCountry");
return location_name + ", "
+ street_address + ", "
+ postal_code + " "
+ address_locality;
} else {
return location_name;
if (!tasks.isEmpty()) {
for (AsyncTask task : tasks) {
try {
task.cancel(true);
task = null;
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (JSONException e) {
e.printStackTrace();
return location_name;
}
}
/**
* Parses a time string from the facebook event.
* Corrects format to ISO date time and parse into ZonedDateTime
* start an EventScraper async task and add to tasks list
*
* @param time_in time string from the event
* @return ZonedDateTime parsed from input or null
* @param event_url
*/
protected ZonedDateTime toZonedDateTime(String time_in) {
try {
// time in is missing a : in the timezone offset
Editable editable = new SpannableStringBuilder(time_in);
String time_str = editable.insert(22, ":").toString();
// parse e.g. 2011-12-03T10:15:30+01:00
return ZonedDateTime.parse(time_str, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (Exception e) {
e.printStackTrace();
return null;
}
void scrapeEvent(String event_url) {
FbEventScraper scraper = new FbEventScraper(this, event_url);
tasks.add(scraper);
scraper.execute();
}
/**
* Replaces all occurrences of a facebook internal links in
* an event description into an actual URL.
* Callback for finished EventSCraper async task
*
* @param description_in description string from the event
* @return corrected String with internal links resolved
* @param event Contains event information if scraping successful
* @param error resId for error message
*/
protected String fixDescriptionLinks(String description_in) {
try {
/* @[152580919265:274:SiteDescription]
* to
* SiteDescription [m.facebook.com/152580919265] */
void scrapeEventResultCallback(FbEvent event, int error) {
return description_in.replaceAll("@\\[([0-9]{10,}):[0-9]{3}:([^]]*)]",
"$2 [m.facebook.com/$1]");
} catch (Exception e) {
e.printStackTrace();
return description_in;
if (event != null) {
main.get().addEvent(event);
main.get().input_helper(main.get().getString(R.string.done), false);
} else if (url_type == url_type_enum.EVENT) {
main.get().input_helper(main.get().getString(error), true);
}
}
/**
* 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
* start a page scraper and add to list of tasks
*
* @param page_url
*/
private String readFromJson(JSONObject reader, String field) {
try {
return reader.getString(field);
} catch (Exception e) {
e.printStackTrace();
return "";
}
void scrapePage(String page_url) {
FbPageScraper scraper = new FbPageScraper(this, page_url);
tasks.add(scraper);
scraper.execute();
}
/**
* Started by scraper.execute().
* Gets the HTML doc from the input string and scrapes the event information from it.
* @param voids
* @return
* Callback for page scraper async task
*
* @param event_urls List of event urls scraped from the event
* @param error resId of error message if task list is empty
*/
@Override
protected Void doInBackground(Void... voids) {
protected void scrapePageResultCallback(List<String> event_urls, int error) {
try {
String url = fixURI(input_url);
// use correct system user agent because of facebook ToS
String user_agent = System.getProperty("http.agent");
Document document = Jsoup.connect(url).userAgent(user_agent).get();
if (event_urls.size() > 0) {
if (document == null) {
throw new IOException();
for (String event_url : event_urls) {
try {
String url = getEventUrl(event_url);
scrapeEvent(url);
} catch (URISyntaxException | MalformedURLException e) {
// ignore this event
}
}
String json = document
.select("script[type = application/ld+json]")
.first().data();
} else {
main.get().input_helper(main.get().getString(error), true);
}
}
JSONObject reader = new JSONObject(json);
protected void redirectUrl (String url) {
FbRedirectionResolver resolver = new FbRedirectionResolver(this, url);
event = new FbEvent(
url,
readFromJson(reader, "name"),
toZonedDateTime(readFromJson(reader, "startDate")),
toZonedDateTime(readFromJson(reader, "endDate")),
fixDescriptionLinks(readFromJson(reader, "description")),
fixLocation(readFromJson(reader, "location")),
readFromJson(reader, "image")
);
resolver.execute();
}
protected void redirectionResultCallback(String url) {
this.input_url = url;
// now try again with expanded url
this.run();
}
/**
* Start scraping input url
*/
void run() {
// check if shortened url
try {
String shortened = getShortened(input_url);
url_type = url_type_enum.SHORT;
redirectUrl(shortened);
return;
} catch (IOException | URISyntaxException e) {
url_type = url_type_enum.INVALID;
}
// check if input url is an event
try {
String event_url = getEventUrl(input_url);
url_type = url_type_enum.EVENT;
scrapeEvent(event_url);
return;
} catch (URISyntaxException | MalformedURLException e) {
e.printStackTrace();
this.error = "Error: URL invalid.";
} catch (JSONException e) {
e.printStackTrace();
this.error = "Error: Scraping event data failed";
} catch (IOException e) {
e.printStackTrace();
this.error = "Error: Unable to connect.";
} catch (Exception e) {
e.printStackTrace();
this.error = "Error: Unknown Error.";
url_type = url_type_enum.INVALID;
}
// check if input url is a page
try {
String page_url = getPageUrl(input_url);
url_type = url_type_enum.PAGE;
scrapePage(page_url);
return null;
}
@Override
protected void onPreExecute() {
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 (main != null) {
if (this.event != null) {
main.get().update(event);
} else {
main.get().error(error);
main.get().clear(false);
}
} catch (URISyntaxException | MalformedURLException e) {
url_type = url_type_enum.INVALID;
main.get().input_helper(main.get().getString(R.string.error_url), true);
}
}
}
// enum for storing url type in this class
enum url_type_enum {SHORT, EVENT, PAGE, INVALID}
}

View File

@ -1,10 +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 {
@ -19,7 +22,17 @@ public class HelpActivity extends AppCompatActivity {
WebView webview_help = findViewById(R.id.webview_help);
webview_help.loadUrl("file:////android_asset/help.html");
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");
}
}

View File

@ -0,0 +1,33 @@
package com.akdev.nofbeventscraper;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class IntentReceiver extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*
* Get data from intent: if launched by other application
* via "share to" or "open with"
*/
Intent intent = getIntent();
setResult(RESULT_OK, intent);
String data = intent.getDataString();
String extra = intent.getStringExtra(Intent.EXTRA_TEXT);
String input = (data != null) ? data : extra;
Intent main = new Intent(this, MainActivity.class);
main.putExtra("InputLink", input);
this.startActivity(main);
finish();
}
}

View File

@ -1,91 +1,149 @@
package com.akdev.nofbeventscraper;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.view.inputmethod.InputMethodManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.Toolbar;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.squareup.picasso.Picasso;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.ref.WeakReference;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Objects;
import static com.akdev.nofbeventscraper.FbEvent.dateTimeToEpoch;
import jp.wasabeef.recyclerview.animators.FadeInAnimator;
import static com.akdev.nofbeventscraper.FbEvent.createEventList;
public class MainActivity extends AppCompatActivity {
protected Button ok_button;
protected Button paste_button;
protected ExtendedFloatingActionButton paste_button;
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;
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;
protected List<FbEvent> events;
EventAdapter adapter;
LinearLayoutManager linear_layout_manager;
private List<FbEvent> getSavedEvents() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Gson gson = new Gson();
String json = prefs.getString("events", "");
Type event_list_type = new TypeToken<List<FbEvent>>() {
}.getType();
List<FbEvent> list = gson.fromJson(json, event_list_type);
if (list == null) {
list = createEventList();
}
return list;
}
/*
* On resume from other activities, e.g. settings
*/
@Override
public void onResume() {
super.onResume();
/*
* Clear events after saved events deleted from settings
*/
if (getSavedEvents().isEmpty()) {
events.clear();
adapter.notifyDataSetChanged();
}
/*
* Intent from IntentReceiver - read only once
*/
Intent intent = getIntent();
String data = intent.getStringExtra("InputLink");
if (data != null) {
intent.removeExtra("InputLink");
edit_text_uri_input.setText(data);
startScraping();
}
}
/**
* Save events list to SharedPreferences as JSON
*/
@Override
public void onPause() {
super.onPause();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor prefs_edit = prefs.edit();
Gson gson = new Gson();
String json = gson.toJson(events);
prefs_edit.putString("events", json);
prefs_edit.apply();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
edit_text_uri_input = findViewById(R.id.edit_text_uri_input);
layout_uri_input = findViewById(R.id.layout_uri_input);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ok_button = (Button) findViewById(R.id.ok_button);
paste_button = (Button) findViewById(R.id.paste_button);
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);
paste_button = findViewById(R.id.paste_button);
/*
* Default view settings
* initialize recycler view with saved list of events
* scroll horizontal with snapping
*/
ok_button.setEnabled(false);
layout_event_location.setEndIconVisible(false);
image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);
RecyclerView recycler_view = findViewById(R.id.recycler_view);
this.events = getSavedEvents();
adapter = new EventAdapter(events);
recycler_view.setAdapter(adapter);
linear_layout_manager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recycler_view.setLayoutManager(linear_layout_manager);
recycler_view.setItemAnimator(new FadeInAnimator());
/*
* Display title only when toolbar is collapsed
*/
AppBarLayout app_bar_layout = (AppBarLayout) findViewById(R.id.app_bar);
AppBarLayout app_bar_layout = findViewById(R.id.app_bar);
app_bar_layout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
boolean show = true;
int scroll_range = -1;
CollapsingToolbarLayout layout_toolbar = findViewById(R.id.layout_toolbar);
@Override
public void onOffsetChanged(AppBarLayout app_bar_layout, int vertical_offset) {
@ -113,67 +171,33 @@ public class MainActivity extends AppCompatActivity {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
String str = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
clear(true);
edit_text_uri_input.setText(str);
} catch (NullPointerException e) {
startScraping();
} catch (Exception e) {
e.printStackTrace();
error("Error: Clipboard empty");
input_helper(getString(R.string.error_clipboard_empty), true);
}
startScraping();
}
});
/*
* Clear button: delete all text in all fields
* Error in input: clear input on click
*/
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
clear(true);
input_helper(getString(R.string.helper_add_link), true);
edit_text_uri_input.setText(null);
if (scraper != null) {
scraper.killAllTasks();
}
input_helper(getString(R.string.helper_add_link), false);
}
};
layout_uri_input.setEndIconOnClickListener(listener);
layout_uri_input.setErrorIconOnClickListener(listener);
layout_uri_input.setEndIconOnClickListener(listener);
/*
* Maps button: launch maps intent
*/
layout_event_location.setEndIconOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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) {
Long start_epoch = dateTimeToEpoch(event.start_date);
Long end_epoch = dateTimeToEpoch(event.end_date);
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);
// prepend url in description
String desc = event.url + "\n\n" + event.description;
intent.putExtra(CalendarContract.Events.DESCRIPTION, desc);
startActivity(intent);
}
});
/*
* Enter button in uri input: start scraping
@ -183,6 +207,13 @@ public class MainActivity extends AppCompatActivity {
//If the key event is a key-down event on the "enter" button
if ((keyevent.getAction() == KeyEvent.ACTION_DOWN) && (keycode == KeyEvent.KEYCODE_ENTER)) {
startScraping();
// do not focus next view, just release it
edit_text_uri_input.clearFocus();
// close soft keyboard
InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
return true;
}
return false;
@ -190,154 +221,82 @@ public class MainActivity extends AppCompatActivity {
});
/*
* 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
edit_text_uri_input.setText(data.toString());
startScraping();
} else if (shared_text != null) {
//share to nofb
edit_text_uri_input.setText(shared_text);
startScraping();
}
}
/**
* launch the FbScraper asynchronous task with the current text in the input text field.
* launch the FbScraper with the current text in the input text field.
*/
public void startScraping() {
error(null);
input_helper(null, false);
String url = Objects.requireNonNull(edit_text_uri_input.getText()).toString();
scraper = new FbScraper(new WeakReference<>(this), url);
scraper.execute();
}
public void error(String str) {
layout_uri_input.setError(str);
scraper.run();
}
/**
* 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.
* manage Helper text on uri_input
*
* @param clear_uri Choose whether to clear the input uri field, too
* @param str What should be displayed
* @param error True if should be displayed as error
*/
public void clear(boolean clear_uri) {
public void input_helper(String str, boolean error) {
if (clear_uri) {
edit_text_uri_input.setText("");
if (str == null) {
str = " ";
} // keep spacing
if (error) {
layout_uri_input.setError(str);
} else {
layout_uri_input.setError(null);
layout_uri_input.setHelperText(str);
}
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 {
scraper.cancel(true);
scraper = null;
} 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.
* Adds new events to the start of the events list.
*
* @param scraped_event the event information that was scraped by FbScraper
* @param new_event the event that was scraped by FbScraper
*/
public void update(FbEvent scraped_event) {
public void addEvent(FbEvent new_event) {
this.event = scraped_event;
edit_text_uri_input.setText(event.url);
if (event.name.equals("")) {
edit_text_event_name.setError("no event name detected");
} else {
edit_text_event_name.setText(event.name);
if (new_event != null) {
this.events.add(0, new_event);
this.adapter.notifyItemInserted(0);
}
if (event.start_date == null) {
edit_text_event_start.setError("no event start date detected");
} else {
String str = FbEvent.dateTimeToString(event.start_date);
edit_text_event_start.setText(str);
}
if (event.end_date == null) {
edit_text_event_end.setError("no event end date detected");
} else {
String str = FbEvent.dateTimeToString(event.end_date);
edit_text_event_end.setText(str);
}
if (event.location.equals("")) {
edit_text_event_location.setError("no event location detected");
} else {
edit_text_event_location.setText(event.location);
layout_event_location.setEndIconVisible(true);
}
if (event.description.equals("")) {
edit_text_event_description.setError("no event description detected");
} 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){
/*
* Display icons, restricted API, maybe find other solution?
*/
if (menu instanceof MenuBuilder) {
MenuBuilder m = (MenuBuilder) menu;
//noinspection RestrictedApi
m.setOptionalIconsVisible(true);
}
return true;
}
/**
* Dispatch menu item to new activity
*
* @param item
* @return
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_about) {
startActivity(new Intent(this, AboutActivity.class));
return true;

View File

@ -1,11 +1,16 @@
package com.akdev.nofbeventscraper;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import com.google.android.material.snackbar.Snackbar;
public class SettingsActivity extends AppCompatActivity {
@Override
@ -26,6 +31,36 @@ public class SettingsActivity extends AppCompatActivity {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.root_preferences, rootKey);
/*
* reset events click action: delete saved events and display snackbar
*/
Preference button = findPreference("event_reset");
if (button != null) {
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final SharedPreferences prefs = preference.getSharedPreferences();
final String undo = prefs.getString("events", "");
prefs.edit().remove("events").apply();
Snackbar.make(getActivity().findViewById(android.R.id.content),
getString(R.string.preferences_event_snackbar), Snackbar.LENGTH_SHORT)
.setAction(R.string.undo, new View.OnClickListener() {
@Override
public void onClick(View v) {
prefs.edit().putString("events", undo).apply();
}
}).show();
return true;
}
});
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:height="8dp"
android:width="0dp"/>
</shape>

View File

@ -1,9 +0,0 @@
<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>

View File

@ -1,63 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="120dp"
android:height="120dp"
android:viewportWidth="120"
android:viewportHeight="120">
<group android:scaleX="0.078457944"
android:scaleY="0.078457944"
android:translateX="34.815"
android:translateY="34.815">
<path
android:pathData="M0.5,0.5h640v640h-640z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
<path
android:pathData="M0.5,120.5h640v410h-640z"
android:fillColor="#297da6"
android:strokeColor="#00000000"/>
<path
android:pathData="M6.5,40.5L634.5,40.5A6,6 0,0 1,640.5 46.5L640.5,134.5A6,6 0,0 1,634.5 140.5L6.5,140.5A6,6 0,0 1,0.5 134.5L0.5,46.5A6,6 0,0 1,6.5 40.5z"
android:fillColor="#74b42b"
android:strokeColor="#00000000"/>
<path
android:pathData="M519.5,0.5L561.5,0.5A9,9 0,0 1,570.5 9.5L570.5,101.5A9,9 0,0 1,561.5 110.5L519.5,110.5A9,9 0,0 1,510.5 101.5L510.5,9.5A9,9 0,0 1,519.5 0.5z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
<path
android:pathData="M399.5,0.5L441.5,0.5A9,9 0,0 1,450.5 9.5L450.5,101.5A9,9 0,0 1,441.5 110.5L399.5,110.5A9,9 0,0 1,390.5 101.5L390.5,9.5A9,9 0,0 1,399.5 0.5z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
<path
android:pathData="M199.5,0.5L241.5,0.5A9,9 0,0 1,250.5 9.5L250.5,101.5A9,9 0,0 1,241.5 110.5L199.5,110.5A9,9 0,0 1,190.5 101.5L190.5,9.5A9,9 0,0 1,199.5 0.5z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
<path
android:pathData="M79.5,0.5L121.5,0.5A9,9 0,0 1,130.5 9.5L130.5,101.5A9,9 0,0 1,121.5 110.5L79.5,110.5A9,9 0,0 1,70.5 101.5L70.5,9.5A9,9 0,0 1,79.5 0.5z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
<path
android:pathData="M526.5,10.5L554.5,10.5A6,6 0,0 1,560.5 16.5L560.5,94.5A6,6 0,0 1,554.5 100.5L526.5,100.5A6,6 0,0 1,520.5 94.5L520.5,16.5A6,6 0,0 1,526.5 10.5z"
android:fillColor="#42a3d2"
android:strokeColor="#00000000"/>
<path
android:pathData="M406.5,10.5L434.5,10.5A6,6 0,0 1,440.5 16.5L440.5,94.5A6,6 0,0 1,434.5 100.5L406.5,100.5A6,6 0,0 1,400.5 94.5L400.5,16.5A6,6 0,0 1,406.5 10.5z"
android:fillColor="#42a3d2"
android:strokeColor="#00000000"/>
<path
android:pathData="M86.5,10.5L114.5,10.5A6,6 0,0 1,120.5 16.5L120.5,94.5A6,6 0,0 1,114.5 100.5L86.5,100.5A6,6 0,0 1,80.5 94.5L80.5,16.5A6,6 0,0 1,86.5 10.5z"
android:fillColor="#42a3d2"
android:strokeColor="#00000000"/>
<path
android:pathData="M206.5,10.5L234.5,10.5A6,6 0,0 1,240.5 16.5L240.5,94.5A6,6 0,0 1,234.5 100.5L206.5,100.5A6,6 0,0 1,200.5 94.5L200.5,16.5A6,6 0,0 1,206.5 10.5z"
android:fillColor="#42a3d2"
android:strokeColor="#00000000"/>
<path
android:pathData="M9.5,490.5L631.5,490.5A9,9 0,0 1,640.5 499.5L640.5,631.5A9,9 0,0 1,631.5 640.5L9.5,640.5A9,9 0,0 1,0.5 631.5L0.5,499.5A9,9 0,0 1,9.5 490.5z"
android:fillColor="#297da6"
android:strokeColor="#00000000"/>
<path
android:pathData="M155.5,295.5L281.94,295.5L320.5,174.5L359.06,295.5L485.5,295.5L384.76,376.53L424.71,504.5L320.5,425.3L216.29,504.5L256.24,376.53Z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
</group>
</vector>

View 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="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"
android:fillColor="#000000"/>
</vector>

View File

@ -0,0 +1,12 @@
<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="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"
android:fillColor="#000000"/>
<path
android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"
android:fillColor="#000000"/>
</vector>

View 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="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"
android:fillColor="#000000"/>
</vector>

View File

@ -1,15 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<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=".AboutActivity">
<WebView
android:id="@+id/webview_about"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

View File

@ -1,15 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<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">
<WebView
android:id="@+id/webview_help"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
@ -21,22 +20,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="center"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title=" "
app:toolbarId="@+id/toolbar">
<!-- android:src="@drawable/ic_banner_foreground"-->
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
android:src="@drawable/ic_banner_foreground"
app:layout_collapseMode="pin" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
@ -48,7 +45,6 @@
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
@ -59,35 +55,10 @@
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/bottom_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="0dp"
app:contentInsetStart="0dp">
<Button
android:id="@+id/ok_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:padding="12dp"
android:text="@string/add_to_calendar"
android:textColor="#FFFFFF"
app:cornerRadius="24dp"
app:icon="@drawable/ic_event_available"
app:iconGravity="textStart"
app:iconPadding="16dp"
app:iconTint="#FFFFFF" />
</com.google.android.material.bottomappbar.BottomAppBar>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,43 +1,31 @@
<?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">
<LinearLayout
android:id="@+id/linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="32dp"
android:layout_marginBottom="64dp"
android:divider="@drawable/divider"
android:layout_height="match_parent"
android:orientation="vertical"
android:showDividers="middle">
android:layout_marginTop="16dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layout_uri_input"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:endIconCheckable="false"
app:endIconDrawable="@drawable/ic_backspace_black"
app:endIconMode="clear_text"
app:errorIconDrawable="@drawable/ic_backspace_black"
app:endIconMode="custom"
app:helperText="@string/add_link_helper"
app:helperText="@string/helper_add_link"
app:helperTextEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -46,100 +34,18 @@
android:layout_height="wrap_content"
android:autoLink="web"
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>
<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_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:cursorVisible="false"
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.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_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:cursorVisible="false"
android: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.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="Event end"
android:inputType="textNoSuggestions"
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"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:endIconDrawable="@drawable/ic_add_location"
app:endIconMode="custom">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_event_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="map"
android:focusable="false"
android:cursorVisible="false"
android:hint="Event location"
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/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="Event description"
android:inputType="textNoSuggestions|textMultiLine"
android:singleLine="false"
android:textColorLink="@color/material_on_background_emphasis_high_type" />
</com.google.android.material.textfield.TextInputLayout>
android:nestedScrollingEnabled="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_view_event_image_fullscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
tools:srcCompat="@tools:sample/avatars" />
</LinearLayout>

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_view_event_image"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginEnd="8dp"
android:contentDescription="thumbnail"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/text_view_event_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event_placeholder"
android:textAppearance="?attr/textAppearanceHeadline6" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_view_event_location"
style="?android:attr/borderlessButtonStyle"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackground"
android:scaleType="centerCrop"
android:src="@drawable/ic_map"
app:tint="@color/material_on_surface_emphasis_high_type" />
<TextView
android:id="@+id/text_view_event_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event_placeholder"
android:textAppearance="?attr/textAppearanceBody1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_view_event_time"
style="?android:attr/borderlessButtonStyle"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="false"
android:src="@drawable/ic_schedule"
app:tint="@color/material_on_surface_emphasis_high_type" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/text_view_event_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event_placeholder"
android:textAppearance="?attr/textAppearanceBody2" />
<TextView
android:id="@+id/text_view_event_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event_placeholder"
android:textAppearance="?attr/textAppearanceBody2" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/text_view_event_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:ellipsize="end"
android:maxLines="5"
android:text="@string/event_placeholder"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/button_add_to_calendar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/button_add"
android:textColor="@android:color/white"
app:icon="@drawable/ic_event_available"
app:iconGravity="textStart"
app:iconTint="@android:color/white" />
<ImageView
android:id="@+id/image_view_share"
style="?android:attr/borderlessButtonStyle"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="16dp"
android:background="?android:attr/selectableItemBackground"
android:scaleType="centerCrop"
android:src="@drawable/ic_share"
app:tint="@color/material_on_surface_emphasis_high_type" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_channel_background"/>
<foreground android:drawable="@drawable/ic_channel_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,12 @@
<!doctype html>
<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>

View 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>

View File

@ -1,11 +1,12 @@
<!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>
<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://www.paypalobjects.com/webstatic/de_DE/i/de-pp-logo-100px.png" /></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>

View File

@ -8,7 +8,7 @@
<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 publicy available. If the event does not offer for example the location without a login, it will not be available in this application. Events with multiple instances are problematic because they do not provide the correct start and end date when scraping from m.facebook.com.</p>
<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&amp;hl=de">Etar Calendar</a> because it is Open Source.</p>
<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>

View File

@ -0,0 +1,26 @@
<?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="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 mbasic.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_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>
<string name="preferences_events_header">Veranstaltungen</string>
<string name="preferences_event_setting">Veranstaltungsliste löschen</string>
<string name="preferences_event_snackbar">"Veranstaltungen gelöscht "</string>
<string name="done">Fertig</string>
<string name="undo">Rückgängig</string>
<string name="preferences_page_event_max_summary">Maximale Anzahl Events, die von einer einzelnen Seite geladen werden sollen.</string>
<string name="preferences_page_event_max">Veranstaltungslimit für Seiten</string>
<string name="error_no_events">Fehler: keine bevorstehenden Veranstaltungen</string>
</resources>

View File

@ -1,12 +1,12 @@
<resources>
<!-- Reply Preference -->
<string-array name="url_to_scrape">
<item>m.facebook.com</item>
<item>mbasic.facebook.com</item>
<item>www.facebook.com</item>
</string-array>
<string-array name="url_prefix">
<item>https://m.</item>
<item>https://mbasic.</item>
<item>https://www.</item>
</string-array>

View File

@ -1,19 +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="action_settings">Settings</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>
<!-- Preference Titles -->
<string name="scraper_header">Scraper</string>
<!-- Input hints -->
<string name="hint_add_link">Event link</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_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>
<string name="error_no_events">Error: No upcoming events</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 mbasic.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="preferences_events_header">Events</string>
<string name="preferences_event_setting">Clear event list</string>
<string name="preferences_event_snackbar">Events list cleared</string>
<string name="preferences_page_event_max_summary">Maximum amount of events scraped from a single page link.</string>
<string name="preferences_page_event_max">Page event limit</string>
<!-- others -->
<string name="event_placeholder" translatable="false">Placeholder</string>
<string name="done">Done</string>
<string name="undo">Undo</string>
<string name="url_setting">Which URL to scrape</string>
<string name="url_setting_summary">
Using m.facebook.com is more stable and faster. Using www.facebook.com works better with multiple instance events but will eventually break when facebook disables the classic design.
</string>
</resources>

View File

@ -14,7 +14,6 @@
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
</resources>

View File

@ -1,21 +1,36 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/scraper_header">
<PreferenceCategory app:title="@string/preferences_scraper_header">
<ListPreference
app:defaultValue="https://m."
android:summary="@string/preferences_url_setting_summary"
app:defaultValue="https://mbasic."
app:entries="@array/url_to_scrape"
app:entryValues="@array/url_prefix"
app:key="url_preference"
app:title="@string/url_setting"
android:summary="@string/url_setting_summary"/>
app:title="@string/preferences_url_setting" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/preferences_events_header">
<SeekBarPreference
android:defaultValue="5"
app:showSeekBarValue="true"
app:min="1"
android:max="30"
android:summary="@string/preferences_page_event_max_summary"
android:key="page_event_max"
android:title="@string/preferences_page_event_max" />
<Preference
android:key="event_reset"
android:title="@string/preferences_event_setting" />
</PreferenceCategory>
</PreferenceScreen>

21
create_changelog.sh Executable file
View 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
awk 1 $changelog_location/"$i".txt >> CHANGELOG.md
done

View File

@ -0,0 +1,12 @@
Der Zweck dieser Anwendung ist es, Zugang zu Facebook-Veranstaltungen ohne ein Konto zu erhalten.
Daher verwendet sie nicht die Facebook-API.
Stattdessen öffnet sie die URI der Facebook-Veranstaltung und lädt den HTML-Code der Website herunter.
Dieser Code sollte die Veranstaltungsinformationen in Form von strukturierten Daten enthalten.
Die Daten werden extrahiert und zur Erstellung von Android-Terminen verwendet.
Features:
* Verwendet keine Facebook-API
* Unterstützt "öffnen-mit" und "teilen mit".
* Unabhängig von regionalen Subdomain-URLs von Facebook
* Speichert den Verlauf der eingegebenen Veranstaltungen
* Unterstützt bevorstehende Veranstaltungen von Seiten

View File

@ -0,0 +1 @@
Facebook-Veranstaltungen zum Kalender hinzufügen

View File

@ -1 +1 @@
Initial release.
- Initial release.

View File

@ -0,0 +1,6 @@
- Support pages with upcoming events *beta*
- Display events in a scrollable card-based view
- Improve intent handling
- Add history for scraped events
- Tap image preview to open fullscreen
- Scrape name and image even if no event data found

View File

@ -0,0 +1,3 @@
- Fix events not displaying correctly after activity resume
- add share action on each event
- add URL shortener redirection for fb.me

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -1,8 +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.
- 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.

View File

@ -1,2 +1,2 @@
Fix invalid default uri.
Update about section.
- Fix invalid default uri.
- Update about section.

View 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.

View File

@ -0,0 +1,3 @@
- Update about section with download and changelog information.
- Improve high-res preview scraping.
- Fix potential crash on calendar intent.

View File

@ -1,4 +1,12 @@
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.
The purpose of this application is to get access to Facebook events without an account.
Therefore it does not use the Facebook API.
Instead it opens the Facebook event URI and downloads the website HTML code.
This source should contain the event information in form of structured data.
That data is extracted and used to create Android events.
Features:
* Does not use Facebook API
* Supports "open-with" and "share-to"
* Independent from Facebook regional sub-domain URLs
* Saves history of scraped events
* Handles upcoming events from pages

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 KiB

After

Width:  |  Height:  |  Size: 261 KiB

View File

@ -1 +1 @@
This app scrapes facebook event links and adds the event to your calendar.
Import Facebook-Events to the calendar