Skip to content

Commit

Permalink
close #89
Browse files Browse the repository at this point in the history
  • Loading branch information
ramack committed Oct 19, 2019
1 parent 4918f60 commit c98a896
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Expand Up @@ -33,10 +33,7 @@ public ImageViewBindingAdapter(Picasso picasso) {
} }


@BindingAdapter("android:src") public void loadImage(ImageView imageView, String url) { @BindingAdapter("android:src") public void loadImage(ImageView imageView, String url) {
picasso.load(url) picasso.load(url).into(imageView); // centering and cropping is done by ImageView from the resources
.fit()
.centerCrop()
.into(imageView);
} }


@BindingAdapter("heightRatio") public void setHeighRatio(ImageView imageView, double ratio) { @BindingAdapter("heightRatio") public void setHeighRatio(ImageView imageView, double ratio) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/piwigo/ui/main/AlbumsViewModel.java
Expand Up @@ -131,7 +131,7 @@ public void onError(Throwable e) {
// NO: NEVER throw an exception here // NO: NEVER throw an exception here
// throw new RuntimeException(e); // throw new RuntimeException(e);
Log.e(TAG, "CategoriesSubscriber: " + e.getMessage()); Log.e(TAG, "CategoriesSubscriber: " + e.getMessage());
// TODO: highlight problem to the user // TODO: #161 highlight problem to the user
} }
} }


Expand Down Expand Up @@ -182,7 +182,7 @@ public void onError(Throwable e) {
// NO: NEVER throw an exception here // NO: NEVER throw an exception here
// throw new RuntimeException(e); // throw new RuntimeException(e);
Log.e(TAG, "ImagesSubscriber: " + e.getMessage()); Log.e(TAG, "ImagesSubscriber: " + e.getMessage());
// TODO: highlight problem to the user // TODO: #161 highlight problem to the user
} }
} }


Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout/item_album.xml
Expand Up @@ -24,7 +24,10 @@
android:src="@{viewModel.url}" android:src="@{viewModel.url}"
android:contentDescription="@{viewModel.title}" android:contentDescription="@{viewModel.title}"
android:onClick="@{viewModel::onClickDo}" android:onClick="@{viewModel::onClickDo}"
app:heightRatio="@{0.66}" /> app:heightRatio="@{0.66}"
android:cropToPadding="false"
android:scaleType="centerCrop"
/>


<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/layout/item_images.xml
Expand Up @@ -42,12 +42,13 @@
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true" android:adjustViewBounds="false"
android:src="@{viewModel.url}"
android:contentDescription="@{viewModel.title}" android:contentDescription="@{viewModel.title}"
android:cropToPadding="false"
android:onClick="@{viewModel::onClickDo}" android:onClick="@{viewModel::onClickDo}"
app:heightRatio="@{1}" android:scaleType="centerCrop"
/> android:src="@{viewModel.url}"
app:heightRatio="@{1}" />


</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
</layout> </layout>

0 comments on commit c98a896

Please sign in to comment.