-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3460 from owncloud/new_arch/empty_folder
New arch/empty folder
- Loading branch information
Showing
6 changed files
with
125 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
owncloudApp/src/main/java/com/owncloud/android/presentation/observers/EmptyDataObserver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.owncloud.android.presentation.observers | ||
|
||
import android.view.View | ||
import androidx.core.view.isVisible | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
class EmptyDataObserver constructor(recyclerView: RecyclerView?, emptyView: View?): RecyclerView.AdapterDataObserver() { | ||
|
||
private var emptyView: View? = null | ||
private var recyclerView: RecyclerView? = null | ||
|
||
init { | ||
this.recyclerView = recyclerView | ||
this.emptyView = emptyView | ||
checkIfEmpty() | ||
} | ||
|
||
|
||
private fun checkIfEmpty() { | ||
if (emptyView != null && recyclerView!!.adapter != null) { | ||
val emptyViewVisible = recyclerView!!.adapter!!.itemCount == 0 | ||
emptyView!!.isVisible = emptyViewVisible | ||
recyclerView!!.isVisible = !emptyViewVisible | ||
} | ||
} | ||
|
||
override fun onChanged() { | ||
super.onChanged() | ||
checkIfEmpty() | ||
} | ||
|
||
override fun onItemRangeChanged(positionStart: Int, itemCount: Int) { | ||
super.onItemRangeChanged(positionStart, itemCount) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="center" | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
android:paddingTop="@dimen/standard_half_padding" | ||
android:paddingBottom="@dimen/standard_half_padding"> | ||
|
||
<ImageView | ||
android:id="@+id/list_empty_dataset_icon" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/ic_folder" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/list_empty_dataset_title" | ||
style="@style/TextAppearance.MaterialComponents.Subtitle1" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/standard_margin" | ||
android:layout_marginEnd="@dimen/standard_margin" | ||
android:gravity="center" | ||
android:padding="@dimen/standard_half_padding" | ||
android:text="@string/local_file_list_empty" | ||
android:textStyle="bold" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/list_empty_dataset_icon" /> | ||
|
||
<TextView | ||
android:id="@+id/list_empty_dataset_sub_title" | ||
style="@style/TextAppearance.MaterialComponents.Body1" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/standard_margin" | ||
android:layout_marginEnd="@dimen/standard_margin" | ||
android:gravity="center" | ||
android:text="@string/folder_upload_some_content_or_sync_devices" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/list_empty_dataset_title" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters