Skip to content

Commit

Permalink
Replace CircleImageView with ShapeableImageView
Browse files Browse the repository at this point in the history
  • Loading branch information
TacoTheDank committed Feb 23, 2022
1 parent c42f294 commit 1a000fe
Show file tree
Hide file tree
Showing 21 changed files with 95 additions and 51 deletions.
2 changes: 0 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ dependencies {
implementation "com.github.lisawray.groupie:groupie:${groupieVersion}"
implementation "com.github.lisawray.groupie:groupie-viewbinding:${groupieVersion}"

// Circular ImageView
implementation "de.hdodenhof:circleimageview:3.1.0"
// Image loading
//noinspection GradleDependency --> 2.8 is the last version, not 2.71828!
implementation "com.squareup.picasso:picasso:2.8"
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ class AboutActivity : AppCompatActivity() {
"AndroidX", "2005 - 2011", "The Android Open Source Project",
"https://developer.android.com/jetpack", StandardLicenses.APACHE2
),
SoftwareComponent(
"CircleImageView", "2014 - 2020", "Henning Dodenhof",
"https://github.com/hdodenhof/CircleImageView", StandardLicenses.APACHE2
),
SoftwareComponent(
"ExoPlayer", "2014 - 2020", "Google, Inc.",
"https://github.com/google/ExoPlayer", StandardLicenses.APACHE2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
Expand All @@ -19,6 +20,10 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;

import com.google.android.material.shape.CornerFamily;
import com.google.android.material.shape.ShapeAppearanceModel;

import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
Expand Down Expand Up @@ -328,9 +333,14 @@ public void handleResult(@NonNull final PlaylistInfo result) {
&& (YoutubeParsingHelper.isYoutubeMixId(result.getId())
|| YoutubeParsingHelper.isYoutubeMusicMixId(result.getId()))) {
// this is an auto-generated playlist (e.g. Youtube mix), so a radio is shown
headerBinding.uploaderAvatarView.setDisableCircularTransformation(true);
headerBinding.uploaderAvatarView.setBorderColor(
getResources().getColor(R.color.transparent_background_color));
final ShapeAppearanceModel model = ShapeAppearanceModel.builder()
.setAllCorners(CornerFamily.ROUNDED, 0f)
.build(); // this turns the image back into a square
headerBinding.uploaderAvatarView.setShapeAppearanceModel(model);
headerBinding.uploaderAvatarView.setStrokeColor(
ColorStateList.valueOf(ContextCompat.getColor(
requireContext(), R.color.transparent_background_color))
);
headerBinding.uploaderAvatarView.setImageDrawable(
AppCompatResources.getDrawable(requireContext(),
R.drawable.ic_radio)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.schabi.newpipe.info_list.holder;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import org.schabi.newpipe.R;
Expand All @@ -11,10 +12,8 @@
import org.schabi.newpipe.util.PicassoHelper;
import org.schabi.newpipe.util.Localization;

import de.hdodenhof.circleimageview.CircleImageView;

public class ChannelMiniInfoItemHolder extends InfoItemHolder {
public final CircleImageView itemThumbnailView;
public final ImageView itemThumbnailView;
public final TextView itemTitleView;
private final TextView itemAdditionalDetailView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

Expand All @@ -28,8 +29,6 @@

import java.util.regex.Matcher;

import de.hdodenhof.circleimageview.CircleImageView;

public class CommentsMiniInfoItemHolder extends InfoItemHolder {
private static final String TAG = "CommentsMiniIIHolder";

Expand All @@ -40,7 +39,7 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
private final int commentVerticalPadding;

private final RelativeLayout itemRoot;
public final CircleImageView itemThumbnailView;
public final ImageView itemThumbnailView;
private final TextView itemContentView;
private final TextView itemLikesCountView;
private final TextView itemPublishedTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

Expand All @@ -24,7 +25,6 @@
import java.util.List;
import java.util.Vector;

import de.hdodenhof.circleimageview.CircleImageView;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
Expand Down Expand Up @@ -200,7 +200,7 @@ public int getItemCount() {

public class SelectChannelItemHolder extends RecyclerView.ViewHolder {
public final View view;
final CircleImageView thumbnailView;
final ImageView thumbnailView;
final TextView titleView;
SelectChannelItemHolder(final View v) {
super(v);
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout-large-land/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,21 +266,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/detail_uploader_thumbnail_view"
android:layout_width="@dimen/video_item_detail_uploader_image_size"
android:layout_height="@dimen/video_item_detail_uploader_image_size"
android:contentDescription="@string/detail_uploader_thumbnail_view_description"
android:src="@drawable/buddy" />
android:src="@drawable/buddy"
app:shapeAppearance="@style/CircularImageView" />

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/detail_sub_channel_thumbnail_view"
android:layout_width="@dimen/video_item_detail_sub_channel_image_size"
android:layout_height="@dimen/video_item_detail_sub_channel_image_size"
android:layout_gravity="bottom|right"
android:contentDescription="@string/detail_sub_channel_thumbnail_view_description"
android:src="@drawable/buddy"
android:visibility="gone"
app:shapeAppearance="@style/CircularImageView"
tools:visibility="visible" />

</FrameLayout>
Expand Down
16 changes: 10 additions & 6 deletions app/src/main/res/layout/channel_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,27 @@
android:layout_marginLeft="8dp"
android:layout_marginTop="50dp">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/channel_avatar_view"
android:layout_width="@dimen/channel_avatar_size"
android:layout_height="@dimen/channel_avatar_size"
android:padding="1dp"
android:src="@drawable/buddy"
app:civ_border_color="#ffffff"
app:civ_border_width="2dp" />
app:shapeAppearance="@style/CircularImageView"
app:strokeColor="#ffffff"
app:strokeWidth="2dp" />

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/sub_channel_avatar_view"
android:layout_width="@dimen/sub_channel_avatar_size"
android:layout_height="@dimen/sub_channel_avatar_size"
android:layout_gravity="bottom|right"
android:padding="1dp"
android:src="@drawable/buddy"
android:visibility="gone"
app:civ_border_color="#ffffff"
app:civ_border_width="2dp"
app:shapeAppearance="@style/CircularImageView"
app:strokeColor="#ffffff"
app:strokeWidth="2dp"
tools:ignore="RtlHardcoded"
tools:visibility="visible" />
</FrameLayout>
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/detail_uploader_thumbnail_view"
android:layout_width="@dimen/video_item_detail_uploader_image_size"
android:layout_height="@dimen/video_item_detail_uploader_image_size"
android:contentDescription="@string/detail_uploader_thumbnail_view_description"
android:src="@drawable/buddy" />
android:src="@drawable/buddy"
app:shapeAppearance="@style/CircularImageView" />

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/detail_sub_channel_thumbnail_view"
android:layout_width="@dimen/video_item_detail_sub_channel_image_size"
android:layout_height="@dimen/video_item_detail_sub_channel_image_size"
android:layout_gravity="bottom|right"
android:contentDescription="@string/detail_sub_channel_thumbnail_view_description"
android:src="@drawable/buddy"
android:visibility="gone"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded"
tools:visibility="visible" />

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/list_channel_grid_item.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/itemRoot"
android:layout_width="match_parent"
Expand All @@ -10,14 +11,15 @@
android:minWidth="@dimen/channel_item_grid_min_width"
android:padding="@dimen/channel_item_grid_padding">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/itemThumbnailView"
android:layout_width="@dimen/channel_item_grid_thumbnail_image_size"
android:layout_height="@dimen/channel_item_grid_thumbnail_image_size"
android:layout_centerHorizontal="true"
android:layout_margin="2dp"
android:contentDescription="@string/detail_uploader_thumbnail_view_description"
android:src="@drawable/buddy_channel_item"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded" />

<TextView
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/res/layout/list_channel_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@
app:layout_constraintTop_toBottomOf="@+id/itemChannelDescriptionView"
tools:text="10M subscribers • 1000 videos" />

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/itemThumbnailView"
android:layout_width="@dimen/video_item_search_thumbnail_image_width"
android:layout_height="@dimen/video_item_search_thumbnail_image_height"
android:layout_marginRight="@dimen/video_item_search_image_right_margin"
android:layout_width="@dimen/video_item_search_avatar_image_width"
android:layout_height="@dimen/video_item_search_avatar_image_height"
android:layout_marginLeft="@dimen/video_item_search_avatar_left_margin"
android:layout_marginRight="@dimen/video_item_search_avatar_right_margin"
android:src="@drawable/buddy"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/itemTitleView"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded" />

</androidx.constraintlayout.widget.ConstraintLayout>
9 changes: 6 additions & 3 deletions app/src/main/res/layout/list_channel_mini_item.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/itemRoot"
android:layout_width="match_parent"
Expand All @@ -9,13 +10,15 @@
android:focusable="true"
android:padding="@dimen/video_item_search_padding">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/itemThumbnailView"
android:layout_width="48dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_marginStart="3dp"
android:layout_marginRight="15dp"
android:src="@drawable/buddy_channel_item"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded" />

<TextView
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/list_comments_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
android:focusable="true"
android:padding="@dimen/comments_vertical_padding">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/itemThumbnailView"
android:layout_width="48dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/video_item_search_image_right_margin"
android:layout_marginLeft="3dp"
android:layout_marginRight="@dimen/comment_item_avatar_right_margin"
android:focusable="false"
android:src="@drawable/buddy"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded" />

<ImageView
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/list_comments_mini_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
android:focusable="true"
android:padding="@dimen/video_item_search_padding">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/itemThumbnailView"
android:layout_width="48dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_marginStart="3dp"
android:layout_marginRight="15dp"
android:src="@drawable/buddy_channel_item"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded" />


Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/picker_subscription_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
android:orientation="vertical"
android:padding="4dp">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/thumbnail_view"
android:layout_width="48dp"
android:layout_height="48dp"
app:shapeAppearance="@style/CircularImageView"
tools:src="@drawable/buddy_channel_item" />

<org.schabi.newpipe.views.NewPipeTextView
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/playlist_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@
tools:ignore="RtlHardcoded"
tools:visibility="visible">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/uploader_avatar_view"
android:layout_width="@dimen/playlist_detail_uploader_image_size"
android:layout_height="@dimen/playlist_detail_uploader_image_size"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="0.7dp"
android:src="@drawable/buddy"
app:civ_border_color="#ffffff"
app:civ_border_width="1dp" />
app:shapeAppearance="@style/CircularImageView"
app:strokeColor="#ffffff"
app:strokeWidth="1dp" />

<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/uploader_name"
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/res/layout/select_channel_item.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -9,15 +10,17 @@
android:orientation="vertical"
android:padding="5dp">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/itemThumbnailView"
android:layout_width="48dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="5dp"
android:layout_marginStart="3dp"
android:layout_marginRight="8dp"
android:src="@drawable/buddy"
app:shapeAppearance="@style/CircularImageView"
tools:ignore="RtlHardcoded" />

<org.schabi.newpipe.views.NewPipeTextView
Expand Down
Loading

0 comments on commit 1a000fe

Please sign in to comment.