use of in.uncod.android.bypass.Bypass in project plaid by nickbutcher.
the class DesignerNewsStory method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_designer_news_story);
ButterKnife.bind(this);
story = getIntent().getParcelableExtra(EXTRA_STORY);
fab.setOnClickListener(fabClick);
chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(this);
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);
layoutManager = new LinearLayoutManager(this);
commentsList.setLayoutManager(layoutManager);
commentsList.setItemAnimator(new CommentAnimator(getResources().getInteger(R.integer.comment_expand_collapse_duration)));
header = getLayoutInflater().inflate(R.layout.designer_news_story_description, commentsList, false);
bindDescription();
// setup title/toolbar
if (collapsingToolbar != null) {
// narrow device: collapsing toolbar
collapsingToolbar.addOnLayoutChangeListener(titlebarLayout);
collapsingToolbar.setTitle(story.title);
final Toolbar toolbar = (Toolbar) findViewById(R.id.story_toolbar);
toolbar.setNavigationOnClickListener(backClick);
commentsList.addOnScrollListener(headerScrollListener);
setEnterSharedElementCallback(new SharedElementCallback() {
@Override
public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
ReflowText.setupReflow(getIntent(), collapsingToolbar);
}
@Override
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
ReflowText.setupReflow(collapsingToolbar);
}
});
} else {
// w600dp configuration: content card scrolls over title bar
final TextView title = (TextView) findViewById(R.id.story_title);
title.setText(story.title);
findViewById(R.id.back).setOnClickListener(backClick);
}
final View enterCommentView = setupCommentField();
if (story.comment_count > 0) {
// flatten the comments from a nested structure {@see Comment#comments} to a
// list appropriate for our adapter (using the depth attribute).
List<Comment> flattened = new ArrayList<>(story.comment_count);
unnestComments(story.comments, flattened);
commentsAdapter = new DesignerNewsCommentsAdapter(header, flattened, enterCommentView);
commentsList.setAdapter(commentsAdapter);
} else {
commentsAdapter = new DesignerNewsCommentsAdapter(header, new ArrayList<Comment>(0), enterCommentView);
commentsList.setAdapter(commentsAdapter);
}
customTab = new CustomTabActivityHelper();
customTab.setConnectionCallback(customTabConnect);
}
Aggregations