From 27050a528a7d0a38add3436d476d167a129906cf Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 29 Jun 2024 10:12:19 -0400 Subject: [PATCH 01/15] build(qa): Switch from `set-output` to `$GITHUB_OUTPUT` Fixes #11018 Signed-off-by: Josh --- .github/workflows/qa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index e1d5e67b23..eed386d51a 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check if secrets are available - run: echo "::set-output name=ok::${{ secrets.KS_PASS != '' }}" + run: echo "{ok}=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT" id: check-secrets - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 if: ${{ steps.check-secrets.outputs.ok == 'true' }} From 32cb1e41ddc8e4c2be9bcd42a6b6ebf476e297f0 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 29 Jun 2024 10:26:25 -0400 Subject: [PATCH 02/15] fix: correct GITHUB_OUTPUT syntax Signed-off-by: Josh --- .github/workflows/qa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index eed386d51a..a031b5ded6 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check if secrets are available - run: echo "{ok}=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT" + run: echo "ok=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT" id: check-secrets - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 if: ${{ steps.check-secrets.outputs.ok == 'true' }} From 9e928ae1806e0fc2b5c9e2f879d0fca52e4f7c2c Mon Sep 17 00:00:00 2001 From: Tobias Kaminsky Date: Sun, 30 Jun 2024 00:05:11 +0200 Subject: [PATCH 03/15] Update library to 2024-06-30 Signed-off-by: Tobias Kaminsky --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 36329a5e41..8377a03dc7 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ */ buildscript { ext { - androidLibraryVersion ="451cddeba122ff4d17dc8f88feb2fd7589f77567" + androidLibraryVersion ="c2355d04a920e8dc69936e08670eca6880d98b28" androidPluginVersion = '8.5.0' androidxMediaVersion = '1.3.1' androidxTestVersion = "1.5.0" From 93a465dbcbfa7a120571b8284b9a578905dd6afa Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Sun, 30 Jun 2024 02:39:44 +0000 Subject: [PATCH 04/15] Fix(l10n): Update translations from Transifex Signed-off-by: Nextcloud bot --- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-b+en+001/strings.xml | 2 ++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-ga/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-nb-rNO/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 2 ++ 7 files changed, 9 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 7e99a58164..c954b149c6 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -354,6 +354,7 @@ فشل تحديث UI إضافة إلى المفضلة المفضلة + ملف مشترك لا يمكن تحديثه اسم الملف موجود مسبقاً حذف خطأ في استرداد النشاطات للملف diff --git a/app/src/main/res/values-b+en+001/strings.xml b/app/src/main/res/values-b+en+001/strings.xml index 17b5d499c6..f454e1d1bd 100644 --- a/app/src/main/res/values-b+en+001/strings.xml +++ b/app/src/main/res/values-b+en+001/strings.xml @@ -92,6 +92,7 @@ %1$s does not support multiple accounts Could not establish connection Cancel Login + There was an issue processing your login request. Please try again later. Please complete login process in your browser kept in original folder, as it is readonly Only upload on unmetered Wi-Fi @@ -353,6 +354,7 @@ Failed to update UI Add to favourites Favourite + Shared file cannot be updated Filename already exists Delete Error retrieving activities for file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 09a90f4983..7665b4da9f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -354,6 +354,7 @@ Oberfläche konnte nicht aktualisiert werden Zu den Favoriten hinzufügen Favoriten + Geteilte Datei kann nicht aktualisiert werden Dateiname bereits vorhanden Löschen Fehler beim Abrufen der Aktivitäten für die Datei diff --git a/app/src/main/res/values-ga/strings.xml b/app/src/main/res/values-ga/strings.xml index bd8b61aa47..b9abfcd443 100644 --- a/app/src/main/res/values-ga/strings.xml +++ b/app/src/main/res/values-ga/strings.xml @@ -354,6 +354,7 @@ Theip ar an Chomhéadain a nuashonrú Cuir le ceanáin is fearr leat + Ní féidir an comhad roinnte a nuashonrú Tá ainm an chomhaid ann cheana Scrios Earráid agus gníomhaíochtaí á aisghabháil don chomhad diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 1e1690bba3..6646eb01fc 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -354,6 +354,7 @@ Produciuse un fallo ao actualizar a IU Engadir a favoritos Favorito + Non foi posíbel actualizar o ficheiro compartido O nome de ficheiro xa existe Eliminar Produciuse un erro ao recuperar actividades para o ficheiro diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 47d5527926..6f4bfd7803 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -354,6 +354,7 @@ Kunne ikke oppdatere brukergrensesnittet Legg til i favoritter Favoritt + Delt fil kan ikke oppdateres Filnavnet finnes allerede Slett Henting av aktiviteter for fil feilet diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 596015e804..2341e12188 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -354,6 +354,7 @@ 更新 UI 失敗 加到我的最愛 我的最愛 + 無法更新分享了的檔案 檔案名已存在 刪除 取得檔案活動時發生錯誤 @@ -927,6 +928,7 @@ 無法複製檔案到近端資料夾 鎖定資料夾失敗 用戶已取消上傳 + %1$d / %2$d - %3$s 加密功能只適用於 Android 5.0 及以上版本 空間不足導致無法將所選檔案複製到 %1$s 資料夾中。您想改為將檔案移到那裡嗎? 超過儲存空間配額 From 8e4a146be66ca89313c7725cac073b05d35aea06 Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Mon, 1 Jul 2024 02:39:09 +0000 Subject: [PATCH 05/15] Fix(l10n): Update translations from Transifex Signed-off-by: Nextcloud bot --- app/src/main/res/values-ja-rJP/strings.xml | 1 + app/src/main/res/values-sr/strings.xml | 5 +++++ app/src/main/res/values-zh-rTW/strings.xml | 1 + 3 files changed, 7 insertions(+) diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 41c57c1a1b..46629fad80 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -197,6 +197,7 @@ 新しいフォルダー 新規プレゼンテーション 新規スプレッドシート + フォルダの説明を追加 資格情報が無効です 毎日のバックアップ バックアップするデータ diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index b8c55e558a..44a1024a9d 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -92,6 +92,7 @@ %1$s не подржава вишеструке налоге Не могу да успоставим везу Откажи пријављивање + Дошло је до проблема при обради вашег захтева за пријаву. Молимо вас да касније покушате поново. Молимо вас да довршите процес пријаве у интернет прегледачу остављен у оригиналној фасцикли јер је само за читање Отпремај само на бежичним мрежама без ограничења @@ -321,6 +322,7 @@ Грешка приликом приказа дијалога за подешавање шифрирања! Грешка при покретању камере Грешка приликом почетка скенирања документа + Није успело креиране медије Налози Покренуто пута 48 сати Направљен @@ -352,6 +354,7 @@ Неуспело освежавање сучеља Додај у омиљене Омиљени + Не може да се ажурира дељени фајл Име фајла већ постоји Обриши Грешка при добављању активности за фајл @@ -904,7 +907,9 @@ Отпреми из… Отпрема садржај из других апликација Фотографија + Желите ли да направите фотографију или видео клип? Отпреми са камере + Видео снимак Назив фајла Тип фајла Пречица Гугл мапа (%s) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a30df721de..21b292ad99 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -354,6 +354,7 @@ 更新使用者介面失敗 加到我的最愛 我的最愛 + 無法更新已分享的檔案 檔案名稱已存在 刪除 取得檔案活動時發生錯誤 From 44a4d5962ad3d207b2a20fa642637e51a6f77249 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 1 Jul 2024 07:16:06 +0200 Subject: [PATCH 06/15] update verification-metadata.xml Signed-off-by: tobiasKaminsky --- gradle/verification-metadata.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 8eff309eca..382148da8d 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -5898,6 +5898,17 @@ + + + + + + + + From 9aee148f8a8c6aae7b1f8c5bd480f1972b2ccf18 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 28 Jun 2024 10:51:49 +0200 Subject: [PATCH 07/15] Rebase master Signed-off-by: alperozturk --- .../main/java/com/nextcloud/ui/ImageDetailFragment.kt | 6 ++++++ .../android/ui/activity/ConflictsResolveActivity.kt | 3 +++ .../com/owncloud/android/ui/activity/FileActivity.java | 1 + .../android/ui/activity/FileDisplayActivity.java | 2 +- .../ui/activity/ReceiveExternalFilesActivity.java | 2 +- .../android/ui/activity/UploadFilesActivity.java | 2 +- .../android/ui/dialog/ConflictsResolveDialog.java | 9 ++++++++- .../ui/fragment/FileDetailActivitiesFragment.java | 2 +- .../owncloud/android/ui/fragment/FileDetailFragment.java | 1 + .../android/ui/fragment/FileDetailSharingFragment.java | 3 ++- .../owncloud/android/ui/fragment/OCFileListFragment.java | 2 +- .../android/ui/preview/FileDownloadFragment.java | 1 + .../owncloud/android/ui/preview/PreviewMediaActivity.kt | 2 +- .../owncloud/android/ui/preview/PreviewMediaFragment.kt | 2 +- .../android/ui/preview/PreviewTextFileFragment.java | 1 + .../android/ui/preview/PreviewTextStringFragment.java | 3 +++ 16 files changed, 33 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt b/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt index 8fc7af18de..35b43fb09c 100644 --- a/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt +++ b/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt @@ -30,6 +30,8 @@ import com.owncloud.android.R import com.owncloud.android.databinding.PreviewImageDetailsFragmentBinding import com.owncloud.android.datamodel.OCFile import com.owncloud.android.datamodel.ThumbnailsCacheManager +import com.owncloud.android.lib.common.utils.Log_OC +import com.owncloud.android.ui.dialog.ConflictsResolveDialog import com.owncloud.android.utils.BitmapUtils import com.owncloud.android.utils.DisplayUtils import com.owncloud.android.utils.theme.ViewThemeUtils @@ -63,6 +65,8 @@ class ImageDetailFragment : Fragment(), Injectable { @Inject lateinit var viewThemeUtils: ViewThemeUtils + private val tag = "ImageDetailFragment" + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { binding = PreviewImageDetailsFragmentBinding.inflate(layoutInflater, container, false) @@ -102,6 +106,8 @@ class ImageDetailFragment : Fragment(), Injectable { override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) + Log_OC.d(tag, "onSaveInstanceState: ${file.fileLength}") + outState.putParcelable(ARG_FILE, file) outState.putParcelable(ARG_USER, user) outState.putParcelable(ARG_METADATA, metadata) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt index 7b8710d4f1..b0384527e7 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt @@ -32,6 +32,7 @@ import com.owncloud.android.lib.resources.files.model.RemoteFile import com.owncloud.android.ui.dialog.ConflictsResolveDialog import com.owncloud.android.ui.dialog.ConflictsResolveDialog.Decision import com.owncloud.android.ui.dialog.ConflictsResolveDialog.OnConflictDecisionMadeListener +import com.owncloud.android.ui.preview.FileDownloadFragment import com.owncloud.android.utils.FileStorageUtils import javax.inject.Inject @@ -143,6 +144,8 @@ class ConflictsResolveActivity : FileActivity(), OnConflictDecisionMadeListener override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) + Log_OC.d(TAG, "onSaveInstanceState: " + existingFile?.fileLength) + outState.putLong(EXTRA_CONFLICT_UPLOAD_ID, conflictUploadId) outState.putParcelable(EXTRA_EXISTING_FILE, existingFile) outState.putInt(EXTRA_LOCAL_BEHAVIOUR, localBehaviour) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java index 5366d73e7f..ba5dd73894 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java @@ -271,6 +271,7 @@ public abstract class FileActivity extends DrawerActivity @Override protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); + Log_OC.d(TAG, "onSaveInstanceState: " + mFile.getFileLength()); outState.putParcelable(FileActivity.EXTRA_FILE, mFile); outState.putBoolean(FileActivity.EXTRA_FROM_NOTIFICATION, mFromNotification); outState.putLong(KEY_WAITING_FOR_OP_ID, mFileOperationsHelper.getOpIdWaitingFor()); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index 5a36009fb8..c3db136606 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -1067,8 +1067,8 @@ public class FileDisplayActivity extends FileActivity protected void onSaveInstanceState(@NonNull Bundle outState) { // responsibility of restore is preferred in onCreate() before than in // onRestoreInstanceState when there are Fragments involved - Log_OC.v(TAG, "onSaveInstanceState() start"); super.onSaveInstanceState(outState); + Log_OC.d(TAG, "onSaveInstanceState: " + mWaitingToPreview.getFileLength()); outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW, mWaitingToPreview); outState.putBoolean(FileDisplayActivity.KEY_SYNC_IN_PROGRESS, mSyncInProgress); // outState.putBoolean(FileDisplayActivity.KEY_REFRESH_SHARES_IN_PROGRESS, diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java index 0370aadb3b..91cf436d55 100755 --- a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java @@ -264,7 +264,7 @@ public class ReceiveExternalFilesActivity extends FileActivity @Override protected void onSaveInstanceState(@NonNull Bundle outState) { - Log_OC.d(TAG, "onSaveInstanceState() start"); + Log_OC.d(TAG, "onSaveInstanceState " + mFile.getFileLength()); super.onSaveInstanceState(outState); outState.putString(KEY_PARENTS, generatePath(mParents)); outState.putParcelable(KEY_FILE, mFile); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index 4de179ad5e..c74f39befd 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -410,7 +410,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList protected void onSaveInstanceState(@NonNull Bundle outState) { // responsibility of restore is preferred in onCreate() before than in // onRestoreInstanceState when there are Fragments involved - Log_OC.d(TAG, "onSaveInstanceState() start"); + Log_OC.d(TAG, "onSaveInstanceState " + mCurrentDir.length()); super.onSaveInstanceState(outState); outState.putString(UploadFilesActivity.KEY_DIRECTORY_PATH, mCurrentDir.getAbsolutePath()); if (mOptionsMenu != null && mOptionsMenu.findItem(R.id.action_select_all) != null) { diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java b/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java index 9807350e81..474d5abfb9 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java @@ -62,6 +62,7 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable @Inject ViewThemeUtils viewThemeUtils; @Inject SyncedFolderProvider syncedFolderProvider; + private static final String TAG = "ConflictsResolveDialog"; private static final String KEY_NEW_FILE = "file"; private static final String KEY_EXISTING_FILE = "ocfile"; private static final String KEY_USER = "user"; @@ -78,7 +79,10 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable Bundle args = new Bundle(); args.putParcelable(KEY_EXISTING_FILE, existingFile); - args.putSerializable(KEY_NEW_FILE, new File(newFile.getStoragePath())); + + File file = new File(newFile.getStoragePath()); + Log_OC.d(TAG,"ConflictsResolveDialog.putSerializable: " + file.getAbsolutePath().length()); + args.putSerializable(KEY_NEW_FILE, file); args.putParcelable(KEY_USER, user); dialog.setArguments(args); @@ -136,6 +140,9 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); + Log_OC.d(TAG,"onSaveInstanceState.existingFile: " + existingFile.getFileLength()); + Log_OC.d(TAG,"onSaveInstanceState.newFile: " + newFile.length()); + outState.putParcelable(KEY_EXISTING_FILE, existingFile); outState.putSerializable(KEY_NEW_FILE, newFile); outState.putParcelable(KEY_USER, user); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java index 6069e4e6c0..7b0b6e0019 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java @@ -431,7 +431,7 @@ public class FileDetailActivitiesFragment extends Fragment implements @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - + Log_OC.d(TAG, "onSaveInstanceState " + file.getFileLength()); outState.putParcelable(ARG_FILE, file); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 048b26b6cf..3b28de8a02 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -355,6 +355,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener, @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); + Log_OC.d(TAG, "onSaveInstanceState " + getFile().getFileLength()); outState.putParcelable(ARG_FILE, getFile()); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java index ed4fc93657..2d534c1a20 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java @@ -80,6 +80,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda DisplayUtils.AvatarGenerationListener, Injectable, FileDetailsSharingMenuBottomSheetActions, QuickSharingPermissionsBottomSheetDialog.QuickPermissionSharingBottomSheetActions { + private final String tag = "FileDetailSharingFragment"; private static final String ARG_FILE = "FILE"; private static final String ARG_USER = "USER"; @@ -541,7 +542,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - + Log_OC.d(tag, "onSaveInstanceState " + file.getFileLength()); outState.putParcelable(ARG_FILE, file); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index c761d789af..4cf2fb2dc3 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -850,7 +850,7 @@ public class OCFileListFragment extends ExtendedListFragment implements @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - + Log_OC.d(TAG, "onSaveInstanceState: " + mFile.getFileLength()); outState.putParcelable(KEY_FILE, mFile); if (searchFragment) { outState.putParcelable(KEY_CURRENT_SEARCH_TYPE, currentSearchType); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java index 83ea8b5bea..afb867a97e 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java @@ -163,6 +163,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); + Log_OC.d(TAG, "onSaveInstanceState: " + getFile().getFileLength()); outState.putParcelable(FileDownloadFragment.EXTRA_FILE, getFile()); outState.putParcelable(FileDownloadFragment.EXTRA_USER, user); outState.putBoolean(FileDownloadFragment.EXTRA_ERROR, mError); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt index 8df0dbe55d..491d52eca2 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt @@ -327,7 +327,7 @@ class PreviewMediaActivity : override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - Log_OC.v(TAG, "onSaveInstanceState") + Log_OC.d(TAG, "onSaveInstanceState: " + file.fileLength) outState.let { bundle -> bundle.putParcelable(EXTRA_FILE, file) bundle.putParcelable(EXTRA_USER, user) diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt index b06c0fea4a..7d9de7372e 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt @@ -254,7 +254,7 @@ class PreviewMediaFragment : FileFragment(), OnTouchListener, Injectable { override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - Log_OC.v(TAG, "onSaveInstanceState") + Log_OC.v(TAG, "onSaveInstanceState " + file.fileLength) toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_LOCKED_CLOSED) outState.run { diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java index 5543de42b9..6e90c85b58 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java @@ -136,6 +136,7 @@ public class PreviewTextFileFragment extends PreviewTextFragment { */ @Override public void onSaveInstanceState(@NonNull Bundle outState) { + Log_OC.d(TAG, "onSaveInstanceState: " + getFile().getFileLength()); outState.putParcelable(PreviewTextFileFragment.EXTRA_FILE, getFile()); outState.putParcelable(PreviewTextFileFragment.EXTRA_USER, user); super.onSaveInstanceState(outState); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java index 547c9d6d73..93029e8d13 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java @@ -21,6 +21,7 @@ import com.nextcloud.android.lib.richWorkspace.RichWorkspaceDirectEditingRemoteO import com.nextcloud.client.account.UserAccountManager; import com.owncloud.android.R; import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.theme.ViewThemeUtils; @@ -37,6 +38,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment { @Inject UserAccountManager accountManager; @Inject ViewThemeUtils viewThemeUtils; + private final String tag = "PreviewTextStringFragment"; private boolean isEditorWebviewLaunched = false; /** @@ -70,6 +72,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment { */ @Override public void onSaveInstanceState(@NonNull Bundle outState) { + Log_OC.d(tag, "onSaveInstanceState: " + getFile().getFileLength()); outState.putParcelable(PreviewTextStringFragment.EXTRA_FILE, getFile()); super.onSaveInstanceState(outState); From 05cde134289ea30cbe88e1f97fad3be7982f0032 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Wed, 19 Jun 2024 15:31:51 +0200 Subject: [PATCH 08/15] Use extension for null files Signed-off-by: alperozturk --- .../java/com/nextcloud/ui/ImageDetailFragment.kt | 6 ++---- .../nextcloud/utils/extensions/FileExtensions.kt | 16 ++++++++++++++++ .../ui/activity/ConflictsResolveActivity.kt | 4 ++-- .../android/ui/activity/FileActivity.java | 3 ++- .../android/ui/activity/FileDisplayActivity.java | 3 ++- .../ui/dialog/ConflictsResolveDialog.java | 8 ++++---- .../fragment/FileDetailActivitiesFragment.java | 3 ++- .../android/ui/fragment/FileDetailFragment.java | 3 ++- .../ui/fragment/FileDetailSharingFragment.java | 3 ++- .../android/ui/fragment/OCFileListFragment.java | 3 ++- .../android/ui/preview/FileDownloadFragment.java | 3 ++- .../android/ui/preview/PreviewMediaFragment.kt | 3 ++- .../ui/preview/PreviewTextFileFragment.java | 3 ++- .../ui/preview/PreviewTextStringFragment.java | 3 ++- 14 files changed, 44 insertions(+), 20 deletions(-) create mode 100644 app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt diff --git a/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt b/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt index 35b43fb09c..5a21ab3523 100644 --- a/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt +++ b/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt @@ -25,13 +25,12 @@ import com.nextcloud.client.NominatimClient import com.nextcloud.client.account.User import com.nextcloud.client.di.Injectable import com.nextcloud.utils.extensions.getParcelableArgument +import com.nextcloud.utils.extensions.logFileSize import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.PreviewImageDetailsFragmentBinding import com.owncloud.android.datamodel.OCFile import com.owncloud.android.datamodel.ThumbnailsCacheManager -import com.owncloud.android.lib.common.utils.Log_OC -import com.owncloud.android.ui.dialog.ConflictsResolveDialog import com.owncloud.android.utils.BitmapUtils import com.owncloud.android.utils.DisplayUtils import com.owncloud.android.utils.theme.ViewThemeUtils @@ -106,8 +105,7 @@ class ImageDetailFragment : Fragment(), Injectable { override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - Log_OC.d(tag, "onSaveInstanceState: ${file.fileLength}") - + file.logFileSize(tag) outState.putParcelable(ARG_FILE, file) outState.putParcelable(ARG_USER, user) outState.putParcelable(ARG_METADATA, metadata) diff --git a/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt b/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt new file mode 100644 index 0000000000..132d590693 --- /dev/null +++ b/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt @@ -0,0 +1,16 @@ +/* + * Nextcloud - Android Client + * + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +package com.nextcloud.utils.extensions + +import com.owncloud.android.datamodel.OCFile +import com.owncloud.android.lib.common.utils.Log_OC +import java.io.File + +fun OCFile?.logFileSize(tag: String) = Log_OC.d(tag, "onSaveInstanceState: ${this?.fileLength}") + +fun File?.logFileSize(tag: String) = Log_OC.d(tag, "onSaveInstanceState: ${this?.length()}") diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt index b0384527e7..c68455f33c 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt @@ -20,6 +20,7 @@ import com.nextcloud.client.jobs.upload.FileUploadWorker import com.nextcloud.client.jobs.upload.UploadNotificationManager import com.nextcloud.model.HTTPStatusCodes import com.nextcloud.utils.extensions.getParcelableArgument +import com.nextcloud.utils.extensions.logFileSize import com.owncloud.android.R import com.owncloud.android.datamodel.FileDataStorageManager import com.owncloud.android.datamodel.OCFile @@ -144,8 +145,7 @@ class ConflictsResolveActivity : FileActivity(), OnConflictDecisionMadeListener override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - Log_OC.d(TAG, "onSaveInstanceState: " + existingFile?.fileLength) - + existingFile.logFileSize(TAG) outState.putLong(EXTRA_CONFLICT_UPLOAD_ID, conflictUploadId) outState.putParcelable(EXTRA_EXISTING_FILE, existingFile) outState.putInt(EXTRA_LOCAL_BEHAVIOUR, localBehaviour) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java index ba5dd73894..58bf035eec 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java @@ -39,6 +39,7 @@ import com.nextcloud.client.network.ConnectivityService; import com.nextcloud.utils.EditorUtils; import com.nextcloud.utils.extensions.ActivityExtensionsKt; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.nextcloud.utils.extensions.IntentExtensionsKt; import com.owncloud.android.MainApp; import com.owncloud.android.R; @@ -271,7 +272,7 @@ public abstract class FileActivity extends DrawerActivity @Override protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(TAG, "onSaveInstanceState: " + mFile.getFileLength()); + FileExtensionsKt.logFileSize(mFile, TAG); outState.putParcelable(FileActivity.EXTRA_FILE, mFile); outState.putBoolean(FileActivity.EXTRA_FROM_NOTIFICATION, mFromNotification); outState.putLong(KEY_WAITING_FOR_OP_ID, mFileOperationsHelper.getOpIdWaitingFor()); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index c3db136606..1b8c280c26 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -66,6 +66,7 @@ import com.nextcloud.model.WorkerState; import com.nextcloud.model.WorkerStateLiveData; import com.nextcloud.utils.extensions.ActivityExtensionsKt; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.nextcloud.utils.extensions.IntentExtensionsKt; import com.nextcloud.utils.view.FastScrollUtils; import com.owncloud.android.MainApp; @@ -1068,7 +1069,7 @@ public class FileDisplayActivity extends FileActivity // responsibility of restore is preferred in onCreate() before than in // onRestoreInstanceState when there are Fragments involved super.onSaveInstanceState(outState); - Log_OC.d(TAG, "onSaveInstanceState: " + mWaitingToPreview.getFileLength()); + FileExtensionsKt.logFileSize(mWaitingToPreview, TAG); outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW, mWaitingToPreview); outState.putBoolean(FileDisplayActivity.KEY_SYNC_IN_PROGRESS, mSyncInProgress); // outState.putBoolean(FileDisplayActivity.KEY_REFRESH_SHARES_IN_PROGRESS, diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java b/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java index 474d5abfb9..d07281b86e 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java @@ -21,6 +21,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.nextcloud.client.account.User; import com.nextcloud.client.di.Injectable; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.databinding.ConflictResolveDialogBinding; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -81,7 +82,7 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable args.putParcelable(KEY_EXISTING_FILE, existingFile); File file = new File(newFile.getStoragePath()); - Log_OC.d(TAG,"ConflictsResolveDialog.putSerializable: " + file.getAbsolutePath().length()); + FileExtensionsKt.logFileSize(file, TAG); args.putSerializable(KEY_NEW_FILE, file); args.putParcelable(KEY_USER, user); dialog.setArguments(args); @@ -140,9 +141,8 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(TAG,"onSaveInstanceState.existingFile: " + existingFile.getFileLength()); - Log_OC.d(TAG,"onSaveInstanceState.newFile: " + newFile.length()); - + FileExtensionsKt.logFileSize(existingFile, TAG); + FileExtensionsKt.logFileSize(newFile, TAG); outState.putParcelable(KEY_EXISTING_FILE, existingFile); outState.putSerializable(KEY_NEW_FILE, newFile); outState.putParcelable(KEY_USER, user); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java index 7b0b6e0019..68618877fa 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java @@ -23,6 +23,7 @@ import com.nextcloud.client.di.Injectable; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.common.NextcloudClient; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.databinding.FileDetailsActivitiesFragmentBinding; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -431,7 +432,7 @@ public class FileDetailActivitiesFragment extends Fragment implements @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(TAG, "onSaveInstanceState " + file.getFileLength()); + FileExtensionsKt.logFileSize(file, TAG); outState.putParcelable(ARG_FILE, file); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 3b28de8a02..8a1708240b 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -35,6 +35,7 @@ import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.MenuUtils; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.FileDetailsFragmentBinding; @@ -355,7 +356,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener, @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(TAG, "onSaveInstanceState " + getFile().getFileLength()); + FileExtensionsKt.logFileSize(getFile(), TAG); outState.putParcelable(ARG_FILE, getFile()); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java index 2d534c1a20..6aa21b6ff8 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java @@ -36,6 +36,7 @@ import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.databinding.FileDetailsSharingFragmentBinding; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -542,7 +543,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(tag, "onSaveInstanceState " + file.getFileLength()); + FileExtensionsKt.logFileSize(file, tag); outState.putParcelable(ARG_FILE, file); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 4cf2fb2dc3..6746c15235 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -57,6 +57,7 @@ import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.EditorUtils; import com.nextcloud.utils.ShortcutUtil; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.nextcloud.utils.extensions.IntentExtensionsKt; import com.nextcloud.utils.view.FastScrollUtils; import com.owncloud.android.MainApp; @@ -850,7 +851,7 @@ public class OCFileListFragment extends ExtendedListFragment implements @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(TAG, "onSaveInstanceState: " + mFile.getFileLength()); + FileExtensionsKt.logFileSize(mFile, TAG); outState.putParcelable(KEY_FILE, mFile); if (searchFragment) { outState.putParcelable(KEY_CURRENT_SEARCH_TYPE, currentSearchType); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java index afb867a97e..3004dce0fd 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java @@ -24,6 +24,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.jobs.download.FileDownloadHelper; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; @@ -163,7 +164,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.d(TAG, "onSaveInstanceState: " + getFile().getFileLength()); + FileExtensionsKt.logFileSize(getFile(), TAG); outState.putParcelable(FileDownloadFragment.EXTRA_FILE, getFile()); outState.putParcelable(FileDownloadFragment.EXTRA_USER, user); outState.putBoolean(FileDownloadFragment.EXTRA_ERROR, mError); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt index 7d9de7372e..7268b6bd54 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt @@ -55,6 +55,7 @@ import com.nextcloud.client.network.ClientFactory.CreationException import com.nextcloud.common.NextcloudClient import com.nextcloud.ui.fileactions.FileActionsBottomSheet.Companion.newInstance import com.nextcloud.utils.extensions.getParcelableArgument +import com.nextcloud.utils.extensions.logFileSize import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.FragmentPreviewMediaBinding @@ -254,7 +255,7 @@ class PreviewMediaFragment : FileFragment(), OnTouchListener, Injectable { override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - Log_OC.v(TAG, "onSaveInstanceState " + file.fileLength) + file.logFileSize(TAG) toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_LOCKED_CLOSED) outState.run { diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java index 6e90c85b58..6d0a25e643 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java @@ -21,6 +21,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.utils.Log_OC; @@ -136,7 +137,7 @@ public class PreviewTextFileFragment extends PreviewTextFragment { */ @Override public void onSaveInstanceState(@NonNull Bundle outState) { - Log_OC.d(TAG, "onSaveInstanceState: " + getFile().getFileLength()); + FileExtensionsKt.logFileSize(getFile(), TAG); outState.putParcelable(PreviewTextFileFragment.EXTRA_FILE, getFile()); outState.putParcelable(PreviewTextFileFragment.EXTRA_USER, user); super.onSaveInstanceState(outState); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java index 93029e8d13..7229e453e5 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java @@ -19,6 +19,7 @@ import android.view.ViewGroup; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.nextcloud.android.lib.richWorkspace.RichWorkspaceDirectEditingRemoteOperation; import com.nextcloud.client.account.UserAccountManager; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; @@ -72,7 +73,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment { */ @Override public void onSaveInstanceState(@NonNull Bundle outState) { - Log_OC.d(tag, "onSaveInstanceState: " + getFile().getFileLength()); + FileExtensionsKt.logFileSize(getFile(), tag); outState.putParcelable(PreviewTextStringFragment.EXTRA_FILE, getFile()); super.onSaveInstanceState(outState); From 3bc37e7097b7a4259127eb96445d3c58ed77af86 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Wed, 19 Jun 2024 15:33:10 +0200 Subject: [PATCH 09/15] Use extension for null files Signed-off-by: alperozturk --- .../android/ui/activity/ReceiveExternalFilesActivity.java | 3 ++- .../com/owncloud/android/ui/activity/UploadFilesActivity.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java index 91cf436d55..4d69dcf4ae 100755 --- a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java @@ -52,6 +52,7 @@ import com.nextcloud.client.jobs.upload.FileUploadHelper; import com.nextcloud.client.jobs.upload.FileUploadWorker; import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.nextcloud.utils.extensions.IntentExtensionsKt; import com.owncloud.android.MainApp; import com.owncloud.android.R; @@ -264,7 +265,7 @@ public class ReceiveExternalFilesActivity extends FileActivity @Override protected void onSaveInstanceState(@NonNull Bundle outState) { - Log_OC.d(TAG, "onSaveInstanceState " + mFile.getFileLength()); + FileExtensionsKt.logFileSize(mFile, TAG); super.onSaveInstanceState(outState); outState.putString(KEY_PARENTS, generatePath(mParents)); outState.putParcelable(KEY_FILE, mFile); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index c74f39befd..da59551317 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -33,6 +33,7 @@ import com.nextcloud.client.di.Injectable; import com.nextcloud.client.jobs.upload.FileUploadWorker; import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.utils.extensions.ActivityExtensionsKt; +import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.databinding.UploadFilesLayoutBinding; import com.owncloud.android.lib.common.utils.Log_OC; @@ -410,7 +411,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList protected void onSaveInstanceState(@NonNull Bundle outState) { // responsibility of restore is preferred in onCreate() before than in // onRestoreInstanceState when there are Fragments involved - Log_OC.d(TAG, "onSaveInstanceState " + mCurrentDir.length()); + FileExtensionsKt.logFileSize(mCurrentDir, TAG); super.onSaveInstanceState(outState); outState.putString(UploadFilesActivity.KEY_DIRECTORY_PATH, mCurrentDir.getAbsolutePath()); if (mOptionsMenu != null && mOptionsMenu.findItem(R.id.action_select_all) != null) { From 8e07b471567055eb4543744ecf21d1855dd4789a Mon Sep 17 00:00:00 2001 From: alperozturk Date: Wed, 19 Jun 2024 15:33:56 +0200 Subject: [PATCH 10/15] Use extension for null files Signed-off-by: alperozturk --- .../com/owncloud/android/ui/preview/PreviewMediaActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt index 491d52eca2..19dead13fa 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt @@ -65,6 +65,7 @@ import com.nextcloud.common.NextcloudClient import com.nextcloud.ui.fileactions.FileActionsBottomSheet.Companion.newInstance import com.nextcloud.ui.fileactions.FileActionsBottomSheet.ResultListener import com.nextcloud.utils.extensions.getParcelableArgument +import com.nextcloud.utils.extensions.logFileSize import com.owncloud.android.R import com.owncloud.android.databinding.ActivityPreviewMediaBinding import com.owncloud.android.datamodel.OCFile @@ -327,7 +328,7 @@ class PreviewMediaActivity : override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - Log_OC.d(TAG, "onSaveInstanceState: " + file.fileLength) + file.logFileSize(TAG) outState.let { bundle -> bundle.putParcelable(EXTRA_FILE, file) bundle.putParcelable(EXTRA_USER, user) From 51724b5a8903da47704af7efc06807b811cfeb78 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Wed, 19 Jun 2024 15:43:35 +0200 Subject: [PATCH 11/15] Use bytesToHumanReadable Signed-off-by: alperozturk --- .../com/nextcloud/utils/extensions/FileExtensions.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt b/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt index 132d590693..111ea1c0af 100644 --- a/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt +++ b/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt @@ -9,8 +9,15 @@ package com.nextcloud.utils.extensions import com.owncloud.android.datamodel.OCFile import com.owncloud.android.lib.common.utils.Log_OC +import com.owncloud.android.utils.DisplayUtils import java.io.File -fun OCFile?.logFileSize(tag: String) = Log_OC.d(tag, "onSaveInstanceState: ${this?.fileLength}") +fun OCFile?.logFileSize(tag: String) { + val size = DisplayUtils.bytesToHumanReadable(this?.fileLength ?: -1) + Log_OC.d(tag, "onSaveInstanceState: $size") +} -fun File?.logFileSize(tag: String) = Log_OC.d(tag, "onSaveInstanceState: ${this?.length()}") +fun File?.logFileSize(tag: String) { + val size = DisplayUtils.bytesToHumanReadable(this?.length() ?: -1) + Log_OC.d(tag, "onSaveInstanceState: $size") +} From a8d96d031997d27af7363ba4f38a8cfce20a0981 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Wed, 19 Jun 2024 15:44:22 +0200 Subject: [PATCH 12/15] Fix code analytics Signed-off-by: alperozturk --- .../com/owncloud/android/ui/activity/ConflictsResolveActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt index c68455f33c..18f3686c9d 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt @@ -33,7 +33,6 @@ import com.owncloud.android.lib.resources.files.model.RemoteFile import com.owncloud.android.ui.dialog.ConflictsResolveDialog import com.owncloud.android.ui.dialog.ConflictsResolveDialog.Decision import com.owncloud.android.ui.dialog.ConflictsResolveDialog.OnConflictDecisionMadeListener -import com.owncloud.android.ui.preview.FileDownloadFragment import com.owncloud.android.utils.FileStorageUtils import javax.inject.Inject From d1d8c58c76833d5d429a4d1e3eec6d1a06f29ea9 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Thu, 20 Jun 2024 12:12:25 +0200 Subject: [PATCH 13/15] Fix code analytics Signed-off-by: alperozturk --- .../android/ui/fragment/FileDetailSharingFragment.java | 4 ++-- .../com/owncloud/android/ui/fragment/GalleryFragment.java | 4 ++-- .../android/ui/preview/PreviewTextStringFragment.java | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java index 6aa21b6ff8..071faeee46 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java @@ -81,7 +81,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda DisplayUtils.AvatarGenerationListener, Injectable, FileDetailsSharingMenuBottomSheetActions, QuickSharingPermissionsBottomSheetDialog.QuickPermissionSharingBottomSheetActions { - private final String tag = "FileDetailSharingFragment"; + private static final String TAG = "FileDetailSharingFragment"; private static final String ARG_FILE = "FILE"; private static final String ARG_USER = "USER"; @@ -543,7 +543,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - FileExtensionsKt.logFileSize(file, tag); + FileExtensionsKt.logFileSize(file, TAG); outState.putParcelable(ARG_FILE, file); outState.putParcelable(ARG_USER, user); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java index 14675325b7..d1d2fa8b5e 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java @@ -67,8 +67,8 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme private GalleryFragmentBottomSheetDialog galleryFragmentBottomSheetDialog; @Inject FileDataStorageManager fileDataStorageManager; - private final int maxColumnSizeLandscape = 5; - private final int maxColumnSizePortrait = 2; + private final static int maxColumnSizeLandscape = 5; + private final static int maxColumnSizePortrait = 2; private int columnSize; protected void setPhotoSearchQueryRunning(boolean value) { diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java index 7229e453e5..28b63b979a 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java @@ -22,7 +22,6 @@ import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.utils.extensions.FileExtensionsKt; import com.owncloud.android.R; import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.theme.ViewThemeUtils; @@ -39,7 +38,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment { @Inject UserAccountManager accountManager; @Inject ViewThemeUtils viewThemeUtils; - private final String tag = "PreviewTextStringFragment"; + private final static String TAG = "PreviewTextStringFragment"; private boolean isEditorWebviewLaunched = false; /** @@ -73,7 +72,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment { */ @Override public void onSaveInstanceState(@NonNull Bundle outState) { - FileExtensionsKt.logFileSize(getFile(), tag); + FileExtensionsKt.logFileSize(getFile(), TAG); outState.putParcelable(PreviewTextStringFragment.EXTRA_FILE, getFile()); super.onSaveInstanceState(outState); From fb3000e7580bc2ed7c1d155be353fa47584cf7d3 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 28 Jun 2024 10:52:52 +0200 Subject: [PATCH 14/15] Rebase master Signed-off-by: alperozturk --- .../java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt index 7268b6bd54..f146374e0a 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt @@ -126,6 +126,7 @@ class PreviewMediaFragment : FileFragment(), OnTouchListener, Injectable { super.onCreate(savedInstanceState) arguments?.let { bundle -> + file.logFileSize(TAG) file = bundle.getParcelableArgument(FILE, OCFile::class.java) user = bundle.getParcelableArgument(USER, User::class.java) From ef99bf5332ffb7a121b8aca3d05c90bde90aacb2 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Mon, 1 Jul 2024 09:34:09 +0200 Subject: [PATCH 15/15] Add raw byte Signed-off-by: alperozturk --- .../java/com/nextcloud/utils/extensions/FileExtensions.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt b/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt index 111ea1c0af..94ae83be09 100644 --- a/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt +++ b/app/src/main/java/com/nextcloud/utils/extensions/FileExtensions.kt @@ -14,10 +14,12 @@ import java.io.File fun OCFile?.logFileSize(tag: String) { val size = DisplayUtils.bytesToHumanReadable(this?.fileLength ?: -1) - Log_OC.d(tag, "onSaveInstanceState: $size") + val rawByte = this?.fileLength ?: -1 + Log_OC.d(tag, "onSaveInstanceState: $size, raw byte $rawByte") } fun File?.logFileSize(tag: String) { val size = DisplayUtils.bytesToHumanReadable(this?.length() ?: -1) - Log_OC.d(tag, "onSaveInstanceState: $size") + val rawByte = this?.length() ?: -1 + Log_OC.d(tag, "onSaveInstanceState: $size, raw byte $rawByte") }