X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/3113c459092dbb3dea60e50efe61070e38804b09..a9a1ad71e9495be4ed6d3e4033456d1161904c7c:/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 a8f0d812..cd26b2a1 100644 --- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java +++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java @@ -186,7 +186,7 @@ public class FileDetailFragment extends SherlockFragment implements @Override public void onClick(View v) { if (v.getId() == R.id.fdDownloadBtn) { - Toast.makeText(getActivity(), "Downloading", Toast.LENGTH_LONG).show(); + //Toast.makeText(getActivity(), "Downloading", Toast.LENGTH_LONG).show(); Intent i = new Intent(getActivity(), FileDownloader.class); i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); i.putExtra(FileDownloader.EXTRA_REMOTE_PATH, mFile.getRemotePath()); @@ -292,8 +292,13 @@ public class FileDetailFragment extends SherlockFragment implements } Display display = getActivity().getWindowManager().getDefaultDisplay(); Point size = new Point(); - display.getSize(size); - int screenwidth = size.x; + int screenwidth; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB_MR2) { + display.getSize(size); + screenwidth = size.x; + } else { + screenwidth = display.getWidth(); + } Log.e("ASD", "W " + width + " SW " + screenwidth); @@ -458,13 +463,14 @@ public class FileDetailFragment extends SherlockFragment implements private class DownloadFinishReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - getView().findViewById(R.id.fdDownloadBtn).setEnabled(true); - if (intent.getAction().equals(FileDownloader.BAD_DOWNLOAD_MESSAGE)) { - Toast.makeText(context, R.string.downloader_download_failed , Toast.LENGTH_SHORT).show(); - - } else if (intent.getAction().equals(FileDownloader.DOWNLOAD_FINISH_MESSAGE)) { + if (getView()!=null && getView().findViewById(R.id.fdDownloadBtn) != null) + getView().findViewById(R.id.fdDownloadBtn).setEnabled(true); + + if (intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false)) { mFile.setStoragePath(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH)); updateFileDetails(); + } else if (intent.getAction().equals(FileDownloader.DOWNLOAD_FINISH_MESSAGE)) { + Toast.makeText(context, R.string.downloader_download_failed , Toast.LENGTH_SHORT).show(); } }