From: David A. Velasco Date: Fri, 28 Mar 2014 11:55:07 +0000 (+0100) Subject: AuthenticatorActivity is bound to OperationsService when created X-Git-Tag: oc-android-1.7.0_signed~345^2~22 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/565875d7536a38de93eb30dd60733f01b231beda?hp=-c AuthenticatorActivity is bound to OperationsService when created --- 565875d7536a38de93eb30dd60733f01b231beda diff --git a/res/values/strings.xml b/res/values/strings.xml index a73f9061..65c0dbc2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,257 +1,269 @@ - %1$s Android App - version %1$s - Refresh account - Upload - Content from other apps - Files - Open with - Create directory - Settings - Details - Send - General - More - Accounts - Manage Accounts - App PIN - Protect your client - Enable instant uploads - Instantly upload photos taken by camera - Enable Logging - This is used to log problems - Logging History - This shows the recorded logs - Delete History - Help - Recommend to a friend - Feedback - Imprint - + %1$s Android App + version %1$s + Refresh account + Upload + Content from other apps + Files + Open with + Create directory + Settings + Details + Send + General + More + Accounts + Manage Accounts + App PIN + Protect your client + Enable instant uploads + Instantly upload photos taken by camera + Enable Logging + This is used to log problems + This shows the recorded logs + Delete History + Help + Recommend to a friend + Feedback + Imprint + "Try %1$s on your smartphone!" - "I want to invite you to use %1$s on your smartphone!\nDownload here: %2$s" + "I want to invite you to use %1$s on your smartphone!\nDownload here: %2$s" + - Check Server - Server address https://… - Username - Password - New to %1$s? - Files - Connect - Upload - Choose upload directory: - No account found - There are no %1$s accounts on your device. Please setup an account first. - Setup - Quit - No content to upload - No content was received. Nothing to upload. - %1$s is not allowed to access the shared content - Uploading - There are no files in this folder.\nNew files can be added with the \"Upload\" menu option. - Tap on a file to display additional information. - Size: - Type: - Created: - Modified: - Download - Refresh file - File was renamed to %1$s during upload - Share link - Unshare link - Yes - No - OK - Cancel download - Cancel upload - Cancel - Save & Exit - Error - Loading … - Unknown error - About - Change password - Delete account - Create account - Upload from … - Directory name - Uploading … - %1$d%% Uploading %2$s - Upload succeeded - %1$s was successfully uploaded - Upload failed - Upload of %1$s could not be completed - Downloading … - %1$d%% Downloading %2$s - Download succeeded - %1$s was successfully downloaded - Download failed - Download of %1$s could not be completed - Not downloaded yet - Choose account - Synchronization failed - Synchronization of %1$s could not be completed - Invalid password for %1$s + Check Server + Server address https://… + Username + Password + New to %1$s? + Files + Connect + Upload + Choose upload directory: + No account found + There are no %1$s accounts on your device. Please setup an account first. + + Setup + Quit + No content to upload + No content was received. Nothing to upload. + %1$s is not allowed to access the shared content + Uploading + There are no files in this folder.\nNew files can be added with the \"Upload\" + menu option. + Tap on a file to display additional information. + Size: + Type: + Created: + Modified: + Download + Refresh file + File was renamed to %1$s during upload + Share link + Unshare link + Yes + No + OK + Cancel download + Cancel upload + Cancel + Save & Exit + Error + Loading … + Unknown error + About + Change password + Delete account + Create account + Upload from … + Directory name + Uploading … + %1$d%% Uploading %2$s + Upload succeeded + %1$s was successfully uploaded + Upload failed + Upload of %1$s could not be completed + Downloading … + %1$d%% Downloading %2$s + Download succeeded + %1$s was successfully downloaded + Download failed + Download of %1$s could not be completed + Not downloaded yet + Choose account + Synchronization failed + Synchronization of %1$s could not be completed + Invalid password for %1$s Conflicts found %1$d kept-in-sync files could not be sync\'ed - Kept-in-sync files failed - Contents of %1$d files could not be sync\'ed (%2$d conflicts) - Some local files were forgotten - %1$d files out of the %2$s directory could not be copied into - As of version 1.3.16, files uploaded from this device are copied into the local %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to this change, all files uploaded in previous versions of this app were copied into the %2$s folder. However, an error prevented the completion of this operation during account synchronization. You may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s directory and retain the link to %4$s.\n\nListed below are the local file(s), and the remote file(s) in %5$s they were linked to. - Folder %1$s does not exist anymore - "Move all" - "All files were moved" - "Some files could not be moved" - "Local: %1$s" - "Remote: %1$s" - There is not space enough to copy the selected files into the %1$s folder. Would like to move them into instead? - Please, insert your App PIN - Enter your App PIN - The PIN will be requested every time the app is started - Please, reenter your App PIN - Remove your App PIN - The App PINs are not the same - Incorrect App PIN - App PIN removed - App PIN stored - - "%1$s music player" - "%1$s (playing)" - "%1$s (loading)" - "%1$s playback finished" - No media file found + Kept-in-sync files failed + Contents of %1$d files could not be sync\'ed (%2$d conflicts) + Some local files were forgotten + %1$d files out of the %2$s directory could not be copied into + As of version 1.3.16, files uploaded from this device are copied into the local + %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to + this change, all files uploaded in previous versions of this app were copied into the %2$s folder. + However, an error prevented the completion of this operation during account synchronization. You + may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s + directory and retain the link to %4$s.\n\nListed below are the local file(s), and the remote + file(s) in %5$s they were linked to. + Folder %1$s does not exist anymore + "Move all" + "All files were moved" + "Some files could not be moved" + "Local: %1$s" + "Remote: %1$s" + There is not space enough to copy the selected files into the %1$s folder. + Would like to move them into instead? + Please, insert your App PIN + Enter your App PIN + The PIN will be requested every time the app is started + Please, reenter your App PIN + Remove your App PIN + The App PINs are not the same + Incorrect App PIN + App PIN removed + App PIN stored + + "%1$s music player" + "%1$s (playing)" + "%1$s (loading)" + "%1$s playback finished" + No media file found No account provided - File not in a valid account - Unsupported media codec - Media file could not be read - Media file not correctly encoded - Timed out while trying to play - Media file cannot be streamed - Media file cannot be played with the stock media player - Security error trying to play %1$s + File not in a valid account + Unsupported media codec + Media file could not be read + Media file not correctly encoded + Timed out while trying to play + Media file cannot be streamed + Media file cannot be played with the stock media player + Security error trying to play %1$s Input error trying to play %1$s Unexpected error trying to play %1$s Rewind button Play or pause button Fast forward button - Trying to login… - No network connection - Secure connection unavailable. - Connection established - Testing connection… - Malformed server configuration - An account for the same user and server already exists in the device - The entered user does not match the user of this account - Unknown error occurred! - Couldn\'t find host - Server instance not found - The server took too long to respond - Malformed URL - SSL initialization failed - Couldn\'t verify SSL server\'s identity - Unrecognized server version - Couldn\'t establish connection - Secure connection established - Wrong username or password + Trying to login… + No network connection + Secure connection unavailable. + Connection established + Testing connection… + Malformed server configuration + An account for the same user and server already exists in the device + The entered user does not match the user of this account + Unknown error occurred! + Couldn\'t find host + Server instance not found + The server took too long to respond + Malformed URL + SSL initialization failed + Couldn\'t verify SSL server\'s identity + Unrecognized server version + Couldn\'t establish connection + Secure connection established + Wrong username or password Unsuccessful authorization Access denied by authorization server - Unexpected state; please, enter the server URL again - Your authorization expired. Please, authorize again - Please, enter the current password - Your session expired. Please connect again + Unexpected state; please, enter the server URL again + Your authorization expired. Please, authorize again + Please, enter the current password + Your session expired. Please connect again Connecting to authentication server… - The server does not support this authentication method + The server does not support this authentication method %1$s does not support multiple accounts - Your server is not returning a correct user id, please contact an administrator + Your server is not returning a correct user id, please contact an administrator + Can not authenticate against this server - - Keep file up to date - Rename - Remove - "Do you really want to remove %1$s ?" - "Do you really want to remove %1$s and its contents ?" - Local only - Local contents only - Remove from server - Remote and local - "Removal succeeded" - "Removal failed" - Enter a new name - "Local copy could not be renamed; try a different name" - "Rename could not be completed" - Remote file could not be checked - File contents already synchronized - Directory could not be created - Forbidden characters: / \\ < > : " | ? * - Wait a moment - "Unexpected problem ; please select the file from a different app" - No file was selected - Send link to … - - Login with oAuth2 - Connecting to oAuth2 server… - - The identity of the site could not be verified - - The server certificate is not trusted - - The server certificate expired - - The server certificate valid dates are in the future - - The URL does not match the hostname in the certificate - Do you want to trust this certificate anyway? - The certificate could not be saved - Details - Hide - Issued to: - Issued by: - Common name: - Organization: - Organizational unit: - Country: - State: - Location: - Validity: - From: + + Keep file up to date + Rename + Remove + "Do you really want to remove %1$s ?" + "Do you really want to remove %1$s and its contents ?" + Local only + Local contents only + Remove from server + Remote and local + "Removal succeeded" + "Removal failed" + Enter a new name + "Local copy could not be renamed; try a different name" + "Rename could not be completed" + Remote file could not be checked + File contents already synchronized + Directory could not be created + Forbidden characters: / \\ < > : " | ? * + Wait a moment + "Unexpected problem ; please select the file from a different app" + No file was selected + Send link to … + + Login with oAuth2 + Connecting to oAuth2 server… + + The identity of the site could not be verified + - The server certificate is not trusted + - The server certificate expired + - The server certificate valid dates are in the future + - The URL does not match the hostname in the certificate + Do you want to trust this certificate anyway? + The certificate could not be saved + Details + Hide + Issued to: + Issued by: + Common name: + Organization: + Organizational unit: + Country: + State: + Location: + Validity: + From: To: Signature: Algorithm: The certificate could not be shown. - No information about the error - - This is a placeholder - placeholder.txt - PNG Image - 389 KB - 2012/05/18 12:23 PM - 12:23:45 - - Upload pictures via WiFi only - /InstantUpload - Update conflict - Remote file %s is not synchronized with local file. Continuing will replace content of file on server. - Keep both - Overwrite - Don\'t upload - - Image preview - This image can not be shown - - %1$s could not be copied to %2$s local directory - Failed InstantUpload - Failed instant uploads - Summary of all failed instant uploads - select all - retry all selected - delete all selected from uploadqueue - retry to upload the image: - Load more Picrures - do nothing you are not online for instant upload + + This is a placeholder + placeholder.txt + PNG Image + 389 KB + 2012/05/18 12:23 PM + 12:23:45 + + Upload pictures via WiFi only + /InstantUpload + Update conflict + Remote file %s is not synchronized with local file. Continuing will replace + content of file on server. + Keep both + Overwrite + Don\'t upload + + Image preview + This image can not be shown + + %1$s could not be copied to %2$s local directory + Failed InstantUpload + Failed instant uploads + Summary of all failed instant uploads + select all + retry all selected + delete all selected from uploadqueue + retry to upload the image: + Load more Picrures + do nothing you are not online for instant upload Failure Message: Please check your server configuration,maybe your quota is exceeded. - - Sorry, sharing is not enabled on your server. Please contact your administrator. + + Sorry, sharing is not enabled on your server. Please contact your + administrator. Unable to share this file or folder. Please, make sure it exists An error occurred while trying to share this file or folder Unable to unshare this file or folder. It does not exist. @@ -259,7 +271,8 @@ Send - Copy link + Copy link Copied to clipboard - + + Critical error: can not perform operations diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index e5e80144..6ff9f6a7 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -25,8 +25,11 @@ import android.accounts.AccountManager; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; +import android.content.ComponentName; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.ServiceConnection; import android.content.SharedPreferences; import android.graphics.Rect; import android.graphics.drawable.Drawable; @@ -34,6 +37,7 @@ import android.net.Uri; import android.net.http.SslError; import android.os.Bundle; import android.os.Handler; +import android.os.IBinder; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -54,6 +58,7 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; +import android.widget.Toast; import com.actionbarsherlock.app.SherlockDialogFragment; import com.owncloud.android.MainApp; @@ -76,6 +81,8 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation; import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation; +import com.owncloud.android.services.OperationsService; +import com.owncloud.android.services.OperationsService.OperationsServiceBinder; import com.owncloud.android.ui.dialog.SamlWebViewDialog; import com.owncloud.android.ui.dialog.SslUntrustedCertDialog; import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener; @@ -140,6 +147,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { private int mAuthStatusText, mAuthStatusIcon; private TextView mAuthStatusLayout; + private ServiceConnection mOperationsConnection = null; + private OperationsServiceBinder mOperationsBinder = null; + private final Handler mHandler = new Handler(); private Thread mOperationThread; private GetRemoteStatusOperation mOcServerChkOperation; @@ -191,6 +201,32 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_NO_TITLE); + // bind to Operations Service + mOperationsConnection = new ServiceConnection() { + + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + Log_OC.d(TAG, "Operations service connected"); + mOperationsBinder = (OperationsServiceBinder) service; + } + + @Override + public void onServiceDisconnected(ComponentName name) { + Log_OC.d(TAG, "Operations service crashed"); + mOperationsBinder = null; + } + + }; + if (!bindService(new Intent(this, OperationsService.class), + mOperationsConnection, + Context.BIND_AUTO_CREATE)) { + Toast.makeText(this, + R.string.error_cant_bind_to_operations_service, + Toast.LENGTH_LONG) + .show(); + finish(); + } + /// set view and get references to view elements setContentView(R.layout.account_setup); mAuthMessage = (TextView) findViewById(R.id.auth_message); @@ -525,6 +561,16 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { mJustCreated = false; } + + + @Override + protected void onDestroy() { + if (mOperationsConnection != null) { + unbindService(mOperationsConnection); + mOperationsBinder = null; + } + super.onDestroy(); + } /** diff --git a/src/com/owncloud/android/services/OperationsService.java b/src/com/owncloud/android/services/OperationsService.java index 80caea71..9dc89709 100644 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@ -1,5 +1,5 @@ /* ownCloud Android client application - * Copyright (C) 2012-2013 ownCloud Inc. + * Copyright (C) 2012-2014 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2,