1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-28 02:50:31 +00:00

Intercept ActivityNotFoundException for ACTION_CAPTIONING_SETTINGS

This commit is contained in:
Alexander-- 2019-12-01 12:33:34 +06:59
parent 20bff1389e
commit 29136d633a

View File

@ -1,9 +1,11 @@
package org.schabi.newpipe.settings;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
@ -42,7 +44,11 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment {
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey().equals(captionSettingsKey) && CAPTIONING_SETTINGS_ACCESSIBLE) {
startActivity(new Intent(Settings.ACTION_CAPTIONING_SETTINGS));
try {
startActivity(new Intent(Settings.ACTION_CAPTIONING_SETTINGS));
} catch (ActivityNotFoundException e) {
Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
}
}
return super.onPreferenceTreeClick(preference);