mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +03:00
Use extension for null files
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
9aee148f8a
commit
05cde13428
14 changed files with 44 additions and 20 deletions
|
@ -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)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2024 Alper Ozturk <alper.ozturk@nextcloud.com>
|
||||
* 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()}")
|
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue