add a helper function for updating menu text sizes
This commit is contained in:
parent
6e786e2bbb
commit
bccfede450
1 changed files with 16 additions and 0 deletions
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
|||
import android.annotation.TargetApi
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.net.Uri
|
||||
|
@ -12,6 +13,9 @@ import android.provider.DocumentsContract
|
|||
import android.support.v4.app.ActivityCompat
|
||||
import android.support.v4.util.Pair
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.text.SpannableString
|
||||
import android.text.style.AbsoluteSizeSpan
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.asynctasks.CopyMoveTask
|
||||
|
@ -75,6 +79,18 @@ open class BaseSimpleActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
fun updateMenuTextSize(resources: Resources, menu: Menu) {
|
||||
val textSize = resources.getDimension(R.dimen.normal_text_size).toInt()
|
||||
(0 until menu.size())
|
||||
.map { menu.getItem(it) }
|
||||
.forEach {
|
||||
SpannableString(it.title).apply {
|
||||
setSpan(AbsoluteSizeSpan(textSize, false), 0, length, 0)
|
||||
it.title = this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, resultData)
|
||||
if (requestCode == OPEN_DOCUMENT_TREE && resultCode == Activity.RESULT_OK && resultData != null) {
|
||||
|
|
Loading…
Reference in a new issue