@@ -494,6 +494,10 @@ public Cursor runQuery(CharSequence charSequence) {
494
494
messageEt .setAdapter (combinedAdapter );
495
495
}
496
496
497
+ /**
498
+ * Returns a cursor for the combinedAdapter used to suggest Emoji when ':' is typed in the {@link #messageEt}
499
+ * @param emoji A string to search in the existing database
500
+ */
497
501
private Cursor makeEmojiCursor (CharSequence emoji )
498
502
throws SQLException {
499
503
if (emoji == null ) {
@@ -620,6 +624,9 @@ public void onAnimationRepeat(Animator animator) {
620
624
animator .start ();
621
625
}
622
626
627
+ /**
628
+ * Setup the streams Drawer which has a {@link ExpandableListView} categorizes the stream and subject
629
+ */
623
630
private void setupListViewAdapter () {
624
631
ExpandableStreamDrawerAdapter streamsDrawerAdapter = null ;
625
632
Callable <Cursor > streamsGenerator = new Callable <Cursor >() {
@@ -722,6 +729,9 @@ public void onClick(View v) {
722
729
streamsDrawer .setAdapter (streamsDrawerAdapter );
723
730
}
724
731
732
+ /**
733
+ * Initiates the streams Drawer if the streams in the drawer is 0.
734
+ */
725
735
public void checkAndSetupStreamsDrawer () {
726
736
try {
727
737
if (streamsDrawer .getAdapter ().getCount () != 0 ) {
@@ -801,6 +811,9 @@ public void onTaskFailure(String result) {
801
811
sender .execute ();
802
812
}
803
813
814
+ /**
815
+ * Disable chatBox and show a loading footer while sending the message.
816
+ */
804
817
private void sendingMessage (boolean isSending ) {
805
818
streamActv .setEnabled (!isSending );
806
819
textView .setEnabled (!isSending );
@@ -816,6 +829,15 @@ private void sendingMessage(boolean isSending) {
816
829
817
830
private LinearLayout composeStatus ;
818
831
832
+ /**
833
+ * Setup adapter's for the {@link AutoCompleteTextView}
834
+ *
835
+ * These adapters are being intialized -
836
+ *
837
+ * {@link #streamActvAdapter} Adapter for suggesting all the stream names in this AutoCompleteTextView
838
+ * {@link #emailActvAdapter} Adapter for suggesting all the person email's in this AutoCompleteTextView
839
+ * {@link #subjectActvAdapter} Adapter for suggesting all the topic for the stream specified in the {@link #streamActv} in this AutoCompleteTextView
840
+ */
819
841
private void setUpAdapter () {
820
842
streamActvAdapter = new SimpleCursorAdapter (
821
843
that , R .layout .stream_tile , null ,
@@ -897,6 +919,10 @@ public Cursor runQuery(CharSequence charSequence) {
897
919
sendingMessage (false );
898
920
}
899
921
922
+ /**
923
+ * Creates a cursor to get the streams saved in the database
924
+ * @param streamName Filter out streams name containing this string
925
+ */
900
926
private Cursor makeStreamCursor (CharSequence streamName )
901
927
throws SQLException {
902
928
if (streamName == null ) {
@@ -915,6 +941,11 @@ private Cursor makeStreamCursor(CharSequence streamName)
915
941
.closeableIterator ().getRawResults ()).getRawCursor ();
916
942
}
917
943
944
+ /**
945
+ * Creates a cursor to get the topics in the stream in
946
+ * @param stream
947
+ * @param subject Filter out subject containing this string
948
+ */
918
949
private Cursor makeSubjectCursor (CharSequence stream , CharSequence subject )
919
950
throws SQLException {
920
951
if (subject == null ) {
@@ -941,6 +972,10 @@ private Cursor makeSubjectCursor(CharSequence stream, CharSequence subject)
941
972
return results .getRawCursor ();
942
973
}
943
974
975
+ /**
976
+ * Creates a cursor to get the E-Mails stored in the database
977
+ * @param email Filter out emails containing this string
978
+ */
944
979
private Cursor makePeopleCursor (CharSequence email ) throws SQLException {
945
980
if (email == null ) {
946
981
email = "" ;
@@ -990,6 +1025,9 @@ private void removeEditTextErrors() {
990
1025
messageEt .setError (null );
991
1026
}
992
1027
1028
+ /**
1029
+ * Switch from Private to Stream or vice versa in chatBox
1030
+ */
993
1031
private void switchView () {
994
1032
if (isCurrentModeStream ()) { //Person
995
1033
togglePrivateStreamBtn .setImageDrawable (ContextCompat .getDrawable (this , R .drawable .ic_action_bullhorn ));
@@ -1109,6 +1147,9 @@ private void setupTitleBar(String title, String subtitle) {
1109
1147
}
1110
1148
}
1111
1149
1150
+ /**
1151
+ * This method creates a new Instance of the MessageListFragment and displays it with the filter.
1152
+ */
1112
1153
private void doNarrow (NarrowFilter filter ) {
1113
1154
narrowedList = MessageListFragment .newInstance (filter );
1114
1155
// Push to the back stack if we are not already narrowed
@@ -1134,6 +1175,10 @@ public void onNarrowFillSendBoxPrivate(Person peopleList[], boolean openSoftKeyb
1134
1175
}
1135
1176
}
1136
1177
1178
+ /**
1179
+ * Fills the chatBox according to the {@link MessageType}
1180
+ * @param openSoftKeyboard If true open's up the SoftKeyboard else not.
1181
+ */
1137
1182
@ Override
1138
1183
public void onNarrowFillSendBox (Message message , boolean openSoftKeyboard ) {
1139
1184
displayChatBox (true );
@@ -1155,6 +1200,12 @@ public void onNarrowFillSendBox(Message message, boolean openSoftKeyboard) {
1155
1200
}
1156
1201
}
1157
1202
1203
+ /**
1204
+ * Fills the chatBox with the stream name and the topic
1205
+ * @param stream Stream name to be filled
1206
+ * @param subject Subject to be filled
1207
+ * @param openSoftKeyboard If true open's the softKeyboard else not
1208
+ */
1158
1209
public void onNarrowFillSendBoxStream (String stream , String subject , boolean openSoftKeyboard ) {
1159
1210
displayChatBox (true );
1160
1211
displayFAB (false );
@@ -1292,6 +1343,10 @@ public void onClick(
1292
1343
return true ;
1293
1344
}
1294
1345
1346
+ /**
1347
+ * Switches the current Day/Night mode to Night/Day mode
1348
+ * @param nightMode which Mode {@link android.support.v7.app.AppCompatDelegate.NightMode}
1349
+ */
1295
1350
private void setNightMode (@ AppCompatDelegate .NightMode int nightMode ) {
1296
1351
AppCompatDelegate .setDefaultNightMode (nightMode );
1297
1352
@@ -1380,6 +1435,9 @@ protected void onDestroy() {
1380
1435
}
1381
1436
}
1382
1437
1438
+ /**
1439
+ * Refresh the current user profile, removes all the tables from the database and reloads them from the server, reset the queue.
1440
+ */
1383
1441
private void onRefresh () {
1384
1442
super .onResume ();
1385
1443
0 commit comments