move the getTabIcon helper function in SimpleActivity

This commit is contained in:
tibbi 2019-12-06 20:03:14 +01:00
parent 2f9c8332f0
commit 9d2254e891
2 changed files with 14 additions and 14 deletions

View File

@ -8,7 +8,6 @@ import android.content.pm.ShortcutInfo
import android.content.pm.ShortcutManager
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.Icon
import android.graphics.drawable.LayerDrawable
import android.net.Uri
@ -416,16 +415,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
}
private fun getTabIcon(position: Int): Drawable {
val drawableId = when (position) {
LOCATION_CONTACTS_TAB -> R.drawable.ic_person_vector
LOCATION_FAVORITES_TAB -> R.drawable.ic_star_on_vector
else -> R.drawable.ic_group_vector
}
return resources.getColoredDrawableWithColor(drawableId, config.textColor)
}
private fun showSortingDialog() {
ChangeSortingDialog(this) {
refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK)

View File

@ -3,15 +3,16 @@ package com.simplemobiletools.contacts.pro.activities
import android.annotation.TargetApi
import android.content.ContentValues
import android.content.Intent
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import android.telecom.TelecomManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.helpers.KEY_MAILTO
import com.simplemobiletools.contacts.pro.helpers.KEY_PHONE
import com.simplemobiletools.contacts.pro.helpers.REQUEST_CODE_SET_DEFAULT_DIALER
import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.helpers.*
open class SimpleActivity : BaseSimpleActivity() {
override fun getAppIconIDs() = arrayListOf(
@ -73,4 +74,14 @@ open class SimpleActivity : BaseSimpleActivity() {
}
}
}
protected fun getTabIcon(position: Int): Drawable {
val drawableId = when (position) {
LOCATION_CONTACTS_TAB -> R.drawable.ic_person_vector
LOCATION_FAVORITES_TAB -> R.drawable.ic_star_on_vector
else -> R.drawable.ic_group_vector
}
return resources.getColoredDrawableWithColor(drawableId, config.textColor)
}
}