mirror of
https://github.com/SimpleMobileTools/Simple-Voice-Recorder.git
synced 2025-06-05 21:59:31 +02:00
moving the bottom tab item layout file to commons
This commit is contained in:
@@ -62,7 +62,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:0834a977e4'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:b2167e4b2a'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'com.github.Armen101:AudioRecordView:1.0.4'
|
||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||
|
@@ -103,26 +103,26 @@ class MainActivity : SimpleActivity() {
|
||||
private fun setupViewPager() {
|
||||
main_tabs_holder.removeAllTabs()
|
||||
main_tabs_holder.newTab().setCustomView(R.layout.bottom_tablayout_item).apply {
|
||||
customView?.findViewById<ImageView>(R.id.tab_icon)?.setImageDrawable(getDrawable(R.drawable.ic_microphone_vector))
|
||||
customView?.findViewById<TextView>(R.id.tab_label)?.setText(R.string.recorder)
|
||||
customView?.findViewById<ImageView>(R.id.tab_item_icon)?.setImageDrawable(getDrawable(R.drawable.ic_microphone_vector))
|
||||
customView?.findViewById<TextView>(R.id.tab_item_label)?.setText(R.string.recorder)
|
||||
main_tabs_holder.addTab(this)
|
||||
}
|
||||
|
||||
main_tabs_holder.newTab().setCustomView(R.layout.bottom_tablayout_item).apply {
|
||||
customView?.findViewById<ImageView>(R.id.tab_icon)?.setImageDrawable(getDrawable(R.drawable.ic_headset_vector))
|
||||
customView?.findViewById<TextView>(R.id.tab_label)?.setText(R.string.player)
|
||||
customView?.findViewById<ImageView>(R.id.tab_item_icon)?.setImageDrawable(getDrawable(R.drawable.ic_headset_vector))
|
||||
customView?.findViewById<TextView>(R.id.tab_item_label)?.setText(R.string.player)
|
||||
main_tabs_holder.addTab(this)
|
||||
}
|
||||
|
||||
main_tabs_holder.onTabSelectionChanged(
|
||||
tabUnselectedAction = {
|
||||
it.customView?.findViewById<ImageView>(R.id.tab_icon)?.applyColorFilter(getProperTextColor())
|
||||
it.customView?.findViewById<TextView>(R.id.tab_label)?.setTextColor(getProperTextColor())
|
||||
it.customView?.findViewById<ImageView>(R.id.tab_item_icon)?.applyColorFilter(getProperTextColor())
|
||||
it.customView?.findViewById<TextView>(R.id.tab_item_label)?.setTextColor(getProperTextColor())
|
||||
},
|
||||
tabSelectedAction = {
|
||||
view_pager.currentItem = it.position
|
||||
it.customView?.findViewById<ImageView>(R.id.tab_icon)?.applyColorFilter(getProperPrimaryColor())
|
||||
it.customView?.findViewById<TextView>(R.id.tab_label)?.setTextColor(getProperPrimaryColor())
|
||||
it.customView?.findViewById<ImageView>(R.id.tab_item_icon)?.applyColorFilter(getProperPrimaryColor())
|
||||
it.customView?.findViewById<TextView>(R.id.tab_item_label)?.setTextColor(getProperPrimaryColor())
|
||||
}
|
||||
)
|
||||
|
||||
@@ -131,6 +131,7 @@ class MainActivity : SimpleActivity() {
|
||||
main_tabs_holder.getTabAt(it)?.select()
|
||||
(view_pager.adapter as ViewPagerAdapter).finishActMode()
|
||||
}
|
||||
|
||||
view_pager.currentItem = config.lastUsedViewPagerPage
|
||||
main_tabs_holder.getTabAt(config.lastUsedViewPagerPage)?.select()
|
||||
}
|
||||
@@ -139,13 +140,13 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
private fun setupTabColors() {
|
||||
main_tabs_holder.getTabAt(getInactiveTabIndex())?.customView?.apply {
|
||||
findViewById<ImageView>(R.id.tab_icon)?.applyColorFilter(getProperTextColor())
|
||||
findViewById<TextView>(R.id.tab_label)?.setTextColor(getProperTextColor())
|
||||
findViewById<ImageView>(R.id.tab_item_icon)?.applyColorFilter(getProperTextColor())
|
||||
findViewById<TextView>(R.id.tab_item_label)?.setTextColor(getProperTextColor())
|
||||
}
|
||||
|
||||
main_tabs_holder.getTabAt(view_pager.currentItem)?.customView?.apply {
|
||||
findViewById<ImageView>(R.id.tab_icon)?.applyColorFilter(getProperPrimaryColor())
|
||||
findViewById<TextView>(R.id.tab_label)?.setTextColor(getProperPrimaryColor())
|
||||
findViewById<ImageView>(R.id.tab_item_icon)?.applyColorFilter(getProperPrimaryColor())
|
||||
findViewById<TextView>(R.id.tab_item_label)?.setTextColor(getProperPrimaryColor())
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tab_icon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@drawable/ic_headset_vector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tab_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:paddingTop="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:textSize="@dimen/smaller_text_size"
|
||||
tools:text="@string/player" />
|
||||
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user