From: masensio Date: Thu, 27 Feb 2014 07:40:17 +0000 (+0100) Subject: Merge branch 'develop' into send_file_pr311_with_develop X-Git-Tag: oc-android-1.5.5~22^2~8 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/ac836eddb76f9489d4ed643802f6c89b184a88c3?ds=inline;hp=-c Merge branch 'develop' into send_file_pr311_with_develop --- ac836eddb76f9489d4ed643802f6c89b184a88c3 diff --combined src/com/owncloud/android/ui/activity/FileDisplayActivity.java index f0e9b828,76ba0c09..6429e870 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@@ -34,7 -34,6 +34,7 @@@ import android.content.IntentFilter import android.content.ServiceConnection; import android.content.SharedPreferences; import android.content.SyncRequest; +import android.content.res.Configuration; import android.content.res.Resources.NotFoundException; import android.database.Cursor; import android.net.Uri; @@@ -121,7 -120,6 +121,7 @@@ OCFileListFragment.ContainerActivity, F private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW"; private static final String KEY_SYNC_IN_PROGRESS = "SYNC_IN_PROGRESS"; //private static final String KEY_REFRESH_SHARES_IN_PROGRESS = "SHARES_IN_PROGRESS"; + private static final String KEY_WAITING_TO_SEND = "WAITING_TO_SEND"; public static final int DIALOG_SHORT_WAIT = 0; private static final int DIALOG_CHOOSE_UPLOAD_SOURCE = 1; @@@ -143,8 -141,6 +143,8 @@@ private boolean mSyncInProgress = false; //private boolean mRefreshSharesInProgress = false; + private OCFile mWaitingToSend; + @Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); @@@ -175,13 -171,11 +175,13 @@@ mWaitingToPreview = (OCFile) savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); //mRefreshSharesInProgress = savedInstanceState.getBoolean(KEY_REFRESH_SHARES_IN_PROGRESS); + mWaitingToSend = (OCFile) savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND); } else { mWaitingToPreview = null; mSyncInProgress = false; //mRefreshSharesInProgress = false; + mWaitingToSend = null; } /// USER INTERFACE @@@ -224,10 -218,6 +224,10 @@@ unbindService(mUploadConnection); } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + } /** * Called when the ownCloud {@link Account} associated to the Activity was just updated. @@@ -676,7 -666,6 +676,7 @@@ outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW, mWaitingToPreview); outState.putBoolean(FileDisplayActivity.KEY_SYNC_IN_PROGRESS, mSyncInProgress); //outState.putBoolean(FileDisplayActivity.KEY_REFRESH_SHARES_IN_PROGRESS, mRefreshSharesInProgress); + outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND, mWaitingToSend); Log_OC.d(TAG, "onSaveInstanceState() end"); } @@@ -691,7 -680,7 +691,7 @@@ // Listen for sync messages IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START); syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END); - syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_SIZE_SYNCED); + //syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_SIZE_SYNCED); syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED); syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED); syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED); @@@ -1033,13 -1022,6 +1033,13 @@@ refreshSecondFragment(intent.getAction(), downloadedRemotePath, intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false)); } + if (mWaitingToSend != null) { + mWaitingToSend = getStorageManager().getFileByPath(mWaitingToSend.getRemotePath()); // Update the file to send + if (mWaitingToSend.isDown() && mWaitingToSend.getStoragePath()!=null) { + sendDownloadedFile(); + } + } + removeStickyBroadcast(intent); } @@@ -1619,34 -1601,4 +1619,34 @@@ } */ + /** + * Requests the download of the received {@link OCFile} , updates the UI + * to monitor the download progress and prepares the activity to send the file + * when the download finishes. + * + * @param file {@link OCFile} to download and preview. + */ + @Override + public void startDownloadForSending(OCFile file) { + mWaitingToSend = file; + requestForDownload(mWaitingToSend); + boolean hasSecondFragment = (getSecondFragment()!= null); + updateFragmentsVisibility(hasSecondFragment); + } + + private void requestForDownload(OCFile file) { + Account account = getAccount(); + if (!mDownloaderBinder.isDownloading(account, file)) { + Intent i = new Intent(this, FileDownloader.class); + i.putExtra(FileDownloader.EXTRA_ACCOUNT, account); + i.putExtra(FileDownloader.EXTRA_FILE, file); + startService(i); + } + } + + private void sendDownloadedFile(){ + getFileOperationsHelper().sendDownloadedFile(mWaitingToSend, this); + mWaitingToSend = null; + } + }