Merge branch 'release-1.8'
authormasensio <masensio@solidgear.es>
Mon, 28 Sep 2015 10:33:47 +0000 (12:33 +0200)
committermasensio <masensio@solidgear.es>
Mon, 28 Sep 2015 10:33:47 +0000 (12:33 +0200)
AndroidManifest.xml
oc_jb_workaround/AndroidManifest.xml
owncloud-android-library
res/layout-land/account_setup.xml
res/layout/account_setup.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
src/com/owncloud/android/providers/FileContentProvider.java
src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
src/com/owncloud/android/utils/FileStorageUtils.java

index a072d78..acb5f1d 100644 (file)
@@ -17,8 +17,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
 <manifest package="com.owncloud.android"
-    android:versionCode="10700200"
-    android:versionName="1.7.2" xmlns:android="http://schemas.android.com/apk/res/android">
+    android:versionCode="10800000"
+    android:versionName="1.8.0" xmlns:android="http://schemas.android.com/apk/res/android">
 
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />
index c516391..766cb0a 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.owncloud.android.workaround.accounts"
-    android:versionCode="0100024"
-    android:versionName="1.0.24" >
+    android:versionCode="0100025"
+    android:versionName="1.0.25" >
 
     <uses-sdk
         android:minSdkVersion="16"
index ecc3415..5985ba9 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ecc3415e3e3c13fa8f73fdd51a88c1ab7087b199
+Subproject commit 5985ba9a9fd9a208b2a09ee7809949874e0c3a97
index 2fcc1d0..477011d 100644 (file)
                            android:gravity="center"\r
                            android:orientation="vertical"\r
                            android:padding="8dp" >\r
-                           \r
-                               <Button\r
-                                   android:id="@+id/centeredRefreshButton"\r
-                                   android:layout_width="wrap_content"\r
-                                   android:layout_height="wrap_content"\r
-                                   android:layout_gravity="center_horizontal"\r
+\r
+                               <android.support.v7.widget.AppCompatButton\r
+                                       android:id="@+id/centeredRefreshButton"\r
+                                       style="@style/ownCloud.Button"\r
+                                       android:layout_width="wrap_content"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:layout_gravity="center_horizontal"\r
                                        android:layout_marginBottom="10dp"\r
-                                   android:text="@string/auth_check_server"\r
-                                   android:visibility="gone"\r
-                    android:contentDescription="@string/auth_check_server"/>\r
+                                       android:text="@string/auth_check_server"\r
+                                       android:visibility="gone"\r
+                                       android:contentDescription="@string/auth_check_server"/>\r
+\r
                                <TextView\r
                                    android:id="@+id/instructions_message"\r
                                    android:layout_width="wrap_content"\r
@@ -82,7 +84,7 @@
                                android:id="@+id/hostUrlFrame"\r
                                        android:layout_width="match_parent"\r
                                        android:layout_height="wrap_content"\r
-                                       android:layout_marginBottom="10dp"\r
+                                       android:layout_marginBottom="0dp"\r
                                >\r
                                        <EditText\r
                                                android:id="@+id/hostUrlInput"\r
                                        </EditText>\r
                                        <ImageButton\r
                                            android:id="@+id/embeddedRefreshButton"\r
-                                           android:layout_width="48dp"\r
-                                           android:layout_height="48dp"\r
+                                           android:layout_width="wrap_content"\r
+                                           android:layout_height="wrap_content"\r
                                            android:layout_gravity="center_vertical|right"\r
                                            android:layout_marginRight="5dp"\r
                                            android:padding="0dp"\r
                                            android:scaleType="fitCenter"\r
-                                           android:src="@drawable/ic_action_refresh_black"\r
+                                           android:src="@drawable/ic_action_refresh_grey"\r
                                android:onClick="onRefreshClick"\r
                                            android:visibility="gone"\r
                                                android:background="@android:color/transparent"\r
                                        android:textColor="@color/login_text_color"\r
                                        android:textColorHint="@color/login_text_hint_color"\r
                                        android:text="@string/auth_testing_connection"\r
+                                       android:minHeight="32dp"\r
                     android:contentDescription="@string/auth_testing_connection"/>\r
                             \r
                                <CheckBox\r
                <android.support.v7.widget.AppCompatButton\r
                    android:id="@+id/buttonOK"\r
                        android:theme="@style/Button.Primary"\r
+                       style="@style/Button.Primary"\r
                    android:layout_width="match_parent"\r
                    android:layout_height="wrap_content"\r
                    android:layout_gravity="center_horizontal"\r
index 0789c59..876d834 100644 (file)
@@ -40,6 +40,7 @@
             android:layout_height="wrap_content"\r
             android:layout_marginBottom="20dp"\r
             android:layout_marginTop="10dp"\r
+            android:background="@color/login_logo_background_color"\r
             android:src="@drawable/logo"\r
             android:contentDescription="@string/app_name"/>\r
 \r
             android:textColor="@color/login_text_color"\r
             android:textColorHint="@color/login_text_hint_color"\r
             android:text="@string/auth_testing_connection"\r
+            android:minHeight="32dp"\r
             android:contentDescription="@string/auth_testing_connection"/>\r
 \r
         <CheckBox\r
index 47985ce..02ab3c7 100644 (file)
@@ -1373,6 +1373,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     public void onAuthenticatorTaskCallback(RemoteOperationResult result) {\r
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
+        mAsyncTask = null;\r
 \r
         if (result.isSuccess()) {\r
             Log_OC.d(TAG, "Successful access - time to save the account");\r
index ab0743a..f0ecf76 100644 (file)
@@ -195,10 +195,6 @@ public class ThumbnailsCacheManager {
         }
 
         protected void onPostExecute(Bitmap bitmap){
-            if (isCancelled()) {
-                bitmap = null;
-            }
-
             if (bitmap != null) {
                 final ImageView imageView = mImageViewReference.get();
                 final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
@@ -365,6 +361,7 @@ public class ThumbnailsCacheManager {
             if (bitmapData == null || bitmapData != file) {
                 // Cancel previous task
                 bitmapWorkerTask.cancel(true);
+                Log_OC.v(TAG, "Cancelled generation of thumbnail for a reused imageView");
             } else {
                 // The same work is already in progress
                 return false;
index a4e50ce..70cd897 100644 (file)
@@ -178,6 +178,7 @@ public class FileContentProvider extends ContentProvider {
             if (c != null && c.moveToFirst()) {
                 remoteId = c.getString(c.getColumnIndex(ProviderTableMeta.FILE_REMOTE_ID));
                 //ThumbnailsCacheManager.removeFileFromCache(remoteId);
+                c.close();
             }
             Log_OC.d(TAG, "Removing FILE " + remoteId);
 
@@ -187,11 +188,6 @@ public class FileContentProvider extends ContentProvider {
                             + uri.getPathSegments().get(1)
                             + (!TextUtils.isEmpty(where) ? " AND (" + where
                                     + ")" : ""), whereArgs);
-            /* just for log
-            if (c!=null) {
-                c.close();
-            }
-            */
             break;
         case DIRECTORY:
             // deletion of folder is recursive
@@ -306,6 +302,9 @@ public class FileContentProvider extends ContentProvider {
             // ugly patch; serious refactorization is needed to reduce work in
             // FileDataStorageManager and bring it to FileContentProvider
             if (doubleCheck == null || !doubleCheck.moveToFirst()) {
+                if (doubleCheck != null) {
+                    doubleCheck.close();
+                }
                 long rowId = db.insert(ProviderTableMeta.FILE_TABLE_NAME, null, values);
                 if (rowId > 0) {
                     Uri insertedFileUri =
@@ -341,6 +340,9 @@ public class FileContentProvider extends ContentProvider {
             // ugly patch; serious refactorization is needed to reduce work in
             // FileDataStorageManager and bring it to FileContentProvider
             if (doubleCheckShare == null || !doubleCheckShare.moveToFirst()) {
+                if (doubleCheckShare != null) {
+                    doubleCheckShare.close();
+                }
                 long rowId = db.insert(ProviderTableMeta.OCSHARES_TABLE_NAME, null, values);
                 if (rowId >0) {
                     insertedShareUri =
index 373d791..60675f4 100644 (file)
@@ -37,6 +37,7 @@ import android.widget.TextView;
 
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;
+import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.utils.BitmapUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimetypeIconUtil;
@@ -46,7 +47,9 @@ import com.owncloud.android.utils.MimetypeIconUtil;
  * in a local directory
  */
 public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
-    
+
+    private static final String TAG = LocalFileListAdapter.class.getSimpleName();
+
     private Context mContext;
     private File mDirectory;
     private File[] mFiles = null;
@@ -104,6 +107,12 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
             fileName.setText(name);
             
             ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
+
+            /** Cancellation needs do be checked and done before changing the drawable in fileIcon, or
+             * {@link ThumbnailsCacheManager#cancelPotentialWork} will NEVER cancel any task.
+             **/
+            boolean allowedToCreateNewThumbnail = (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon));
+
             if (!file.isDirectory()) {
                 fileIcon.setImageResource(R.drawable.file);
             } else {
@@ -143,7 +152,7 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
                     } else {
 
                         // generate new Thumbnail
-                        if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) {
+                        if (allowedToCreateNewThumbnail) {
                             final ThumbnailsCacheManager.ThumbnailGenerationTask task =
                                     new ThumbnailsCacheManager.ThumbnailGenerationTask(fileIcon);
                             if (thumbnail == null) {
@@ -157,7 +166,9 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
                                        );
                             fileIcon.setImageDrawable(asyncDrawable);
                             task.execute(file);
-                        }
+                            Log_OC.v(TAG, "Executing task to generate a new thumbnail");
+
+                        } // else, already being generated, don't restart it
                     }
                 } else {
                     fileIcon.setImageResource(MimetypeIconUtil.getFileTypeIconId(null, file.getName()));
index b6f3682..e61e335 100644 (file)
@@ -476,7 +476,7 @@ public class PreviewImageFragment extends FileFragment {
 
         @Override
         protected void onCancelled(LoadImage result) {
-            if (result.bitmap != null) {
+            if (result != null && result.bitmap != null) {
                 result.bitmap.recycle();
             }
         }
index e70302f..d6ebdbd 100644 (file)
@@ -46,12 +46,12 @@ import android.webkit.MimeTypeMap;
  * Static methods to help in access to local file system.
  */
 public class FileStorageUtils {
-    public static Integer mSortOrder;
-    public static Boolean mSortAscending;
     public static final Integer SORT_NAME = 0;
     public static final Integer SORT_DATE = 1;
     public static final Integer SORT_SIZE = 2;
-  
+    public static Integer mSortOrder = SORT_NAME;
+    public static Boolean mSortAscending = true;
+
     
     //private static final String LOG_TAG = "FileStorageUtils";