redesign public challenge item - use styles for fontFamily - new header icons
BIN
Habitica/res/drawable-hdpi/dialogue_gem.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Habitica/res/drawable-hdpi/dialogue_participants.png
Normal file
|
After Width: | Height: | Size: 809 B |
|
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 598 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
Habitica/res/drawable-hdpi/ic_header_healer.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 1 KiB |
BIN
Habitica/res/drawable-hdpi/ic_header_mage.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 933 B |
BIN
Habitica/res/drawable-hdpi/ic_header_rogue.png
Normal file
|
After Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
Habitica/res/drawable-hdpi/ic_header_warrior.png
Normal file
|
After Width: | Height: | Size: 2 KiB |
BIN
Habitica/res/drawable-mdpi/dialogue_gem.png
Normal file
|
After Width: | Height: | Size: 1,016 B |
BIN
Habitica/res/drawable-mdpi/dialogue_participants.png
Normal file
|
After Width: | Height: | Size: 540 B |
|
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 434 B |
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
Habitica/res/drawable-xhdpi/dialogue_gem.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Habitica/res/drawable-xhdpi/dialogue_participants.png
Normal file
|
After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 847 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 996 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 2.7 KiB |
BIN
Habitica/res/drawable-xxhdpi/dialogue_gem.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Habitica/res/drawable-xxhdpi/dialogue_participants.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 711 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 4.1 KiB |
BIN
Habitica/res/drawable-xxxhdpi/dialogue_gem.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
Habitica/res/drawable-xxxhdpi/dialogue_participants.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
Habitica/res/drawable-xxxhdpi/ic_header_healer.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
|
@ -2,6 +2,6 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval" >
|
||||
<solid android:color="@color/white"/>
|
||||
<stroke android:color="@color/brand_300" android:width="2dp" />
|
||||
<stroke android:color="@color/gem_icon_color" android:width="2dp" />
|
||||
|
||||
</shape>
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
android:shape="rectangle" >
|
||||
<solid android:color="@color/white"/>
|
||||
<corners android:radius="80dp"/>
|
||||
<stroke android:color="@color/brand_300" android:width="2dp" />
|
||||
<stroke android:color="@color/gem_icon_color" android:width="2dp" />
|
||||
|
||||
</shape>
|
||||
|
|
@ -46,6 +46,7 @@
|
|||
android:lines="1"
|
||||
android:text="0"
|
||||
android:textSize="12dp"
|
||||
android:textColor="@color/gem_icon_color"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -64,35 +65,47 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/challenge_name"
|
||||
style="@style/ChallengeName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/md_black_1000"
|
||||
android:textSize="16sp"
|
||||
tools:text="Example Challenge Name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/challenge_description"
|
||||
style="@style/ChallengeByGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="1dp"
|
||||
tools:text="Guild: XYZ" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/challenge_is_participating"
|
||||
style="@style/ParticipatingChallenge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/participating" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/challenge_task_summary"
|
||||
style="@style/ChallengeTaskDetails"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginTop="1dp"
|
||||
tools:text="1 Habit | 4 Dailies | 1 To-Do" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/officialHabiticaChallengeLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="22dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:background="@drawable/layout_rounded_bg_official_challenge"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
style="@style/OfficialChallenge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
|
|
@ -101,11 +114,16 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
<LinearLayout
|
||||
android:id="@+id/arrowImage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_gray_24dp" />
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_gray_24dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -104,4 +104,5 @@
|
|||
|
||||
<color name="gem_view_background">#10bda8ff</color>
|
||||
|
||||
<color name="gem_icon_color">#24cc8f</color>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -448,4 +448,5 @@ To start, which parts of your life do you want to improve?</string>
|
|||
<string name="reward">Reward</string>
|
||||
<string name="todo">To-Do</string>
|
||||
<string name="official_habitica_challenge">Official Habitica Challenge</string>
|
||||
<string name="participating">Participating</string>
|
||||
</resources>
|
||||
|
|
|
|||
50
Habitica/res/values/styles.challenges.xml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<string name="font_family_light">sans-serif-light</string>
|
||||
<string name="font_family_medium">sans-serif-medium</string>
|
||||
<string name="font_family_regular">sans-serif</string>
|
||||
<string name="font_family_condensed">sans-serif-condensed</string>
|
||||
<string name="font_family_black">sans-serif-black</string>
|
||||
<string name="font_family_thin">sans-serif-thin</string>
|
||||
|
||||
<style name="ChallengeName">
|
||||
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/font_family_condensed
|
||||
</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textColor">#000</item>
|
||||
</style>
|
||||
|
||||
<style name="ChallengeByGroup">
|
||||
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/font_family_regular
|
||||
</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:height">20dp</item>
|
||||
<item name="android:textColor">#8a000000</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
</style>
|
||||
|
||||
<style name="ChallengeTaskDetails">
|
||||
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/font_family_regular
|
||||
</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:height">20dp</item>
|
||||
<item name="android:textColor">#8a000000</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
</style>
|
||||
|
||||
<style name="OfficialChallenge">
|
||||
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/font_family_medium
|
||||
</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:textColor">#8a000000</item>
|
||||
</style>
|
||||
|
||||
<style name="ParticipatingChallenge">
|
||||
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/font_family_medium
|
||||
</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:height">20dp</item>
|
||||
<item name="android:textColor">#1ca372</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.adapter.social;
|
|||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
|
|
@ -9,6 +10,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
|
@ -36,6 +38,12 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
|
||||
|
||||
private List<Challenge> challenges = new ArrayList<>();
|
||||
private boolean viewUserChallengesOnly;
|
||||
|
||||
public ChallengesListViewAdapter(boolean viewUserChallengesOnly) {
|
||||
|
||||
this.viewUserChallengesOnly = viewUserChallengesOnly;
|
||||
}
|
||||
|
||||
public void setChallenges(List<Challenge> challenges) {
|
||||
this.challenges = challenges;
|
||||
|
|
@ -47,7 +55,7 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.challenge_item, parent, false);
|
||||
|
||||
return new ChallengeViewHolder(view);
|
||||
return new ChallengeViewHolder(view, viewUserChallengesOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -66,7 +74,6 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
}
|
||||
|
||||
public static class ChallengeViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
@Nullable
|
||||
@BindView(R.id.challenge_name)
|
||||
TextView challengeName;
|
||||
|
||||
|
|
@ -79,21 +86,33 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
@BindView(R.id.officialHabiticaChallengeLayout)
|
||||
LinearLayout officialChallengeLayout;
|
||||
|
||||
@BindView(R.id.challenge_is_participating)
|
||||
TextView challengeParticipatingTextView;
|
||||
|
||||
@Nullable
|
||||
@BindView(R.id.memberCountTextView)
|
||||
TextView memberCountTextView;
|
||||
|
||||
@BindView(R.id.arrowImage)
|
||||
LinearLayout arrowImage;
|
||||
|
||||
@BindView(R.id.gemPrizeTextView)
|
||||
TextView gemPrizeTextView;
|
||||
|
||||
private Challenge challenge;
|
||||
private boolean viewUserChallengesOnly;
|
||||
|
||||
public ChallengeViewHolder(View itemView) {
|
||||
public ChallengeViewHolder(View itemView, boolean viewUserChallengesOnly) {
|
||||
super(itemView);
|
||||
this.viewUserChallengesOnly = viewUserChallengesOnly;
|
||||
|
||||
ButterKnife.bind(this, itemView);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
|
||||
if(!viewUserChallengesOnly){
|
||||
challengeName.setTextColor(ContextCompat.getColor(getContext(), R.color.brand_200));
|
||||
}
|
||||
}
|
||||
|
||||
public void bind(Challenge challenge) {
|
||||
|
|
@ -103,24 +122,30 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
|
||||
challengeDescription.setText(challenge.groupName);
|
||||
|
||||
List<String> taskSummary = new ArrayList<>();
|
||||
HashMap<String, String[]> tasksOrder = challenge.getTasksOrder();
|
||||
for (Map.Entry<String, String[]> stringEntry : tasksOrder.entrySet()) {
|
||||
if(stringEntry.getValue().length != 0)
|
||||
{
|
||||
taskSummary.add(stringEntry.getValue().length + " " + getLabelByTypeAndCount(stringEntry.getKey(), stringEntry.getValue().length));
|
||||
}
|
||||
}
|
||||
|
||||
officialChallengeLayout.setVisibility(challenge.official ? View.VISIBLE : View.GONE);
|
||||
boolean userIdExists = challenge.user_id != null && !challenge.user_id.isEmpty();
|
||||
|
||||
challengeTaskSummary.setText(TextUtils.join(" | ", taskSummary));
|
||||
if (viewUserChallengesOnly) {
|
||||
List<String> taskSummary = new ArrayList<>();
|
||||
|
||||
//DataBindingUtils.setRoundedBackgroundInt(leaderLayout, android.R.color.darker_gray);
|
||||
//DataBindingUtils.setForegroundTintColor(leaderLabel, android.R.color.white);
|
||||
//leaderLabel.setText(String.format(getContext().getString(R.string.byLeader), challenge.leaderName));
|
||||
HashMap<String, String[]> tasksOrder = challenge.getTasksOrder();
|
||||
for (Map.Entry<String, String[]> stringEntry : tasksOrder.entrySet()) {
|
||||
if (stringEntry.getValue().length != 0) {
|
||||
taskSummary.add(stringEntry.getValue().length + " " + getLabelByTypeAndCount(stringEntry.getKey(), stringEntry.getValue().length));
|
||||
}
|
||||
}
|
||||
|
||||
//memberCountTextView.setText(challenge.memberCount + "");
|
||||
challengeTaskSummary.setText(TextUtils.join(" | ", taskSummary));
|
||||
challengeParticipatingTextView.setVisibility(View.GONE);
|
||||
arrowImage.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
challengeParticipatingTextView.setVisibility(userIdExists ? View.VISIBLE : View.GONE);
|
||||
|
||||
challengeTaskSummary.setText(String.format(getContext().getString(R.string.byLeader), challenge.leaderName) + " | " +
|
||||
challenge.memberCount + " " + getContext().getString(R.string.quest_participants));
|
||||
arrowImage.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (challenge.prize == 0) {
|
||||
//gem_prize_layout.setVisibility(View.GONE);
|
||||
|
|
@ -130,19 +155,19 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
}
|
||||
|
||||
/*if (leaveButton != null && joinButton != null) {
|
||||
boolean userIdExists = challenge.user_id != null && !challenge.user_id.isEmpty();
|
||||
|
||||
|
||||
leaveButton.setVisibility(userIdExists ? View.VISIBLE : View.INVISIBLE);
|
||||
joinButton.setVisibility(userIdExists ? View.INVISIBLE : View.VISIBLE);
|
||||
}*/
|
||||
}
|
||||
|
||||
private String getLabelByTypeAndCount(String type, int count){
|
||||
if(type == Challenge.TASK_ORDER_DAILYS){
|
||||
return getContext().getString(count == 1 ? R.string.daily : R.string.dailies);
|
||||
} else if(type == Challenge.TASK_ORDER_HABITS){
|
||||
private String getLabelByTypeAndCount(String type, int count) {
|
||||
if (type == Challenge.TASK_ORDER_DAILYS) {
|
||||
return getContext().getString(count == 1 ? R.string.daily : R.string.dailies);
|
||||
} else if (type == Challenge.TASK_ORDER_HABITS) {
|
||||
return getContext().getString(count == 1 ? R.string.habit : R.string.habits);
|
||||
} else if(type == Challenge.TASK_ORDER_REWARDS){
|
||||
} else if (type == Challenge.TASK_ORDER_REWARDS) {
|
||||
return getContext().getString(count == 1 ? R.string.reward : R.string.rewards);
|
||||
} else {
|
||||
return getContext().getString(count == 1 ? R.string.todo : R.string.todos);
|
||||
|
|
@ -165,7 +190,8 @@ public class ChallengesListViewAdapter extends RecyclerView.Adapter<ChallengesLi
|
|||
}).setNegativeButton(context.getString(R.string.no), (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
}).show();
|
||||
} else*/if (challenge != null) {
|
||||
} else*/
|
||||
if (challenge != null) {
|
||||
// Card tapped
|
||||
EventBus.getDefault().post(new ShowChallengeTasksCommand(challenge.id));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ChallengeListFragment extends BaseMainFragment implements View.OnCl
|
|||
public void onCreate(Bundle savedInstance) {
|
||||
super.onCreate(savedInstance);
|
||||
|
||||
challengeAdapter = new ChallengesListViewAdapter();
|
||||
challengeAdapter = new ChallengesListViewAdapter(viewUserChallengesOnly);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||