scale bottom tab text size automatically

This commit is contained in:
tibbi
2022-06-27 09:56:54 +02:00
parent ed15ec4288
commit c68f85cbac
4 changed files with 12 additions and 12 deletions

View File

@ -63,7 +63,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:b45fde5669' implementation 'com.github.SimpleMobileTools:Simple-Commons:e79c9bba93'
implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'com.facebook.stetho:stetho:1.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.shawnlin:number-picker:2.4.6' implementation 'com.shawnlin:number-picker:2.4.6'
@ -73,6 +73,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'org.greenrobot:eventbus:3.3.1' implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'androidx.room:room-runtime:2.4.2' implementation 'androidx.room:room-runtime:2.4.2'
kapt 'androidx.room:room-compiler:2.4.2' kapt 'androidx.room:room-compiler:2.4.2'

View File

@ -17,12 +17,10 @@ import com.simplemobiletools.clock.extensions.rescheduleEnabledAlarms
import com.simplemobiletools.clock.extensions.updateWidgets import com.simplemobiletools.clock.extensions.updateWidgets
import com.simplemobiletools.clock.helpers.* import com.simplemobiletools.clock.helpers.*
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.LICENSE_NUMBER_PICKER import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.LICENSE_RTL
import com.simplemobiletools.commons.helpers.LICENSE_STETHO
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.FAQItem import com.simplemobiletools.commons.models.FAQItem
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import me.grantland.widget.AutofitHelper
class MainActivity : SimpleActivity() { class MainActivity : SimpleActivity() {
private var storedTextColor = 0 private var storedTextColor = 0
@ -169,6 +167,7 @@ class MainActivity : SimpleActivity() {
main_tabs_holder.newTab().setCustomView(R.layout.bottom_tablayout_item).apply { main_tabs_holder.newTab().setCustomView(R.layout.bottom_tablayout_item).apply {
customView?.findViewById<ImageView>(R.id.tab_item_icon)?.setImageDrawable(getDrawable(drawableId)) customView?.findViewById<ImageView>(R.id.tab_item_icon)?.setImageDrawable(getDrawable(drawableId))
customView?.findViewById<TextView>(R.id.tab_item_label)?.setText(tabLabels[i]) customView?.findViewById<TextView>(R.id.tab_item_label)?.setText(tabLabels[i])
AutofitHelper.create(customView?.findViewById(R.id.tab_item_label))
main_tabs_holder.addTab(this) main_tabs_holder.addTab(this)
} }
} }
@ -206,7 +205,7 @@ class MainActivity : SimpleActivity() {
} }
private fun launchAbout() { private fun launchAbout() {
val licenses = LICENSE_STETHO or LICENSE_NUMBER_PICKER or LICENSE_RTL val licenses = LICENSE_STETHO or LICENSE_NUMBER_PICKER or LICENSE_RTL or LICENSE_AUTOFITTEXTVIEW
val faqItems = arrayListOf( val faqItems = arrayListOf(
FAQItem(R.string.faq_1_title, R.string.faq_1_text), FAQItem(R.string.faq_1_title, R.string.faq_1_text),

View File

@ -10,7 +10,7 @@ import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.extensions.config
import com.simplemobiletools.clock.helpers.MyAnalogueTimeWidgetProvider import com.simplemobiletools.clock.helpers.MyAnalogueTimeWidgetProvider
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog import com.simplemobiletools.commons.dialogs.FeatureLockedDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import kotlinx.android.synthetic.main.widget_config_analogue.* import kotlinx.android.synthetic.main.widget_config_analogue.*
@ -20,7 +20,7 @@ class WidgetAnalogueConfigureActivity : SimpleActivity() {
private var mWidgetId = 0 private var mWidgetId = 0
private var mBgColor = 0 private var mBgColor = 0
private var mBgColorWithoutTransparency = 0 private var mBgColorWithoutTransparency = 0
private var mWidgetLockedDialog: WidgetLockedDialog? = null private var mWidgetLockedDialog: FeatureLockedDialog? = null
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false useDynamicTheme = false
@ -43,7 +43,7 @@ class WidgetAnalogueConfigureActivity : SimpleActivity() {
config_analogue_bg_seekbar.setColors(getProperTextColor(), primaryColor, primaryColor) config_analogue_bg_seekbar.setColors(getProperTextColor(), primaryColor, primaryColor)
if (!isCustomizingColors && !isOrWasThankYouInstalled()) { if (!isCustomizingColors && !isOrWasThankYouInstalled()) {
mWidgetLockedDialog = WidgetLockedDialog(this) { mWidgetLockedDialog = FeatureLockedDialog(this) {
if (!isOrWasThankYouInstalled()) { if (!isOrWasThankYouInstalled()) {
finish() finish()
} }

View File

@ -10,7 +10,7 @@ import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.extensions.config
import com.simplemobiletools.clock.helpers.MyDigitalTimeWidgetProvider import com.simplemobiletools.clock.helpers.MyDigitalTimeWidgetProvider
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog import com.simplemobiletools.commons.dialogs.FeatureLockedDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import kotlinx.android.synthetic.main.widget_config_digital.* import kotlinx.android.synthetic.main.widget_config_digital.*
@ -21,7 +21,7 @@ class WidgetDigitalConfigureActivity : SimpleActivity() {
private var mBgColor = 0 private var mBgColor = 0
private var mTextColor = 0 private var mTextColor = 0
private var mBgColorWithoutTransparency = 0 private var mBgColorWithoutTransparency = 0
private var mWidgetLockedDialog: WidgetLockedDialog? = null private var mWidgetLockedDialog: FeatureLockedDialog? = null
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false useDynamicTheme = false
@ -45,7 +45,7 @@ class WidgetDigitalConfigureActivity : SimpleActivity() {
config_digital_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor) config_digital_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
if (!isCustomizingColors && !isOrWasThankYouInstalled()) { if (!isCustomizingColors && !isOrWasThankYouInstalled()) {
mWidgetLockedDialog = WidgetLockedDialog(this) { mWidgetLockedDialog = FeatureLockedDialog(this) {
if (!isOrWasThankYouInstalled()) { if (!isOrWasThankYouInstalled()) {
finish() finish()
} }