mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 12:49:02 +00:00
Tweak empty task state
This commit is contained in:
parent
ca9c1d14f0
commit
b0b7fbed4f
3 changed files with 51 additions and 30 deletions
|
|
@ -5,44 +5,57 @@
|
|||
android:id="@+id/refreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:background="@color/gray_700">
|
||||
android:background="@color/gray_700"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/emptyView"
|
||||
style="@style/EmptyView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="60dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/empty_icon_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/emptyViewTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_200"
|
||||
android:textSize="@dimen/card_medium_text"
|
||||
tools:text="No Items" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/emptyViewDescription"
|
||||
style="@style/Body2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_200"
|
||||
tools:text="No Items" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.habitrpg.android.habitica.ui.helpers.RecyclerViewEmptySupport
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/scrollbarThumb"
|
||||
android:scrollbars="vertical"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/emptyView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="60dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
style="@style/EmptyView">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/emptyViewTitle"
|
||||
tools:text="No Items"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/card_medium_text"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/emptyViewDescription"
|
||||
android:gravity="center"
|
||||
tools:text="No Items" />
|
||||
</LinearLayout>
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
</FrameLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
|
|
|||
|
|
@ -288,44 +288,52 @@ open class TaskRecyclerViewFragment : BaseFragment(), androidx.swiperefreshlayou
|
|||
private fun setEmptyLabels() {
|
||||
if (this.classType != null) {
|
||||
binding.recyclerView.setEmptyView(binding.emptyView)
|
||||
context?.let { binding.emptyIconView.setColorFilter(ContextCompat.getColor(it, R.color.gray_400), android.graphics.PorterDuff.Mode.MULTIPLY) }
|
||||
if (taskFilterHelper.howMany(classType) > 0) {
|
||||
when (this.classType) {
|
||||
Task.TYPE_HABIT -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_habits_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_habits_filtered)
|
||||
binding.emptyViewDescription.setText(R.string.empty_description_habits_filtered)
|
||||
}
|
||||
Task.TYPE_DAILY -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_dailies_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_dailies_filtered)
|
||||
binding.emptyViewDescription.setText(R.string.empty_description_dailies_filtered)
|
||||
}
|
||||
Task.TYPE_TODO -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_todos_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_todos_filtered)
|
||||
binding.emptyViewDescription.setText(R.string.empty_description_todos_filtered)
|
||||
}
|
||||
Task.TYPE_REWARD -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_rewards_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_rewards)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when (this.classType) {
|
||||
Task.TYPE_HABIT -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_habits_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_habits)
|
||||
binding.emptyViewDescription.setText(R.string.empty_description_habits)
|
||||
}
|
||||
Task.TYPE_DAILY -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_dailies_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_dailies)
|
||||
binding.emptyViewDescription.setText(R.string.empty_description_dailies)
|
||||
}
|
||||
Task.TYPE_TODO -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_todos_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_todos)
|
||||
binding.emptyViewDescription.setText(R.string.empty_description_todos)
|
||||
}
|
||||
Task.TYPE_REWARD -> {
|
||||
binding.emptyIconView.setImageResource(R.drawable.icon_rewards_selected)
|
||||
binding.emptyViewTitle.setText(R.string.empty_title_rewards)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ buildscript {
|
|||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.0-alpha09'
|
||||
classpath 'com.android.tools.build:gradle:3.6.0-rc01'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
classpath "io.realm:realm-gradle-plugin:6.0.2"
|
||||
|
|
|
|||
Loading…
Reference in a new issue