updating the main screens ui
This commit is contained in:
parent
f232f577e4
commit
0d2486a7eb
|
@ -64,7 +64,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:7e489f7121'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:7408174438'
|
||||||
implementation 'com.github.tibbi:PdfViewPager:d2af24208d'
|
implementation 'com.github.tibbi:PdfViewPager:d2af24208d'
|
||||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||||
implementation 'com.github.Stericson:RootShell:1.6'
|
implementation 'com.github.Stericson:RootShell:1.6'
|
||||||
|
|
|
@ -67,11 +67,13 @@ class MainActivity : SimpleActivity() {
|
||||||
private var mStoredShowTabs = 0
|
private var mStoredShowTabs = 0
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
appLaunched(BuildConfig.APPLICATION_ID)
|
appLaunched(BuildConfig.APPLICATION_ID)
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
|
updateMaterialActivityViews(main_coordinator, main_holder, false)
|
||||||
mTabsToShow = getTabsList()
|
mTabsToShow = getTabsList()
|
||||||
|
|
||||||
if (!config.wasStorageAnalysisTabAdded && isOreoPlus()) {
|
if (!config.wasStorageAnalysisTabAdded && isOreoPlus()) {
|
||||||
|
@ -110,9 +112,15 @@ class MainActivity : SimpleActivity() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
setupTabColors()
|
val statusBarColor = if (getCurrentFragment()?.getScrollingView() == null) {
|
||||||
setupToolbar(main_toolbar, searchMenuItem = mSearchMenuItem)
|
getProperBackgroundColor()
|
||||||
|
} else {
|
||||||
|
window.statusBarColor
|
||||||
|
}
|
||||||
|
|
||||||
|
setupToolbar(main_toolbar, statusBarColor = statusBarColor, searchMenuItem = mSearchMenuItem)
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
|
setupTabColors()
|
||||||
|
|
||||||
getAllFragments().forEach {
|
getAllFragments().forEach {
|
||||||
it?.onResume(getProperTextColor())
|
it?.onResume(getProperTextColor())
|
||||||
|
@ -416,6 +424,7 @@ class MainActivity : SimpleActivity() {
|
||||||
(it as? ItemOperationsListener)?.finishActMode()
|
(it as? ItemOperationsListener)?.finishActMode()
|
||||||
}
|
}
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
|
updateStatusBarChanger()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
main_view_pager.currentItem = config.lastUsedViewPagerPage
|
main_view_pager.currentItem = config.lastUsedViewPagerPage
|
||||||
|
@ -466,6 +475,14 @@ class MainActivity : SimpleActivity() {
|
||||||
)
|
)
|
||||||
|
|
||||||
main_tabs_holder.beGoneIf(main_tabs_holder.tabCount == 1)
|
main_tabs_holder.beGoneIf(main_tabs_holder.tabCount == 1)
|
||||||
|
main_tabs_holder.onGlobalLayout {
|
||||||
|
updateStatusBarChanger()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateStatusBarChanger() {
|
||||||
|
setupMaterialScrollListener(getCurrentFragment()?.getScrollingView(), main_toolbar)
|
||||||
|
updateStatusBarOnPageChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupTabColors() {
|
private fun setupTabColors() {
|
||||||
|
|
|
@ -557,4 +557,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
override fun selectedPaths(paths: ArrayList<String>) {
|
override fun selectedPaths(paths: ArrayList<String>) {
|
||||||
(activity as MainActivity).pickedPaths(paths)
|
(activity as MainActivity).pickedPaths(paths)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getScrollingView() = items_list
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simplemobiletools.filemanager.pro.fragments
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.core.view.ScrollingView
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST
|
import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST
|
||||||
import com.simplemobiletools.filemanager.pro.R
|
import com.simplemobiletools.filemanager.pro.R
|
||||||
|
@ -66,4 +67,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||||
abstract fun onResume(textColor: Int)
|
abstract fun onResume(textColor: Int)
|
||||||
|
|
||||||
abstract fun refreshFragment()
|
abstract fun refreshFragment()
|
||||||
|
|
||||||
|
abstract fun getScrollingView(): ScrollingView?
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,4 +230,6 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||||
override fun finishActMode() {
|
override fun finishActMode() {
|
||||||
getRecyclerAdapter()?.finishActMode()
|
getRecyclerAdapter()?.finishActMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getScrollingView() = recents_list
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,4 +221,6 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getScrollingView() = storage_nested_scrollview
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,27 +5,21 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/main_app_bar_layout"
|
android:id="@+id/main_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="@color/color_primary"
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
app:menu="@menu/menu"
|
||||||
android:id="@+id/main_toolbar"
|
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="@color/color_primary"
|
|
||||||
app:menu="@menu/menu"
|
|
||||||
app:title="@string/app_launcher_name"
|
|
||||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/main_screen"
|
android:id="@+id/main_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyViewPager
|
<com.simplemobiletools.commons.views.MyViewPager
|
||||||
android:id="@+id/main_view_pager"
|
android:id="@+id/main_view_pager"
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/storage_scrollview"
|
android:id="@+id/storage_nested_scrollview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
@ -301,5 +301,5 @@
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</ScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
</com.simplemobiletools.filemanager.pro.fragments.StorageFragment>
|
</com.simplemobiletools.filemanager.pro.fragments.StorageFragment>
|
||||||
|
|
Loading…
Reference in New Issue