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