Search in sources :

Example 1 with FontTextView

use of io.plaidapp.ui.widget.FontTextView in project sbt-android by scala-android.

the class DesignerNewsStory method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_designer_news_story);
    ButterKnife.bind(this);
    getWindow().getSharedElementReturnTransition().addListener(returnHomeListener);
    story = getIntent().getParcelableExtra(EXTRA_STORY);
    fab.setOnClickListener(fabClick);
    chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(getWindow()) {

        @Override
        public void onDragDismissed() {
            finishAfterTransition();
        }
    };
    markdown = new Bypass(this, new Bypass.Options().setBlockQuoteLineColor(ContextCompat.getColor(this, R.color.designer_news_quote_line)).setBlockQuoteLineWidth(// dps
    2).setBlockQuoteLineIndent(// dps
    8).setPreImageLinebreakHeight(// dps
    4).setBlockQuoteIndentSize(TypedValue.COMPLEX_UNIT_DIP, 2f).setBlockQuoteTextColor(ContextCompat.getColor(this, R.color.designer_news_quote)));
    circleTransform = new CircleTransform(this);
    designerNewsPrefs = DesignerNewsPrefs.get(this);
    createDesignerNewsApi();
    layoutManager = new LinearLayoutManager(this);
    commentsList.setLayoutManager(layoutManager);
    header = getLayoutInflater().inflate(R.layout.designer_news_story_description, commentsList, false);
    bindDescription();
    // setup toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.story_toolbar);
    if (collapsingToolbar != null) {
        // portrait: collapsing toolbar
        collapsingToolbar.setTitle(story.title);
        collapsingToolbar.addOnLayoutChangeListener(titlebarLayout);
    } else {
        // landscape: scroll toolbar with content
        toolbar = (Toolbar) header.findViewById(R.id.story_toolbar);
        FontTextView title = (FontTextView) toolbar.findViewById(R.id.story_title);
        title.setText(story.title);
    }
    commentsList.addOnScrollListener(headerScrollListener);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            finishAfterTransition();
        }
    });
    View enterCommentView = setupCommentField();
    if (story.comment_count > 0) {
        // flatten the comments from a nested structure {@see Comment#comments} to an
        // array for our adapter (saving the depth).
        List<ThreadedComment> wrapped = new ArrayList<>(story.comment_count);
        addComments(story.comments, 0, wrapped);
        commentsAdapter = new DesignerNewsCommentsAdapter(header, wrapped, enterCommentView);
        commentsList.setAdapter(commentsAdapter);
    } else {
        commentsAdapter = new DesignerNewsCommentsAdapter(header, new ArrayList<ThreadedComment>(0), enterCommentView);
        commentsList.setAdapter(commentsAdapter);
    }
    customTab = new CustomTabActivityHelper();
    customTab.setConnectionCallback(customTabConnect);
    setEnterSharedElementCallback(sharedEnterCallback);
}
Also used : ActivityOptions(android.app.ActivityOptions) ArrayList(java.util.ArrayList) CircleTransform(io.plaidapp.util.glide.CircleTransform) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) AuthorTextView(io.plaidapp.ui.widget.AuthorTextView) TextView(android.widget.TextView) FontTextView(io.plaidapp.ui.widget.FontTextView) PinnedOffsetView(io.plaidapp.ui.widget.PinnedOffsetView) RecyclerView(android.support.v7.widget.RecyclerView) ElasticDragDismissFrameLayout(io.plaidapp.ui.widget.ElasticDragDismissFrameLayout) CustomTabActivityHelper(io.plaidapp.util.customtabs.CustomTabActivityHelper) Bypass(in.uncod.android.bypass.Bypass) FontTextView(io.plaidapp.ui.widget.FontTextView) Toolbar(android.widget.Toolbar)

Aggregations

ActivityOptions (android.app.ActivityOptions)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 Toolbar (android.widget.Toolbar)1 Bypass (in.uncod.android.bypass.Bypass)1 AuthorTextView (io.plaidapp.ui.widget.AuthorTextView)1 ElasticDragDismissFrameLayout (io.plaidapp.ui.widget.ElasticDragDismissFrameLayout)1 FontTextView (io.plaidapp.ui.widget.FontTextView)1 PinnedOffsetView (io.plaidapp.ui.widget.PinnedOffsetView)1 CustomTabActivityHelper (io.plaidapp.util.customtabs.CustomTabActivityHelper)1 CircleTransform (io.plaidapp.util.glide.CircleTransform)1 ArrayList (java.util.ArrayList)1