switch to m.facebook scraping
more descriptive toolbar button string update unit tests
This commit is contained in:
parent
98ab900b3d
commit
d60717f0b7
|
@ -36,7 +36,7 @@ public class MainActivityUnitTest {
|
|||
mInstrumentation.removeMonitor(monitor);
|
||||
|
||||
|
||||
final String exp = "https://www.facebook.com/events/261145401687844";
|
||||
final String exp = "https://m.facebook.com/events/261145401687844";
|
||||
|
||||
String url = "https://www.facebook.com/events/261145401687844";
|
||||
String act = mainActivity.checkURI(url);
|
||||
|
@ -53,6 +53,10 @@ public class MainActivityUnitTest {
|
|||
url = "https://www.facebook.com/events/261145401687844/?active_tab=discussion";
|
||||
act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
|
||||
url = "https://www.facebook.com/events/261145401687844?reflink_something";
|
||||
act = mainActivity.checkURI(url);
|
||||
assertEquals(exp, act);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -202,18 +202,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static boolean isNumeric(String strNum) {
|
||||
if (strNum == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
double d = Double.parseDouble(strNum);
|
||||
} catch (NumberFormatException e) {
|
||||
//e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
String checkURI(String str)
|
||||
{
|
||||
try {
|
||||
|
@ -223,7 +211,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
if (str.matches(".*(facebook.com/events/[0-9]*).*")) {
|
||||
return str.replaceAll(".*(facebook.com/events/[0-9]*).*",
|
||||
"https://www.$1");
|
||||
"https://m.$1");
|
||||
}
|
||||
else {
|
||||
error("Error: Invalid URL");
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_height="180dp"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
app:layout_anchor="@id/app_bar"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:icon="@drawable/ic_content_paste"
|
||||
android:text="@android:string/paste"/>
|
||||
android:text="@string/paste_button"/>
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<string name="add_link_hint">Event link</string>
|
||||
<string name="add_link_helper">Paste facebook link to the event.</string>
|
||||
<string name="add_to_calendar">Add to calendar</string>
|
||||
<string name="paste_button">Paste from clipboard</string>
|
||||
|
||||
<string name="description_heading">Description</string>
|
||||
<string name="description_text">This application was developed to be used without a facebook account.
|
||||
|
|
Loading…
Reference in New Issue