From: masensio Date: Tue, 29 Oct 2013 13:13:24 +0000 (+0100) Subject: Merge branch 'develop' into setup_buttons X-Git-Tag: oc-android-1.5.5~139^2~14 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/c2abbaaedb69dba35866a48b745b68f3519cbca1?hp=6ace8ab1c18b23a4c016986256075cfda8e50104 Merge branch 'develop' into setup_buttons --- diff --git a/README.md b/README.md index 3ba9f73a..45cb4be9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -This is the android client for [owncloud][0]. +This is the Android client for [ownCloud][0]. + +The app performs file synchronization with an ownCloud server. Other ownCloud features may be added in the future, but they are not a priority right now. Make sure you read [SETUP.md][1] when you start working on this project. diff --git a/SETUP.md b/SETUP.md index cd67a800..6e7b7f62 100644 --- a/SETUP.md +++ b/SETUP.md @@ -1,5 +1,5 @@ - If you want to start development of ownCloud first download required files, then compile using console or Eclipse, finally create pull request: + If you want to start help developing ownCloud please follow the [contribution guidlines][0] and observe these instructions: 1. Fork and download android/develop repository: @@ -42,6 +42,7 @@ 4. Create pull request: + - NOTE: You must sign the [Contributor Agreement][1] before your changes can be accepted! - Commit your changes locally: "git commit -a" - Push your changes to your Github repo: "git push" - Browse to https://github.com/YOURGITHUBNAME/android/pulls and issue pull request @@ -50,5 +51,6 @@ - Enter description and send pull request. - +[0]: https://github.com/owncloud/android/blob/master/CONTRIBUTING.md +[1]: http://owncloud.org/about/contributor-agreement/ diff --git a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java index 8d453f62..fbb6888b 100644 --- a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java +++ b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java @@ -53,9 +53,6 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log_OC.d(TAG, "Received: " + intent.getAction()); - - FileUploader fileUploader = new FileUploader(); - if (intent.getAction().equals(android.net.ConnectivityManager.CONNECTIVITY_ACTION)) { handleConnectivityAction(context, intent); }else if (intent.getAction().equals(NEW_PHOTO_ACTION_UNOFFICIAL)) { @@ -64,7 +61,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { } else if (intent.getAction().equals(NEW_PHOTO_ACTION)) { handleNewPhotoAction(context, intent); Log_OC.d(TAG, "OFFICIAL processed: android.hardware.action.NEW_PICTURE"); - } else if (intent.getAction().equals(fileUploader.getUploadFinishMessage())) { + } else if (intent.getAction().equals(FileUploader.getUploadFinishMessage())) { handleUploadFinished(context, intent); } else { Log_OC.e(TAG, "Incorrect intent sent: " + intent.getAction()); diff --git a/src/com/owncloud/android/files/services/FileDownloader.java b/src/com/owncloud/android/files/services/FileDownloader.java index 64d5d3ed..09103a1e 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -93,12 +93,12 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis private int mLastPercent; - public String getDownloadAddedMessage() { - return getClass().getName().toString() + DOWNLOAD_ADDED_MESSAGE; + public static String getDownloadAddedMessage() { + return FileDownloader.class.getName().toString() + DOWNLOAD_ADDED_MESSAGE; } - public String getDownloadFinishMessage() { - return getClass().getName().toString() + DOWNLOAD_FINISH_MESSAGE; + public static String getDownloadFinishMessage() { + return FileDownloader.class.getName().toString() + DOWNLOAD_FINISH_MESSAGE; } /** diff --git a/src/com/owncloud/android/files/services/FileObserverService.java b/src/com/owncloud/android/files/services/FileObserverService.java index a0003bec..7aa3fa9a 100644 --- a/src/com/owncloud/android/files/services/FileObserverService.java +++ b/src/com/owncloud/android/files/services/FileObserverService.java @@ -58,9 +58,6 @@ public class FileObserverService extends Service { private static DownloadCompletedReceiverBis mDownloadReceiver; private IBinder mBinder = new LocalBinder(); - private String mDownloadAddedMessage; - private String mDownloadFinishMessage; - public class LocalBinder extends Binder { FileObserverService getService() { return FileObserverService.this; @@ -72,13 +69,9 @@ public class FileObserverService extends Service { super.onCreate(); mDownloadReceiver = new DownloadCompletedReceiverBis(); - FileDownloader downloader = new FileDownloader(); - mDownloadAddedMessage = downloader.getDownloadAddedMessage(); - mDownloadFinishMessage= downloader.getDownloadFinishMessage(); - IntentFilter filter = new IntentFilter(); - filter.addAction(mDownloadAddedMessage); - filter.addAction(mDownloadFinishMessage); + filter.addAction(FileDownloader.getDownloadAddedMessage()); + filter.addAction(FileDownloader.getDownloadFinishMessage()); registerReceiver(mDownloadReceiver, filter); mObserversMap = new HashMap(); @@ -268,12 +261,12 @@ public class FileObserverService extends Service { String downloadPath = intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH); OwnCloudFileObserver observer = mObserversMap.get(downloadPath); if (observer != null) { - if (intent.getAction().equals(mDownloadFinishMessage) && + if (intent.getAction().equals(FileDownloader.getDownloadFinishMessage()) && new File(downloadPath).exists()) { // the download could be successful. not; in both cases, the file could be down, due to a former download or upload observer.startWatching(); Log_OC.d(TAG, "Watching again " + downloadPath); - } else if (intent.getAction().equals(mDownloadAddedMessage)) { + } else if (intent.getAction().equals(FileDownloader.getDownloadAddedMessage())) { observer.stopWatching(); Log_OC.d(TAG, "Disabling observance of " + downloadPath); } diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index 11084623..51f8238a 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -130,8 +130,8 @@ public class FileUploader extends Service implements OnDatatransferProgressListe private RemoteViews mDefaultNotificationContentView; - public String getUploadFinishMessage() { - return getClass().getName().toString() + UPLOAD_FINISH_MESSAGE; + public static String getUploadFinishMessage() { + return FileUploader.class.getName().toString() + UPLOAD_FINISH_MESSAGE; } /** diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 3d09b47e..25f7ed35 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -361,5 +361,4 @@ public class SynchronizeFolderOperation extends RemoteOperation { } } - } diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 8c187cc6..a0ca9881 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -288,9 +288,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { * @param dirRemotePath Remote path of a folder that was just synchronized (with or without success) */ private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) { - FileSyncService fileSyncService = new FileSyncService(); - - Intent i = new Intent(fileSyncService.getSyncMessage()); + Intent i = new Intent(FileSyncService.getSyncMessage()); i.putExtra(FileSyncService.IN_PROGRESS, inProgress); i.putExtra(FileSyncService.ACCOUNT_NAME, getAccount().name); if (dirRemotePath != null) { diff --git a/src/com/owncloud/android/syncadapter/FileSyncService.java b/src/com/owncloud/android/syncadapter/FileSyncService.java index d3472658..7d4dda68 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncService.java +++ b/src/com/owncloud/android/syncadapter/FileSyncService.java @@ -28,14 +28,15 @@ import android.os.IBinder; * */ public class FileSyncService extends Service { - public static final String SYNC_MESSAGE = "ACCOUNT_SYNC"; + + private static final String SYNC_MESSAGE = "ACCOUNT_SYNC"; public static final String SYNC_FOLDER_REMOTE_PATH = "SYNC_FOLDER_REMOTE_PATH"; public static final String IN_PROGRESS = "SYNC_IN_PROGRESS"; public static final String ACCOUNT_NAME = "ACCOUNT_NAME"; public static final String SYNC_RESULT = "SYNC_RESULT"; - public String getSyncMessage(){ - return getClass().getName().toString() + SYNC_MESSAGE; + public static String getSyncMessage(){ + return FileSyncService.class.getName().toString() + SYNC_MESSAGE; } /* * {@inheritDoc} diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index b93321ab..a7097060 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -139,9 +139,6 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa private OCFile mWaitingToPreview; private Handler mHandler; - private String mDownloadAddedMessage; - private String mDownloadFinishMessage; - @Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); @@ -151,10 +148,6 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa mHandler = new Handler(); - FileDownloader downloader = new FileDownloader(); - mDownloadAddedMessage = downloader.getDownloadAddedMessage(); - mDownloadFinishMessage= downloader.getDownloadFinishMessage(); - /// bindings to transference services mUploadConnection = new ListServiceConnection(); mDownloadConnection = new ListServiceConnection(); @@ -412,12 +405,12 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa // the user browsed to other file ; forget the automatic preview mWaitingToPreview = null; - } else if (downloadEvent.equals(mDownloadAddedMessage)) { + } else if (downloadEvent.equals(FileDownloader.getDownloadAddedMessage())) { // grant that the right panel updates the progress bar detailsFragment.listenForTransferProgress(); detailsFragment.updateFileDetails(true, false); - } else if (downloadEvent.equals(mDownloadFinishMessage)) { + } else if (downloadEvent.equals(FileDownloader.getDownloadFinishMessage())) { // update the right panel boolean detailsFragmentChanged = false; if (waitedPreview) { @@ -635,22 +628,19 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa super.onResume(); Log_OC.e(TAG, "onResume() start"); - FileUploader fileUploader = new FileUploader(); - FileSyncService fileSyncService = new FileSyncService(); - // Listen for sync messages - IntentFilter syncIntentFilter = new IntentFilter(fileSyncService.getSyncMessage()); + IntentFilter syncIntentFilter = new IntentFilter(FileSyncService.getSyncMessage()); mSyncBroadcastReceiver = new SyncBroadcastReceiver(); registerReceiver(mSyncBroadcastReceiver, syncIntentFilter); // Listen for upload messages - IntentFilter uploadIntentFilter = new IntentFilter(fileUploader.getUploadFinishMessage()); + IntentFilter uploadIntentFilter = new IntentFilter(FileUploader.getUploadFinishMessage()); mUploadFinishReceiver = new UploadFinishReceiver(); registerReceiver(mUploadFinishReceiver, uploadIntentFilter); // Listen for download messages - IntentFilter downloadIntentFilter = new IntentFilter(mDownloadAddedMessage); - downloadIntentFilter.addAction(mDownloadFinishMessage); + IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage()); + downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage()); mDownloadFinishReceiver = new DownloadFinishReceiver(); registerReceiver(mDownloadFinishReceiver, downloadIntentFilter); diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 36d7c217..317b98c5 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -208,8 +208,7 @@ public class FileDetailFragment extends FileFragment implements public void onResume() { super.onResume(); mUploadFinishReceiver = new UploadFinishReceiver(); - FileUploader fileUploader = new FileUploader(); - IntentFilter filter = new IntentFilter(fileUploader.getUploadFinishMessage()); + IntentFilter filter = new IntentFilter(FileUploader.getUploadFinishMessage()); getActivity().registerReceiver(mUploadFinishReceiver, filter); } diff --git a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java index 8f12ac70..87ddd562 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -82,9 +82,6 @@ public class PreviewImageActivity extends FileActivity implements FileFragment.C private boolean mFullScreen; - private String mDownloadAddedMessage; - private String mDownloadFinishMessage; - @Override protected void onCreate(Bundle savedInstanceState) { @@ -104,9 +101,6 @@ public class PreviewImageActivity extends FileActivity implements FileFragment.C mRequestWaitingForBinder = false; } - FileDownloader downloader = new FileDownloader(); - mDownloadAddedMessage = downloader.getDownloadAddedMessage(); - mDownloadFinishMessage= downloader.getDownloadFinishMessage(); } private void initViewPager() { @@ -227,8 +221,8 @@ public class PreviewImageActivity extends FileActivity implements FileFragment.C //Log.e(TAG, "ACTIVITY, ONRESUME"); mDownloadFinishReceiver = new DownloadFinishReceiver(); - IntentFilter filter = new IntentFilter(mDownloadFinishMessage); - filter.addAction(mDownloadAddedMessage); + IntentFilter filter = new IntentFilter(FileDownloader.getDownloadFinishMessage()); + filter.addAction(FileDownloader.getDownloadAddedMessage()); registerReceiver(mDownloadFinishReceiver, filter); } @@ -387,7 +381,7 @@ public class PreviewImageActivity extends FileActivity implements FileFragment.C boolean downloadWasFine = intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false); //boolean isOffscreen = Math.abs((mViewPager.getCurrentItem() - position)) <= mViewPager.getOffscreenPageLimit(); - if (position >= 0 && intent.getAction().equals(mDownloadFinishMessage)) { + if (position >= 0 && intent.getAction().equals(FileDownloader.getDownloadFinishMessage())) { if (downloadWasFine) { mPreviewImagePagerAdapter.updateFile(position, file);