Merge pull request #1327 from Somethingweirdhere/dev

Fixed crash when trying to open a downloaded file without a player
This commit is contained in:
Christian Schabesberger 2018-04-18 20:35:44 +02:00 committed by GitHub
commit a708278cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import android.webkit.MimeTypeMap;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
@ -282,7 +283,12 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
} }
//mContext.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); //mContext.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
Log.v(TAG, "Starting intent: " + intent); Log.v(TAG, "Starting intent: " + intent);
mContext.startActivity(intent); if (intent.resolveActivity(mContext.getPackageManager()) != null) {
mContext.startActivity(intent);
} else {
Toast noPlayerToast = Toast.makeText(mContext, R.string.toast_no_player, Toast.LENGTH_LONG);
noPlayerToast.show();
}
} }
static class ViewHolder extends RecyclerView.ViewHolder { static class ViewHolder extends RecyclerView.ViewHolder {

View File

@ -294,6 +294,8 @@
<string name="charset_letters_and_digits">Letters and digits</string> <string name="charset_letters_and_digits">Letters and digits</string>
<string name="charset_most_special_characters">Most special characters</string> <string name="charset_most_special_characters">Most special characters</string>
<string name="toast_no_player">No player has been found for this file</string>
<!-- About --> <!-- About -->
<string name="title_activity_about">About NewPipe</string> <string name="title_activity_about">About NewPipe</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>