1
1
package org .fossasia .openevent .core .about ;
2
2
3
3
import android .annotation .TargetApi ;
4
- import android .support .annotation .NonNull ;
5
- import android .support .v4 .app .Fragment ;
6
- import android .support .v4 .app .FragmentTransaction ;
7
4
import android .arch .lifecycle .ViewModelProviders ;
8
5
import android .content .ClipData ;
9
6
import android .content .ClipboardManager ;
10
7
import android .content .Context ;
11
8
import android .content .Intent ;
12
9
import android .os .Bundle ;
10
+ import android .support .annotation .NonNull ;
13
11
import android .support .annotation .Nullable ;
14
12
import android .support .design .widget .CoordinatorLayout ;
15
13
import android .support .design .widget .Snackbar ;
14
+ import android .support .v4 .app .Fragment ;
15
+ import android .support .v4 .app .FragmentTransaction ;
16
16
import android .support .v7 .app .AlertDialog ;
17
+ import android .support .v7 .widget .DefaultItemAnimator ;
17
18
import android .support .v7 .widget .DividerItemDecoration ;
18
19
import android .support .v7 .widget .LinearLayoutManager ;
19
20
import android .support .v7 .widget .RecyclerView ;
37
38
38
39
import org .fossasia .openevent .OpenEventApp ;
39
40
import org .fossasia .openevent .R ;
41
+ import org .fossasia .openevent .common .ConstantStrings ;
42
+ import org .fossasia .openevent .common .date .DateConverter ;
43
+ import org .fossasia .openevent .common .events .BookmarkChangedEvent ;
44
+ import org .fossasia .openevent .common .events .EventLoadedEvent ;
45
+ import org .fossasia .openevent .common .ui .SnackbarUtil ;
46
+ import org .fossasia .openevent .common .ui .Views ;
40
47
import org .fossasia .openevent .common .ui .base .BaseFragment ;
48
+ import org .fossasia .openevent .common .utils .Utils ;
41
49
import org .fossasia .openevent .core .bookmark .BookmarkStatus ;
50
+ import org .fossasia .openevent .core .bookmark .OnBookmarkSelectedListener ;
42
51
import org .fossasia .openevent .core .main .MainActivity ;
43
- import org .fossasia .openevent .core .search .SearchActivity ;
44
52
import org .fossasia .openevent .core .search .GlobalSearchAdapter ;
53
+ import org .fossasia .openevent .core .search .SearchActivity ;
54
+ import org .fossasia .openevent .core .track .session .SessionSpeakerListAdapter ;
45
55
import org .fossasia .openevent .data .Event ;
56
+ import org .fossasia .openevent .data .Speaker ;
46
57
import org .fossasia .openevent .data .extras .Copyright ;
47
58
import org .fossasia .openevent .data .extras .SocialLink ;
48
59
import org .fossasia .openevent .data .extras .SpeakersCall ;
49
- import org .fossasia .openevent .common .events .BookmarkChangedEvent ;
50
- import org .fossasia .openevent .common .events .EventLoadedEvent ;
51
- import org .fossasia .openevent .common .ConstantStrings ;
52
- import org .fossasia .openevent .core .bookmark .OnBookmarkSelectedListener ;
53
- import org .fossasia .openevent .common .date .DateConverter ;
54
- import org .fossasia .openevent .common .ui .SnackbarUtil ;
55
- import org .fossasia .openevent .common .utils .Utils ;
56
- import org .fossasia .openevent .common .ui .Views ;
57
60
58
61
import java .util .ArrayList ;
59
62
import java .util .List ;
@@ -95,14 +98,20 @@ public class AboutFragment extends BaseFragment implements OnBookmarkSelectedLis
95
98
protected LinearLayout eventLoc ;
96
99
@ BindView (R .id .coordinate_layout_about )
97
100
protected CoordinatorLayout coordinatorLayoutParent ;
101
+ @ BindView (R .id .featured_speakers_header )
102
+ protected TextView featuredSpeakersHeader ;
103
+ @ BindView (R .id .list_featured_speakers )
104
+ protected RecyclerView featuresSpeakersRecyclerView ;
98
105
99
106
private Context context ;
100
107
private View root ;
101
108
private GlobalSearchAdapter bookMarksListAdapter ;
102
109
private SocialLinksListAdapter socialLinksListAdapter ;
110
+ private SessionSpeakerListAdapter featuredSpeakersListAdapter ;
103
111
104
112
private final List <Object > sessions = new ArrayList <>();
105
113
private final List <SocialLink > socialLinks = new ArrayList <>();
114
+ private final List <Speaker > featuredSpeakers = new ArrayList <>();
106
115
private static final String MAP_FRAGMENT_TAG = "mapFragment" ;
107
116
108
117
private Event event ;
@@ -122,6 +131,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
122
131
123
132
setUpBookmarksRecyclerView ();
124
133
setUpSocialLinksRecyclerView ();
134
+ setUpFeaturedSpeakersRecyclerView ();
125
135
126
136
eventLoc .setOnClickListener (v -> {
127
137
if (event .isValid ()) {
@@ -195,6 +205,15 @@ private void setUpSocialLinksRecyclerView() {
195
205
socialLinksRecyclerView .setNestedScrollingEnabled (false );
196
206
}
197
207
208
+ private void setUpFeaturedSpeakersRecyclerView () {
209
+ featuresSpeakersRecyclerView .setVisibility (View .VISIBLE );
210
+ featuredSpeakersListAdapter = new SessionSpeakerListAdapter (featuredSpeakers );
211
+ featuresSpeakersRecyclerView .setLayoutManager (new LinearLayoutManager (getContext (), LinearLayoutManager .HORIZONTAL , false ));
212
+ featuresSpeakersRecyclerView .setNestedScrollingEnabled (false );
213
+ featuresSpeakersRecyclerView .setAdapter (featuredSpeakersListAdapter );
214
+ featuresSpeakersRecyclerView .setItemAnimator (new DefaultItemAnimator ());
215
+ }
216
+
198
217
private void loadEvent (Event event ) {
199
218
if (event == null || !event .isValid ())
200
219
return ;
@@ -386,6 +405,14 @@ private void handleVisibility() {
386
405
bookmarksRecyclerView .setVisibility (View .GONE );
387
406
bookmarkHeader .setVisibility (View .GONE );
388
407
}
408
+
409
+ if (!featuredSpeakers .isEmpty ()) {
410
+ featuredSpeakersHeader .setVisibility (View .VISIBLE );
411
+ featuresSpeakersRecyclerView .setVisibility (View .VISIBLE );
412
+ } else {
413
+ featuredSpeakersHeader .setVisibility (View .GONE );
414
+ featuresSpeakersRecyclerView .setVisibility (View .GONE );
415
+ }
389
416
}
390
417
391
418
private void loadData () {
@@ -397,6 +424,13 @@ private void loadData() {
397
424
bookmarksRecyclerView .setAdapter (bookMarksListAdapter );
398
425
handleVisibility ();
399
426
});
427
+
428
+ aboutFragmentViewModel .getFeaturedSpeakers ().observe (this , featuredSpeakersList -> {
429
+ featuredSpeakers .clear ();
430
+ featuredSpeakers .addAll (featuredSpeakersList );
431
+ featuredSpeakersListAdapter .notifyDataSetChanged ();
432
+ handleVisibility ();
433
+ });
400
434
}
401
435
402
436
@ Override
0 commit comments