|
@ -185,13 +185,17 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
|
|
|
|
|
|
replyFAB = findViewById(R.id.topic_fab); |
|
|
replyFAB = findViewById(R.id.topic_fab); |
|
|
replyFAB.hide(); |
|
|
replyFAB.hide(); |
|
|
|
|
|
replyFAB.setTag(false); |
|
|
bottomNavBar = findViewById(R.id.bottom_navigation_bar); |
|
|
bottomNavBar = findViewById(R.id.bottom_navigation_bar); |
|
|
if (!sessionManager.isLoggedIn()) replyFAB.hide(); |
|
|
if (!sessionManager.isLoggedIn()) { |
|
|
else { |
|
|
replyFAB.hide(); |
|
|
|
|
|
replyFAB.setTag(false); |
|
|
|
|
|
} else { |
|
|
replyFAB.setOnClickListener(view -> { |
|
|
replyFAB.setOnClickListener(view -> { |
|
|
if (sessionManager.isLoggedIn()) |
|
|
if (sessionManager.isLoggedIn()) |
|
|
viewModel.prepareForReply(); |
|
|
viewModel.prepareForReply(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
replyFAB.setTag(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Sets bottom navigation bar
|
|
|
//Sets bottom navigation bar
|
|
@ -281,6 +285,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
topicAdapter.setBackButtonHidden(); |
|
|
topicAdapter.setBackButtonHidden(); |
|
|
viewModel.setWritingReply(false); |
|
|
viewModel.setWritingReply(false); |
|
|
replyFAB.show(); |
|
|
replyFAB.show(); |
|
|
|
|
|
replyFAB.setTag(true); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
return; |
|
|
return; |
|
|
} else if (viewModel.isEditingPost()) { |
|
|
} else if (viewModel.isEditingPost()) { |
|
@ -289,6 +294,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
topicAdapter.setBackButtonHidden(); |
|
|
topicAdapter.setBackButtonHidden(); |
|
|
viewModel.setEditingPost(false); |
|
|
viewModel.setEditingPost(false); |
|
|
replyFAB.show(); |
|
|
replyFAB.show(); |
|
|
|
|
|
replyFAB.setTag(true); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -522,6 +528,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
BaseApplication.getInstance().logFirebaseAnalyticsEvent("post_creation", null); |
|
|
BaseApplication.getInstance().logFirebaseAnalyticsEvent("post_creation", null); |
|
|
Timber.i("Post reply successful"); |
|
|
Timber.i("Post reply successful"); |
|
|
replyFAB.show(); |
|
|
replyFAB.show(); |
|
|
|
|
|
replyFAB.setTag(true); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
viewModel.setWritingReply(false); |
|
|
viewModel.setWritingReply(false); |
|
|
if ((((Post) topicItems.get(topicItems.size() - 1)).getPostNumber() + 1) % 15 == 0) { |
|
|
if ((((Post) topicItems.get(topicItems.size() - 1)).getPostNumber() + 1) % 15 == 0) { |
|
@ -540,6 +547,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
topicAdapter.notifyItemInserted(topicItems.size()); |
|
|
topicAdapter.notifyItemInserted(topicItems.size()); |
|
|
recyclerView.scrollToPosition(topicItems.size() - 1); |
|
|
recyclerView.scrollToPosition(topicItems.size() - 1); |
|
|
replyFAB.hide(); |
|
|
replyFAB.hide(); |
|
|
|
|
|
replyFAB.setTag(false); |
|
|
bottomNavBar.setVisibility(View.GONE); |
|
|
bottomNavBar.setVisibility(View.GONE); |
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(TopicActivity.this, |
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(TopicActivity.this, |
|
|
R.style.AppTheme_Dark_Dialog); |
|
|
R.style.AppTheme_Dark_Dialog); |
|
@ -590,6 +598,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
((Post) topicItems.get(position)).setPostType(Post.TYPE_POST); |
|
|
((Post) topicItems.get(position)).setPostType(Post.TYPE_POST); |
|
|
topicAdapter.notifyItemChanged(position); |
|
|
topicAdapter.notifyItemChanged(position); |
|
|
replyFAB.show(); |
|
|
replyFAB.show(); |
|
|
|
|
|
replyFAB.setTag(true); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
bottomNavBar.setVisibility(View.VISIBLE); |
|
|
viewModel.setEditingPost(false); |
|
|
viewModel.setEditingPost(false); |
|
|
viewModel.reloadPage(); |
|
|
viewModel.reloadPage(); |
|
@ -656,10 +665,13 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
viewModel.getReplyPageUrl().observe(this, replyPageUrl -> { |
|
|
viewModel.getReplyPageUrl().observe(this, replyPageUrl -> { |
|
|
if (replyPageUrl == null) |
|
|
if (replyPageUrl == null) { |
|
|
replyFAB.hide(); |
|
|
replyFAB.hide(); |
|
|
else |
|
|
replyFAB.setTag(false); |
|
|
|
|
|
} else { |
|
|
replyFAB.show(); |
|
|
replyFAB.show(); |
|
|
|
|
|
replyFAB.setTag(true); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
viewModel.getTopicItems().observe(this, postList -> { |
|
|
viewModel.getTopicItems().observe(this, postList -> { |
|
|
if (postList == null) progressBar.setVisibility(ProgressBar.VISIBLE); |
|
|
if (postList == null) progressBar.setVisibility(ProgressBar.VISIBLE); |
|
@ -744,6 +756,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
topicAdapter.notifyItemInserted(topicItems.size()); |
|
|
topicAdapter.notifyItemInserted(topicItems.size()); |
|
|
recyclerView.scrollToPosition(topicItems.size() - 1); |
|
|
recyclerView.scrollToPosition(topicItems.size() - 1); |
|
|
replyFAB.hide(); |
|
|
replyFAB.hide(); |
|
|
|
|
|
replyFAB.setTag(false); |
|
|
bottomNavBar.setVisibility(View.GONE); |
|
|
bottomNavBar.setVisibility(View.GONE); |
|
|
} else { |
|
|
} else { |
|
|
Timber.i("Prepare for reply unsuccessful"); |
|
|
Timber.i("Prepare for reply unsuccessful"); |
|
@ -759,6 +772,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
topicAdapter.notifyItemChanged(result.getPosition()); |
|
|
topicAdapter.notifyItemChanged(result.getPosition()); |
|
|
recyclerView.scrollToPosition(result.getPosition()); |
|
|
recyclerView.scrollToPosition(result.getPosition()); |
|
|
replyFAB.hide(); |
|
|
replyFAB.hide(); |
|
|
|
|
|
replyFAB.setTag(false); |
|
|
bottomNavBar.setVisibility(View.GONE); |
|
|
bottomNavBar.setVisibility(View.GONE); |
|
|
} else { |
|
|
} else { |
|
|
Timber.i("Prepare for edit unsuccessful"); |
|
|
Timber.i("Prepare for edit unsuccessful"); |
|
|