mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-07 23:58:59 +01:00
add a helper function for determining if a medium is hidden
This commit is contained in:
parent
5804d81eac
commit
c76087e54a
@ -295,8 +295,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||
findItem(R.id.menu_edit).isVisible = visibleBottomActions and BOTTOM_ACTION_EDIT == 0
|
||||
findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() && visibleBottomActions and BOTTOM_ACTION_ROTATE == 0
|
||||
findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0
|
||||
findItem(R.id.menu_hide).isVisible = !currentMedium.name.startsWith('.') && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
||||
findItem(R.id.menu_unhide).isVisible = currentMedium.name.startsWith('.') && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
||||
findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
||||
findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
||||
findItem(R.id.menu_add_to_favorites).isVisible = !currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0
|
||||
findItem(R.id.menu_remove_from_favorites).isVisible = currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0
|
||||
findItem(R.id.menu_restore_file).isVisible = currentMedium.path.startsWith(filesDir.toString())
|
||||
@ -853,7 +853,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||
val favoriteIcon = if (medium.isFavorite) R.drawable.ic_star_on else R.drawable.ic_star_off
|
||||
bottom_favorite.setImageResource(favoriteIcon)
|
||||
|
||||
val hideIcon = if (medium.name.startsWith('.')) R.drawable.ic_unhide else R.drawable.ic_hide
|
||||
val hideIcon = if (medium.isHidden()) R.drawable.ic_unhide else R.drawable.ic_hide
|
||||
bottom_toggle_file_visibility.setImageResource(hideIcon)
|
||||
|
||||
bottom_rotate.beVisibleIf(config.visibleBottomActions and BOTTOM_ACTION_ROTATE != 0 && getCurrentMedium()?.isImage() == true)
|
||||
|
@ -162,7 +162,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
||||
var hiddenCnt = 0
|
||||
var unhiddenCnt = 0
|
||||
getSelectedMedia().forEach {
|
||||
if (it.name.startsWith('.')) {
|
||||
if (it.isHidden()) {
|
||||
hiddenCnt++
|
||||
} else {
|
||||
unhiddenCnt++
|
||||
|
@ -40,6 +40,8 @@ data class Medium(
|
||||
|
||||
fun isRaw() = type == TYPE_RAWS
|
||||
|
||||
fun isHidden() = name.startsWith('.')
|
||||
|
||||
fun getBubbleText(sorting: Int) = when {
|
||||
sorting and SORT_BY_NAME != 0 -> name
|
||||
sorting and SORT_BY_PATH != 0 -> path
|
||||
|
Loading…
x
Reference in New Issue
Block a user