@ -13,6 +13,7 @@ import android.text.style.RelativeSizeSpan;
import android.text.style.StyleSpan ;
import android.util.Log ;
import android.view.ActionMode ;
import android.view.Gravity ;
import android.view.LayoutInflater ;
import android.view.Menu ;
import android.view.MenuInflater ;
@ -60,8 +61,8 @@ import awais.instagrabber.asyncs.UsernameFetcher;
import awais.instagrabber.asyncs.direct_messages.CreateThreadAction ;
import awais.instagrabber.customviews.PrimaryActionModeCallback ;
import awais.instagrabber.customviews.PrimaryActionModeCallback.CallbacksHelper ;
import awais.instagrabber.customviews.helpers.NestedCoordinatorLayout ;
import awais.instagrabber.databinding.FragmentProfileBinding ;
import awais.instagrabber.databinding.LayoutProfileDetailsBinding ;
import awais.instagrabber.dialogs.PostsLayoutPreferencesDialogFragment ;
import awais.instagrabber.dialogs.ProfilePicDialogFragment ;
import awais.instagrabber.fragments.PostViewV2Fragment ;
@ -117,7 +118,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
private Set < FeedModel > selectedFeedModels ;
private FeedModel downloadFeedModel ;
private int downloadChildPosition = - 1 ;
private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences . fromJson ( settingsHelper . getString ( Constants . PREF_PROFILE_POSTS_LAYOUT ) ) ;
private PostsLayoutPreferences layoutPreferences = Utils . getPostsLayoutPreferences ( Constants . PREF_PROFILE_POSTS_LAYOUT ) ;
private final Runnable usernameSettingRunnable = ( ) - > {
final ActionBar actionBar = fragmentActivity . getSupportActionBar ( ) ;
@ -281,6 +282,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
}
} ;
private LayoutProfileDetailsBinding profileDetailsBinding ;
@Override
public void onCreate ( @Nullable final Bundle savedInstanceState ) {
@ -306,21 +308,26 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
final boolean isSame = ( "@" + profileModelUsername ) . equals ( this . username ) ;
if ( isSame ) {
setUsernameDelayed ( ) ;
fragmentActivity . setCollapsingView ( profileDetailsBinding . getRoot ( ) ) ;
shouldRefresh = false ;
return root ;
}
}
if ( username = = null | | ! username . equals ( this . username ) ) {
fragmentActivity . setCollapsingView ( profileDetailsBinding . getRoot ( ) ) ;
shouldRefresh = true ;
return root ;
}
}
setUsernameDelayed ( ) ;
fragmentActivity . setCollapsingView ( profileDetailsBinding . getRoot ( ) ) ;
shouldRefresh = false ;
return root ;
}
binding = FragmentProfileBinding . inflate ( inflater , container , false ) ;
root = binding . getRoot ( ) ;
profileDetailsBinding = LayoutProfileDetailsBinding . inflate ( inflater , fragmentActivity . getCollapsingToolbarView ( ) , false ) ;
fragmentActivity . setCollapsingView ( profileDetailsBinding . getRoot ( ) ) ;
return root ;
}
@ -431,6 +438,14 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
}
@Override
public void onDestroyView ( ) {
super . onDestroyView ( ) ;
if ( profileDetailsBinding ! = null ) {
fragmentActivity . removeCollapsingView ( profileDetailsBinding . getRoot ( ) ) ;
}
}
@Override
public void onRequestPermissionsResult ( final int requestCode , @NonNull final String [ ] permissions , @NonNull final int [ ] grantResults ) {
super . onRequestPermissionsResult ( requestCode , permissions , grantResults ) ;
@ -457,12 +472,13 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
setUsernameDelayed ( ) ;
}
if ( TextUtils . isEmpty ( username ) & & ! isLoggedIn ) {
b inding. infoContainer . setVisibility ( View . GONE ) ;
profileDetailsB inding. infoContainer . setVisibility ( View . GONE ) ;
binding . swipeRefreshLayout . setEnabled ( false ) ;
binding . privatePage1 . setImageResource ( R . drawable . ic_outline_info_24 ) ;
binding . privatePage2 . setText ( R . string . no_acc ) ;
final Nested CoordinatorLayout. LayoutParams layoutParams = ( Nested CoordinatorLayout. LayoutParams ) binding . privatePage . getLayoutParams ( ) ;
final CoordinatorLayout . LayoutParams layoutParams = ( CoordinatorLayout . LayoutParams ) binding . privatePage . getLayoutParams ( ) ;
layoutParams . topMargin = 0 ;
layoutParams . gravity = Gravity . CENTER ;
binding . privatePage . setLayoutParams ( layoutParams ) ;
binding . privatePage . setVisibility ( View . VISIBLE ) ;
return ;
@ -531,7 +547,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} else {
binding . postsRecyclerView . refresh ( ) ;
}
b inding. isVerified . setVisibility ( profileModel . isVerified ( ) ? View . VISIBLE : View . GONE ) ;
profileDetailsB inding. isVerified . setVisibility ( profileModel . isVerified ( ) ? View . VISIBLE : View . GONE ) ;
final String profileId = profileModel . getId ( ) ;
final String myId = CookieUtils . getUserIdFromCookie ( cookie ) ;
if ( isLoggedIn ) {
@ -539,14 +555,14 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
setupButtons ( profileId , myId ) ;
if ( ! profileId . equals ( myId ) ) {
b inding. favCb . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. favCb . setVisibility ( View . VISIBLE ) ;
final boolean isFav = Utils . dataBox . getFavorite ( username . substring ( 1 ) , FavoriteType . USER ) ! = null ;
b inding. favCb . setChecked ( isFav ) ;
b inding. favCb . setButtonDrawable ( isFav ? R . drawable . ic_star_check_24 : R . drawable . ic_outline_star_plus_24 ) ;
profileDetailsB inding. favCb . setChecked ( isFav ) ;
profileDetailsB inding. favCb . setButtonDrawable ( isFav ? R . drawable . ic_star_check_24 : R . drawable . ic_outline_star_plus_24 ) ;
} else {
b inding. favCb . setVisibility ( View . GONE ) ;
profileDetailsB inding. favCb . setVisibility ( View . GONE ) ;
}
b inding. mainProfileImage . setImageURI ( profileModel . getHdProfilePic ( ) ) ;
profileDetailsB inding. mainProfileImage . setImageURI ( profileModel . getHdProfilePic ( ) ) ;
final long followersCount = profileModel . getFollowersCount ( ) ;
final long followingCount = profileModel . getFollowingCount ( ) ;
@ -557,7 +573,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
postCount ) ) ;
span . setSpan ( new RelativeSizeSpan ( 1 . 2f ) , 0 , postCount . length ( ) , 0 ) ;
span . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , postCount . length ( ) , 0 ) ;
b inding. mainPostCount . setText ( span ) ;
profileDetailsB inding. mainPostCount . setText ( span ) ;
final String followersCountStr = String . valueOf ( followersCount ) ;
final int followersCountStrLen = followersCountStr . length ( ) ;
@ -565,7 +581,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
followersCountStr ) ) ;
span . setSpan ( new RelativeSizeSpan ( 1 . 2f ) , 0 , followersCountStrLen , 0 ) ;
span . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , followersCountStrLen , 0 ) ;
b inding. mainFollowers . setText ( span ) ;
profileDetailsB inding. mainFollowers . setText ( span ) ;
final String followingCountStr = String . valueOf ( followingCount ) ;
final int followingCountStrLen = followingCountStr . length ( ) ;
@ -573,68 +589,67 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
followingCountStr ) ) ;
span . setSpan ( new RelativeSizeSpan ( 1 . 2f ) , 0 , followingCountStrLen , 0 ) ;
span . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , followingCountStrLen , 0 ) ;
b inding. mainFollowing . setText ( span ) ;
profileDetailsB inding. mainFollowing . setText ( span ) ;
b inding. mainFullName . setText ( TextUtils . isEmpty ( profileModel . getName ( ) ) ? profileModel . getUsername ( )
: profileModel . getName ( ) ) ;
profileDetailsB inding. mainFullName . setText ( TextUtils . isEmpty ( profileModel . getName ( ) ) ? profileModel . getUsername ( )
: profileModel . getName ( ) ) ;
final String biography = profileModel . getBiography ( ) ;
if ( ! TextUtils . isEmpty ( biography ) ) {
b inding. mainBiography . setText ( biography ) ;
b inding. mainBiography . addOnHashtagListener ( autoLinkItem - > {
profileDetailsB inding. mainBiography . setText ( biography ) ;
profileDetailsB inding. mainBiography . addOnHashtagListener ( autoLinkItem - > {
final NavController navController = NavHostFragment . findNavController ( this ) ;
final Bundle bundle = new Bundle ( ) ;
final String originalText = autoLinkItem . getOriginalText ( ) . trim ( ) ;
bundle . putString ( ARG_HASHTAG , originalText ) ;
navController . navigate ( R . id . action_global_hashTagFragment , bundle ) ;
} ) ;
b inding. mainBiography . addOnMentionClickListener ( autoLinkItem - > {
profileDetailsB inding. mainBiography . addOnMentionClickListener ( autoLinkItem - > {
final String originalText = autoLinkItem . getOriginalText ( ) . trim ( ) ;
navigateToProfile ( originalText ) ;
} ) ;
binding . mainBiography . addOnEmailClickListener ( autoLinkItem - > Utils . openEmailAddress ( getContext ( ) ,
autoLinkItem . getOriginalText ( ) . trim ( ) ) ) ;
binding . mainBiography . addOnURLClickListener ( autoLinkItem - > Utils . openURL ( getContext ( ) , autoLinkItem . getOriginalText ( ) . trim ( ) ) ) ;
binding . mainBiography . setOnLongClickListener ( v - > {
if ( context ! = null ) Utils . copyText ( context , biography ) ;
profileDetailsBinding . mainBiography . addOnEmailClickListener ( autoLinkItem - > Utils . openEmailAddress ( getContext ( ) ,
autoLinkItem . getOriginalText ( )
. trim ( ) ) ) ;
profileDetailsBinding . mainBiography
. addOnURLClickListener ( autoLinkItem - > Utils . openURL ( getContext ( ) , autoLinkItem . getOriginalText ( ) . trim ( ) ) ) ;
profileDetailsBinding . mainBiography . setOnLongClickListener ( v - > {
Utils . copyText ( context , biography ) ;
return true ;
} ) ;
}
final String url = profileModel . getUrl ( ) ;
if ( TextUtils . isEmpty ( url ) ) {
b inding. mainUrl . setVisibility ( View . GONE ) ;
profileDetailsB inding. mainUrl . setVisibility ( View . GONE ) ;
} else {
b inding. mainUrl . setVisibility ( View . VISIBLE ) ;
b inding. mainUrl . setText ( url ) ;
b inding. mainUrl . addOnURLClickListener ( autoLinkItem - > Utils . openURL ( getContext ( ) , autoLinkItem . getOriginalText ( ) . trim ( ) ) ) ;
b inding. mainUrl . setOnLongClickListener ( v - > {
if ( context ! = null ) Utils . copyText ( context , url ) ;
profileDetailsB inding. mainUrl . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. mainUrl . setText ( url ) ;
profileDetailsB inding. mainUrl . addOnURLClickListener ( autoLinkItem - > Utils . openURL ( getContext ( ) , autoLinkItem . getOriginalText ( ) . trim ( ) ) ) ;
profileDetailsB inding. mainUrl . setOnLongClickListener ( v - > {
Utils . copyText ( context , url ) ;
return true ;
} ) ;
}
if ( ! profileModel . isReallyPrivate ( ) & & isLoggedIn ) {
binding . mainFollowing . setClickable ( true ) ;
binding . mainFollowers . setClickable ( true ) ;
if ( ! profileModel . isReallyPrivate ( ) ) {
if ( isLoggedIn ) {
profileDetailsBinding . mainFollowing . setClickable ( true ) ;
profileDetailsBinding . mainFollowers . setClickable ( true ) ;
final View . OnClickListener followClickListener = v - > {
final NavDirections action = ProfileFragmentDirections . actionProfileFragmentToFollowViewerFragment (
profileId ,
v = = b inding. mainFollowers ,
v = = profileDetailsB inding. mainFollowers ,
profileModel . getUsername ( ) ) ;
NavHostFragment . findNavController ( this ) . navigate ( action ) ;
} ;
binding . mainFollowers . setOnClickListener ( followersCount > 0 ? followClickListener : null ) ;
binding . mainFollowing . setOnClickListener ( followingCount > 0 ? followClickListener : null ) ;
profileDetailsBinding . mainFollowers . setOnClickListener ( followersCount > 0 ? followClickListener : null ) ;
profileDetailsBinding . mainFollowing . setOnClickListener ( followingCount > 0 ? followClickListener : null ) ;
}
binding . swipeRefreshLayout . setRefreshing ( true ) ;
binding . postsRecyclerView . setVisibility ( View . VISIBLE ) ;
fetchPosts ( ) ;
} else {
b inding. mainFollowers . setClickable ( false ) ;
b inding. mainFollowing . setClickable ( false ) ;
profileDetailsB inding. mainFollowers . setClickable ( false ) ;
profileDetailsB inding. mainFollowing . setClickable ( false ) ;
binding . swipeRefreshLayout . setRefreshing ( false ) ;
/ / error
binding . privatePage1 . setImageResource ( R . drawable . lock ) ;
@ -647,27 +662,27 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
private void setupButtons ( final String profileId , final String myId ) {
if ( isLoggedIn ) {
if ( profileId . equals ( myId ) ) {
b inding. btnTagged . setVisibility ( View . VISIBLE ) ;
b inding. btnSaved . setVisibility ( View . VISIBLE ) ;
b inding. btnLiked . setVisibility ( View . VISIBLE ) ;
b inding. btnDM . setVisibility ( View . GONE ) ;
b inding. btnSaved . setText ( R . string . saved ) ;
profileDetailsB inding. btnTagged . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. btnSaved . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. btnLiked . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. btnDM . setVisibility ( View . GONE ) ;
profileDetailsB inding. btnSaved . setText ( R . string . saved ) ;
return ;
}
b inding. btnTagged . setVisibility ( View . GONE ) ;
b inding. btnSaved . setVisibility ( View . GONE ) ;
b inding. btnLiked . setVisibility ( View . GONE ) ;
b inding. btnDM . setVisibility ( View . VISIBLE ) ; / / maybe there is a judgment mechanism ?
b inding. btnFollow . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. btnTagged . setVisibility ( View . GONE ) ;
profileDetailsB inding. btnSaved . setVisibility ( View . GONE ) ;
profileDetailsB inding. btnLiked . setVisibility ( View . GONE ) ;
profileDetailsB inding. btnDM . setVisibility ( View . VISIBLE ) ; / / maybe there is a judgment mechanism ?
profileDetailsB inding. btnFollow . setVisibility ( View . VISIBLE ) ;
if ( profileModel . getFollowing ( ) ) {
b inding. btnFollow . setText ( R . string . unfollow ) ;
b inding. btnFollow . setIconResource ( R . drawable . ic_outline_person_add_disabled_24 ) ;
profileDetailsB inding. btnFollow . setText ( R . string . unfollow ) ;
profileDetailsB inding. btnFollow . setIconResource ( R . drawable . ic_outline_person_add_disabled_24 ) ;
} else if ( profileModel . getRequested ( ) ) {
b inding. btnFollow . setText ( R . string . cancel ) ;
b inding. btnFollow . setIconResource ( R . drawable . ic_outline_person_add_disabled_24 ) ;
profileDetailsB inding. btnFollow . setText ( R . string . cancel ) ;
profileDetailsB inding. btnFollow . setIconResource ( R . drawable . ic_outline_person_add_disabled_24 ) ;
} else {
b inding. btnFollow . setText ( R . string . follow ) ;
b inding. btnFollow . setIconResource ( R . drawable . ic_outline_person_add_24 ) ;
profileDetailsB inding. btnFollow . setText ( R . string . follow ) ;
profileDetailsB inding. btnFollow . setIconResource ( R . drawable . ic_outline_person_add_24 ) ;
}
if ( restrictMenuItem ! = null ) {
restrictMenuItem . setVisible ( true ) ;
@ -677,7 +692,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
restrictMenuItem . setTitle ( R . string . restrict ) ;
}
}
b inding. btnTagged . setVisibility ( profileModel . isReallyPrivate ( ) ? View . GONE : View . VISIBLE ) ;
profileDetailsB inding. btnTagged . setVisibility ( profileModel . isReallyPrivate ( ) ? View . GONE : View . VISIBLE ) ;
if ( blockMenuItem ! = null ) {
blockMenuItem . setVisible ( true ) ;
if ( profileModel . getBlocked ( ) ) {
@ -708,7 +723,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
@Override
public void onSuccess ( final List < StoryModel > storyModels ) {
if ( storyModels ! = null & & ! storyModels . isEmpty ( ) ) {
b inding. mainProfileImage . setStoriesBorder ( ) ;
profileDetailsB inding. mainProfileImage . setStoriesBorder ( ) ;
hasStories = true ;
}
}
@ -722,15 +737,15 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
result - > {
highlightsFetching = false ;
if ( result ! = null ) {
b inding. highlightsList . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. highlightsList . setVisibility ( View . VISIBLE ) ;
highlightsViewModel . getList ( ) . postValue ( result ) ;
} else b inding. highlightsList . setVisibility ( View . GONE ) ;
} else profileDetailsB inding. highlightsList . setVisibility ( View . GONE ) ;
} ) . executeOnExecutor ( AsyncTask . THREAD_POOL_EXECUTOR ) ;
}
private void setupCommonListeners ( ) {
final String userIdFromCookie = CookieUtils . getUserIdFromCookie ( cookie ) ;
b inding. btnFollow . setOnClickListener ( v - > {
profileDetailsB inding. btnFollow . setOnClickListener ( v - > {
if ( profileModel . getFollowing ( ) | | profileModel . getRequested ( ) ) {
friendshipService . unfollow (
userIdFromCookie ,
@ -767,29 +782,29 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} ) ;
}
} ) ;
b inding. btnSaved . setOnClickListener ( v - > {
profileDetailsB inding. btnSaved . setOnClickListener ( v - > {
final NavDirections action = ProfileFragmentDirections . actionProfileFragmentToSavedViewerFragment ( profileModel . getUsername ( ) ,
profileModel . getId ( ) ,
PostItemType . SAVED ) ;
NavHostFragment . findNavController ( this ) . navigate ( action ) ;
} ) ;
b inding. btnLiked . setOnClickListener ( v - > {
profileDetailsB inding. btnLiked . setOnClickListener ( v - > {
final NavDirections action = ProfileFragmentDirections . actionProfileFragmentToSavedViewerFragment ( profileModel . getUsername ( ) ,
profileModel . getId ( ) ,
PostItemType . LIKED ) ;
NavHostFragment . findNavController ( this ) . navigate ( action ) ;
} ) ;
b inding. btnTagged . setOnClickListener ( v - > {
profileDetailsB inding. btnTagged . setOnClickListener ( v - > {
final NavDirections action = ProfileFragmentDirections . actionProfileFragmentToSavedViewerFragment ( profileModel . getUsername ( ) ,
profileModel . getId ( ) ,
PostItemType . TAGGED ) ;
NavHostFragment . findNavController ( this ) . navigate ( action ) ;
} ) ;
b inding. btnDM . setOnClickListener ( v - > new CreateThreadAction ( cookie , profileModel . getId ( ) , threadId - > {
profileDetailsB inding. btnDM . setOnClickListener ( v - > new CreateThreadAction ( cookie , profileModel . getId ( ) , threadId - > {
final NavDirections action = ProfileFragmentDirections . actionProfileFragmentToDMThreadFragment ( threadId , profileModel . getUsername ( ) ) ;
NavHostFragment . findNavController ( this ) . navigate ( action ) ;
} ) . execute ( ) ) ;
b inding. mainProfileImage . setOnClickListener ( v - > {
profileDetailsB inding. mainProfileImage . setOnClickListener ( v - > {
if ( ! hasStories ) {
/ / show profile pic
showProfilePicDialog ( ) ;
@ -818,7 +833,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
. setNegativeButton ( R . string . cancel , null )
. show ( ) ;
} ) ;
b inding. favCb . setOnCheckedChangeListener ( ( buttonView , isChecked ) - > {
profileDetailsB inding. favCb . setOnCheckedChangeListener ( ( buttonView , isChecked ) - > {
/ / do not do anything if state matches the db , as listener is set before profile details are set
final String finalUsername = username . startsWith ( "@" ) ? username . substring ( 1 ) : username ;
final DataBox . FavoriteModel favorite = Utils . dataBox . getFavorite ( finalUsername , FavoriteType . USER ) ;
@ -826,7 +841,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
return ;
}
buttonView . setVisibility ( View . GONE ) ;
b inding. favProgress . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. favProgress . setVisibility ( View . VISIBLE ) ;
final String message ;
if ( isChecked ) {
final DataBox . FavoriteModel model = new DataBox . FavoriteModel (
@ -838,20 +853,20 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
new Date ( )
) ;
Utils . dataBox . addOrUpdateFavorite ( model ) ;
b inding. favCb . setButtonDrawable ( R . drawable . ic_star_check_24 ) ;
profileDetailsB inding. favCb . setButtonDrawable ( R . drawable . ic_star_check_24 ) ;
message = getString ( R . string . added_to_favs ) ;
} else {
Utils . dataBox . deleteFavorite ( finalUsername , FavoriteType . USER ) ;
message = getString ( R . string . removed_from_favs ) ;
b inding. favCb . setButtonDrawable ( R . drawable . ic_outline_star_plus_24 ) ;
profileDetailsB inding. favCb . setButtonDrawable ( R . drawable . ic_outline_star_plus_24 ) ;
}
final Snackbar snackbar = Snackbar . make ( root , message , BaseTransientBottomBar . LENGTH_LONG ) ;
snackbar . setAction ( R . string . ok , v - > snackbar . dismiss ( ) )
. setAnimationMode ( BaseTransientBottomBar . ANIMATION_MODE_SLIDE )
. setAnchorView ( fragmentActivity . getBottomNavView ( ) )
. show ( ) ;
b inding. favProgress . setVisibility ( View . GONE ) ;
b inding. favCb . setVisibility ( View . VISIBLE ) ;
profileDetailsB inding. favProgress . setVisibility ( View . GONE ) ;
profileDetailsB inding. favCb . setVisibility ( View . VISIBLE ) ;
} ) ;
}
@ -900,8 +915,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
final Context context = getContext ( ) ;
if ( context = = null ) return ;
final RecyclerView . LayoutManager layoutManager = new LinearLayoutManager ( context , RecyclerView . HORIZONTAL , false ) ;
b inding. highlightsList . setLayoutManager ( layoutManager ) ;
b inding. highlightsList . setAdapter ( highlightsAdapter ) ;
profileDetailsB inding. highlightsList . setLayoutManager ( layoutManager ) ;
profileDetailsB inding. highlightsList . setAdapter ( highlightsAdapter ) ;
highlightsViewModel . getList ( ) . observe ( getViewLifecycleOwner ( ) , highlightModels - > highlightsAdapter . submitList ( highlightModels ) ) ;
}