updating placeholder texts a bit

This commit is contained in:
tibbi 2020-04-18 10:32:13 +02:00
parent c966acbbe9
commit aa7300fc35
6 changed files with 62 additions and 57 deletions

View File

@ -196,8 +196,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble
directories_refresh_layout.isEnabled = config.enablePullToRefresh directories_refresh_layout.isEnabled = config.enablePullToRefresh
invalidateOptionsMenu() invalidateOptionsMenu()
directories_empty_text_label.setTextColor(config.textColor)
directories_empty_text.setTextColor(getAdjustedPrimaryColor()) directories_empty_placeholder.setTextColor(config.textColor)
directories_empty_placeholder_2.setTextColor(getAdjustedPrimaryColor())
directories_switch_searching.setTextColor(getAdjustedPrimaryColor()) directories_switch_searching.setTextColor(getAdjustedPrimaryColor())
directories_switch_searching.underlineText() directories_switch_searching.underlineText()
@ -1009,8 +1010,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (isPlaceholderVisible) { if (isPlaceholderVisible) {
isPlaceholderVisible = false isPlaceholderVisible = false
runOnUiThread { runOnUiThread {
directories_empty_text_label.beGone() directories_empty_placeholder.beGone()
directories_empty_text.beGone() directories_empty_placeholder_2.beGone()
directories_grid.beVisible() directories_grid.beVisible()
} }
} }
@ -1052,32 +1053,32 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
} }
private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) { private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) {
directories_empty_text_label.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) directories_empty_placeholder.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
directories_empty_text.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) directories_empty_placeholder_2.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
if (mIsSearchOpen) { if (mIsSearchOpen) {
directories_empty_text_label.text = getString(R.string.no_items_found) directories_empty_placeholder.text = getString(R.string.no_items_found)
directories_empty_text.beGone() directories_empty_placeholder_2.beGone()
} else if (dirs.isEmpty() && config.filterMedia == TYPE_DEFAULT_FILTER) { } else if (dirs.isEmpty() && config.filterMedia == TYPE_DEFAULT_FILTER) {
directories_empty_text_label.text = getString(R.string.no_media_add_included) directories_empty_placeholder.text = getString(R.string.no_media_add_included)
directories_empty_text.text = getString(R.string.add_folder) directories_empty_placeholder_2.text = getString(R.string.add_folder)
directories_empty_text.setOnClickListener { directories_empty_placeholder_2.setOnClickListener {
showAddIncludedFolderDialog { showAddIncludedFolderDialog {
refreshItems() refreshItems()
} }
} }
} else { } else {
directories_empty_text_label.text = getString(R.string.no_media_with_filters) directories_empty_placeholder.text = getString(R.string.no_media_with_filters)
directories_empty_text.text = getString(R.string.change_filters_underlined) directories_empty_placeholder_2.text = getString(R.string.change_filters_underlined)
directories_empty_text.setOnClickListener { directories_empty_placeholder_2.setOnClickListener {
showFilterMediaDialog() showFilterMediaDialog()
} }
} }
directories_empty_text.underlineText() directories_empty_placeholder_2.underlineText()
directories_grid.beVisibleIf(directories_empty_text_label.isGone()) directories_grid.beVisibleIf(directories_empty_placeholder.isGone())
} }
private fun setupAdapter(dirs: ArrayList<Directory>, textToSearch: String = "") { private fun setupAdapter(dirs: ArrayList<Directory>, textToSearch: String = "") {

View File

@ -108,7 +108,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
registerFileUpdateListener() registerFileUpdateListener()
} }
media_empty_text.setOnClickListener { media_empty_text_placeholder_2.setOnClickListener {
showFilterMediaDialog() showFilterMediaDialog()
} }
@ -156,8 +156,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble
media_refresh_layout.isEnabled = config.enablePullToRefresh media_refresh_layout.isEnabled = config.enablePullToRefresh
invalidateOptionsMenu() invalidateOptionsMenu()
media_empty_text_label.setTextColor(config.textColor) media_empty_text_placeholder.setTextColor(config.textColor)
media_empty_text.setTextColor(getAdjustedPrimaryColor()) media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor())
if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) { if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) {
tryLoadGallery() tryLoadGallery()
@ -339,10 +339,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, mPath) val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, mPath)
runOnUiThread { runOnUiThread {
if (grouped.isEmpty()) { if (grouped.isEmpty()) {
media_empty_text_label.text = getString(R.string.no_items_found) media_empty_text_placeholder.text = getString(R.string.no_items_found)
media_empty_text_label.beVisible() media_empty_text_placeholder.beVisible()
} else { } else {
media_empty_text_label.beGone() media_empty_text_placeholder.beGone()
} }
getMediaAdapter()?.updateMedia(grouped) getMediaAdapter()?.updateMedia(grouped)
@ -876,13 +876,13 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
runOnUiThread { runOnUiThread {
media_refresh_layout.isRefreshing = false media_refresh_layout.isRefreshing = false
media_empty_text_label.beVisibleIf(media.isEmpty() && !isFromCache) media_empty_text_placeholder.beVisibleIf(media.isEmpty() && !isFromCache)
media_empty_text.beVisibleIf(media.isEmpty() && !isFromCache) media_empty_text_placeholder_2.beVisibleIf(media.isEmpty() && !isFromCache)
if (media_empty_text_label.isVisible()) { if (media_empty_text_placeholder.isVisible()) {
media_empty_text_label.text = getString(R.string.no_media_with_filters) media_empty_text_placeholder.text = getString(R.string.no_media_with_filters)
} }
media_grid.beVisibleIf(media_empty_text_label.isGone()) media_grid.beVisibleIf(media_empty_text_placeholder.isGone())
val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath) val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath)
val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID

View File

@ -39,7 +39,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_search) setContentView(R.layout.activity_search)
media_empty_text_label.setTextColor(config.textColor) media_empty_text_placeholder.setTextColor(config.textColor)
getAllMedia() getAllMedia()
} }
@ -108,10 +108,10 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, "") val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, "")
runOnUiThread { runOnUiThread {
if (grouped.isEmpty()) { if (grouped.isEmpty()) {
media_empty_text_label.text = getString(R.string.no_items_found) media_empty_text_placeholder.text = getString(R.string.no_items_found)
media_empty_text_label.beVisible() media_empty_text_placeholder.beVisible()
} else { } else {
media_empty_text_label.beGone() media_empty_text_placeholder.beGone()
} }
getMediaAdapter()?.updateMedia(grouped) getMediaAdapter()?.updateMedia(grouped)

View File

@ -22,23 +22,25 @@
android:visibility="gone"/> android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/directories_empty_text_label" android:id="@+id/directories_empty_placeholder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/directories_switch_searching" android:layout_below="@+id/directories_switch_searching"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin" android:alpha="0.8"
android:textStyle="italic"
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/big_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_media_with_filters" android:text="@string/no_media_with_filters"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/directories_empty_text" android:id="@+id/directories_empty_placeholder_2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/directories_empty_text_label" android:layout_below="@+id/directories_empty_placeholder"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin" android:padding="@dimen/activity_margin"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/media_refresh_layout" android:id="@+id/media_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -12,28 +11,30 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text_label" android:id="@+id/media_empty_text_placeholder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="0.8"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin" android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/big_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_media_with_filters" android:text="@string/no_media_with_filters"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:textStyle="italic"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text" android:id="@+id/media_empty_text_placeholder_2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/media_empty_text_label" android:layout_below="@+id/media_empty_text_placeholder"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin" android:padding="@dimen/activity_margin"
android:text="@string/change_filters_underlined" android:text="@string/change_filters_underlined"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:visibility="gone" />
<com.simplemobiletools.commons.views.MyRecyclerView <com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/media_grid" android:id="@+id/media_grid"
@ -41,7 +42,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="none" android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/media_columns_vertical_scroll"/> app:spanCount="@integer/media_columns_vertical_scroll" />
<com.simplemobiletools.commons.views.FastScroller <com.simplemobiletools.commons.views.FastScroller
android:id="@+id/media_vertical_fastscroller" android:id="@+id/media_vertical_fastscroller"
@ -51,7 +52,7 @@
android:paddingStart="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:visibility="gone"> android:visibility="gone">
<include layout="@layout/fastscroller_handle_vertical"/> <include layout="@layout/fastscroller_handle_vertical" />
</com.simplemobiletools.commons.views.FastScroller> </com.simplemobiletools.commons.views.FastScroller>
@ -64,7 +65,7 @@
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:visibility="gone"> android:visibility="gone">
<include layout="@layout/fastscroller_handle_horizontal"/> <include layout="@layout/fastscroller_handle_horizontal" />
</com.simplemobiletools.commons.views.FastScroller> </com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout> </RelativeLayout>

View File

@ -1,22 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/media_holder" android:id="@+id/media_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text_label" android:id="@+id/media_empty_text_placeholder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="0.8"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin" android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/big_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_media_with_filters" android:text="@string/no_media_with_filters"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:textStyle="italic"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyRecyclerView <com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/media_grid" android:id="@+id/media_grid"
@ -24,7 +25,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="none" android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/media_columns_vertical_scroll"/> app:spanCount="@integer/media_columns_vertical_scroll" />
<com.simplemobiletools.commons.views.FastScroller <com.simplemobiletools.commons.views.FastScroller
android:id="@+id/media_vertical_fastscroller" android:id="@+id/media_vertical_fastscroller"
@ -34,7 +35,7 @@
android:paddingStart="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:visibility="gone"> android:visibility="gone">
<include layout="@layout/fastscroller_handle_vertical"/> <include layout="@layout/fastscroller_handle_vertical" />
</com.simplemobiletools.commons.views.FastScroller> </com.simplemobiletools.commons.views.FastScroller>
@ -47,7 +48,7 @@
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:visibility="gone"> android:visibility="gone">
<include layout="@layout/fastscroller_handle_horizontal"/> <include layout="@layout/fastscroller_handle_horizontal" />
</com.simplemobiletools.commons.views.FastScroller> </com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout> </RelativeLayout>