public class SpecificPostActivity extends AppCompatActivity implements FormatManager.IconUpdateListener
Post
along with its comments (PostReply
). Also allows the
user to add comments.Modifier and Type | Field and Description |
---|---|
(package private) android.widget.ImageButton |
boldButton
Buttons for inline markup of the text of the reply
|
(package private) ListenableEditText |
commentField
Field for the user to enter a comment
|
private RecyclerView |
commentsRV
Scrollable list of comments
|
(package private) android.widget.TextView |
content
Body of the
Post |
(package private) CardView |
cv
The
View that holds the UI elements that make up the displayed Post |
(package private) boolean |
editTextOpened
Whether the "window" to write a reply is open.
|
(package private) FormatManager |
formatManager
Manages markup of the text of the reply
|
(package private) android.widget.ImageView[] |
images
Array of images associated with the
Post |
(package private) android.widget.ImageButton |
italicButton
Buttons for inline markup of the text of the reply
|
(package private) android.widget.ImageButton |
linkButton
Buttons for inline markup of the text of the reply
|
(package private) android.widget.FrameLayout |
loadingOverlay |
private LinearLayoutManager |
mLayoutManager
Manages the currently visible comments
|
(package private) android.widget.TextView |
personName
Name of the creator of the
Post |
(package private) android.widget.ImageView |
personPhoto
Profile photo of the author of the
Post |
(package private) android.widget.Button |
postButton
Button to submit a comment on the
Post |
(package private) android.widget.ImageView |
postTypePhoto
Other photo associated with the
Post |
(package private) android.widget.ProgressBar |
progressBar
Progress bar for displaying the progress of network operations
|
(package private) RequestQueue |
queue
Queue for asynchronous tasks
|
(package private) android.widget.TextView |
timestamp
When the
Post was created |
(package private) android.util.SparseArray<android.widget.ImageButton> |
toggleButtons
Tracks whether the inline markup buttons have been toggled to "on"
|
(package private) android.widget.TextView |
username
Unique display name of the creator of the
Post |
(package private) ConstraintLayout |
writeReplyView
Layout within which the compose reply UI elements are arranged
|
Constructor and Description |
---|
SpecificPostActivity() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
closeEditTextView()
When the user selects out of the text field, the view will shrink back to its original
position.
|
(package private) void |
genResizeAnimation(int oldSize,
int newSize,
ConstraintLayout layout)
This little helper handles the animation involved in changing the size of the write reply view.
|
protected void |
onCreate(android.os.Bundle savedInstanceState)
Create the user interface from the layout defined by
R.layout#activity_specific_post . |
protected void |
onStop()
This ensures that we are canceling all network requests if the user is leaving this activity.
|
(package private) void |
openEditTextView()
This function animates the bottom view to expand up, allowing for a greater text field
as well as toggle buttons.
|
void |
updateIconToggles(android.util.SparseBooleanArray formTogState,
android.util.SparseArray<int[]> toggleIcons)
Update whether an icon has been "toggled", or selected
|
CardView cv
View
that holds the UI elements that make up the displayed Post
android.widget.TextView personName
Post
android.widget.TextView username
Post
android.widget.TextView content
Post
android.widget.TextView timestamp
Post
was createdandroid.widget.ImageView personPhoto
Post
android.widget.ImageView postTypePhoto
Post
android.widget.ImageView[] images
Post
ListenableEditText commentField
android.widget.Button postButton
Post
ConstraintLayout writeReplyView
boolean editTextOpened
false
android.widget.ImageButton boldButton
android.widget.ImageButton italicButton
android.widget.ImageButton linkButton
FormatManager formatManager
android.util.SparseArray<android.widget.ImageButton> toggleButtons
android.widget.ProgressBar progressBar
android.widget.FrameLayout loadingOverlay
RequestQueue queue
private RecyclerView commentsRV
private LinearLayoutManager mLayoutManager
protected void onCreate(android.os.Bundle savedInstanceState)
R.layout#activity_specific_post
.
Initialize instance fields with the UI elements defined in the layout. Setup listeners to
handle loading more comments, clicks to post replies, and load the Post
to display.savedInstanceState
- public void updateIconToggles(android.util.SparseBooleanArray formTogState, android.util.SparseArray<int[]> toggleIcons)
updateIconToggles
in interface FormatManager.IconUpdateListener
formTogState
- a SparseBooleanArray (HashMap) with int as key and boolean as value
key: int id of toggleButton View we are using.
value: true if toggled, false if not toggled.toggleIcons
- a SparseArray (HashMap) with int as key and int[] as value.
key: int id of toggleButton View we are using.void openEditTextView()
void closeEditTextView()
void genResizeAnimation(int oldSize, int newSize, ConstraintLayout layout)
oldSize
- start height, in pixels.newSize
- final height, in pixels.layout
- writeReplyViewprotected void onStop()