mirror of
https://github.com/akaessens/NoFbEventScraper
synced 2025-06-05 23:29:13 +02:00
fix tests,
minor design fixes
This commit is contained in:
@ -36,7 +36,7 @@ public class MainActivityUnitTest {
|
||||
mInstrumentation.removeMonitor(monitor);
|
||||
|
||||
|
||||
final String exp = "https://m.facebook.com/events/261145401687844";
|
||||
final String exp = "https://www.facebook.com/events/261145401687844";
|
||||
|
||||
String url = "https://www.facebook.com/events/261145401687844";
|
||||
String act = mainActivity.checkURI(url);
|
||||
|
@ -55,12 +55,12 @@ public class ScraperUnitTest {
|
||||
FbScraper scraper = new FbScraper(null, "");
|
||||
|
||||
String in = "foo @[152580919265:274:MagentaMusik 360] bar";
|
||||
String exp = "foo m.facebook.com/152580919265 (MagentaMusik 360) bar";
|
||||
String exp = "foo MagentaMusik 360 [m.facebook.com/152580919265] bar";
|
||||
String act = scraper.fixLinks(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
in = "foo @[152580919265:274:MagentaMusik 360] bar @[666666666666:274:NoOfTheBeast]";
|
||||
exp = "foo m.facebook.com/152580919265 (MagentaMusik 360) bar m.facebook.com/666666666666 (NoOfTheBeast)";
|
||||
exp = "foo MagentaMusik 360 [m.facebook.com/152580919265] bar NoOfTheBeast [m.facebook.com/666666666666]";
|
||||
act = scraper.fixLinks(in);
|
||||
assertEquals(exp, act);
|
||||
|
||||
|
@ -80,7 +80,8 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||
protected String fixLinks(String description_in) {
|
||||
try {
|
||||
// @[152580919265:274:MagentaMusik 360] -> m.facebook.com/152580919265
|
||||
return description_in.replaceAll("@\\[([0-9]{10,}):[0-9]{3}:([^\\]]*)\\]", "m.facebook.com/$1 ($2)");
|
||||
return description_in.replaceAll("@\\[([0-9]{10,}):[0-9]{3}:([^\\]]*)\\]",
|
||||
"$2 [m.facebook.com/$1]");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -21,13 +21,9 @@ import android.widget.Toast;
|
||||
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.TimeZone;
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
@ -82,8 +82,9 @@
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_weight="1"
|
||||
android:padding="12dp"
|
||||
android:text="@android:string/cancel"
|
||||
@ -93,8 +94,9 @@
|
||||
android:id="@+id/ok_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_weight="1"
|
||||
android:padding="12dp"
|
||||
android:text="@android:string/ok"
|
||||
|
@ -2,5 +2,5 @@
|
||||
<resources>
|
||||
<color name="colorPrimary">#297DA6</color>
|
||||
<color name="colorPrimaryDark">#23607E</color>
|
||||
<color name="colorAccent">#23607E</color>
|
||||
<color name="colorAccent">#297DA6</color>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user