moving tabs at the bottom

This commit is contained in:
tibbi 2022-06-22 20:09:27 +02:00
parent 6bc0624b88
commit 8a522323f4
4 changed files with 27 additions and 16 deletions

View File

@ -62,7 +62,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:0ee0850e6f'
implementation 'com.github.SimpleMobileTools:Simple-Commons:4b8a3568df'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.github.Armen101:AudioRecordView:1.0.4'
implementation 'androidx.documentfile:documentfile:1.0.1'

View File

@ -103,6 +103,11 @@ class MainActivity : SimpleActivity() {
}
view_pager.currentItem = config.lastUsedViewPagerPage
main_tabs_holder.setTabTextColors(
getProperTextColor(),
getProperPrimaryColor()
)
main_tabs_holder.onTabSelectionChanged(
tabUnselectedAction = {
it.icon?.applyColorFilter(getProperTextColor())
@ -119,7 +124,6 @@ class MainActivity : SimpleActivity() {
private fun setupTabColors() {
main_tabs_holder.apply {
background = ColorDrawable(getProperBackgroundColor())
setSelectedTabIndicatorColor(getProperPrimaryColor())
getTabAt(view_pager.currentItem)?.icon?.applyColorFilter(getProperPrimaryColor())
getTabAt(getInactiveTabIndex())?.icon?.applyColorFilter(getProperTextColor())
}

View File

@ -5,34 +5,38 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.commons.views.MyViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/main_tabs_holder" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/main_tabs_holder"
android:layout_width="match_parent"
android:layout_height="48dp"
app:elevation="6dp"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:elevation="8dp"
app:tabIndicator="@null"
app:tabMinWidth="150dp"
app:tabSelectedTextColor="@android:color/white">
app:tabRippleColor="@null"
app:tabTextAppearance="@style/TabLayoutStyle">
<com.google.android.material.tabs.TabItem
android:id="@+id/tab_recorder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_microphone_vector" />
android:contentDescription="@string/recorder"
android:icon="@drawable/ic_microphone_vector"
android:text="@string/recorder" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tab_player"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_headset_vector" />
android:contentDescription="@string/player"
android:icon="@drawable/ic_headset_vector"
android:text="@string/player" />
</com.google.android.material.tabs.TabLayout>
<com.simplemobiletools.commons.views.MyViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/main_tabs_holder" />
</RelativeLayout>

View File

@ -11,4 +11,7 @@
<item name="android:windowNoDisplay">true</item>
</style>
<style name="TabLayoutStyle" parent="Base.Widget.Design.TabLayout">
<item name="android:textSize">@dimen/smaller_text_size</item>
</style>
</resources>