SpecificPostActivity¶
-
public class
SpecificPostActivity
extends AppCompatActivity implements FormatManager.IconUpdateListener¶ Displays a particular
Post
along with its comments (PostReply
). Also allows the user to add comments.
Fields¶
boldButton¶
-
ImageButton
boldButton
¶ Buttons for inline markup of the text of the reply
commentField¶
-
ListenableEditText
commentField
¶ Field for the user to enter a comment
editTextOpened¶
-
boolean
editTextOpened
¶ Whether the “window” to write a reply is open. Starts off
false
formatManager¶
-
FormatManager
formatManager
¶ Manages markup of the text of the reply
loadingOverlay¶
-
FrameLayout
loadingOverlay
¶
progressBar¶
-
ProgressBar
progressBar
¶ Progress bar for displaying the progress of network operations
toggleButtons¶
-
SparseArray<ImageButton>
toggleButtons
¶ Tracks whether the inline markup buttons have been toggled to “on”
writeReplyView¶
-
ConstraintLayout
writeReplyView
¶ Layout within which the compose reply UI elements are arranged
Methods¶
closeEditTextView¶
-
void
closeEditTextView
()¶ When the user selects out of the text field, the view will shrink back to its original position.
genResizeAnimation¶
-
void
genResizeAnimation
(int oldSize, int newSize, ConstraintLayout layout)¶ This little helper handles the animation involved in changing the size of the write reply view.
Parameters: - oldSize – start height, in pixels.
- newSize – final height, in pixels.
- layout – writeReplyView
onCreate¶
-
protected void
onCreate
(Bundle savedInstanceState)¶ Create the user interface from the layout defined by
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 thePost
to display.Parameters: - savedInstanceState – {@inheritDoc}
onStop¶
-
protected void
onStop
()¶ This ensures that we are canceling all network requests if the user is leaving this activity. We use a RequestFilter that accepts all requests (meaning it cancels all requests)
openEditTextView¶
-
void
openEditTextView
()¶ This function animates the bottom view to expand up, allowing for a greater text field as well as toggle buttons.
updateIconToggles¶
-
public void
updateIconToggles
(SparseBooleanArray formTogState, SparseArray<int[]> toggleIcons)¶ Update whether an icon has been “toggled”, or selected
Parameters: - 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.