|
@ -1,50 +1,34 @@ |
|
|
package awais.instagrabber.fragments; |
|
|
package awais.instagrabber.fragments; |
|
|
|
|
|
|
|
|
import android.animation.Animator; |
|
|
|
|
|
import android.animation.AnimatorListenerAdapter; |
|
|
|
|
|
import android.animation.ObjectAnimator; |
|
|
|
|
|
import android.animation.PropertyValuesHolder; |
|
|
|
|
|
import android.animation.ValueAnimator; |
|
|
|
|
|
import android.annotation.SuppressLint; |
|
|
import android.annotation.SuppressLint; |
|
|
import android.app.Dialog; |
|
|
|
|
|
import android.content.Context; |
|
|
import android.content.Context; |
|
|
import android.content.DialogInterface; |
|
|
|
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
import android.content.pm.PackageManager; |
|
|
import android.content.pm.PackageManager; |
|
|
import android.graphics.Color; |
|
|
|
|
|
import android.graphics.drawable.Animatable; |
|
|
|
|
|
import android.graphics.drawable.ColorDrawable; |
|
|
|
|
|
|
|
|
import android.content.res.ColorStateList; |
|
|
|
|
|
import android.content.res.Resources; |
|
|
import android.graphics.drawable.Drawable; |
|
|
import android.graphics.drawable.Drawable; |
|
|
import android.net.Uri; |
|
|
import android.net.Uri; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
import android.os.Handler; |
|
|
|
|
|
import android.text.SpannableStringBuilder; |
|
|
import android.text.SpannableStringBuilder; |
|
|
import android.text.Spanned; |
|
|
import android.text.Spanned; |
|
|
import android.util.Log; |
|
|
import android.util.Log; |
|
|
import android.view.GestureDetector; |
|
|
import android.view.GestureDetector; |
|
|
import android.view.Gravity; |
|
|
|
|
|
import android.view.LayoutInflater; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.MenuItem; |
|
|
import android.view.MenuItem; |
|
|
import android.view.MotionEvent; |
|
|
import android.view.MotionEvent; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.ViewTreeObserver; |
|
|
|
|
|
import android.view.Window; |
|
|
|
|
|
import android.view.WindowManager; |
|
|
|
|
|
import android.widget.FrameLayout; |
|
|
|
|
|
import android.widget.ScrollView; |
|
|
|
|
|
import android.widget.Toast; |
|
|
import android.widget.Toast; |
|
|
import android.widget.ViewSwitcher; |
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.appcompat.content.res.AppCompatResources; |
|
|
import androidx.appcompat.content.res.AppCompatResources; |
|
|
import androidx.appcompat.view.ContextThemeWrapper; |
|
|
import androidx.appcompat.view.ContextThemeWrapper; |
|
|
import androidx.appcompat.widget.PopupMenu; |
|
|
import androidx.appcompat.widget.PopupMenu; |
|
|
import androidx.constraintlayout.widget.ConstraintLayout; |
|
|
|
|
|
import androidx.core.content.PermissionChecker; |
|
|
import androidx.core.content.PermissionChecker; |
|
|
|
|
|
import androidx.core.util.Pair; |
|
|
import androidx.core.widget.NestedScrollView; |
|
|
import androidx.core.widget.NestedScrollView; |
|
|
import androidx.fragment.app.DialogFragment; |
|
|
|
|
|
|
|
|
import androidx.fragment.app.Fragment; |
|
|
import androidx.fragment.app.FragmentActivity; |
|
|
import androidx.fragment.app.FragmentActivity; |
|
|
import androidx.lifecycle.LiveData; |
|
|
import androidx.lifecycle.LiveData; |
|
|
import androidx.lifecycle.MutableLiveData; |
|
|
import androidx.lifecycle.MutableLiveData; |
|
@ -58,11 +42,7 @@ import androidx.transition.TransitionManager; |
|
|
import androidx.viewpager2.widget.ViewPager2; |
|
|
import androidx.viewpager2.widget.ViewPager2; |
|
|
|
|
|
|
|
|
import com.facebook.drawee.backends.pipeline.Fresco; |
|
|
import com.facebook.drawee.backends.pipeline.Fresco; |
|
|
import com.facebook.drawee.controller.BaseControllerListener; |
|
|
|
|
|
import com.facebook.drawee.drawable.ScalingUtils; |
|
|
|
|
|
import com.facebook.drawee.generic.GenericDraweeHierarchy; |
|
|
|
|
|
import com.facebook.drawee.interfaces.DraweeController; |
|
|
import com.facebook.drawee.interfaces.DraweeController; |
|
|
import com.facebook.imagepipeline.image.ImageInfo; |
|
|
|
|
|
import com.facebook.imagepipeline.request.ImageRequest; |
|
|
import com.facebook.imagepipeline.request.ImageRequest; |
|
|
import com.facebook.imagepipeline.request.ImageRequestBuilder; |
|
|
import com.facebook.imagepipeline.request.ImageRequestBuilder; |
|
|
import com.google.android.material.bottomsheet.BottomSheetBehavior; |
|
|
import com.google.android.material.bottomsheet.BottomSheetBehavior; |
|
@ -76,7 +56,6 @@ import awais.instagrabber.R; |
|
|
import awais.instagrabber.adapters.SliderCallbackAdapter; |
|
|
import awais.instagrabber.adapters.SliderCallbackAdapter; |
|
|
import awais.instagrabber.adapters.SliderItemsAdapter; |
|
|
import awais.instagrabber.adapters.SliderItemsAdapter; |
|
|
import awais.instagrabber.adapters.viewholder.SliderVideoViewHolder; |
|
|
import awais.instagrabber.adapters.viewholder.SliderVideoViewHolder; |
|
|
import awais.instagrabber.customviews.SharedElementTransitionDialogFragment; |
|
|
|
|
|
import awais.instagrabber.customviews.VerticalImageSpan; |
|
|
import awais.instagrabber.customviews.VerticalImageSpan; |
|
|
import awais.instagrabber.customviews.VideoPlayerCallbackAdapter; |
|
|
import awais.instagrabber.customviews.VideoPlayerCallbackAdapter; |
|
|
import awais.instagrabber.customviews.VideoPlayerViewHelper; |
|
|
import awais.instagrabber.customviews.VideoPlayerViewHelper; |
|
@ -101,31 +80,28 @@ import awais.instagrabber.viewmodels.PostViewV2ViewModel; |
|
|
import static androidx.core.content.PermissionChecker.checkSelfPermission; |
|
|
import static androidx.core.content.PermissionChecker.checkSelfPermission; |
|
|
import static awais.instagrabber.fragments.HashTagFragment.ARG_HASHTAG; |
|
|
import static awais.instagrabber.fragments.HashTagFragment.ARG_HASHTAG; |
|
|
import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION; |
|
|
import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION; |
|
|
|
|
|
import static awais.instagrabber.utils.Utils.getAttrValue; |
|
|
import static awais.instagrabber.utils.Utils.settingsHelper; |
|
|
import static awais.instagrabber.utils.Utils.settingsHelper; |
|
|
|
|
|
|
|
|
public class PostViewV2Fragment extends SharedElementTransitionDialogFragment implements EditTextDialogFragment.EditTextDialogFragmentCallback { |
|
|
|
|
|
|
|
|
public class PostViewV2Fragment extends Fragment implements EditTextDialogFragment.EditTextDialogFragmentCallback { |
|
|
private static final String TAG = "PostViewV2Fragment"; |
|
|
private static final String TAG = "PostViewV2Fragment"; |
|
|
private static final int DETAILS_HIDE_DELAY_MILLIS = 2000; |
|
|
private static final int DETAILS_HIDE_DELAY_MILLIS = 2000; |
|
|
private static final String ARG_MEDIA = "media"; |
|
|
|
|
|
private static final String ARG_SLIDER_POSITION = "position"; |
|
|
|
|
|
|
|
|
public static final String ARG_MEDIA = "media"; |
|
|
|
|
|
public static final String ARG_SLIDER_POSITION = "position"; |
|
|
private static final int STORAGE_PERM_REQUEST_CODE = 8020; |
|
|
private static final int STORAGE_PERM_REQUEST_CODE = 8020; |
|
|
|
|
|
|
|
|
// private Media media; |
|
|
// private Media media; |
|
|
private View sharedProfilePicElement; |
|
|
|
|
|
private View sharedMainPostElement; |
|
|
|
|
|
private DialogPostViewBinding binding; |
|
|
private DialogPostViewBinding binding; |
|
|
// private MediaService mediaService; |
|
|
// private MediaService mediaService; |
|
|
private Context context; |
|
|
|
|
|
|
|
|
// private Context context; |
|
|
private BottomSheetBehavior<NestedScrollView> bottomSheetBehavior; |
|
|
private BottomSheetBehavior<NestedScrollView> bottomSheetBehavior; |
|
|
private boolean detailsVisible = true; |
|
|
private boolean detailsVisible = true; |
|
|
private boolean video; |
|
|
private boolean video; |
|
|
private VideoPlayerViewHelper videoPlayerViewHelper; |
|
|
private VideoPlayerViewHelper videoPlayerViewHelper; |
|
|
private SliderItemsAdapter sliderItemsAdapter; |
|
|
private SliderItemsAdapter sliderItemsAdapter; |
|
|
// private boolean wasControlsVisible; |
|
|
// private boolean wasControlsVisible; |
|
|
private boolean wasPaused; |
|
|
|
|
|
private int captionState = BottomSheetBehavior.STATE_HIDDEN; |
|
|
private int captionState = BottomSheetBehavior.STATE_HIDDEN; |
|
|
private int sliderPosition = -1; |
|
|
private int sliderPosition = -1; |
|
|
private DialogInterface.OnShowListener onShowListener; |
|
|
|
|
|
private boolean hasBeenToggled = false; |
|
|
private boolean hasBeenToggled = false; |
|
|
private PostViewV2ViewModel viewModel; |
|
|
private PostViewV2ViewModel viewModel; |
|
|
private PopupMenu optionsPopup; |
|
|
private PopupMenu optionsPopup; |
|
@ -151,51 +127,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// private final VerticalDragHelper.OnVerticalDragListener onVerticalDragListener = new VerticalDragHelper.OnVerticalDragListener() { |
|
|
|
|
|
// |
|
|
|
|
|
// @Override |
|
|
|
|
|
// public void onDrag(final float dY) { |
|
|
|
|
|
// // allow the view to be draggable |
|
|
|
|
|
// final ConstraintLayout v = binding.getRoot(); |
|
|
|
|
|
// final float finalY = v.getY() + dY; |
|
|
|
|
|
// animateY(v, finalY, 0, null); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// @Override |
|
|
|
|
|
// public void onDragEnd() { |
|
|
|
|
|
// // animate and dismiss if user drags the view more that 30% of the view |
|
|
|
|
|
// if (Math.abs(binding.getRoot().getY()) > Utils.displayMetrics.heightPixels * 0.25) { |
|
|
|
|
|
// animateAndDismiss(binding.getRoot().getY() < 0 ? 1 : -1); |
|
|
|
|
|
// return; |
|
|
|
|
|
// } |
|
|
|
|
|
// // animate back the view to proper position |
|
|
|
|
|
// animateY(binding.getRoot(), 0, 200, null); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// @Override |
|
|
|
|
|
// public void onFling(final double flingVelocity) { |
|
|
|
|
|
// // animate and dismiss if user flings up/down |
|
|
|
|
|
// animateAndDismiss(flingVelocity > 0 ? 1 : -1); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// private void animateAndDismiss(final int direction) { |
|
|
|
|
|
// final int height = binding.getRoot().getHeight(); |
|
|
|
|
|
// final int finalYDist = height + Utils.getStatusBarHeight(context); |
|
|
|
|
|
// // less than 0 means up direction, else down |
|
|
|
|
|
// final int finalY = direction > 0 ? -finalYDist : finalYDist; |
|
|
|
|
|
// animateY(binding.getRoot(), finalY, 200, new AnimatorListenerAdapter() { |
|
|
|
|
|
// @Override |
|
|
|
|
|
// public void onAnimationEnd(final Animator animation) { |
|
|
|
|
|
// dismiss(); |
|
|
|
|
|
// } |
|
|
|
|
|
// }); |
|
|
|
|
|
// } |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
public void setOnShowListener(final DialogInterface.OnShowListener onShowListener) { |
|
|
|
|
|
this.onShowListener = onShowListener; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setOnDeleteListener(final OnDeleteListener onDeleteListener) { |
|
|
public void setOnDeleteListener(final OnDeleteListener onDeleteListener) { |
|
|
if (onDeleteListener == null) return; |
|
|
if (onDeleteListener == null) return; |
|
|
this.onDeleteListener = onDeleteListener; |
|
|
this.onDeleteListener = onDeleteListener; |
|
@ -205,68 +136,12 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
void onDelete(); |
|
|
void onDelete(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static class Builder { |
|
|
|
|
|
private final Media feedModel; |
|
|
|
|
|
private View profilePicElement; |
|
|
|
|
|
private View mainPostElement; |
|
|
|
|
|
private int position; |
|
|
|
|
|
|
|
|
|
|
|
public Builder setSharedProfilePicElement(final View profilePicElement) { |
|
|
|
|
|
this.profilePicElement = profilePicElement; |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("UnusedReturnValue") |
|
|
|
|
|
public Builder setSharedMainPostElement(final View mainPostElement) { |
|
|
|
|
|
this.mainPostElement = mainPostElement; |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Builder setPosition(final int position) { |
|
|
|
|
|
this.position = position; |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PostViewV2Fragment build() { |
|
|
|
|
|
return PostViewV2Fragment.newInstance(feedModel, profilePicElement, mainPostElement, position); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Builder(final Media feedModel) { |
|
|
|
|
|
this.feedModel = feedModel; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static PostViewV2Fragment newInstance(final Media feedModel, |
|
|
|
|
|
final View profilePicElement, |
|
|
|
|
|
final View mainPostElement, |
|
|
|
|
|
final int position) { |
|
|
|
|
|
final PostViewV2Fragment f = new PostViewV2Fragment(profilePicElement, mainPostElement); |
|
|
|
|
|
final Bundle args = new Bundle(); |
|
|
|
|
|
args.putSerializable(ARG_MEDIA, feedModel); |
|
|
|
|
|
if (position >= 0) { |
|
|
|
|
|
args.putInt(ARG_SLIDER_POSITION, position); |
|
|
|
|
|
} |
|
|
|
|
|
f.setArguments(args); |
|
|
|
|
|
return f; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Builder builder(final Media feedModel) { |
|
|
|
|
|
return new Builder(feedModel); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// default constructor for fragment manager |
|
|
// default constructor for fragment manager |
|
|
public PostViewV2Fragment() {} |
|
|
public PostViewV2Fragment() {} |
|
|
|
|
|
|
|
|
private PostViewV2Fragment(final View sharedProfilePicElement, |
|
|
|
|
|
final View sharedMainPostElement) { |
|
|
|
|
|
this.sharedProfilePicElement = sharedProfilePicElement; |
|
|
|
|
|
this.sharedMainPostElement = sharedMainPostElement; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onCreate(@Nullable final Bundle savedInstanceState) { |
|
|
public void onCreate(@Nullable final Bundle savedInstanceState) { |
|
|
super.onCreate(savedInstanceState); |
|
|
super.onCreate(savedInstanceState); |
|
|
setStyle(DialogFragment.STYLE_NO_FRAME, R.style.PostViewV2Style); |
|
|
|
|
|
viewModel = new ViewModelProvider(this).get(PostViewV2ViewModel.class); |
|
|
viewModel = new ViewModelProvider(this).get(PostViewV2ViewModel.class); |
|
|
captionState = settingsHelper.getBoolean(Constants.SHOW_CAPTIONS) ? |
|
|
captionState = settingsHelper.getBoolean(Constants.SHOW_CAPTIONS) ? |
|
|
BottomSheetBehavior.STATE_COLLAPSED : BottomSheetBehavior.STATE_HIDDEN; |
|
|
BottomSheetBehavior.STATE_COLLAPSED : BottomSheetBehavior.STATE_HIDDEN; |
|
@ -278,58 +153,19 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
@Nullable final ViewGroup container, |
|
|
@Nullable final ViewGroup container, |
|
|
@Nullable final Bundle savedInstanceState) { |
|
|
@Nullable final Bundle savedInstanceState) { |
|
|
binding = DialogPostViewBinding.inflate(inflater, container, false); |
|
|
binding = DialogPostViewBinding.inflate(inflater, container, false); |
|
|
final ConstraintLayout root = binding.getRoot(); |
|
|
|
|
|
final ViewTreeObserver.OnPreDrawListener preDrawListener = new ViewTreeObserver.OnPreDrawListener() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean onPreDraw() { |
|
|
|
|
|
root.getViewTreeObserver().removeOnPreDrawListener(this); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
root.getViewTreeObserver().addOnPreDrawListener(preDrawListener); |
|
|
|
|
|
return root; |
|
|
|
|
|
|
|
|
return binding.getRoot(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) { |
|
|
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) { |
|
|
|
|
|
// postponeEnterTransition(); |
|
|
init(); |
|
|
init(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onAttach(@NonNull final Context context) { |
|
|
|
|
|
super.onAttach(context); |
|
|
|
|
|
this.context = context; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onStart() { |
|
|
|
|
|
super.onStart(); |
|
|
|
|
|
final Dialog dialog = getDialog(); |
|
|
|
|
|
if (dialog == null) return; |
|
|
|
|
|
final Window window = dialog.getWindow(); |
|
|
|
|
|
if (window == null) return; |
|
|
|
|
|
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
|
|
|
|
|
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); |
|
|
|
|
|
window.setDimAmount(0); |
|
|
|
|
|
int width = ViewGroup.LayoutParams.MATCH_PARENT; |
|
|
|
|
|
int height = ViewGroup.LayoutParams.MATCH_PARENT; |
|
|
|
|
|
window.setLayout(width, height); |
|
|
|
|
|
if (!wasPaused && (sharedProfilePicElement != null || sharedMainPostElement != null)) { |
|
|
|
|
|
final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder( |
|
|
|
|
|
binding.getRoot().getBackground().mutate(), |
|
|
|
|
|
PropertyValuesHolder.ofInt("alpha", 0, 255) |
|
|
|
|
|
); |
|
|
|
|
|
addAnimator(animator); |
|
|
|
|
|
} |
|
|
|
|
|
if (onShowListener != null) { |
|
|
|
|
|
onShowListener.onShow(dialog); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onPause() { |
|
|
public void onPause() { |
|
|
super.onPause(); |
|
|
super.onPause(); |
|
|
wasPaused = true; |
|
|
|
|
|
|
|
|
// wasPaused = true; |
|
|
if (bottomSheetBehavior != null) { |
|
|
if (bottomSheetBehavior != null) { |
|
|
captionState = bottomSheetBehavior.getState(); |
|
|
captionState = bottomSheetBehavior.getState(); |
|
|
} |
|
|
} |
|
@ -390,85 +226,12 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
protected void onBeforeSharedElementAnimation(@NonNull final View startView, |
|
|
|
|
|
@NonNull final View destView, |
|
|
|
|
|
@NonNull final SharedElementTransitionDialogFragment.ViewBounds viewBounds) { |
|
|
|
|
|
GenericDraweeHierarchy hierarchy = null; |
|
|
|
|
|
if (destView == binding.postImage) { |
|
|
|
|
|
hierarchy = binding.postImage.getHierarchy(); |
|
|
|
|
|
} else if (destView == binding.videoPost.thumbnailParent) { |
|
|
|
|
|
hierarchy = binding.videoPost.thumbnail.getHierarchy(); |
|
|
|
|
|
} |
|
|
|
|
|
if (hierarchy != null) { |
|
|
|
|
|
final ScalingUtils.ScaleType scaleTypeTo = ScalingUtils.ScaleType.FIT_CENTER; |
|
|
|
|
|
final ScalingUtils.InterpolatingScaleType scaleType = new ScalingUtils.InterpolatingScaleType( |
|
|
|
|
|
ScalingUtils.ScaleType.CENTER_CROP, |
|
|
|
|
|
scaleTypeTo, |
|
|
|
|
|
viewBounds.getStartBounds(), |
|
|
|
|
|
viewBounds.getDestBounds() |
|
|
|
|
|
); |
|
|
|
|
|
hierarchy.setActualImageScaleType(scaleType); |
|
|
|
|
|
final ValueAnimator animator = ValueAnimator.ofFloat(0, 1); |
|
|
|
|
|
animator.setDuration(getAnimationDuration()); |
|
|
|
|
|
animator.addUpdateListener(animation -> { |
|
|
|
|
|
float fraction = (float) animation.getAnimatedValue(); |
|
|
|
|
|
scaleType.setValue(fraction); |
|
|
|
|
|
}); |
|
|
|
|
|
final GenericDraweeHierarchy finalHierarchy = hierarchy; |
|
|
|
|
|
animator.addListener(new AnimatorListenerAdapter() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onAnimationEnd(Animator animation) { |
|
|
|
|
|
finalHierarchy.setActualImageScaleType(scaleTypeTo); |
|
|
|
|
|
destView.requestLayout(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
addAnimator(animator); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
protected void onEndSharedElementAnimation(@NonNull final View startView, |
|
|
|
|
|
@NonNull final View destView, |
|
|
|
|
|
@NonNull final ViewBounds viewBounds) { |
|
|
|
|
|
if (destView == binding.postImage) { |
|
|
|
|
|
binding.postImage.setTranslationX(0); |
|
|
|
|
|
binding.postImage.setTranslationY(0); |
|
|
|
|
|
binding.postImage.setX(0); |
|
|
|
|
|
binding.postImage.setY(0); |
|
|
|
|
|
binding.postImage.setLayoutParams(new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, |
|
|
|
|
|
ViewGroup.LayoutParams.MATCH_PARENT)); |
|
|
|
|
|
binding.postImage.requestLayout(); |
|
|
|
|
|
if (bottomSheetBehavior != null) { |
|
|
|
|
|
bottomSheetBehavior.setState(captionState); |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (destView == binding.sliderParent) { |
|
|
|
|
|
binding.sliderParent.setLayoutParams(new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, |
|
|
|
|
|
ViewGroup.LayoutParams.MATCH_PARENT)); |
|
|
|
|
|
binding.sliderParent.requestLayout(); |
|
|
|
|
|
if (bottomSheetBehavior != null) { |
|
|
|
|
|
bottomSheetBehavior.setState(captionState); |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (destView == binding.videoPost.thumbnailParent) { |
|
|
|
|
|
final FrameLayout.LayoutParams params = new ViewSwitcher.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, |
|
|
|
|
|
ViewGroup.LayoutParams.WRAP_CONTENT); |
|
|
|
|
|
params.gravity = Gravity.CENTER; |
|
|
|
|
|
binding.videoPost.thumbnailParent.setLayoutParams(params); |
|
|
|
|
|
binding.videoPost.thumbnailParent.requestLayout(); |
|
|
|
|
|
if (bottomSheetBehavior != null) { |
|
|
|
|
|
bottomSheetBehavior.setState(captionState); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) { |
|
|
public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) { |
|
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
|
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
|
|
if (requestCode == STORAGE_PERM_REQUEST_CODE && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
|
|
if (requestCode == STORAGE_PERM_REQUEST_CODE && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
DownloadUtils.showDownloadDialog(context, viewModel.getMedia(), sliderPosition); |
|
|
DownloadUtils.showDownloadDialog(context, viewModel.getMedia(), sliderPosition); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -476,17 +239,17 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
private void init() { |
|
|
private void init() { |
|
|
final Bundle arguments = getArguments(); |
|
|
final Bundle arguments = getArguments(); |
|
|
if (arguments == null) { |
|
|
if (arguments == null) { |
|
|
dismiss(); |
|
|
|
|
|
|
|
|
// dismiss(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
final Serializable feedModelSerializable = arguments.getSerializable(ARG_MEDIA); |
|
|
final Serializable feedModelSerializable = arguments.getSerializable(ARG_MEDIA); |
|
|
if (feedModelSerializable == null) { |
|
|
if (feedModelSerializable == null) { |
|
|
Log.e(TAG, "onCreate: feedModelSerializable is null"); |
|
|
Log.e(TAG, "onCreate: feedModelSerializable is null"); |
|
|
dismiss(); |
|
|
|
|
|
|
|
|
// dismiss(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!(feedModelSerializable instanceof Media)) { |
|
|
if (!(feedModelSerializable instanceof Media)) { |
|
|
dismiss(); |
|
|
|
|
|
|
|
|
// dismiss(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
final Media media = (Media) feedModelSerializable; |
|
|
final Media media = (Media) feedModelSerializable; |
|
@ -494,11 +257,11 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0); |
|
|
sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0); |
|
|
} |
|
|
} |
|
|
viewModel.setMedia(media); |
|
|
viewModel.setMedia(media); |
|
|
if (!wasPaused && (sharedProfilePicElement != null || sharedMainPostElement != null)) { |
|
|
|
|
|
binding.getRoot().getBackground().mutate().setAlpha(0); |
|
|
|
|
|
} |
|
|
|
|
|
setProfilePicSharedElement(); |
|
|
|
|
|
setupCaptionBottomSheet(); |
|
|
|
|
|
|
|
|
// if (!wasPaused && (sharedProfilePicElement != null || sharedMainPostElement != null)) { |
|
|
|
|
|
// binding.getRoot().getBackground().mutate().setAlpha(0); |
|
|
|
|
|
// } |
|
|
|
|
|
// setProfilePicSharedElement(); |
|
|
|
|
|
// setupCaptionBottomSheet(); |
|
|
setupCommonActions(); |
|
|
setupCommonActions(); |
|
|
setObservers(); |
|
|
setObservers(); |
|
|
} |
|
|
} |
|
@ -506,10 +269,14 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
private void setObservers() { |
|
|
private void setObservers() { |
|
|
viewModel.getUser().observe(getViewLifecycleOwner(), user -> { |
|
|
viewModel.getUser().observe(getViewLifecycleOwner(), user -> { |
|
|
if (user == null) { |
|
|
if (user == null) { |
|
|
binding.userDetailsGroup.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
binding.profilePic.setVisibility(View.GONE); |
|
|
|
|
|
binding.title.setVisibility(View.GONE); |
|
|
|
|
|
binding.subtitle.setVisibility(View.GONE); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
binding.userDetailsGroup.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
|
binding.profilePic.setVisibility(View.VISIBLE); |
|
|
|
|
|
binding.title.setVisibility(View.VISIBLE); |
|
|
|
|
|
binding.subtitle.setVisibility(View.VISIBLE); |
|
|
binding.getRoot().post(() -> setupProfilePic(user)); |
|
|
binding.getRoot().post(() -> setupProfilePic(user)); |
|
|
binding.getRoot().post(() -> setupTitles(user)); |
|
|
binding.getRoot().post(() -> setupTitles(user)); |
|
|
}); |
|
|
}); |
|
@ -563,30 +330,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
return safeCount; |
|
|
return safeCount; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void setupCaptionBottomSheet() { |
|
|
|
|
|
bottomSheetBehavior = BottomSheetBehavior.from(binding.captionParent); |
|
|
|
|
|
bottomSheetBehavior.setState(captionState); |
|
|
|
|
|
bottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onStateChanged(@NonNull final View bottomSheet, final int newState) {} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onSlide(@NonNull final View bottomSheet, final float slideOffset) { |
|
|
|
|
|
binding.captionParent.getBackground().mutate().setAlpha((int) (128 + (128 * (slideOffset < 0 ? 0 : slideOffset)))); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (sharedProfilePicElement == null || sharedMainPostElement == null) { |
|
|
|
|
|
binding.getRoot().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onGlobalLayout() { |
|
|
|
|
|
binding.getRoot().getViewTreeObserver().removeOnGlobalLayoutListener(this); |
|
|
|
|
|
if (bottomSheetBehavior == null) return; |
|
|
|
|
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setupCommonActions() { |
|
|
private void setupCommonActions() { |
|
|
setupLike(); |
|
|
setupLike(); |
|
|
setupSave(); |
|
|
setupSave(); |
|
@ -619,6 +362,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
binding.comment.setOnLongClickListener(v -> { |
|
|
binding.comment.setOnLongClickListener(v -> { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return false; |
|
|
Utils.displayToastAboveView(context, v, getString(R.string.comment)); |
|
|
Utils.displayToastAboveView(context, v, getString(R.string.comment)); |
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
}); |
|
@ -626,6 +371,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
|
|
|
|
|
|
private void setupDownload() { |
|
|
private void setupDownload() { |
|
|
binding.download.setOnClickListener(v -> { |
|
|
binding.download.setOnClickListener(v -> { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
if (checkSelfPermission(context, WRITE_PERMISSION) == PermissionChecker.PERMISSION_GRANTED) { |
|
|
if (checkSelfPermission(context, WRITE_PERMISSION) == PermissionChecker.PERMISSION_GRANTED) { |
|
|
DownloadUtils.showDownloadDialog(context, viewModel.getMedia(), sliderPosition); |
|
|
DownloadUtils.showDownloadDialog(context, viewModel.getMedia(), sliderPosition); |
|
|
return; |
|
|
return; |
|
@ -633,6 +380,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
requestPermissions(DownloadUtils.PERMS, STORAGE_PERM_REQUEST_CODE); |
|
|
requestPermissions(DownloadUtils.PERMS, STORAGE_PERM_REQUEST_CODE); |
|
|
}); |
|
|
}); |
|
|
binding.download.setOnLongClickListener(v -> { |
|
|
binding.download.setOnLongClickListener(v -> { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return false; |
|
|
Utils.displayToastAboveView(context, v, getString(R.string.action_download)); |
|
|
Utils.displayToastAboveView(context, v, getString(R.string.action_download)); |
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
}); |
|
@ -702,17 +451,21 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
private void setLikedResources(final boolean liked) { |
|
|
private void setLikedResources(final boolean liked) { |
|
|
final int iconResource; |
|
|
final int iconResource; |
|
|
final int tintResource; |
|
|
final int tintResource; |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
|
|
|
final Resources resources = context.getResources(); |
|
|
|
|
|
if (resources == null) return; |
|
|
if (liked) { |
|
|
if (liked) { |
|
|
iconResource = R.drawable.ic_like; |
|
|
iconResource = R.drawable.ic_like; |
|
|
tintResource = R.color.red_600; |
|
|
|
|
|
|
|
|
tintResource = resources.getColor(R.color.red_600); |
|
|
// textResId = R.string.unlike_without_count; |
|
|
// textResId = R.string.unlike_without_count; |
|
|
} else { |
|
|
} else { |
|
|
iconResource = R.drawable.ic_not_liked; |
|
|
iconResource = R.drawable.ic_not_liked; |
|
|
tintResource = R.color.white; |
|
|
|
|
|
|
|
|
tintResource = getAttrValue(context, R.attr.colorPrimary); |
|
|
// textResId = R.string.like_without_count; |
|
|
// textResId = R.string.like_without_count; |
|
|
} |
|
|
} |
|
|
binding.like.setIconResource(iconResource); |
|
|
binding.like.setIconResource(iconResource); |
|
|
binding.like.setIconTintResource(tintResource); |
|
|
|
|
|
|
|
|
binding.like.setIconTint(ColorStateList.valueOf(tintResource)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void setupSave() { |
|
|
private void setupSave() { |
|
@ -769,23 +522,21 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
private void setSavedResources(final boolean saved) { |
|
|
private void setSavedResources(final boolean saved) { |
|
|
final int iconResource; |
|
|
final int iconResource; |
|
|
final int tintResource; |
|
|
final int tintResource; |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
|
|
|
final Resources resources = context.getResources(); |
|
|
|
|
|
if (resources == null) return; |
|
|
if (saved) { |
|
|
if (saved) { |
|
|
iconResource = R.drawable.ic_class_24; |
|
|
iconResource = R.drawable.ic_class_24; |
|
|
tintResource = R.color.blue_700; |
|
|
|
|
|
|
|
|
tintResource = resources.getColor(R.color.blue_700); |
|
|
// textResId = R.string.saved; |
|
|
// textResId = R.string.saved; |
|
|
} else { |
|
|
} else { |
|
|
iconResource = R.drawable.ic_outline_class_24; |
|
|
iconResource = R.drawable.ic_outline_class_24; |
|
|
tintResource = R.color.white; |
|
|
|
|
|
|
|
|
tintResource = getAttrValue(context, R.attr.colorPrimary); |
|
|
// textResId = R.string.save; |
|
|
// textResId = R.string.save; |
|
|
} |
|
|
} |
|
|
binding.save.setIconResource(iconResource); |
|
|
binding.save.setIconResource(iconResource); |
|
|
binding.save.setIconTintResource(tintResource); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setProfilePicSharedElement() { |
|
|
|
|
|
if (!wasPaused && sharedProfilePicElement != null) { |
|
|
|
|
|
addSharedElement(sharedProfilePicElement, binding.profilePic); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
binding.save.setIconTint(ColorStateList.valueOf(tintResource)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void setupProfilePic(final User user) { |
|
|
private void setupProfilePic(final User user) { |
|
@ -797,19 +548,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
final DraweeController controller = Fresco |
|
|
final DraweeController controller = Fresco |
|
|
.newDraweeControllerBuilder() |
|
|
.newDraweeControllerBuilder() |
|
|
.setUri(uri) |
|
|
.setUri(uri) |
|
|
.setControllerListener(new BaseControllerListener<ImageInfo>() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onFailure(final String id, final Throwable throwable) { |
|
|
|
|
|
startPostponedEnterTransition(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onFinalImageSet(final String id, |
|
|
|
|
|
final ImageInfo imageInfo, |
|
|
|
|
|
final Animatable animatable) { |
|
|
|
|
|
startPostponedEnterTransition(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.build(); |
|
|
.build(); |
|
|
binding.profilePic.setController(controller); |
|
|
binding.profilePic.setController(controller); |
|
|
binding.profilePic.setOnClickListener(v -> navigateToProfile("@" + user.getUsername())); |
|
|
binding.profilePic.setOnClickListener(v -> navigateToProfile("@" + user.getUsername())); |
|
@ -821,7 +559,13 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
binding.subtitle.setVisibility(View.GONE); |
|
|
binding.subtitle.setVisibility(View.GONE); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
binding.subtitle.setText(user.getFullName()); |
|
|
|
|
|
|
|
|
final String fullName = user.getFullName(); |
|
|
|
|
|
if (TextUtils.isEmpty(fullName)) { |
|
|
|
|
|
binding.subtitle.setVisibility(View.GONE); |
|
|
|
|
|
} else { |
|
|
|
|
|
binding.subtitle.setVisibility(View.VISIBLE); |
|
|
|
|
|
binding.subtitle.setText(fullName); |
|
|
|
|
|
} |
|
|
setUsername(user); |
|
|
setUsername(user); |
|
|
binding.title.setOnClickListener(v -> navigateToProfile("@" + user.getUsername())); |
|
|
binding.title.setOnClickListener(v -> navigateToProfile("@" + user.getUsername())); |
|
|
binding.subtitle.setOnClickListener(v -> navigateToProfile("@" + user.getUsername())); |
|
|
binding.subtitle.setOnClickListener(v -> navigateToProfile("@" + user.getUsername())); |
|
@ -831,6 +575,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
final SpannableStringBuilder sb = new SpannableStringBuilder(user.getUsername()); |
|
|
final SpannableStringBuilder sb = new SpannableStringBuilder(user.getUsername()); |
|
|
final int drawableSize = Utils.convertDpToPx(24); |
|
|
final int drawableSize = Utils.convertDpToPx(24); |
|
|
if (user.isVerified()) { |
|
|
if (user.isVerified()) { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
final Drawable verifiedDrawable = AppCompatResources.getDrawable(context, R.drawable.verified); |
|
|
final Drawable verifiedDrawable = AppCompatResources.getDrawable(context, R.drawable.verified); |
|
|
VerticalImageSpan verifiedSpan = null; |
|
|
VerticalImageSpan verifiedSpan = null; |
|
|
if (verifiedDrawable != null) { |
|
|
if (verifiedDrawable != null) { |
|
@ -854,7 +600,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
if (caption == null || TextUtils.isEmpty(caption.getText())) { |
|
|
if (caption == null || TextUtils.isEmpty(caption.getText())) { |
|
|
binding.caption.setVisibility(View.GONE); |
|
|
binding.caption.setVisibility(View.GONE); |
|
|
binding.translate.setVisibility(View.GONE); |
|
|
binding.translate.setVisibility(View.GONE); |
|
|
binding.captionToggle.setVisibility(View.GONE); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
final String postCaption = caption.getText(); |
|
|
final String postCaption = caption.getText(); |
|
@ -872,35 +617,13 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
binding.caption.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(getContext(), autoLinkItem.getOriginalText().trim())); |
|
|
binding.caption.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(getContext(), autoLinkItem.getOriginalText().trim())); |
|
|
binding.caption.addOnURLClickListener(autoLinkItem -> Utils.openURL(getContext(), autoLinkItem.getOriginalText().trim())); |
|
|
binding.caption.addOnURLClickListener(autoLinkItem -> Utils.openURL(getContext(), autoLinkItem.getOriginalText().trim())); |
|
|
binding.caption.setOnLongClickListener(v -> { |
|
|
binding.caption.setOnLongClickListener(v -> { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return false; |
|
|
Utils.copyText(context, postCaption); |
|
|
Utils.copyText(context, postCaption); |
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
}); |
|
|
binding.caption.setText(postCaption); |
|
|
binding.caption.setText(postCaption); |
|
|
binding.translate.setOnClickListener(v -> handleTranslateCaptionResource(viewModel.translateCaption())); |
|
|
binding.translate.setOnClickListener(v -> handleTranslateCaptionResource(viewModel.translateCaption())); |
|
|
binding.captionToggle.setOnClickListener(v -> { |
|
|
|
|
|
if (bottomSheetBehavior == null) return; |
|
|
|
|
|
switch (bottomSheetBehavior.getState()) { |
|
|
|
|
|
case BottomSheetBehavior.STATE_HIDDEN: |
|
|
|
|
|
binding.captionParent.fullScroll(ScrollView.FOCUS_UP); // reset scroll position |
|
|
|
|
|
// if (binding.playerControls.getRoot().getVisibility() == View.VISIBLE) { |
|
|
|
|
|
// hidePlayerControls(); |
|
|
|
|
|
// } |
|
|
|
|
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); |
|
|
|
|
|
return; |
|
|
|
|
|
case BottomSheetBehavior.STATE_COLLAPSED: |
|
|
|
|
|
case BottomSheetBehavior.STATE_EXPANDED: |
|
|
|
|
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); |
|
|
|
|
|
return; |
|
|
|
|
|
case BottomSheetBehavior.STATE_DRAGGING: |
|
|
|
|
|
case BottomSheetBehavior.STATE_HALF_EXPANDED: |
|
|
|
|
|
case BottomSheetBehavior.STATE_SETTLING: |
|
|
|
|
|
default: |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
binding.captionToggle.setOnLongClickListener(v -> { |
|
|
|
|
|
Utils.displayToastAboveView(context, v, getString(R.string.caption)); |
|
|
|
|
|
return true; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void handleTranslateCaptionResource(@NonNull final LiveData<Resource<String>> data) { |
|
|
private void handleTranslateCaptionResource(@NonNull final LiveData<Resource<String>> data) { |
|
@ -953,6 +676,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
} |
|
|
} |
|
|
binding.share.setVisibility(View.VISIBLE); |
|
|
binding.share.setVisibility(View.VISIBLE); |
|
|
binding.share.setOnLongClickListener(v -> { |
|
|
binding.share.setOnLongClickListener(v -> { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return false; |
|
|
Utils.displayToastAboveView(context, v, getString(R.string.share)); |
|
|
Utils.displayToastAboveView(context, v, getString(R.string.share)); |
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
}); |
|
@ -962,6 +687,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
if (profileModel == null) return; |
|
|
if (profileModel == null) return; |
|
|
final boolean isPrivate = profileModel.isPrivate(); |
|
|
final boolean isPrivate = profileModel.isPrivate(); |
|
|
if (isPrivate) { |
|
|
if (isPrivate) { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
// is this necessary? |
|
|
// is this necessary? |
|
|
Toast.makeText(context, R.string.share_private_post, Toast.LENGTH_LONG).show(); |
|
|
Toast.makeText(context, R.string.share_private_post, Toast.LENGTH_LONG).show(); |
|
|
} |
|
|
} |
|
@ -996,15 +723,15 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
// binding.playerControls.getRoot().setVisibility(View.GONE); |
|
|
// binding.playerControls.getRoot().setVisibility(View.GONE); |
|
|
binding.mediaCounter.setVisibility(View.GONE); |
|
|
binding.mediaCounter.setVisibility(View.GONE); |
|
|
binding.postImage.setVisibility(View.VISIBLE); |
|
|
binding.postImage.setVisibility(View.VISIBLE); |
|
|
if (!wasPaused && sharedMainPostElement != null) { |
|
|
|
|
|
binding.postImage.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP); |
|
|
|
|
|
addSharedElement(sharedMainPostElement, binding.postImage); |
|
|
|
|
|
} |
|
|
|
|
|
final Media media = viewModel.getMedia(); |
|
|
final Media media = viewModel.getMedia(); |
|
|
final String imageUrl = ResponseBodyUtils.getImageUrl(media); |
|
|
final String imageUrl = ResponseBodyUtils.getImageUrl(media); |
|
|
if (TextUtils.isEmpty(imageUrl)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(imageUrl)) return; |
|
|
|
|
|
final ViewGroup.LayoutParams layoutParams = binding.postImage.getLayoutParams(); |
|
|
|
|
|
final Pair<Integer, Integer> widthHeight = NumberUtils.calculateWidthHeight(media.getOriginalHeight(), |
|
|
|
|
|
media.getOriginalWidth(), |
|
|
|
|
|
(int) (Utils.displayMetrics.heightPixels * 0.8), |
|
|
|
|
|
Utils.displayMetrics.widthPixels); |
|
|
|
|
|
layoutParams.height = widthHeight.second; |
|
|
final ImageRequest requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl)) |
|
|
final ImageRequest requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl)) |
|
|
.setLocalThumbnailPreviewsEnabled(true) |
|
|
.setLocalThumbnailPreviewsEnabled(true) |
|
|
.build(); |
|
|
.build(); |
|
@ -1012,35 +739,22 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
.newDraweeControllerBuilder() |
|
|
.newDraweeControllerBuilder() |
|
|
.setLowResImageRequest(ImageRequest.fromUri(ResponseBodyUtils.getThumbUrl(media))) |
|
|
.setLowResImageRequest(ImageRequest.fromUri(ResponseBodyUtils.getThumbUrl(media))) |
|
|
.setImageRequest(requestBuilder) |
|
|
.setImageRequest(requestBuilder) |
|
|
.setControllerListener(new BaseControllerListener<ImageInfo>() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onFailure(final String id, final Throwable throwable) { |
|
|
|
|
|
startPostponedEnterTransition(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onFinalImageSet(final String id, |
|
|
|
|
|
final ImageInfo imageInfo, |
|
|
|
|
|
final Animatable animatable) { |
|
|
|
|
|
startPostponedEnterTransition(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.build(); |
|
|
.build(); |
|
|
binding.postImage.setController(controller); |
|
|
binding.postImage.setController(controller); |
|
|
// binding.postImage.setOnClickListener(v -> toggleDetails()); |
|
|
// binding.postImage.setOnClickListener(v -> toggleDetails()); |
|
|
final AnimatedZoomableController zoomableController = AnimatedZoomableController.newInstance(); |
|
|
|
|
|
|
|
|
final AnimatedZoomableController zoomableController = (AnimatedZoomableController) binding.postImage.getZoomableController(); |
|
|
zoomableController.setMaxScaleFactor(3f); |
|
|
zoomableController.setMaxScaleFactor(3f); |
|
|
zoomableController.setGestureZoomEnabled(true); |
|
|
zoomableController.setGestureZoomEnabled(true); |
|
|
zoomableController.setEnabled(true); |
|
|
zoomableController.setEnabled(true); |
|
|
binding.postImage.setZoomableController(zoomableController); |
|
|
|
|
|
|
|
|
binding.postImage.setZoomingEnabled(true); |
|
|
binding.postImage.setTapListener(new GestureDetector.SimpleOnGestureListener() { |
|
|
binding.postImage.setTapListener(new GestureDetector.SimpleOnGestureListener() { |
|
|
@Override |
|
|
@Override |
|
|
public boolean onSingleTapUp(final MotionEvent e) { |
|
|
public boolean onSingleTapUp(final MotionEvent e) { |
|
|
toggleDetails(); |
|
|
|
|
|
|
|
|
// toggleDetails(); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
binding.postImage.setAllowTouchInterceptionWhileZoomed(true); |
|
|
|
|
|
|
|
|
// binding.postImage.setAllowTouchInterceptionWhileZoomed(true); |
|
|
// binding.postImage.setOnVerticalDragListener(onVerticalDragListener); |
|
|
// binding.postImage.setOnVerticalDragListener(onVerticalDragListener); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1052,9 +766,26 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
// binding.playerControls.getRoot().setVisibility(View.GONE); |
|
|
// binding.playerControls.getRoot().setVisibility(View.GONE); |
|
|
binding.sliderParent.setVisibility(View.VISIBLE); |
|
|
binding.sliderParent.setVisibility(View.VISIBLE); |
|
|
binding.mediaCounter.setVisibility(View.VISIBLE); |
|
|
binding.mediaCounter.setVisibility(View.VISIBLE); |
|
|
if (!wasPaused && sharedMainPostElement != null) { |
|
|
|
|
|
addSharedElement(sharedMainPostElement, binding.sliderParent); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
final Pair<Integer, Integer> maxHW = media |
|
|
|
|
|
.getCarouselMedia() |
|
|
|
|
|
.stream() |
|
|
|
|
|
.reduce(new Pair<>(0, 0), |
|
|
|
|
|
(prev, m) -> { |
|
|
|
|
|
final int height = m.getOriginalHeight() > prev.first ? m.getOriginalHeight() : prev.first; |
|
|
|
|
|
final int width = m.getOriginalWidth() > prev.second ? m.getOriginalWidth() : prev.second; |
|
|
|
|
|
return new Pair<>(height, width); |
|
|
|
|
|
}, |
|
|
|
|
|
(p1, p2) -> { |
|
|
|
|
|
final int height = p1.first > p2.first ? p1.first : p2.first; |
|
|
|
|
|
final int width = p1.second > p2.second ? p1.second : p2.second; |
|
|
|
|
|
return new Pair<>(height, width); |
|
|
|
|
|
}); |
|
|
|
|
|
final ViewGroup.LayoutParams layoutParams = binding.sliderParent.getLayoutParams(); |
|
|
|
|
|
final Pair<Integer, Integer> widthHeight = NumberUtils.calculateWidthHeight(maxHW.first, |
|
|
|
|
|
maxHW.second, |
|
|
|
|
|
(int) (Utils.displayMetrics.heightPixels * 0.8), |
|
|
|
|
|
Utils.displayMetrics.widthPixels); |
|
|
|
|
|
layoutParams.height = widthHeight.second; |
|
|
final boolean hasVideo = media.getCarouselMedia() |
|
|
final boolean hasVideo = media.getCarouselMedia() |
|
|
.stream() |
|
|
.stream() |
|
|
.anyMatch(postChild -> postChild.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO); |
|
|
.anyMatch(postChild -> postChild.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO); |
|
@ -1078,7 +809,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onItemClicked(final int position) { |
|
|
public void onItemClicked(final int position) { |
|
|
toggleDetails(); |
|
|
|
|
|
|
|
|
// toggleDetails(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -1095,8 +826,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
final FragmentActivity activity = getActivity(); |
|
|
final FragmentActivity activity = getActivity(); |
|
|
if (activity == null) return; |
|
|
if (activity == null) return; |
|
|
Utils.disableKeepScreenOn(activity); |
|
|
Utils.disableKeepScreenOn(activity); |
|
|
if (detailsVisible || hasBeenToggled) return; |
|
|
|
|
|
toggleDetails(); |
|
|
|
|
|
|
|
|
// if (detailsVisible || hasBeenToggled) return; |
|
|
|
|
|
// toggleDetails(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -1135,7 +866,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
final String text = (position + 1) + "/" + size; |
|
|
final String text = (position + 1) + "/" + size; |
|
|
binding.mediaCounter.setText(text); |
|
|
binding.mediaCounter.setText(text); |
|
|
final Media childMedia = media.getCarouselMedia().get(position); |
|
|
final Media childMedia = media.getCarouselMedia().get(position); |
|
|
final View view = binding.sliderParent.getChildAt(0); |
|
|
|
|
|
|
|
|
// final View view = binding.sliderParent.getChildAt(0); |
|
|
// if (prevPosition != -1) { |
|
|
// if (prevPosition != -1) { |
|
|
// if (view instanceof RecyclerView) { |
|
|
// if (view instanceof RecyclerView) { |
|
|
// final RecyclerView.ViewHolder viewHolder = ((RecyclerView) view).findViewHolderForAdapterPosition(prevPosition); |
|
|
// final RecyclerView.ViewHolder viewHolder = ((RecyclerView) view).findViewHolderForAdapterPosition(prevPosition); |
|
@ -1203,32 +934,17 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
binding.sliderParent.setVisibility(View.GONE); |
|
|
binding.sliderParent.setVisibility(View.GONE); |
|
|
binding.mediaCounter.setVisibility(View.GONE); |
|
|
binding.mediaCounter.setVisibility(View.GONE); |
|
|
// binding.playerControls.getRoot().setVisibility(View.VISIBLE); |
|
|
// binding.playerControls.getRoot().setVisibility(View.VISIBLE); |
|
|
if (!wasPaused && sharedMainPostElement != null) { |
|
|
|
|
|
final GenericDraweeHierarchy hierarchy = binding.videoPost.thumbnail.getHierarchy(); |
|
|
|
|
|
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP); |
|
|
|
|
|
addSharedElement(sharedMainPostElement, binding.videoPost.thumbnailParent); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
final ViewGroup.LayoutParams layoutParams = binding.videoPost.root.getLayoutParams(); |
|
|
|
|
|
final Pair<Integer, Integer> widthHeight = NumberUtils.calculateWidthHeight(media.getOriginalHeight(), |
|
|
|
|
|
media.getOriginalWidth(), |
|
|
|
|
|
(int) (Utils.displayMetrics.heightPixels * 0.8), |
|
|
|
|
|
Utils.displayMetrics.widthPixels); |
|
|
|
|
|
layoutParams.height = widthHeight.second; |
|
|
binding.videoPost.root.setVisibility(View.VISIBLE); |
|
|
binding.videoPost.root.setVisibility(View.VISIBLE); |
|
|
// final VerticalDragHelper thumbnailVerticalDragHelper = new VerticalDragHelper(binding.videoPost.thumbnailParent); |
|
|
|
|
|
// final VerticalDragHelper playerVerticalDragHelper = new VerticalDragHelper(binding.videoPost.playerView); |
|
|
|
|
|
// thumbnailVerticalDragHelper.setOnVerticalDragListener(onVerticalDragListener); |
|
|
|
|
|
// playerVerticalDragHelper.setOnVerticalDragListener(onVerticalDragListener); |
|
|
|
|
|
// enablePlayerControls(true); |
|
|
// enablePlayerControls(true); |
|
|
// binding.videoPost.thumbnailParent.setOnTouchListener((v, event) -> { |
|
|
|
|
|
// final boolean onDragTouch = thumbnailVerticalDragHelper.onDragTouch(event); |
|
|
|
|
|
// if (onDragTouch) { |
|
|
|
|
|
// return true; |
|
|
|
|
|
// } |
|
|
|
|
|
// return thumbnailVerticalDragHelper.onGestureTouchEvent(event); |
|
|
|
|
|
// }); |
|
|
|
|
|
// binding.videoPost.playerView.setOnTouchListener((v, event) -> { |
|
|
|
|
|
// final boolean onDragTouch = playerVerticalDragHelper.onDragTouch(event); |
|
|
|
|
|
// if (onDragTouch) { |
|
|
|
|
|
// return true; |
|
|
|
|
|
// } |
|
|
|
|
|
// return playerVerticalDragHelper.onGestureTouchEvent(event); |
|
|
|
|
|
// }); |
|
|
|
|
|
binding.videoPost.playerView.setOnClickListener(v -> toggleDetails()); |
|
|
|
|
|
|
|
|
// binding.videoPost.playerView.setOnClickListener(v -> toggleDetails()); |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
final GestureDetector gestureDetector = new GestureDetector(context, videoPlayerViewGestureListener); |
|
|
final GestureDetector gestureDetector = new GestureDetector(context, videoPlayerViewGestureListener); |
|
|
binding.videoPost.playerView.setOnTouchListener((v, event) -> { |
|
|
binding.videoPost.playerView.setOnTouchListener((v, event) -> { |
|
|
gestureDetector.onTouchEvent(event); |
|
|
gestureDetector.onTouchEvent(event); |
|
@ -1258,9 +974,9 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
final FragmentActivity activity = getActivity(); |
|
|
final FragmentActivity activity = getActivity(); |
|
|
if (activity == null) return; |
|
|
if (activity == null) return; |
|
|
Utils.enabledKeepScreenOn(activity); |
|
|
Utils.enabledKeepScreenOn(activity); |
|
|
if (detailsVisible) { |
|
|
|
|
|
new Handler().postDelayed(() -> toggleDetails(), DETAILS_HIDE_DELAY_MILLIS); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if (detailsVisible) { |
|
|
|
|
|
// new Handler().postDelayed(() -> toggleDetails(), DETAILS_HIDE_DELAY_MILLIS); |
|
|
|
|
|
// } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -1318,10 +1034,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
// hidePlayerControls(); |
|
|
// hidePlayerControls(); |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
private void hideCaption() { |
|
|
|
|
|
if (bottomSheetBehavior == null) return; |
|
|
|
|
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// private void hideCaption() { |
|
|
|
|
|
// if (bottomSheetBehavior == null) return; |
|
|
|
|
|
// bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
// private void showPlayerControls() { |
|
|
// private void showPlayerControls() { |
|
|
// hideCaption(); |
|
|
// hideCaption(); |
|
@ -1400,6 +1116,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
|
|
|
|
|
|
private void createOptionsPopupMenu() { |
|
|
private void createOptionsPopupMenu() { |
|
|
if (optionsPopup == null) { |
|
|
if (optionsPopup == null) { |
|
|
|
|
|
final Context context = getContext(); |
|
|
|
|
|
if (context == null) return; |
|
|
final ContextThemeWrapper themeWrapper = new ContextThemeWrapper(context, R.style.popupMenuStyle); |
|
|
final ContextThemeWrapper themeWrapper = new ContextThemeWrapper(context, R.style.popupMenuStyle); |
|
|
optionsPopup = new PopupMenu(themeWrapper, binding.options); |
|
|
optionsPopup = new PopupMenu(themeWrapper, binding.options); |
|
|
} else { |
|
|
} else { |
|
@ -1526,18 +1244,18 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
binding.profilePic.setVisibility(View.GONE); |
|
|
binding.profilePic.setVisibility(View.GONE); |
|
|
binding.title.setVisibility(View.GONE); |
|
|
binding.title.setVisibility(View.GONE); |
|
|
binding.subtitle.setVisibility(View.GONE); |
|
|
binding.subtitle.setVisibility(View.GONE); |
|
|
binding.topBg.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
// binding.topBg.setVisibility(View.GONE); |
|
|
} |
|
|
} |
|
|
if (media.getLocation() != null) { |
|
|
if (media.getLocation() != null) { |
|
|
binding.location.setVisibility(View.GONE); |
|
|
binding.location.setVisibility(View.GONE); |
|
|
} |
|
|
} |
|
|
binding.captionParent.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
// binding.captionParent.setVisibility(View.GONE); |
|
|
binding.bottomBg.setVisibility(View.GONE); |
|
|
binding.bottomBg.setVisibility(View.GONE); |
|
|
binding.likesCount.setVisibility(View.GONE); |
|
|
binding.likesCount.setVisibility(View.GONE); |
|
|
binding.commentsCount.setVisibility(View.GONE); |
|
|
binding.commentsCount.setVisibility(View.GONE); |
|
|
binding.date.setVisibility(View.GONE); |
|
|
binding.date.setVisibility(View.GONE); |
|
|
binding.comment.setVisibility(View.GONE); |
|
|
binding.comment.setVisibility(View.GONE); |
|
|
binding.captionToggle.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
// binding.captionToggle.setVisibility(View.GONE); |
|
|
// binding.playerControlsToggle.setVisibility(View.GONE); |
|
|
// binding.playerControlsToggle.setVisibility(View.GONE); |
|
|
binding.like.setVisibility(View.GONE); |
|
|
binding.like.setVisibility(View.GONE); |
|
|
binding.save.setVisibility(View.GONE); |
|
|
binding.save.setVisibility(View.GONE); |
|
@ -1559,7 +1277,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
binding.profilePic.setVisibility(View.VISIBLE); |
|
|
binding.profilePic.setVisibility(View.VISIBLE); |
|
|
binding.title.setVisibility(View.VISIBLE); |
|
|
binding.title.setVisibility(View.VISIBLE); |
|
|
binding.subtitle.setVisibility(View.VISIBLE); |
|
|
binding.subtitle.setVisibility(View.VISIBLE); |
|
|
binding.topBg.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
|
// binding.topBg.setVisibility(View.VISIBLE); |
|
|
} |
|
|
} |
|
|
if (media.getLocation() != null) { |
|
|
if (media.getLocation() != null) { |
|
|
binding.location.setVisibility(View.VISIBLE); |
|
|
binding.location.setVisibility(View.VISIBLE); |
|
@ -1568,8 +1286,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
if (viewModel.hasPk()) { |
|
|
if (viewModel.hasPk()) { |
|
|
binding.likesCount.setVisibility(View.VISIBLE); |
|
|
binding.likesCount.setVisibility(View.VISIBLE); |
|
|
binding.date.setVisibility(View.VISIBLE); |
|
|
binding.date.setVisibility(View.VISIBLE); |
|
|
binding.captionParent.setVisibility(View.VISIBLE); |
|
|
|
|
|
binding.captionToggle.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
|
// binding.captionParent.setVisibility(View.VISIBLE); |
|
|
|
|
|
// binding.captionToggle.setVisibility(View.VISIBLE); |
|
|
binding.share.setVisibility(View.VISIBLE); |
|
|
binding.share.setVisibility(View.VISIBLE); |
|
|
} |
|
|
} |
|
|
if (viewModel.hasPk() && !viewModel.getMedia().isCommentsDisabled()) { |
|
|
if (viewModel.hasPk() && !viewModel.getMedia().isCommentsDisabled()) { |
|
@ -1599,16 +1317,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// private void animateY(final View v, |
|
|
|
|
|
// final float finalY, |
|
|
|
|
|
// final int duration, |
|
|
|
|
|
// final AnimatorListenerAdapter listener) { |
|
|
|
|
|
// v.animate() |
|
|
|
|
|
// .y(finalY) |
|
|
|
|
|
// .setDuration(duration) |
|
|
|
|
|
// .setListener(listener).start(); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
private void navigateToProfile(final String username) { |
|
|
private void navigateToProfile(final String username) { |
|
|
final NavController navController = getNavController(); |
|
|
final NavController navController = getNavController(); |
|
|
if (navController == null) return; |
|
|
if (navController == null) return; |
|
|