[HELP] Custom Font Support
Hi, I am using Calligraphy for custom font support of user choice. But after coming to Cyanea, the fonts are not applied to the application.
I read about the FontDecorator but is it only to be used in XML (Also I'm not getting the kotlin part, I'm still using Java). I want to use custom fonts of user choice from a list of given fonts stored in assets. How am I supposed to use them?
@jaredrummler Any news about that?
Calligraphy3 and ViewPump basically set a standard font in all views, including dialogs, snack bars, etc. And you can set a different font in xml views if you want a text in bold type, for example
Maybe it would be better if you remove the font option and create an extra module for that?!
I got it partly working:
abstract class AdvancedActivity : AppCompatActivity(), BaseCyaneaActivity {
companion object {
init {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
}
}
private val delegate: CyaneaDelegate by lazy {
CyaneaDelegate.create(this, cyanea, getThemeResId())
}
private val resources: CyaneaResources by lazy {
CyaneaResources(super.getResources(), cyanea)
}
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(delegate.wrap(newBase)))
}
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
delegate.onCreate(savedInstanceState)
super.onCreate(savedInstanceState, persistentState)
}
override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onPostCreate(savedInstanceState, persistentState)
delegate.onPostCreate(savedInstanceState)
}
override fun onStart() {
super.onStart()
delegate.onStart()
}
override fun onResume() {
super.onResume()
delegate.onResume()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
delegate.onCreateOptionsMenu(menu)
return super.onCreateOptionsMenu(menu)
}
override fun getResources(): Resources = resources
}
And MainActivity extending AdvancedActivity:
class MainActivity : AdvancedActivity() {
...
}
However my custom toolbars e.g. does not apply changed colors (works like a charm when using without calligraphy and viewpump) Having default red Toolbar and changing to blue but the toolbar is still red for example (all other parts are changed as intended)