From e68c16c7a4adcff98ac94c1723cf45d3e94da4c5 Mon Sep 17 00:00:00 2001 From: Amine Date: Sun, 2 Jul 2017 19:31:18 +0200 Subject: [PATCH] Fixes #28 --- .../bou/readerforselfoss/HomeActivity.kt | 12 ++++++- .../main/res/layout-land/activity_home.xml | 31 ++++++++++++++---- app/src/main/res/layout/activity_home.xml | 32 +++++++++++++++---- 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index 7725622..8af67e3 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -20,6 +20,7 @@ import android.support.v7.widget.helper.ItemTouchHelper import android.view.Menu import android.view.MenuItem import android.view.View +import android.widget.TextView import android.widget.Toast import com.anupcowkur.reservoir.Reservoir @@ -86,6 +87,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { private var maybeSourceFilter: Sources? = null private var maybeSearchFilter: String? = null + private lateinit var emptyText: TextView private lateinit var mRecyclerView: RecyclerView private lateinit var mBottomBar: BottomBar private lateinit var mCoordinatorLayout: CoordinatorLayout @@ -157,6 +159,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { mSwipeRefreshLayout = findViewById(R.id.swipeRefreshLayout) mRecyclerView = findViewById(R.id.my_recycler_view) + emptyText = findViewById(R.id.emptyText) + reloadLayoutManager() mSwipeRefreshLayout.setColorSchemeResources( @@ -518,7 +522,13 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { } if (didUpdate) 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 } diff --git a/app/src/main/res/layout-land/activity_home.xml b/app/src/main/res/layout-land/activity_home.xml index 8b0dcc0..8cb7791 100644 --- a/app/src/main/res/layout-land/activity_home.xml +++ b/app/src/main/res/layout-land/activity_home.xml @@ -90,13 +90,32 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 89677b4..fd15d97 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -70,14 +70,32 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + +