Skip to content

Commit

Permalink
Fix part of #3258 : Replacing CircularImageView with ShapeableImageVi…
Browse files Browse the repository at this point in the history
…ew (#4155)

* Fix part of #3258 : Replacing CircularImageView with ShapeableImageView

* Updated bazel version

* Updated maven_install.json

* Added missing appearance overlay property in some files

* Added missing appearance overlay property in some files

* Added comment to style.xml and removed blank line

* Syncing with latest develop branch

* added elevation

* decreased elevation

* decreased elevation and replaced CircularImageView with
ShapeableImageView in nav_header_navigation_drawer.xml

* added comment for style

* empty_commit

* empty_commit

* maven_install

* Update maven_install.json to latest version

* added corner_family

* added comment for shapeableimageview

* changed style name
  • Loading branch information
bhaktideshmukh authored Apr 20, 2022
1 parent 5ae96db commit 5221bfc
Show file tree
Hide file tree
Showing 21 changed files with 266 additions and 133 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ dependencies {
'androidx.work:work-runtime-ktx:2.4.0',
'com.github.bumptech.glide:glide:4.11.0',
'com.google.android.flexbox:flexbox:3.0.0',
'com.google.android.material:material:1.2.0-alpha02',
'com.google.android.material:material:1.2.0',
'com.google.dagger:dagger:2.24',
'com.google.firebase:firebase-analytics:17.5.0',
'com.google.firebase:firebase-analytics-ktx:17.5.0',
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout-land/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_margin : @dimen/profile_chooser_add_view_margin_bottom_profile_not_added}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_add_view_margin_top_profile_already_added : @dimen/profile_chooser_add_view_margin_top_profile_not_added}">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_add_button"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginBottom="8dp"
app:srcCompat="@{@drawable/ic_add_profile}"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp" />
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp" />

<TextView
android:id="@+id/add_profile_text"
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout-land/profile_chooser_profile_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_avatar_img"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginBottom="8dp"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp"
profile:src="@{viewModel.profile.avatar}" />

<LinearLayout
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout-land/profile_edit_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_edit_image"
android:layout_width="90dp"
android:layout_height="90dp"
Expand All @@ -43,6 +43,7 @@
android:translationZ="4dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{viewModel.profile.avatar}" />

<TextView
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout-land/profile_progress_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:paddingTop="32dp"
android:paddingEnd="16dp">

<com.jackandphantom.circularimageview.CircleImage
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_edit_image"
android:layout_width="160dp"
android:layout_height="160dp"
Expand All @@ -29,10 +29,12 @@
android:contentDescription="@string/current_profile_picture_content_description"
android:focusable="true"
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:elevation="4dp"
app:add_shadow="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shadow_radius="8"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{viewModel.profile.avatar}" />

<ImageView
Expand All @@ -42,6 +44,7 @@
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:paddingStart="12dp"
android:paddingTop="12dp"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="@+id/profile_edit_image"
app:layout_constraintEnd_toEndOf="@+id/profile_edit_image"
app:srcCompat="@drawable/rounded_white_background_with_shadow" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
android:paddingStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/profile_chooser_add_view_margin_start_profile_not_added}"
tools:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_add_button"
android:layout_width="108dp"
android:layout_height="108dp"
app:srcCompat="@{@drawable/ic_add_profile}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_add_view_circular_image_margin_top_profile_already_added : @dimen/space_0dp}"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp" />
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape" />

<LinearLayout
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
app:layout_constraintTop_toTopOf="parent"
profile:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_avatar_img"
android:layout_width="108dp"
android:layout_height="108dp"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp"
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_circular_image_margin_top_profile_already_added : @dimen/space_0dp}"
profile:src="@{viewModel.profile.avatar}" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@
android:paddingStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/profile_chooser_add_view_margin_start_profile_not_added}"
tools:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_add_button"
android:layout_width="108dp"
android:layout_height="108dp"
app:srcCompat="@{@drawable/ic_add_profile}"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_add_view_circular_image_margin_top_profile_already_added : @dimen/space_0dp}"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp" />
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp" />

<LinearLayout
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@
android:layout_height="wrap_content"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}"
android:orientation="@{hasProfileEverBeenAddedValue ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}"
android:paddingEnd="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_end_profile_already_added : @dimen/profile_view_not_added_margin}"
android:paddingStart="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_start_profile_already_added : @dimen/profile_view_not_added_margin}"
android:paddingEnd="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_end_profile_already_added : @dimen/profile_view_not_added_margin}"
android:paddingStart="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_start_profile_already_added : @dimen/profile_view_not_added_margin}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/profile_chooser_profile_view_margin_top_profile_not_added}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
profile:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_avatar_img"
android:layout_width="108dp"
android:layout_height="108dp"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp"
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_circular_image_margin_top_profile_already_added : @dimen/space_0dp}"
profile:src="@{viewModel.profile.avatar}" />

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout-sw600dp/profile_progress_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:importantForAccessibility="no"
android:paddingTop="92dp">

<com.jackandphantom.circularimageview.CircleImage
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_edit_image"
android:layout_width="160dp"
android:layout_height="160dp"
Expand All @@ -28,10 +28,12 @@
android:contentDescription="@string/current_profile_picture_content_description"
android:focusable="true"
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:elevation="4dp"
app:add_shadow="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shadow_radius="8"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{viewModel.profile.avatar}" />

<ImageView
Expand All @@ -41,6 +43,7 @@
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:paddingStart="12dp"
android:paddingTop="12dp"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="@+id/profile_edit_image"
app:layout_constraintEnd_toEndOf="@+id/profile_edit_image"
app:srcCompat="@drawable/rounded_white_background_with_shadow" />
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/layout/add_profile_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@
android:paddingTop="@dimen/add_profile_main_padding_top"
android:paddingBottom="@dimen/add_profile_main_padding_bottom">

<com.jackandphantom.circularimageview.CircleImage
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/add_profile_activity_user_image_view"
android:layout_width="120dp"
android:layout_height="120dp"
android:clickable="true"
android:contentDescription="@string/current_profile_picture_content_description"
android:focusable="true"
android:elevation="4dp"
app:add_shadow="true"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shadow_radius="8"
app:srcCompat="@drawable/ic_default_avatar" />
app:srcCompat="@{@drawable/ic_add_profile}"/>

<ImageView
android:id="@+id/add_profile_activity_edit_user_image_view"
Expand All @@ -59,6 +61,7 @@
android:contentDescription="@string/edit_profile_picture_content_description"
android:paddingStart="12dp"
android:paddingTop="12dp"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="@+id/add_profile_activity_user_image_view"
app:layout_constraintEnd_toEndOf="@+id/add_profile_activity_user_image_view"
app:srcCompat="@drawable/rounded_white_background_with_shadow" />
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/nav_header_navigation_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="64dp"
android:layout_height="64dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/layout/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_add_view_margin_end_profile_already_added : @dimen/profile_view_not_added_margin}"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_add_view_margin_start_profile_already_added : @dimen/profile_view_not_added_margin}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/profile_chooser_add_view_margin_top_profile_not_added}">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_add_button"
android:layout_width="72dp"
android:layout_height="72dp"
app:srcCompat="@{@drawable/ic_add_profile}"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp" />
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp" />

<LinearLayout
android:layout_width="match_parent"
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/profile_chooser_profile_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_avatar_img"
android:layout_width="72dp"
android:layout_height="72dp"
app:civ_border_color="@color/avatar_border"
app:civ_border_width="1dp"
app:strokeColor="@color/avatar_border"
app:strokeWidth="1dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{viewModel.profile.avatar}" />

<LinearLayout
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/profile_edit_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_edit_image"
android:layout_width="90dp"
android:layout_height="90dp"
Expand All @@ -43,6 +43,7 @@
android:translationZ="4dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{viewModel.profile.avatar}" />

<TextView
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/profile_list_profile_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
android:layout_height="wrap_content"
android:background="@drawable/general_item_background_border">

<de.hdodenhof.circleimageview.CircleImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_list_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="@dimen/profile_list_profile_view_margin_start"
android:layout_marginTop="18dp"
android:layout_marginBottom="18dp"
android:background="@drawable/profile_image_shadow"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{profile.avatar}" />

<TextView
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout/profile_progress_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:importantForAccessibility="no"
android:paddingTop="32dp">

<com.jackandphantom.circularimageview.CircleImage
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profile_edit_image"
android:layout_width="100dp"
android:layout_height="100dp"
Expand All @@ -29,11 +29,13 @@
android:contentDescription="@string/current_profile_picture_content_description"
android:focusable="true"
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:elevation="4dp"
app:add_shadow="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shadow_radius="8"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.RoundedShape"
profile:src="@{viewModel.profile.avatar}" />

<ImageView
Expand All @@ -43,6 +45,7 @@
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="@+id/profile_edit_image"
app:layout_constraintEnd_toEndOf="@+id/profile_edit_image"
app:srcCompat="@drawable/rounded_white_background_with_shadow" />
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,13 @@
<style name="TextViewCenterHorizontal" parent="TextView.Common1">
<item name="android:gravity">center_horizontal</item>
</style>

<!-- ShapeableImageView -->
<!-- The corner size & family type are set up to ensure a circular shape is created for components
with equal width & height
(per https://material.io/design/shape/about-shape.html#shape-customization-tool). -->
<style name="ShapeAppearanceOverlay.RoundedShape">
<item name="cornerSize">50%</item>
<item name="cornerFamily">rounded</item>
</style>
</resources>
Loading

0 comments on commit 5221bfc

Please sign in to comment.