|
@ -19,6 +19,7 @@ import android.view.MotionEvent; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.widget.ArrayAdapter; |
|
|
import android.widget.ArrayAdapter; |
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.LinearLayout; |
|
|
|
|
|
import android.widget.RelativeLayout; |
|
|
import android.widget.TextView; |
|
|
import android.widget.TextView; |
|
|
import android.widget.Toast; |
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
@ -250,7 +251,7 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
|
|
|
|
|
|
final boolean postIdNull = postModel.getPostId() == null; |
|
|
final boolean postIdNull = postModel.getPostId() == null; |
|
|
if (!postIdNull) |
|
|
if (!postIdNull) |
|
|
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType()); |
|
|
|
|
|
|
|
|
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null); |
|
|
|
|
|
|
|
|
isFromShare = postModel.getPosition() == -1 || postIdNull; |
|
|
isFromShare = postModel.getPosition() == -1 || postIdNull; |
|
|
|
|
|
|
|
@ -403,7 +404,7 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
postModel.setBookmark(viewerPostModel.getBookmark()); |
|
|
postModel.setBookmark(viewerPostModel.getBookmark()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType()); |
|
|
|
|
|
|
|
|
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation()); |
|
|
|
|
|
|
|
|
postCaption = postModel.getPostCaption(); |
|
|
postCaption = postModel.getPostCaption(); |
|
|
viewerCaptionParent.setVisibility(View.VISIBLE); |
|
|
viewerCaptionParent.setVisibility(View.VISIBLE); |
|
@ -575,6 +576,10 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
|
|
|
|
|
|
private void refreshPost() { |
|
|
private void refreshPost() { |
|
|
postShortCode = postModel.getShortCode(); |
|
|
postShortCode = postModel.getShortCode(); |
|
|
|
|
|
if (containerLayoutParams.weight != 3.3f) { |
|
|
|
|
|
containerLayoutParams.weight = (viewerBinding.mediaList.getVisibility() == View.VISIBLE) ? 1.35f : 1.9f; |
|
|
|
|
|
viewerBinding.container.setLayoutParams(containerLayoutParams); |
|
|
|
|
|
} |
|
|
if (viewerBinding.mediaList.getVisibility() == View.VISIBLE) { |
|
|
if (viewerBinding.mediaList.getVisibility() == View.VISIBLE) { |
|
|
ViewerPostModel item = mediaAdapter.getItemAt(lastSlidePos); |
|
|
ViewerPostModel item = mediaAdapter.getItemAt(lastSlidePos); |
|
|
if (item != null) { |
|
|
if (item != null) { |
|
@ -604,7 +609,7 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
viewerBinding.bottomPanel.viewerCaption.setText(postCaption); |
|
|
viewerBinding.bottomPanel.viewerCaption.setText(postCaption); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType()); |
|
|
|
|
|
|
|
|
setupPostInfoBar(viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation()); |
|
|
|
|
|
|
|
|
if (postModel instanceof PostModel) { |
|
|
if (postModel instanceof PostModel) { |
|
|
final PostModel postModel = (PostModel) this.postModel; |
|
|
final PostModel postModel = (PostModel) this.postModel; |
|
@ -654,7 +659,7 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType) { |
|
|
|
|
|
|
|
|
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final String location) { |
|
|
if (prevUsername == null || !prevUsername.equals(from)) { |
|
|
if (prevUsername == null || !prevUsername.equals(from)) { |
|
|
viewerBinding.topPanel.ivProfilePic.setImageBitmap(null); |
|
|
viewerBinding.topPanel.ivProfilePic.setImageBitmap(null); |
|
|
viewerBinding.topPanel.ivProfilePic.setImageDrawable(null); |
|
|
viewerBinding.topPanel.ivProfilePic.setImageDrawable(null); |
|
@ -707,6 +712,20 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
spannableString.setSpan(new CommentMentionClickSpan(), titleLen - from.length() - 1, titleLen - 1, 0); |
|
|
spannableString.setSpan(new CommentMentionClickSpan(), titleLen - from.length() - 1, titleLen - 1, 0); |
|
|
viewerBinding.topPanel.title.setText(spannableString); |
|
|
viewerBinding.topPanel.title.setText(spannableString); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (location == null) { |
|
|
|
|
|
viewerBinding.topPanel.location.setVisibility(View.GONE); |
|
|
|
|
|
viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams( |
|
|
|
|
|
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT |
|
|
|
|
|
)); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
viewerBinding.topPanel.location.setVisibility(View.VISIBLE); |
|
|
|
|
|
viewerBinding.topPanel.location.setText(location); |
|
|
|
|
|
viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams( |
|
|
|
|
|
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT |
|
|
|
|
|
)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void toggleFullscreen() { |
|
|
private void toggleFullscreen() { |
|
@ -755,13 +774,13 @@ public final class PostViewer extends BaseLanguageActivity { |
|
|
@Override |
|
|
@Override |
|
|
protected void onPostExecute(Void result) { |
|
|
protected void onPostExecute(Void result) { |
|
|
if (ok == true && action == "likes") { |
|
|
if (ok == true && action == "likes") { |
|
|
postModel.setLike(!postModel.getLike()); |
|
|
|
|
|
viewerPostModel.setManualLike(!postModel.getLike()); |
|
|
|
|
|
|
|
|
postModel.setLike(!viewerPostModel.getLike()); |
|
|
|
|
|
viewerPostModel.setManualLike(!viewerPostModel.getLike()); |
|
|
refreshPost(); |
|
|
refreshPost(); |
|
|
} |
|
|
} |
|
|
else if (ok == true && action == "save") { |
|
|
else if (ok == true && action == "save") { |
|
|
viewerPostModel.setBookmark(!postModel.getBookmark()); |
|
|
|
|
|
postModel.setBookmark(!postModel.getBookmark()); |
|
|
|
|
|
|
|
|
viewerPostModel.setBookmark(!viewerPostModel.getBookmark()); |
|
|
|
|
|
postModel.setBookmark(!viewerPostModel.getBookmark()); |
|
|
refreshPost(); |
|
|
refreshPost(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|