Ver código fonte

Fix UI

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 ano atrás
pai
commit
e5174b37a7

+ 3 - 3
app/build.gradle

@@ -84,8 +84,8 @@ android {
 
     defaultConfig {
         minSdkVersion 24
-        targetSdkVersion 34
-        compileSdk 34
+        targetSdkVersion 33
+        compileSdk 33
 
         buildConfigField 'boolean', 'CI', ciBuild.toString()
         buildConfigField 'boolean', 'RUNTIME_PERF_ANALYSIS', perfAnalysis.toString()
@@ -246,7 +246,7 @@ dependencies {
     implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5' // remove after entire switch to lib v2
     implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
     implementation 'androidx.legacy:legacy-support-v4:1.0.0'
-    implementation 'com.google.android.material:material:1.10.0'
+    implementation 'com.google.android.material:material:1.9.0'
     implementation 'com.jakewharton:disklrucache:2.0.2'
     implementation "androidx.appcompat:appcompat:$appCompatVersion"
     implementation 'androidx.webkit:webkit:1.7.0'

+ 0 - 13
app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -888,9 +888,6 @@ public class FileDisplayActivity extends FileActivity
             }, new String[] { FileOperationsHelper.createImageFile(getActivity()).getAbsolutePath() }).execute();
         } else if (requestCode == REQUEST_CODE__MOVE_OR_COPY_FILES && resultCode == RESULT_OK) {
             exitSelectionMode();
-            // TODO check this implementation
-            // final Intent fData = data;
-            // getHandler().postDelayed(() -> requestMoveOrCopyOperation(fData), DELAY_TO_REQUEST_OPERATIONS_LATER);
         } else if (requestCode == PermissionUtil.REQUEST_CODE_MANAGE_ALL_FILES) {
             syncAndUpdateFolder(true);
         } else {
@@ -997,16 +994,6 @@ public class FileDisplayActivity extends FileActivity
 
     }
 
-    /*
-     private void requestMoveOrCopyOperation(Intent data) {
-        final OCFile file = data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER);
-        final List<String> filePaths = data.getStringArrayListExtra(FolderPickerActivity.EXTRA_FILE_PATHS);
-        assert filePaths != null;
-        getFileOperationsHelper().moveOrCopyFiles(filePaths, file);
-    }
-     */
-
-
     private boolean isSearchOpen() {
         if (searchView == null) {
             return false;

+ 5 - 6
app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt

@@ -27,9 +27,7 @@ import android.content.Intent
 import android.content.IntentFilter
 import android.content.res.Resources
 import android.os.Bundle
-import android.os.Parcel
 import android.os.Parcelable
-import android.util.Log
 import android.view.ActionMode
 import android.view.Menu
 import android.view.MenuItem
@@ -381,20 +379,20 @@ open class FolderPickerActivity :
         mCopyBtn = findViewById(R.id.btnCopy)
         mMoveBtn = findViewById(R.id.btnMove)
 
-        // FIXME colorMaterialButtonPrimaryFilled breaks material button style
         if (mCopyBtn != null) {
-            //viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCopyBtn!!)
+            viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCopyBtn!!)
             mCopyBtn!!.setOnClickListener(this)
         }
         if (mMoveBtn != null) {
-            //viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mMoveBtn!!)
+            viewThemeUtils.material.colorMaterialButtonPrimaryTonal(mMoveBtn!!)
             mMoveBtn!!.setOnClickListener(this)
         }
+
         if (mCancelBtn != null) {
             if (this is FilePickerActivity) {
                 viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCancelBtn!!)
             } else {
-                viewThemeUtils.material.colorMaterialButtonPrimaryOutlined(mCancelBtn!!)
+                viewThemeUtils.material.colorMaterialButtonText(mCancelBtn!!)
             }
             mCancelBtn!!.setOnClickListener(this)
         }
@@ -412,6 +410,7 @@ open class FolderPickerActivity :
                 resultData.putParcelableArrayListExtra(EXTRA_FILES, targetFiles)
             }
 
+            // TODO check if this activity not in view hierarchy is operation still active
             mTargetFilePaths.let {
                 if (it != null) {
                     if (v == mCopyBtn) {

+ 4 - 8
app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -1236,7 +1236,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
             mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(checkedFiles, false);
             return true;
         } else if (itemId == R.id.action_move_or_copy) {
-            pickFolderForMoveOrCopy(FolderPickerActivity.MOVE_OR_COPY, checkedFiles);
+            pickFolderForMoveOrCopy(checkedFiles);
             return true;
         } else if (itemId == R.id.action_select_all_action_menu) {
             selectAllFiles(true);
@@ -1254,13 +1254,9 @@ public class OCFileListFragment extends ExtendedListFragment implements
         return false;
     }
 
-    private void pickFolderForMoveOrCopy(final String extraAction, final Set<OCFile> checkedFiles) {
-        int requestCode;
-        if (extraAction.equals(FolderPickerActivity.MOVE_OR_COPY)) {
-            requestCode = FileDisplayActivity.REQUEST_CODE__MOVE_OR_COPY_FILES;
-        } else {
-            throw new IllegalArgumentException("Unknown extra action: " + extraAction);
-        }
+    private void pickFolderForMoveOrCopy(final Set<OCFile> checkedFiles) {
+        int requestCode = FileDisplayActivity.REQUEST_CODE__MOVE_OR_COPY_FILES;
+        String extraAction = FolderPickerActivity.MOVE_OR_COPY;
 
         final Intent action = new Intent(getActivity(), FolderPickerActivity.class);
         final ArrayList<String> paths = new ArrayList<>(checkedFiles.size());

+ 0 - 1
app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -42,7 +42,6 @@ import android.os.Environment;
 import android.os.StatFs;
 import android.provider.MediaStore;
 import android.text.TextUtils;
-import android.util.Log;
 import android.view.View;
 import android.webkit.MimeTypeMap;
 

+ 10 - 5
app/src/main/res/layout/files_folder_picker.xml

@@ -46,7 +46,6 @@
 	<LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:gravity="end"
         android:orientation="horizontal"
 		android:padding="@dimen/standard_padding">
 
@@ -56,22 +55,28 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/common_cancel"
-            android:layout_marginEnd="@dimen/standard_half_margin"
+            android:layout_weight="1"
             app:cornerRadius="@dimen/button_corner_radius" />
 
+        <View
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:layout_weight="1"/>
+
         <com.google.android.material.button.MaterialButton
             android:id="@+id/btnCopy"
             style="@style/Widget.Material3.Button.IconButton.Filled"
-            android:layout_width="100dp"
+            android:layout_width="wrap_content"
+            android:layout_weight="1"
             android:layout_height="wrap_content"
             android:text="@string/folder_picker_copy_button_text"
-            android:layout_marginEnd="@dimen/standard_half_margin"
             app:cornerRadius="@dimen/button_corner_radius" />
 
         <com.google.android.material.button.MaterialButton
             android:id="@+id/btnMove"
             style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
-            android:layout_width="100dp"
+            android:layout_width="wrap_content"
+            android:layout_weight="1"
             android:layout_height="wrap_content"
             android:text="@string/folder_picker_move_button_text"
             app:cornerRadius="@dimen/button_corner_radius" />

+ 0 - 2
app/src/main/res/values/strings.xml

@@ -438,14 +438,12 @@
     <string name="folder_picker_move_button_text">Move</string>
     <string name="folder_picker_choose_caption_text">Choose target folder</string>
 
-
     <string name="move_file_not_found">Unable to move file. Please check whether it exists.</string>
     <string name="move_file_invalid_into_descendent">It is not possible to move a folder into one of its own underlying folders</string>
     <string name="move_file_invalid_overwrite">The file is already present in the destination folder</string>
     <string name="move_file_error">An error occurred while trying to move this file or folder</string>
     <string name="forbidden_permissions_move">to move this file</string>
 
-
     <string name="copy_file_not_found">Unable to copy. Please check whether the file exists.</string>
     <string name="copy_file_invalid_into_descendent">It is not possible to copy a folder into one of its own underlying folders</string>
     <string name="copy_file_invalid_overwrite">The file is already present in the destination folder</string>