Skip to content

Commit c17a1f9

Browse files
vanshikaaroradomdomegg
authored andcommitted
Fix commons-app#2677: Adjusted position of level number in achievements activity (commons-app#2695)
1 parent 711a1db commit c17a1f9

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import android.graphics.Bitmap;
88
import android.net.Uri;
99
import android.os.Bundle;
10+
11+
import androidx.constraintlayout.widget.ConstraintLayout;
1012
import androidx.core.content.FileProvider;
1113
import androidx.appcompat.app.AlertDialog;
1214
import androidx.appcompat.widget.Toolbar;
@@ -127,7 +129,7 @@ protected void onCreate(Bundle savedInstanceState) {
127129
int width = displayMetrics.widthPixels;
128130

129131
// Used for the setting the size of imageView at runtime
130-
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)
132+
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams)
131133
imageView.getLayoutParams();
132134
params.height = (int) (height * BADGE_IMAGE_HEIGHT_RATIO);
133135
params.width = (int) (width * BADGE_IMAGE_WIDTH_RATIO);

app/src/main/res/layout/activity_achievements.xml

+26-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
android:orientation="vertical">
2929

3030

31-
3231
<RelativeLayout
3332
android:layout_width="match_parent"
3433
android:layout_height="wrap_content"
@@ -59,32 +58,41 @@
5958
android:tint="?attr/icon"
6059
android:layout_marginVertical="@dimen/activity_margin_vertical" />
6160

62-
<ImageView
63-
android:id="@+id/achievement_badge_image"
61+
<androidx.constraintlayout.widget.ConstraintLayout
62+
android:id="@+id/badge_layout"
6463
android:layout_width="wrap_content"
6564
android:layout_height="wrap_content"
6665
android:layout_below="@id/achievement_info"
67-
android:layout_alignParentLeft="true"
68-
android:layout_alignParentRight="true"
69-
android:layout_marginVertical="@dimen/activity_margin_vertical" />
66+
android:layout_centerHorizontal="true">
7067

71-
<TextView
72-
android:id="@+id/achievement_badge_text"
73-
android:textColor="@color/achievement_badge_text"
74-
android:textSize="90dp"
75-
android:textAlignment="center"
76-
android:layout_width="wrap_content"
77-
android:layout_height="wrap_content"
78-
android:layout_marginTop="50dp"
79-
android:layout_alignTop="@+id/achievement_badge_image"
80-
android:layout_alignParentLeft="true"
81-
android:layout_alignParentRight="true" />
68+
<ImageView
69+
android:id="@+id/achievement_badge_image"
70+
android:layout_width="wrap_content"
71+
android:layout_height="wrap_content"
72+
app:layout_constraintLeft_toLeftOf="parent"
73+
app:layout_constraintRight_toRightOf="parent"
74+
app:layout_constraintTop_toTopOf="parent"
75+
app:srcCompat="@drawable/badge" />
76+
77+
<TextView
78+
android:id="@+id/achievement_badge_text"
79+
android:layout_width="wrap_content"
80+
android:layout_height="wrap_content"
81+
android:textAlignment="center"
82+
android:textColor="@color/achievement_badge_text"
83+
android:textSize="75sp"
84+
app:layout_constraintBottom_toBottomOf="@+id/achievement_badge_image"
85+
app:layout_constraintEnd_toEndOf="@+id/achievement_badge_image"
86+
app:layout_constraintStart_toStartOf="@+id/achievement_badge_image"
87+
app:layout_constraintTop_toTopOf="@+id/achievement_badge_image"
88+
app:layout_constraintVertical_bias="0.58" />
89+
</androidx.constraintlayout.widget.ConstraintLayout>
8290

8391
<RelativeLayout
8492
android:id="@+id/layout_image_uploaded"
8593
android:layout_width="match_parent"
8694
android:layout_height="wrap_content"
87-
android:layout_below="@+id/achievement_badge_image"
95+
android:layout_below="@+id/badge_layout"
8896
android:layout_marginEnd="@dimen/activity_margin_horizontal"
8997
android:layout_marginLeft="@dimen/activity_margin_horizontal"
9098
android:layout_marginRight="@dimen/activity_margin_horizontal"

0 commit comments

Comments
 (0)