X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/435b31ba4f3597cc7a43270cd4a54fb0180956c1..ffc941e4407b1cb8989a8e87b032856ff9cfc8c0:/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java index 5dbb56eb..137cd296 100644 --- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java +++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java @@ -53,7 +53,7 @@ public class FileDetailFragment extends SherlockFragment implements public static final String FILE = "FILE"; private Intent mIntent; - private View mView; + //private View mView; private DownloadFinishReceiver mDownloadFinishReceiver; private OCFile mFile; @@ -73,8 +73,7 @@ public class FileDetailFragment extends SherlockFragment implements * to contain {@link FileDetailFragment#FILE} with an OCFile and also * {@link FileDownloader#EXTRA_ACCOUNT} with the account. * - * @param nonEmptyFragment - * True, to enable file detail rendering + * @param intent Intent with an account and a file in it for rendering */ public FileDetailFragment(Intent intent) { mLayout = R.layout.file_details_fragment; @@ -101,9 +100,8 @@ public class FileDetailFragment extends SherlockFragment implements /** * Use this method to signal this Activity that it shall update its view. * - * @param intent - * The {@link Intent} that contains extra information about this - * file The intent needs to have these extras: + * @param intent The {@link Intent} that contains extra information about + * this file The intent needs to have these extras: *
* * {@link FileDetailFragment#FILE}: An {@link OCFile} @@ -126,23 +124,23 @@ public class FileDetailFragment extends SherlockFragment implements setFilesize(mFile.getFileLength()); // set file preview if available and possible - VideoView videoView = (VideoView) mView + VideoView videoView = (VideoView) getView() .findViewById(R.id.videoView1); videoView.setVisibility(View.INVISIBLE); - if (mFile.getPath() == null) { + if (mFile.getStoragePath() == null) { ImageView imageView = (ImageView) getView().findViewById( R.id.imageView2); imageView.setImageResource(R.drawable.download); imageView.setOnClickListener(this); } else { if (mFile.getMimetype().startsWith("image/")) { - ImageView imageView = (ImageView) mView + ImageView imageView = (ImageView) getView() .findViewById(R.id.imageView2); - Bitmap bmp = BitmapFactory.decodeFile(mFile.getPath()); + Bitmap bmp = BitmapFactory.decodeFile(mFile.getStoragePath()); imageView.setImageBitmap(bmp); } else if (mFile.getMimetype().startsWith("video/")) { videoView.setVisibility(View.VISIBLE); - videoView.setVideoPath(mFile.getPath()); + videoView.setVideoPath(mFile.getStoragePath()); videoView.start(); } } @@ -153,23 +151,25 @@ public class FileDetailFragment extends SherlockFragment implements public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = null; - view = inflater.inflate(mLayout, container, false); - mIntent = getActivity().getIntent(); - mView = view; - - // make sure we are not using the empty layout - if (mEmptyLayout == false) { - updateFileDetails(); - } - return view; } @Override - public View getView() { - return mView == null ? super.getView() : mView; - }; + public void onStart() { + super.onStart(); + + // Fill in required information about file displaying + if(mIntent == null){ + mIntent = getActivity().getIntent(); + } + + // Fill in the details if the layout is not empty + if(!mEmptyLayout){ + updateFileDetails(); + } + + } private void setFilename(String filename) { TextView tv = (TextView) getView().findViewById(R.id.textView1);