Skip to content

Commit

Permalink
Catch exceptions when launching PDF viewer.
Browse files Browse the repository at this point in the history
Closes #8
  • Loading branch information
CDrummond committed Feb 28, 2023
1 parent 2c672b2 commit 7219d4a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/401.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed

• Catch exceptions when launching PDF viewer.
4 changes: 2 additions & 2 deletions lms-material/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
minSdkVersion 21
// Need to target 28, or lower, to allow WiFi to be enabled...
targetSdkVersion 28
versionCode 400
versionName "0.4.0"
versionCode 401
versionName "0.4.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,13 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (null!=path && path.toLowerCase().endsWith(".pdf")) {
intent.setDataAndType(uri, "application/pdf");
}
startActivity(intent);
try {
startActivity(intent);
} catch (Exception e) {
StyleableToast.makeText(getApplicationContext(),
getApplicationContext().getResources().getString(R.string.no_termux_run_perms),
Toast.LENGTH_SHORT, R.style.toast).show();
}
return true;
}

Expand Down
1 change: 1 addition & 0 deletions lms-material/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@
<string name="menu_start_player_summary">Show an entry in the main menu to start chosen player app.</string>
<string name="stopping_player">Stopping local player</string>
<string name="no_termux_run_perms">Do not have permission to run Termux commands</string>
<string name="failed_start_activity">Failed to start activity</string>
</resources>

0 comments on commit 7219d4a

Please sign in to comment.