mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 03:39:00 +00:00
Dialog with OK-Button, Count-Bubble on an Achievement-Icon
This commit is contained in:
parent
85d0ac004d
commit
3e27fe90e3
5 changed files with 40 additions and 8 deletions
|
|
@ -3,7 +3,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dip">
|
||||
android:paddingLeft="24dip"
|
||||
android:paddingTop="24dip"
|
||||
android:paddingRight="24dip">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -1,25 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:fresco="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/achievement_item_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:id="@+id/achievement_item_layout"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/achievement_drawee"
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal">
|
||||
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="33dp"
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/achievement_drawee"
|
||||
|
||||
android:layout_gravity="center_horizontal" />
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginRight="3dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/achievement_count_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:text="2"
|
||||
android:background="@drawable/layout_rounded_bg_brand"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingRight="2dp"
|
||||
android:textSize="10dp"
|
||||
android:textColor="#ffffff" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/achievement_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="center" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -12,5 +12,6 @@
|
|||
<string name="profile_boosts">Boosts:</string>
|
||||
<string name="profile_private_message">Private Message</string>
|
||||
<string name="profile_achievements">Achievements</string>
|
||||
<string name="profile_achievement_ok">Ok</string>
|
||||
|
||||
</resources>
|
||||
|
|
@ -87,6 +87,9 @@ public class AchievementAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
@BindView(R.id.achievement_text)
|
||||
TextView titleView;
|
||||
|
||||
@BindView(R.id.achievement_count_label)
|
||||
TextView countText;
|
||||
|
||||
@BindView(R.id.achievement_item_layout)
|
||||
LinearLayout item_layout;
|
||||
|
||||
|
|
@ -118,6 +121,13 @@ public class AchievementAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
|
||||
this.achievement = item;
|
||||
titleView.setText(item.title);
|
||||
|
||||
if(item.optionalCount == null) {
|
||||
countText.setVisibility(View.GONE);
|
||||
} else{
|
||||
countText.setVisibility(View.VISIBLE);
|
||||
countText.setText(item.optionalCount.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -137,6 +147,7 @@ public class AchievementAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
textView.setText(achievement.text);
|
||||
|
||||
b.setView(customView);
|
||||
b.setPositiveButton(R.string.profile_achievement_ok, (dialogInterface, i) -> {});
|
||||
|
||||
b.show();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ public class Achievement {
|
|||
public String value;
|
||||
public boolean earned;
|
||||
public int index;
|
||||
public int optionalCount;
|
||||
public Integer optionalCount;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue