Search in sources :

Example 1 with BaseActivity

use of com.waz.zclient.BaseActivity in project wire-android by wireapp.

the class MarkdownTextView method configureStyleSheet.

/**
 * Configures the style sheet used for rendering.
 */
private void configureStyleSheet() {
    mStyleSheet = new StyleSheet();
    mStyleSheet.setBaseFontColor(getCurrentTextColor());
    mStyleSheet.setBaseFontSize((int) getTextSize());
    mStyleSheet.setCodeColor(ContextUtils.getStyledColor(R.attr.codeColor, context()));
    mStyleSheet.setQuoteColor(ContextUtils.getStyledColor(R.attr.quoteColor, context()));
    mStyleSheet.setQuoteStripeColor(ContextUtils.getStyledColor(R.attr.quoteStripeColor, context()));
    mStyleSheet.setListPrefixColor(ContextUtils.getStyledColor(R.attr.listPrefixColor, context()));
    BaseActivity activity = (BaseActivity) getContext();
    if (activity != null) {
        // update the link color whenever the accent color changes
        activity.injectJava(AccentColorController.class).accentColorForJava(new AccentColorCallback() {

            @Override
            public void color(AccentColor color) {
                mStyleSheet.setLinkColor(color.color());
                setLinkTextColor(color.color());
                refreshLinks();
            }
        }, eventContext());
    }
    // to make links clickable
    mStyleSheet.configureLinkHandler(context());
    setMovementMethod(new LinkTextView.MovementMethod(getContext()));
    setLineSpacing(0f, 1.1f);
}
Also used : AccentColor(com.waz.model.AccentColor) LinkTextView(com.waz.zclient.common.views.LinkTextView) AccentColorController(com.waz.zclient.common.controllers.global.AccentColorController) BaseActivity(com.waz.zclient.BaseActivity) AccentColorCallback(com.waz.zclient.common.controllers.global.AccentColorCallback)

Aggregations

AccentColor (com.waz.model.AccentColor)1 BaseActivity (com.waz.zclient.BaseActivity)1 AccentColorCallback (com.waz.zclient.common.controllers.global.AccentColorCallback)1 AccentColorController (com.waz.zclient.common.controllers.global.AccentColorController)1 LinkTextView (com.waz.zclient.common.views.LinkTextView)1