Bläddra i källkod

Merge branch 'release-1.8'

masensio 9 år sedan
förälder
incheckning
ee9aa68d23

+ 2 - 2
AndroidManifest.xml

@@ -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" />

+ 2 - 2
oc_jb_workaround/AndroidManifest.xml

@@ -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"

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit ecc3415e3e3c13fa8f73fdd51a88c1ab7087b199
+Subproject commit 5985ba9a9fd9a208b2a09ee7809949874e0c3a97

+ 17 - 13
res/layout-land/account_setup.xml

@@ -57,16 +57,18 @@
 			    android:gravity="center"
 			    android:orientation="vertical"
 			    android:padding="8dp" >
-			    
-				<Button
-				    android:id="@+id/centeredRefreshButton"
-				    android:layout_width="wrap_content"
-				    android:layout_height="wrap_content"
-				    android:layout_gravity="center_horizontal"
+
+				<android.support.v7.widget.AppCompatButton
+					android:id="@+id/centeredRefreshButton"
+					style="@style/ownCloud.Button"
+					android:layout_width="wrap_content"
+					android:layout_height="wrap_content"
+					android:layout_gravity="center_horizontal"
 					android:layout_marginBottom="10dp"
-				    android:text="@string/auth_check_server"
-				    android:visibility="gone"
-                    android:contentDescription="@string/auth_check_server"/>
+					android:text="@string/auth_check_server"
+					android:visibility="gone"
+					android:contentDescription="@string/auth_check_server"/>
+
 				<TextView
 				    android:id="@+id/instructions_message"
 				    android:layout_width="wrap_content"
@@ -82,7 +84,7 @@
 	        		android:id="@+id/hostUrlFrame"
 					android:layout_width="match_parent"
 					android:layout_height="wrap_content"
-					android:layout_marginBottom="10dp"
+					android:layout_marginBottom="0dp"
 			        >
 					<EditText
 						android:id="@+id/hostUrlInput"
@@ -101,13 +103,13 @@
 					</EditText>
 					<ImageButton
 					    android:id="@+id/embeddedRefreshButton"
-					    android:layout_width="48dp"
-					    android:layout_height="48dp"
+					    android:layout_width="wrap_content"
+					    android:layout_height="wrap_content"
 					    android:layout_gravity="center_vertical|right"
 					    android:layout_marginRight="5dp"
 					    android:padding="0dp"
 					    android:scaleType="fitCenter"
-					    android:src="@drawable/ic_action_refresh_black"
+					    android:src="@drawable/ic_action_refresh_grey"
             			android:onClick="onRefreshClick"
 					    android:visibility="gone"
 						android:background="@android:color/transparent"
@@ -126,6 +128,7 @@
 					android:textColor="@color/login_text_color"
 					android:textColorHint="@color/login_text_hint_color"
 					android:text="@string/auth_testing_connection"
+					android:minHeight="32dp"
                     android:contentDescription="@string/auth_testing_connection"/>
 		             
 				<CheckBox
@@ -223,6 +226,7 @@
 		<android.support.v7.widget.AppCompatButton
 		    android:id="@+id/buttonOK"
 			android:theme="@style/Button.Primary"
+			style="@style/Button.Primary"
 		    android:layout_width="match_parent"
 		    android:layout_height="wrap_content"
 		    android:layout_gravity="center_horizontal"

+ 2 - 0
res/layout/account_setup.xml

@@ -40,6 +40,7 @@
             android:layout_height="wrap_content"
             android:layout_marginBottom="20dp"
             android:layout_marginTop="10dp"
+            android:background="@color/login_logo_background_color"
             android:src="@drawable/logo"
             android:contentDescription="@string/app_name"/>
 
@@ -114,6 +115,7 @@
             android:textColor="@color/login_text_color"
             android:textColorHint="@color/login_text_hint_color"
             android:text="@string/auth_testing_connection"
+            android:minHeight="32dp"
             android:contentDescription="@string/auth_testing_connection"/>
 
         <CheckBox

+ 1 - 0
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -1373,6 +1373,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     public void onAuthenticatorTaskCallback(RemoteOperationResult result) {
         mWaitingForOpId = Long.MAX_VALUE;
         dismissDialog(WAIT_DIALOG_TAG);
+        mAsyncTask = null;
 
         if (result.isSuccess()) {
             Log_OC.d(TAG, "Successful access - time to save the account");

+ 1 - 4
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

@@ -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;

+ 7 - 5
src/com/owncloud/android/providers/FileContentProvider.java

@@ -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 =

+ 14 - 3
src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java

@@ -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()));

+ 1 - 1
src/com/owncloud/android/ui/preview/PreviewImageFragment.java

@@ -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();
             }
         }

+ 3 - 3
src/com/owncloud/android/utils/FileStorageUtils.java

@@ -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";