aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-16 12:32:05 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-16 12:32:05 +0000
commitb382ebecc3703569fff15d93bba90ad36f1f1298 (patch)
treef3e041469f332fcd505612323fcb16461fb38f72 /app/src/main/java/ml/docilealligator/infinityforreddit
parent89704cd6523cbd751a88a5c43c36e4958f44e178 (diff)
downloadinfinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.tar
infinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.tar.gz
infinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.tar.bz2
infinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.tar.lz
infinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.tar.xz
infinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.tar.zst
infinity-for-reddit-b382ebecc3703569fff15d93bba90ad36f1f1298.zip
Center the FloatingActionButton in PostGalleryActivity.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java
index 87853c93..97509970 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java
@@ -9,6 +9,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.ProgressBar;
@@ -164,7 +165,19 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorPrimaryLightTheme()));
fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor()));
- itemView.setOnClickListener(view -> itemClickListener.onAddImageClicked());
+ itemView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ itemView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ int width = itemView.getMeasuredWidth();
+ ViewGroup.LayoutParams params = itemView.getLayoutParams();
+ params.height = width;
+ itemView.setLayoutParams(params);
+ }
+ });
+
+ fab.setOnClickListener(view -> itemClickListener.onAddImageClicked());
+ itemView.setOnClickListener(view -> fab.performClick());
}
}