Skip to content

Commit fc3096f

Browse files
authored
Merge pull request #4790 from mykh-hailo/fix/scrollable-space-header
[FIX] Spaces' root folder in landscape has no room for the list of files
2 parents 28d1c10 + 2f1c60a commit fc3096f

7 files changed

Lines changed: 34 additions & 2 deletions

File tree

changelog/unreleased/4790

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: Reduce space header size after rotating device
2+
3+
The space header height has been reduced in landscape orientation.
4+
5+
https://github.com/owncloud/android/issues/4625
6+
https://github.com/owncloud/android/pull/4790

owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import android.annotation.SuppressLint
2929
import android.content.Context
3030
import android.content.Intent
3131
import android.content.res.ColorStateList
32+
import android.content.res.Configuration
3233
import android.graphics.drawable.Drawable
3334
import android.net.Uri
3435
import android.os.Build
@@ -327,6 +328,27 @@ class MainFileListFragment : Fragment(),
327328
subscribeToViewModels()
328329
}
329330

331+
override fun onConfigurationChanged(newConfig: Configuration) {
332+
super.onConfigurationChanged(newConfig)
333+
updateConfigDependentSizes()
334+
}
335+
336+
private fun updateConfigDependentSizes() {
337+
val cardSize = resources.getDimensionPixelSize(R.dimen.spaces_header_card_height)
338+
binding.spaceHeader.spaceHeaderCard.layoutParams.apply {
339+
width = cardSize
340+
height = cardSize
341+
}
342+
binding.spaceHeader.spaceHeaderCard.requestLayout()
343+
344+
val iconSize = resources.getDimensionPixelSize(R.dimen.empty_icon_size)
345+
binding.emptyDataParent.listEmptyDatasetIcon.layoutParams.apply {
346+
width = iconSize
347+
height = iconSize
348+
}
349+
binding.emptyDataParent.listEmptyDatasetIcon.requestLayout()
350+
}
351+
330352
override fun onResume() {
331353
super.onResume()
332354
if (browserOpened) {

owncloudApp/src/main/res/layout/item_empty_dataset.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
<ImageView
1111
android:id="@+id/list_empty_dataset_icon"
12-
android:layout_width="72dp"
13-
android:layout_height="72dp"
12+
android:layout_width="@dimen/empty_icon_size"
13+
android:layout_height="@dimen/empty_icon_size"
1414
app:layout_constraintBottom_toTopOf="@id/list_empty_dataset_title"
1515
app:layout_constraintEnd_toEndOf="parent"
1616
app:layout_constraintStart_toStartOf="parent"

owncloudApp/src/main/res/values-h640dp/dims.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@
2929
<!-- Spaces -->
3030
<dimen name="spaces_thumbnail_height">172dp</dimen>
3131
<dimen name="spaces_header_card_height">100dp</dimen>
32+
<dimen name="empty_icon_size">48dp</dimen>
3233
</resources>

owncloudApp/src/main/res/values-h740dp/dims.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@
3232
<dimen name="spaces_header_card_height">150dp</dimen>
3333
<dimen name="spaces_margin_horizontal">30dp</dimen>
3434
<dimen name="spaces_margin_vertical">20dp</dimen>
35+
<dimen name="empty_icon_size">72dp</dimen>
3536
</resources>

owncloudApp/src/main/res/values-sw720dp/dims.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424
<dimen name="spaces_header_card_height">150dp</dimen>
2525
<dimen name="spaces_margin_horizontal">50dp</dimen>
2626
<dimen name="spaces_margin_vertical">40dp</dimen>
27+
<dimen name="empty_icon_size">72dp</dimen>
2728
</resources>

owncloudApp/src/main/res/values/dims.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,5 @@
8888

8989
<!-- Accessibility dims -->
9090
<dimen name="icon_button_size">48dp</dimen>
91+
<dimen name="empty_icon_size">36dp</dimen>
9192
</resources>

0 commit comments

Comments
 (0)