use of android.view.View.VISIBLE in project twicalico by moko256.
the class ShowTweetActivity method updateView.
private void updateView(Status item) {
TextView tweetIsReply = findViewById(R.id.tweet_show_is_reply_text);
long replyTweetId = item.getInReplyToStatusId();
if (replyTweetId != -1) {
tweetIsReply.setVisibility(VISIBLE);
tweetIsReply.setOnClickListener(v -> startActivity(getIntent(this, replyTweetId)));
} else {
tweetIsReply.setVisibility(GONE);
}
StatusView statusView = new StatusView(this);
statusView.setStatus(item);
ViewGroup cview = (ViewGroup) statusView.getChildAt(0);
ViewGroup sview = (ViewGroup) cview.getChildAt(0);
cview.removeView(sview);
FrameLayout statusViewFrame = findViewById(R.id.tweet_show_tweet);
statusViewFrame.removeAllViews();
statusViewFrame.addView(sview);
((TextView) findViewById(R.id.tweet_show_timestamp)).setText(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(item.getCreatedAt()));
TextView viaText = findViewById(R.id.tweet_show_via);
viaText.setText(TwitterStringUtils.convertUrlSpanToCustomTabs(Html.fromHtml("via:" + item.getSource()), this));
viaText.setMovementMethod(new LinkMovementMethod());
AppCompatEditText replyText = findViewById(R.id.tweet_show_tweet_reply_text);
AppCompatButton replyButton = findViewById(R.id.tweet_show_tweet_reply_button);
UserMentionEntity[] users = item.getUserMentionEntities();
replyText.setText(TwitterStringUtils.convertToReplyTopString(GlobalApplication.userCache.get(GlobalApplication.userId).getScreenName(), item.getUser().getScreenName(), users));
replyButton.setOnClickListener(v -> {
replyButton.setEnabled(false);
PostTweetModel model = PostTweetModelCreator.getInstance(GlobalApplication.twitter, getContentResolver());
model.setTweetText(replyText.getText().toString());
model.setInReplyToStatusId(item.getId());
subscriptions.add(model.postTweet().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(it -> {
replyText.setText(TwitterStringUtils.convertToReplyTopString(GlobalApplication.userCache.get(GlobalApplication.userId).getScreenName(), item.getUser().getScreenName(), users));
replyButton.setEnabled(true);
Toast.makeText(ShowTweetActivity.this, R.string.succeeded, Toast.LENGTH_SHORT).show();
}, e -> {
e.printStackTrace();
Toast.makeText(ShowTweetActivity.this, R.string.error_occurred, Toast.LENGTH_SHORT).show();
replyButton.setEnabled(true);
}));
});
}
Aggregations