Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package com.nextcloud.ui.fileDetail
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.widget.ImageView
import com.nextcloud.utils.extensions.getBigThumbnail
import com.nextcloud.utils.extensions.getSmallThumbnail
import com.nextcloud.utils.thumbnail.FolderThumbnailGenerator
import com.nextcloud.utils.thumbnail.VideoOverlayGenerator
Expand All @@ -32,7 +33,7 @@ class FileDetailPreview(
return
}

val thumbnail = file.getSmallThumbnail()
val thumbnail = file.getBigThumbnail() ?: file.getSmallThumbnail()
if (thumbnail == null) {
setIcon(MimeTypeUtil.getFileTypeIcon(file.mimeType, file.fileName, toolbarActivity, viewThemeUtils))
} else {
Expand All @@ -53,7 +54,7 @@ class FileDetailPreview(

private fun setIcon(icon: Drawable) {
previewImageView?.setImageDrawable(icon)
val padding = toolbarActivity.resources.getDimensionPixelSize(R.dimen.standard_double_padding)
val padding = toolbarActivity.resources.getDimensionPixelSize(R.dimen.file_details_preview_icon_padding)
applyScaling(ImageView.ScaleType.FIT_CENTER, padding)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2026 Alper Ozturk <alper.ozturk@nextcloud.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

package com.nextcloud.ui.fileDetail

import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.core.widget.NestedScrollView

class HeaderFirstNestedScrollView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : NestedScrollView(context, attrs, defStyleAttr) {

override fun onNestedPreScroll(target: View, dx: Int, dy: Int, consumed: IntArray, type: Int) {
super.onNestedPreScroll(target, dx, dy, consumed, type)

val remainingDy = dy - consumed[1]
if (remainingDy <= 0) {
return
}

val scrollYBefore = scrollY
scrollBy(0, remainingDy)
consumed[1] += scrollY - scrollYBefore
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ class FileDisplayActivity :
setLeftFragment(detailFragment, false)
// swap now, so no frame shows the list without its sort row
supportFragmentManager.executePendingTransactions()
configureToolbarForPreview(file)
updateActionBarForFile(file)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import android.animation.AnimatorInflater;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
Expand Down Expand Up @@ -347,13 +346,7 @@ public final void hideInfoBox() {
}

public void setPreviewImageVisibility(boolean isVisibility) {
if (mPreviewImage != null && mPreviewImageContainer != null) {
if (isVisibility) {
mToolbar.setTitle(null);
mToolbar.setBackgroundColor(Color.TRANSPARENT);
} else {
mToolbar.setBackgroundResource(R.color.appbar);
}
if (mPreviewImageContainer != null) {
mPreviewImageContainer.setVisibility(isVisibility ? View.VISIBLE : View.GONE);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,

binding = FileDetailsFragmentBinding.inflate(inflater, container, false);
view = binding.getRoot();
binding.detailContainer.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
oldBottom) -> fitTabContentToViewport());

if (getFile() == null || user == null) {
showEmptyContent();
Expand Down Expand Up @@ -843,6 +845,27 @@ public void showHideFragmentView(boolean isFragmentReplaced) {
binding.sharingFrameContainer.setVisibility(isFragmentReplaced ? View.VISIBLE : View.GONE);
}

private void fitTabContentToViewport() {
int tabLayoutHeight = binding.tabLayout.getVisibility() == View.VISIBLE ? binding.tabLayout.getHeight() : 0;
int tabContentHeight = binding.detailContainer.getHeight() - tabLayoutHeight;
if (tabContentHeight <= 0) {
return;
}

setHeight(binding.pager, tabContentHeight);
setHeight(binding.sharingFrameContainer, tabContentHeight);
}

private void setHeight(View target, int height) {
ViewGroup.LayoutParams params = target.getLayoutParams();
if (params.height == height) {
return;
}

params.height = height;
target.post(target::requestLayout);
}

/**
* open the new sharing screen process to modify the created share
*
Expand Down
19 changes: 0 additions & 19 deletions app/src/main/res/drawable/preview_image_gradient_shape.xml

This file was deleted.

Loading
Loading