Fixed NPE after a file has been opened for the first time: Added a check for  if the Activity has been attached to the fragment + refactored the onCreateView method in order to slice out the methods that need this check.
Merge remote-tracking branch 'origin/master'