mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Center the FloatingActionButton in PostGalleryActivity.
This commit is contained in:
parent
89704cd652
commit
b382ebecc3
@ -9,6 +9,7 @@ import android.util.Log;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
@ -164,7 +165,19 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada
|
|||||||
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorPrimaryLightTheme()));
|
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorPrimaryLightTheme()));
|
||||||
fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor()));
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,7 @@
|
|||||||
android:id="@+id/images_recycler_view_post_gallery_activity"
|
android:id="@+id/images_recycler_view_post_gallery_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
app:spanCount="2" />
|
app:spanCount="2" />
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fab_item_gallery_submission_add_image"
|
android:id="@+id/fab_item_gallery_submission_add_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:src="@drawable/ic_outline_select_photo_24dp"
|
||||||
android:src="@drawable/ic_outline_select_photo_24dp" />
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
</LinearLayout>
|
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user