Fixes #28
This commit is contained in:
parent
585c57fe3a
commit
e68c16c7a4
@ -20,6 +20,7 @@ import android.support.v7.widget.helper.ItemTouchHelper
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
|
||||||
import com.anupcowkur.reservoir.Reservoir
|
import com.anupcowkur.reservoir.Reservoir
|
||||||
@ -86,6 +87,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
private var maybeSourceFilter: Sources? = null
|
private var maybeSourceFilter: Sources? = null
|
||||||
private var maybeSearchFilter: String? = null
|
private var maybeSearchFilter: String? = null
|
||||||
|
|
||||||
|
private lateinit var emptyText: TextView
|
||||||
private lateinit var mRecyclerView: RecyclerView
|
private lateinit var mRecyclerView: RecyclerView
|
||||||
private lateinit var mBottomBar: BottomBar
|
private lateinit var mBottomBar: BottomBar
|
||||||
private lateinit var mCoordinatorLayout: CoordinatorLayout
|
private lateinit var mCoordinatorLayout: CoordinatorLayout
|
||||||
@ -157,6 +159,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
mSwipeRefreshLayout = findViewById(R.id.swipeRefreshLayout)
|
mSwipeRefreshLayout = findViewById(R.id.swipeRefreshLayout)
|
||||||
mRecyclerView = findViewById(R.id.my_recycler_view)
|
mRecyclerView = findViewById(R.id.my_recycler_view)
|
||||||
|
|
||||||
|
emptyText = findViewById(R.id.emptyText)
|
||||||
|
|
||||||
reloadLayoutManager()
|
reloadLayoutManager()
|
||||||
|
|
||||||
mSwipeRefreshLayout.setColorSchemeResources(
|
mSwipeRefreshLayout.setColorSchemeResources(
|
||||||
@ -518,7 +522,13 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
if (didUpdate)
|
if (didUpdate)
|
||||||
handleListResult()
|
handleListResult()
|
||||||
if (items.isEmpty()) Toast.makeText(this@HomeActivity, R.string.nothing_here, Toast.LENGTH_SHORT).show()
|
if (items.isEmpty()) {
|
||||||
|
emptyText.visibility = View.VISIBLE
|
||||||
|
mRecyclerView.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
emptyText.visibility = View.GONE
|
||||||
|
mRecyclerView.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
mSwipeRefreshLayout.isRefreshing = false
|
mSwipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,13 +90,32 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<LinearLayout
|
||||||
android:id="@+id/my_recycler_view"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background_grey"
|
android:orientation="vertical">
|
||||||
android:scrollbars="vertical"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
<TextView
|
||||||
|
android:id="@+id/emptyText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="fill"
|
||||||
|
android:paddingTop="100dp"
|
||||||
|
android:text="@string/nothing_here"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
|
||||||
|
android:textColor="@color/about_libraries_card_dark"
|
||||||
|
android:visibility="gone" />
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/my_recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/background_grey"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -70,14 +70,32 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<LinearLayout
|
||||||
android:id="@+id/my_recycler_view"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background_grey"
|
android:orientation="vertical">
|
||||||
android:clipToPadding="false"
|
|
||||||
android:scrollbars="vertical"
|
<TextView
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
android:id="@+id/emptyText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="fill"
|
||||||
|
android:paddingTop="100dp"
|
||||||
|
android:text="@string/nothing_here"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
|
||||||
|
android:textColor="@color/about_libraries_card_dark"
|
||||||
|
android:visibility="gone" />
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/my_recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/background_grey"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user