Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.net.Uri;
import android.util.ArrayMap;

import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.FileProvider;
import androidx.test.espresso.IdlingRegistry;
import androidx.test.espresso.IdlingResource;
Expand Down Expand Up @@ -184,4 +185,22 @@ public void testPDF() {
.perform(click());
});
}

@Test
public void testFileTypeSwitch() {
// Test the file type registration switch functionality
SwitchCompat fileTypeSwitch = mainActivityActivityTestRule.getActivity().findViewById(R.id.landing_catch_all);
Assert.assertNotNull("File type switch should exist", fileTypeSwitch);

// Test toggling the switch
onView(withId(R.id.landing_catch_all))
.perform(click());

// Switch should now be in opposite state
onView(withId(R.id.landing_catch_all))
.perform(click());

// Should be back to original state
// This test verifies the switch is functional and doesn't crash
}
}
89 changes: 89 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,95 @@
android:label="@string/app_title"
android:targetActivity="at.tomtasche.reader.ui.activity.MainActivity"
tools:ignore="AppLinkUrlError">
<!-- PDF files -->
<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:mimeType="application/pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data android:scheme="content" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
<data android:pathPattern=".*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="*/*" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
<data android:pathPattern=".*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.pdf" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.pdf" />
</intent-filter>
<!-- Microsoft Word DOC files -->
<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:mimeType="application/msword" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data android:scheme="content" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.doc" />
<data android:pathPattern=".*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.doc" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="*/*" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.doc" />
<data android:pathPattern=".*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.doc" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.doc" />
</intent-filter>
<!-- OpenDocument formats -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand Down