use of in.testpress.testpress.util.ImagePickerUtil in project android by testpress.
the class PostActivity method displayComments.
void displayComments() {
commentsAdapter = new CommentsListAdapter(this);
listView.setNestedScrollingEnabled(false);
listView.setLayoutManager(new LinearLayoutManager(this));
listView.setAdapter(commentsAdapter);
loadPreviousCommentsLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadPreviousCommentsLayout.setVisibility(View.GONE);
getSupportLoaderManager().restartLoader(PREVIOUS_COMMENTS_LOADER_ID, null, PostActivity.this);
}
});
loadNewCommentsLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadNewCommentsLayout.setVisibility(View.GONE);
getSupportLoaderManager().restartLoader(NEW_COMMENTS_LOADER_ID, null, PostActivity.this);
}
});
newCommentsAvailableLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
newCommentsAvailableLabel.setVisibility(View.GONE);
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.fullScroll(View.FOCUS_DOWN);
}
});
}
});
scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
int scrollViewHeight = scrollView.getHeight();
int totalScrollViewChildHeight = scrollView.getChildAt(0).getHeight();
// Let's assume end has reached at 50 pixels before itself(on partial visible of last item)
boolean endHasBeenReached = (scrollY + scrollViewHeight + 50) >= totalScrollViewChildHeight;
if (endHasBeenReached) {
newCommentsAvailableLabel.setVisibility(View.GONE);
}
}
});
imagePickerUtil = new ImagePickerUtil(activityRootLayout, this);
commentsLayout.setVisibility(View.VISIBLE);
getSupportLoaderManager().initLoader(PREVIOUS_COMMENTS_LOADER_ID, null, PostActivity.this);
}
Aggregations