rename habitica colors

This commit is contained in:
Phillip Thelen 2017-09-11 13:31:20 +02:00
parent a1b9b9db3e
commit 95fa5ccc41
47 changed files with 260 additions and 223 deletions

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.habitrpg.android.habitica"
android:versionCode="1928"
android:versionCode="1929"
android:versionName="1.2"
android:screenOrientation="portrait"
android:installLocation="auto" >

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/worse_50" />
<solid android:color="@color/red_50" />
<corners android:topLeftRadius="4dp" android:topRightRadius="4dp" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/good_100" />
<solid android:color="@color/green_100" />
<corners android:radius="@dimen/rounded_button_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/worse_100" />
<solid android:color="@color/red_100" />
<corners android:radius="@dimen/rounded_button_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/neutral_100" />
<solid android:color="@color/yellow_100" />
<corners android:radius="@dimen/rounded_button_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/good_50"/>
<solid android:color="@color/green_50"/>
<corners android:radius="20dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/worse_10"/>
<solid android:color="@color/red_10"/>
<corners android:radius="20dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/good_50" />
<solid android:color="@color/green_50" />
<corners android:topLeftRadius="4dp" android:topRightRadius="4dp" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/best_100" />
<solid android:color="@color/blue_100" />
<corners android:radius="100dp" />
<stroke android:width="1dp" android:color="@color/black_20_alpha" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/good_100" />
<solid android:color="@color/green_100" />
<corners android:radius="100dp" />
<stroke android:width="1dp" android:color="@color/black_20_alpha" />
</shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/worse_100" />
<solid android:color="@color/red_100" />
<corners android:radius="100dp" />
<stroke android:width="1dp" android:color="@color/black_20_alpha" />
</shape>

View file

@ -5,7 +5,7 @@
<!-- view background color -->
<solid
android:color="@color/neutral_10" >
android:color="@color/yellow_10" >
</solid>
</shape>

View file

@ -5,7 +5,7 @@
<!-- view background color -->
<solid
android:color="@color/best_10" >
android:color="@color/blue_10" >
</solid>
</shape>

View file

@ -5,7 +5,7 @@
<!-- view background color -->
<solid
android:color="@color/worse_10" >
android:color="@color/red_10" >
</solid>
</shape>

View file

@ -83,9 +83,10 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<com.habitrpg.android.habitica.ui.views.CurrencyView
<com.habitrpg.android.habitica.ui.views.CurrencyViews
android:id="@+id/currencyView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
app:hasLightBackground="false"/>
</LinearLayout>
</LinearLayout>

View file

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center_vertical"
tools:parentTag="LinearLayout"
tools:orientation="horizontal">
<TextView
android:id="@+id/hourglassTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textColorSecondaryDark"
style="@style/CurrencyTextView"
android:visibility="gone"
tools:visibility="visible"
tools:text="2"
/>
<TextView
android:id="@+id/gemTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textColorSecondaryDark"
style="@style/CurrencyTextView"
android:visibility="gone"
tools:visibility="visible"
tools:text="22"
/>
<TextView
android:id="@+id/goldTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textColorSecondaryDark"
style="@style/CurrencyTextView"
tools:text="4.2k"
/>
</merge>

View file

@ -27,6 +27,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:id="@+id/next_unlock_message"
android:textColor="@color/best_10"/>
android:textColor="@color/blue_10"/>
</LinearLayout>

View file

@ -53,7 +53,7 @@
android:layout_height="wrap_content"
tools:text="+6"
android:layout_marginRight="16dp"
android:textColor="@color/good_50"/>
android:textColor="@color/green_50"/>
<TextView
android:id="@+id/per_label"
android:text="@string/per_abbrv"
@ -66,7 +66,7 @@
android:layout_height="wrap_content"
tools:text="+6"
android:layout_marginRight="16dp"
android:textColor="@color/good_50"/>
android:textColor="@color/green_50"/>
</TableRow>
<TableRow
android:layout_width="wrap_content"
@ -84,7 +84,7 @@
android:layout_height="wrap_content"
tools:text="+6"
android:layout_marginRight="16dp"
android:textColor="@color/good_50"/>
android:textColor="@color/green_50"/>
<TextView
android:id="@+id/int_label"
android:text="@string/int_abbrv"
@ -97,7 +97,7 @@
android:layout_height="wrap_content"
tools:text="+6"
android:layout_marginRight="16dp"
android:textColor="@color/good_50"/>
android:textColor="@color/green_50"/>
</TableRow>
</TableLayout>
</merge>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -21,10 +22,11 @@
android:maxLines="1"
android:text="@string/your_balance"
android:layout_gravity="center_vertical"/>
<com.habitrpg.android.habitica.ui.views.CurrencyView
<com.habitrpg.android.habitica.ui.views.CurrencyViews
android:id="@+id/currencyView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:hasLightBackground="true"/>
</LinearLayout>
<TextView
android:id="@+id/limitedTextView"
@ -81,17 +83,14 @@
android:textAllCaps="true"
android:textColor="@color/brand_300"
style="@style/Body1" />
<ImageView
android:id="@+id/currency_icon_view"
android:layout_width="@dimen/currency_icon_size"
android:layout_height="@dimen/currency_icon_size" />
<TextView
<com.habitrpg.android.habitica.ui.views.CurrencyView
android:id="@+id/priceLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="10"
tools:textColor="@color/good_10"
style="@style/Body1" />
tools:textColor="@color/green_10"
style="@style/Body1"
android:layout_marginLeft="12dp"/>
</LinearLayout>
<Button
android:id="@+id/closeButton"

View file

@ -21,7 +21,7 @@
android:text="@string/gem.purchase.title"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textColor="@color/best_10"
android:textColor="@color/blue_10"
android:textSize="14sp"
android:lineSpacingExtra="4dp" />
<TextView

View file

@ -234,7 +234,7 @@
android:text="@string/subscribe.title"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textColor="@color/best_10"
android:textColor="@color/blue_10"
android:textSize="14sp"
android:lineSpacingExtra="4dp"
android:layout_marginTop="16dp"/>

View file

@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gem_amount"
android:textColor="@color/best_10"
android:textColor="@color/blue_10"
android:gravity="center"
android:textSize="36sp"
tools:text="21" />
@ -28,7 +28,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/gems"
android:textColor="@color/best_10"
android:textColor="@color/blue_10"
android:gravity="center"
android:layout_marginBottom="14dp" />

View file

@ -30,6 +30,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:lightBackground="true"
app:barForegroundColor="@color/good_100"/>
app:barForegroundColor="@color/green_100"/>
</LinearLayout>
</LinearLayout>

View file

@ -16,7 +16,7 @@
android:id="@+id/boss_health_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:barForegroundColor="@color/worse_100"
app:barForegroundColor="@color/red_100"
app:lightBackground="true" />
<LinearLayout
android:id="@+id/collection_container"

View file

@ -74,7 +74,7 @@
android:id="@id/priceLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/neutral_10"
android:textColor="@color/yellow_10"
android:gravity="center_horizontal"
tools:text="150"
style="@style/Body1"/>

View file

@ -36,4 +36,10 @@
<attr name="lightBackground" format="boolean" />
<attr name="description" format="string" />
</declare-styleable>
<declare-styleable name="CurrencyView">
<attr name="currency" format="string" />
</declare-styleable>
<declare-styleable name="CurrencyViews">
<attr name="hasLightBackground" format="boolean" />
</declare-styleable>
</resources>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="class_healer">@color/neutral_100</color>
<color name="class_warrior">@color/worse_100</color>
<color name="class_wizard">@color/best_100</color>
<color name="class_healer">@color/yellow_100</color>
<color name="class_warrior">@color/red_100</color>
<color name="class_wizard">@color/blue_100</color>
<color name="class_rogue">@color/brand_100</color>
</resources>

View file

@ -2,7 +2,7 @@
<resources>
<color name="tavern.nolikes.background">#eeeeee</color>
<color name="tavern.somelikes.background">#cccccc</color>
<color name="tavern.userliked.background">@color/good_50</color>
<color name="tavern.userliked.background">@color/green_50</color>
<color name="tavern.nolikes.foreground">#aaaaaa</color>
<color name="tavern.somelikes.foreground">#FFFFFF</color>
<color name="tavern.userliked.foreground">#FFFFFF</color>

View file

@ -11,33 +11,40 @@
<color name="brand">@color/brand_100</color>
<!-- HabitRPG task color -->
<color name="worst_100">#DE3F3F</color>
<color name="worst_50">#C92B2B</color>
<color name="maroon_500">#f19595</color>
<color name="maroon_100">#DE3F3F</color>
<color name="maroon_50">#C92B2B</color>
<color name="worst_10">#B01515</color>
<color name="worse_100">#FF6165</color>
<color name="worse_50">#F74E52</color>
<color name="worse_10">#F23035</color>
<color name="red_500">#ffb6b8</color>
<color name="red_100">#FF6165</color>
<color name="red_50">#F74E52</color>
<color name="red_10">#F23035</color>
<color name="bad_100">#FF944C</color>
<color name="bad_50">#FA8537</color>
<color name="bad_10">#F47825</color>
<color name="orange_500">#ffc8a7</color>
<color name="orange_100">#FF944C</color>
<color name="orange_50">#FA8537</color>
<color name="orange_10">#F47825</color>
<color name="neutral_100">#FFBE5D</color>
<color name="neutral_50">#FFB445</color>
<color name="neutral_10">#FFA624</color>
<color name="yellow_500">#fedead</color>
<color name="yellow_100">#FFBE5D</color>
<color name="yellow_50">#FFB445</color>
<color name="yellow_10">#FFA624</color>
<color name="good_100">#24CC8F</color>
<color name="good_50">#20B780</color>
<color name="good_10">#1CA372</color>
<color name="green_500">#77f4c7</color>
<color name="green_100">#24CC8F</color>
<color name="green_50">#20B780</color>
<color name="green_10">#1CA372</color>
<color name="better_100">#3BCAD7</color>
<color name="better_50">#34B5C1</color>
<color name="better_10">#26A0AB</color>
<color name="teal_500">#8eedf6</color>
<color name="teal_100">#3BCAD7</color>
<color name="teal_50">#34B5C1</color>
<color name="teal_10">#26A0AB</color>
<color name="best_100">#50B5E9</color>
<color name="best_50">#46A7D9</color>
<color name="best_10">#2995cd</color>
<color name="blue_500">#a9dcf6</color>
<color name="blue_100">#50B5E9</color>
<color name="blue_50">#46A7D9</color>
<color name="blue_10">#2995cd</color>
<color name="gray_10">#34313a</color>
@ -55,13 +62,13 @@
<color name="completed">#D9D9D9</color>
<color name="completed_btn">#989898</color>
<color name="hpColor">@color/worse_100</color>
<color name="hpColor">@color/red_100</color>
<color name="hpColorBackground">#fcf0f0</color>
<color name="hpColorForeground">#250808</color>
<color name="xpColor">@color/neutral_100</color>
<color name="xpColor">@color/yellow_100</color>
<color name="xpColorBackground">#fffbf0</color>
<color name="xpColorForeground">#2e2200</color>
<color name="mpColor">@color/best_100</color>
<color name="mpColor">@color/blue_100</color>
<color name="mpColorBackground">#eff4fd</color>
<color name="mpColorForeground">#051228</color>
@ -110,9 +117,9 @@
<!-- Preferences -->
<color name="preference_fallback_accent_color">@color/colorAccent</color>
<!-- buttons -->
<color name="btn_success">@color/good_10</color>
<color name="btn_warning">@color/neutral_10</color>
<color name="btn_danger">@color/worse_10</color>
<color name="btn_success">@color/green_10</color>
<color name="btn_warning">@color/yellow_10</color>
<color name="btn_danger">@color/red_10</color>
<color name="widget_background">#c8432874</color>

View file

@ -6,7 +6,7 @@
<string name="SP_APIToken" translatable="false">APIToken</string>
<string name="SP_username" translatable="false">Username</string>
<string name="SP_email" translatable="false">E-mail</string>
<string name="base_url" translatable="false">https://habitrpg-staging.herokuapp.com</string>
<string name="base_url" translatable="false">https://habitica.com</string>
<!-- Local notification actions -->
<string name="accept_party_invite" translatable="false">ACCEPT_PARTY_INVITE</string>

View file

@ -272,7 +272,7 @@
</style>
<style name="subscriptionBoxText.Title.Red">
<item name="android:textColor">@color/worse_50</item>
<item name="android:textColor">@color/red_50</item>
</style>
<style name="SubscriptionListDescription" parent="GemPurchaseListItemDescription">

View file

@ -10,13 +10,10 @@ import android.view.View;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.HabiticaApplication;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.data.ApiClient;
import com.habitrpg.android.habitica.data.UserRepository;
import com.habitrpg.android.habitica.events.ShowSnackbarEvent;
import com.habitrpg.android.habitica.models.Notification;
import com.habitrpg.android.habitica.models.user.User;
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar;
@ -65,7 +62,7 @@ public class PopupNotificationsManager {
String youEarnedMessage = context.getString(R.string.checkInRewardEarned, notification.data.rewardText);
TextView titleTextView = new TextView(context);
titleTextView.setBackgroundResource(R.color.best_100);
titleTextView.setBackgroundResource(R.color.blue_100);
titleTextView.setTextColor(ContextCompat.getColor(context, R.color.white));
float density = context.getResources().getDisplayMetrics().density;
int paddingDp = (int) (16 * density);

View file

@ -392,18 +392,18 @@ public class Task extends RealmObject implements Parcelable {
public int getLightTaskColor() {
if (this.value < -20)
return R.color.worst_100;
return R.color.maroon_100;
if (this.value < -10)
return R.color.worse_100;
return R.color.red_100;
if (this.value < -1)
return R.color.bad_100;
return R.color.orange_100;
if (this.value < 1)
return R.color.neutral_100;
return R.color.yellow_100;
if (this.value < 5)
return R.color.good_100;
return R.color.green_100;
if (this.value < 10)
return R.color.better_100;
return R.color.best_100;
return R.color.teal_100;
return R.color.blue_100;
}
/**
@ -413,19 +413,19 @@ public class Task extends RealmObject implements Parcelable {
*/
public int getMediumTaskColor() {
if (this.value < -20)
return R.color.worst_50;
return R.color.maroon_50;
if (this.value < -10)
return R.color.worse_50;
return R.color.red_50;
if (this.value < -1)
return R.color.bad_50;
return R.color.orange_50;
if (this.value < 1)
return R.color.neutral_50;
return R.color.yellow_50;
if (this.value < 5)
return R.color.good_50;
return R.color.green_50;
if (this.value < 10)
return R.color.better_50;
return R.color.teal_50;
return R.color.best_50;
return R.color.blue_50;
}
/**
@ -437,17 +437,17 @@ public class Task extends RealmObject implements Parcelable {
if (this.value < -20)
return R.color.worst_10;
if (this.value < -10)
return R.color.worse_10;
return R.color.red_10;
if (this.value < -1)
return R.color.bad_10;
return R.color.orange_10;
if (this.value < 1)
return R.color.neutral_10;
return R.color.yellow_10;
if (this.value < 5)
return R.color.good_10;
return R.color.green_10;
if (this.value < 10)
return R.color.better_10;
return R.color.teal_10;
return R.color.best_10;
return R.color.blue_10;
}
public Boolean checkIfDue(int offset) {

View file

@ -5,7 +5,6 @@ import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.content.res.ResourcesCompat;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
@ -17,7 +16,7 @@ import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
import com.habitrpg.android.habitica.models.Avatar;
import com.habitrpg.android.habitica.models.user.Stats;
import com.habitrpg.android.habitica.ui.menu.MainDrawerBuilder;
import com.habitrpg.android.habitica.ui.views.CurrencyView;
import com.habitrpg.android.habitica.ui.views.CurrencyViews;
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
import com.habitrpg.android.habitica.ui.views.ValueBar;
@ -40,14 +39,12 @@ public class AvatarWithBarsViewModel {
@BindView(R.id.avatarView)
AvatarView avatarView;
private android.content.res.Resources res;
private Context context;
@BindView(R.id.lvl_tv)
TextView lvlText;
@BindView(R.id.currencyView)
CurrencyView currencyView;
CurrencyViews currencyView;
private Avatar userObject;
@ -55,7 +52,6 @@ public class AvatarWithBarsViewModel {
public AvatarWithBarsViewModel(Context context, View v) {
this.context = context;
res = context.getResources();
if (v == null) {
Log.w("AvatarWithBarsViewModel", "View is null");
@ -160,7 +156,7 @@ public class AvatarWithBarsViewModel {
currencyView.setGems(gems);
}
@OnClick(R.id.gemTextView)
@OnClick(R.id.currencyView)
public void gemTextClicked() {
EventBus.getDefault().post(new OpenGemPurchaseFragmentCommand());
}

View file

@ -41,7 +41,6 @@ public class SpeechBubbleView extends FrameLayout implements View.OnClickListene
inflate(context, R.layout.speechbubble, this);
ButterKnife.bind(this);
TypedArray attributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.SpeechBubbleView,

View file

@ -138,7 +138,7 @@ public class IntroActivity extends BaseActivity implements View.OnClickListener,
fragment.setSubtitle(getString(R.string.intro_2_subtitle));
fragment.setTitle(getString(R.string.intro_2_title));
fragment.setDescription(getString(R.string.intro_2_description));
fragment.setBackgroundColor(ContextCompat.getColor(IntroActivity.this, R.color.best_10));
fragment.setBackgroundColor(ContextCompat.getColor(IntroActivity.this, R.color.blue_10));
break;
}
case 2: {
@ -146,7 +146,7 @@ public class IntroActivity extends BaseActivity implements View.OnClickListener,
fragment.setSubtitle(getString(R.string.intro_3_subtitle));
fragment.setTitle(getString(R.string.intro_3_title));
fragment.setDescription(getString(R.string.intro_3_description));
fragment.setBackgroundColor(ContextCompat.getColor(IntroActivity.this, R.color.worse_100));
fragment.setBackgroundColor(ContextCompat.getColor(IntroActivity.this, R.color.red_100));
break;
}
}

View file

@ -81,7 +81,6 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.OnClick;
import io.realm.RealmList;
import rx.Observable;
public class TaskFormActivity extends BaseActivity implements AdapterView.OnItemSelectedListener {
public static final String TASK_ID_KEY = "taskId";
@ -307,7 +306,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
startDateListener = new DateEditTextListener(startDatePickerText);
btnDelete.setEnabled(false);
ViewHelper.SetBackgroundTint(btnDelete, ContextCompat.getColor(this, R.color.worse_10));
ViewHelper.SetBackgroundTint(btnDelete, ContextCompat.getColor(this, R.color.red_10));
btnDelete.setOnClickListener(view -> new AlertDialog.Builder(view.getContext())
.setTitle(getString(R.string.taskform_delete_title))
.setMessage(getString(R.string.taskform_delete_message)).setPositiveButton(getString(R.string.yes), (dialog, which) -> {

View file

@ -17,7 +17,7 @@ import com.habitrpg.android.habitica.models.shops.Shop;
import com.habitrpg.android.habitica.models.user.User;
import com.habitrpg.android.habitica.ui.activities.MainActivity;
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
import com.habitrpg.android.habitica.ui.views.CurrencyView;
import com.habitrpg.android.habitica.ui.views.CurrencyViews;
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar;
import org.greenrobot.eventbus.Subscribe;
@ -34,7 +34,7 @@ public class ShopsFragment extends BaseMainFragment {
InventoryRepository inventoryRepository;
public ViewPager viewPager;
private CurrencyView currencyView;
private CurrencyViews currencyView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -57,7 +57,7 @@ public class ShopsFragment extends BaseMainFragment {
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
currencyView = new CurrencyView(getContext());
currencyView = new CurrencyViews(getContext());
if (toolbarAccessoryContainer != null) {
toolbarAccessoryContainer.addView(currencyView);
}

View file

@ -22,7 +22,6 @@ import com.habitrpg.android.habitica.helpers.QrCodeManager;
import com.habitrpg.android.habitica.helpers.RxErrorHandler;
import com.habitrpg.android.habitica.models.user.User;
import com.habitrpg.android.habitica.models.user.SubscriptionPlan;
import com.habitrpg.android.habitica.ui.activities.MainActivity;
import com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionDetailsView;
import org.greenrobot.eventbus.EventBus;
@ -120,7 +119,7 @@ public class AccountDetailsFragment extends BasePreferencesFragment {
}))
.setNegativeButton(R.string.nevermind, ((thisDialog, which) -> thisDialog.dismiss()))
.create();
dialog.setOnShowListener(arg0 -> dialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.worse_10)));
dialog.setOnShowListener(arg0 -> dialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.red_10)));
dialog.setView(input);
dialog.show();
}
@ -146,7 +145,7 @@ public class AccountDetailsFragment extends BasePreferencesFragment {
}))
.setNegativeButton(R.string.nevermind, ((thisDialog, which) -> thisDialog.dismiss()))
.create();
dialog.setOnShowListener(arg0 -> dialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.worse_10)));
dialog.setOnShowListener(arg0 -> dialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.red_10)));
dialog.show();
}

View file

@ -5,12 +5,10 @@ import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.TextViewCompat;
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;
@ -25,7 +23,6 @@ import com.habitrpg.android.habitica.models.inventory.Quest;
import com.habitrpg.android.habitica.models.inventory.QuestContent;
import com.habitrpg.android.habitica.models.members.Member;
import com.habitrpg.android.habitica.models.social.Group;
import com.habitrpg.android.habitica.models.user.User;
import com.habitrpg.android.habitica.modules.AppModule;
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
@ -189,10 +186,10 @@ public class QuestDetailFragment extends BaseMainFragment {
statusTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.gray_200));
} else if (participant.getParticipatesInQuest()) {
statusTextView.setText(R.string.accepted);
statusTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.good_100));
statusTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.green_100));
} else {
statusTextView.setText(R.string.declined);
statusTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.worse_100));
statusTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.red_100));
}
} else {
statusTextView.setVisibility(View.GONE);

View file

@ -30,7 +30,7 @@ public class BottomSheetMenuItem {
TextView textView = (TextView) menuItemView.findViewById(R.id.textView);
textView.setText(this.title);
if (this.isDestructive) {
textView.setTextColor(ContextCompat.getColor(context, R.color.worse_50));
textView.setTextColor(ContextCompat.getColor(context, R.color.red_50));
}
return menuItemView;
}

View file

@ -71,7 +71,7 @@ public class ShopItemViewHolder extends RecyclerView.ViewHolder implements View.
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.gold));
} else if (item.getCurrency().equals("gems")) {
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfGem());
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.good_10));
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.green_10));
} else if (item.getCurrency().equals("hourglasses")) {
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfHourglass());
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.brand_300));

View file

@ -40,7 +40,7 @@ public class HabitViewHolder extends BaseTaskViewHolder {
if (this.task.up) {
this.btnPlusWrapper.setBackgroundResource(this.task.getLightTaskColor());
if (this.task.getLightTaskColor() == R.color.neutral_100) {
if (this.task.getLightTaskColor() == R.color.yellow_100) {
this.btnPlusIconView.setImageResource(R.drawable.habit_plus_yellow);
} else {
this.btnPlusIconView.setImageResource(R.drawable.habit_plus);
@ -56,7 +56,7 @@ public class HabitViewHolder extends BaseTaskViewHolder {
if (this.task.down) {
this.btnMinusWrapper.setBackgroundResource(this.task.getLightTaskColor());
if (this.task.getLightTaskColor() == R.color.neutral_100) {
if (this.task.getLightTaskColor() == R.color.yellow_100) {
this.btnMinusIconView.setImageResource(R.drawable.habit_minus_yellow);
} else {
this.btnMinusIconView.setImageResource(R.drawable.habit_minus);

View file

@ -1,67 +1,87 @@
package com.habitrpg.android.habitica.ui.views;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.helpers.NumberAbbreviator;
import butterknife.BindView;
import butterknife.ButterKnife;
public class CurrencyView extends android.support.v7.widget.AppCompatTextView {
public class CurrencyView extends LinearLayout {
@BindView(R.id.hourglassTextView)
TextView hourglassTextView;
@BindView(R.id.gemTextView)
TextView gemTextView;
@BindView(R.id.goldTextView)
TextView goldTextView;
private boolean lightbackground = false;
private String currency;
private BitmapDrawable drawable;
public CurrencyView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setupView();
}
public CurrencyView(Context context) {
public CurrencyView(Context context, String currency, boolean lightbackground) {
super(context);
setupView();
this.lightbackground = lightbackground;
setCurrency(currency);
}
private void setupView() {
inflate(getContext(), R.layout.currency_view, this);
ButterKnife.bind(this, this);
Drawable hourglassDrawable = new BitmapDrawable(getResources(), HabiticaIconsHelper.imageOfHourglass());
hourglassTextView.setCompoundDrawablesWithIntrinsicBounds(hourglassDrawable, null, null, null);
Drawable goldDrawable = new BitmapDrawable(getResources(), HabiticaIconsHelper.imageOfGold());
goldTextView.setCompoundDrawablesWithIntrinsicBounds(goldDrawable, null, null, null);
Drawable gemDrawable = new BitmapDrawable(getResources(), HabiticaIconsHelper.imageOfGem());
gemTextView.setCompoundDrawablesWithIntrinsicBounds(gemDrawable, null, null, null);
private void setIcon(Bitmap iconBitmap) {
drawable = new BitmapDrawable(getResources(), iconBitmap);
this.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, getContext().getResources().getDisplayMetrics());
setCompoundDrawablePadding(padding);
}
public void setGold(Double gold) {
goldTextView.setText(NumberAbbreviator.abbreviate(getContext(), gold));
public String getCurrency() {
return currency;
}
public void setGems(Integer gemCount) {
gemTextView.setText(String.valueOf(gemCount));
gemTextView.setVisibility(View.VISIBLE);
public void setCurrency(String currency) {
this.currency = currency;
if ("gold".equals(currency)) {
setIcon(HabiticaIconsHelper.imageOfGold());
if (lightbackground) {
setTextColor(ContextCompat.getColor(getContext(), R.color.yellow_50));
} else {
setTextColor(ContextCompat.getColor(getContext(), R.color.yellow_100));
}
} else if ("gems".equals(currency)) {
setIcon(HabiticaIconsHelper.imageOfGem());
setTextColor(ContextCompat.getColor(getContext(), R.color.green_50));
} else if ("hourglasses".equals(currency)) {
setIcon(HabiticaIconsHelper.imageOfHourglass());
if (lightbackground) {
setTextColor(ContextCompat.getColor(getContext(), R.color.brand_300));
} else {
setTextColor(ContextCompat.getColor(getContext(), R.color.brand_500));
}
}
updateVisibility();
}
public void setHourglasses(Integer hourglassCount) {
hourglassTextView.setText(String.valueOf(hourglassCount));
if (hourglassCount > 0) {
hourglassTextView.setVisibility(View.VISIBLE);
} else {
hourglassTextView.setVisibility(View.GONE);
private void updateVisibility() {
if ("hourglasses".equals(currency)) {
setVisibility("0".equals(getText()) ? View.GONE : View.VISIBLE);
}
}
public void setValue(Double value) {
setText(NumberAbbreviator.abbreviate(getContext(), value));
updateVisibility();
}
public void setLocked(boolean isLocked) {
if (isLocked) {
this.setTextColor(ContextCompat.getColor(getContext(), R.color.gray_300));
drawable.setAlpha(127);
} else {
drawable.setAlpha(255);
}
this.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
}
}

View file

@ -0,0 +1,73 @@
package com.habitrpg.android.habitica.ui.views;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.LinearLayout;
import com.habitrpg.android.habitica.R;
/**
* Created by phillip on 08.09.17.
*/
public class CurrencyViews extends LinearLayout {
private CurrencyView hourglassTextView;
private CurrencyView goldTextView;
private CurrencyView gemTextView;
public boolean lightbackground;
public CurrencyViews(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
TypedArray attributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.CurrencyViews,
0, 0);
lightbackground = attributes.getBoolean(R.styleable.CurrencyViews_hasLightBackground, true);
setupViews();
}
public CurrencyViews(Context context) {
super(context);
setupViews();
}
private void setupViews() {
Resources r = getContext().getResources();
int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics());
hourglassTextView = new CurrencyView(getContext(), "hourglasses", lightbackground);
this.addView(hourglassTextView);
LinearLayout.LayoutParams hourglassParams = (LayoutParams) hourglassTextView.getLayoutParams();
hourglassParams.setMargins(margin, 0, 0, 0);
hourglassTextView.setLayoutParams(hourglassParams);
goldTextView = new CurrencyView(getContext(), "gold", lightbackground);
this.addView(goldTextView);
LinearLayout.LayoutParams goldParams = (LayoutParams) goldTextView.getLayoutParams();
goldParams.setMargins(margin, 0, 0, 0);
goldTextView.setLayoutParams(goldParams);
gemTextView = new CurrencyView(getContext(), "gems", lightbackground);
this.addView(gemTextView);
LinearLayout.LayoutParams gemParams = (LayoutParams) gemTextView.getLayoutParams();
gemParams.setMargins(margin, 0, 0, 0);
gemTextView.setLayoutParams(gemParams);
}
public void setGold(Double gold) {
goldTextView.setValue(gold);
}
public void setGems(Integer gemCount) {
gemTextView.setValue(Double.valueOf(gemCount));
}
public void setHourglasses(Integer hourglassCount) {
hourglassTextView.setText(String.valueOf(hourglassCount));
}
}

View file

@ -20,6 +20,7 @@ import com.habitrpg.android.habitica.helpers.RxErrorHandler;
import com.habitrpg.android.habitica.models.shops.ShopItem;
import com.habitrpg.android.habitica.models.user.User;
import com.habitrpg.android.habitica.ui.views.CurrencyView;
import com.habitrpg.android.habitica.ui.views.CurrencyViews;
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
import org.greenrobot.eventbus.EventBus;
@ -41,13 +42,11 @@ public class PurchaseDialog extends AlertDialog {
InventoryRepository inventoryRepository;
@BindView(R.id.currencyView)
CurrencyView currencyView;
CurrencyViews currencyView;
@BindView(R.id.limitedTextView)
TextView limitedTextView;
@BindView(R.id.priceLabel)
TextView priceLabel;
@BindView(R.id.currency_icon_view)
ImageView currencyIconView;
CurrencyView priceLabel;
@BindView(R.id.buyButton)
View buyButton;
@BindView(R.id.content_container)
@ -57,8 +56,6 @@ public class PurchaseDialog extends AlertDialog {
private ShopItem shopItem;
private PurchaseDialogContent contentView;
private CompositeSubscription compositeSubscription;
public String shopIdentifier;
@ -93,7 +90,7 @@ public class PurchaseDialog extends AlertDialog {
limitedTextView.setText(getContext().getString(R.string.gems_left_nomax, gemsLeft));
}
limitedTextView.setVisibility(View.VISIBLE);
limitedTextView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.good_10));
limitedTextView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.green_10));
}
}
@ -113,19 +110,8 @@ public class PurchaseDialog extends AlertDialog {
buyButton.setVisibility(View.VISIBLE);
if (item.getUnlockCondition() == null) {
priceLabel.setText(item.getValue().toString());
if (item.getCurrency().equals("gold")) {
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfGold());
priceLabel.setTextColor(ContextCompat.getColor(getContext(), R.color.gold));
} else if (item.getCurrency().equals("gems")) {
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfGem());
priceLabel.setTextColor(ContextCompat.getColor(getContext(), R.color.good_10));
} else if (item.getCurrency().equals("hourglasses")) {
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfHourglass());
priceLabel.setTextColor(ContextCompat.getColor(getContext(), R.color.brand_300));
} else {
setBuyButtonEnabled(false);
}
priceLabel.setValue(Double.valueOf(item.getValue()));
priceLabel.setCurrency(item.getCurrency());
} else {
setBuyButtonEnabled(false);
}
@ -137,13 +123,9 @@ public class PurchaseDialog extends AlertDialog {
limitedTextView.setVisibility(View.GONE);
}
if (item.getLocked()) {
priceLabel.setTextColor(ContextCompat.getColor(getContext(), R.color.gray_300));
currencyIconView.setAlpha(0.5f);
} else {
currencyIconView.setAlpha(1.0f);
}
priceLabel.setLocked(item.getLocked());
PurchaseDialogContent contentView;
if (shopItem.isTypeItem()) {
contentView = new PurchaseDialogItemContent(getContext());
} else if (shopItem.isTypeQuest()) {
@ -199,7 +181,7 @@ public class PurchaseDialog extends AlertDialog {
dismiss();
}
public void setBuyButtonEnabled(boolean enabled) {
private void setBuyButtonEnabled(boolean enabled) {
if (enabled) {
buyButton.setAlpha(0.5f);
} else{

View file

@ -112,7 +112,7 @@ public class AvatarStatsWidgetProvider extends BaseWidgetProvider {
}
remoteViews.setImageViewBitmap(R.id.hourglass_cion, HabiticaIconsHelper.imageOfHourglass());
remoteViews.setImageViewBitmap(R.id.gem_icon, HabiticaIconsHelper.imageOfGem());
remoteViews.setImageViewBitmap(R.id.goldTextView, HabiticaIconsHelper.imageOfGold());
remoteViews.setImageViewBitmap(R.id.gold_icon, HabiticaIconsHelper.imageOfGold());
remoteViews.setTextViewText(R.id.lvl_tv, context.getString(R.string.user_level, user.getStats().getLvl()));
AvatarView avatarView = new AvatarView(context, true, true, true);