Skip to content

Commit

Permalink
adding some tab numbering changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed May 21, 2021
1 parent a48300e commit 90b9eee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ android {
}

dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:f07ca31126'
implementation 'com.github.SimpleMobileTools:Simple-Commons:fe68ccdac8'
implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import com.simplemobiletools.filemanager.pro.fragments.ItemsFragment
import com.simplemobiletools.filemanager.pro.fragments.MyViewPagerFragment
import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT
import com.simplemobiletools.filemanager.pro.helpers.RootHelpers
import com.simplemobiletools.filemanager.pro.helpers.TAB_FILES
import com.simplemobiletools.filemanager.pro.helpers.TAB_RECENTS
import com.simplemobiletools.filemanager.pro.helpers.tabsList
import com.stericson.RootTools.RootTools
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.items_fragment.*
Expand Down Expand Up @@ -591,14 +590,11 @@ class MainActivity : SimpleActivity() {
}
}

private fun getInactiveTabIndexes(activeIndex: Int) = arrayListOf(TAB_FILES, TAB_RECENTS).filter { it != activeIndex }
private fun getInactiveTabIndexes(activeIndex: Int) = (0 until tabsList.size).filter { it != activeIndex }

private fun getAllFragments(): ArrayList<MyViewPagerFragment?> = arrayListOf(items_fragment, recents_fragment)

private fun getCurrentFragment(): MyViewPagerFragment? = when (main_view_pager.currentItem) {
TAB_FILES -> items_fragment
else -> recents_fragment
}
private fun getCurrentFragment() = getAllFragments().getOrNull(main_view_pager.currentItem)

private fun checkWhatsNewDialog() {
arrayListOf<Release>().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.simplemobiletools.filemanager.pro.R
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity
import com.simplemobiletools.filemanager.pro.extensions.config
import com.simplemobiletools.filemanager.pro.fragments.MyViewPagerFragment
import com.simplemobiletools.filemanager.pro.helpers.TAB_FILES

class ViewPagerAdapter(val activity: SimpleActivity) : PagerAdapter() {
override fun instantiateItem(container: ViewGroup, position: Int): Any {
Expand All @@ -31,8 +30,8 @@ class ViewPagerAdapter(val activity: SimpleActivity) : PagerAdapter() {

override fun isViewFromObject(view: View, item: Any) = view == item

private fun getFragment(position: Int) = when (position) {
TAB_FILES -> R.layout.items_fragment
else -> R.layout.recents_fragment
private fun getFragment(position: Int): Int {
val fragments = arrayListOf(R.layout.items_fragment, R.layout.recents_fragment)
return fragments[position]
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.simplemobiletools.filemanager.pro.helpers

import com.simplemobiletools.commons.helpers.TAB_FILES
import com.simplemobiletools.commons.helpers.TAB_RECENT_FILES

const val PATH = "path"
const val MAX_COLUMN_COUNT = 20

Expand All @@ -25,5 +28,5 @@ const val OPEN_AS_AUDIO = 3
const val OPEN_AS_VIDEO = 4
const val OPEN_AS_OTHER = 5

const val TAB_FILES = 0
const val TAB_RECENTS = 1
const val ALL_TABS_MASK = TAB_FILES or TAB_RECENT_FILES
val tabsList = arrayListOf(TAB_FILES, TAB_RECENT_FILES)

0 comments on commit 90b9eee

Please sign in to comment.