mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
add insufficient currency dialogs
This commit is contained in:
parent
e69ad2e3e9
commit
ccc774f062
9 changed files with 495 additions and 40 deletions
17
Habitica/res/layout/dialog_insufficient_currency.xml
Normal file
17
Habitica/res/layout/dialog_insufficient_currency.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/shopitem_image_size"
|
||||
android:layout_height="@dimen/shopitem_image_size"
|
||||
android:layout_margin="12dp"
|
||||
android:scaleType="center" />
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
|
@ -655,4 +655,9 @@
|
|||
<string name="nevermind">Nevermind</string>
|
||||
<string name="resetting_account">Resetting Account</string>
|
||||
<string name="deleting_account">Deleting Account</string>
|
||||
<string name="insufficientGold">You need to complete more tasks before you can afford this item!</string>
|
||||
<string name="insufficientGems">You\'ll need more Gems to buy this item!</string>
|
||||
<string name="purchase_gems">Purchase gems</string>
|
||||
<string name="insufficientHourglasses">You\'ll need more Mystic Hourglasses to buy this item!</string>
|
||||
<string name="get_hourglasses">Get hourglasses</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.Stack;
|
|||
|
||||
|
||||
/**
|
||||
* Created by Phillip Thelen on 20.09.17.
|
||||
* Created by Phillip Thelen on 27.09.17.
|
||||
* Copyright © 2017 HabitRPG Inc.. All rights reserved.
|
||||
*
|
||||
* Generated by PaintCode
|
||||
|
|
@ -77,12 +77,12 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForHeart.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor3 = Color.argb(128, 255, 255, 255);
|
||||
int fillColor5 = Color.argb(64, 255, 255, 255);
|
||||
int heartDarkBackground = Color.argb(178, 255, 255, 255);
|
||||
int fillColor2 = Color.argb(255, 255, 97, 101);
|
||||
int fillColor3 = Color.argb(128, 255, 255, 255);
|
||||
int fillColor4 = Color.argb(89, 181, 36, 40);
|
||||
int heartLightBackground = Color.argb(255, 247, 78, 82);
|
||||
int heartDarkBackground = Color.argb(178, 255, 255, 255);
|
||||
int fillColor6 = Color.argb(128, 181, 36, 40);
|
||||
|
||||
// Local Variables
|
||||
|
|
@ -588,11 +588,11 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForMagic.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor5 = Color.argb(64, 255, 255, 255);
|
||||
int fillColor3 = Color.argb(128, 255, 255, 255);
|
||||
int fillColor9 = Color.argb(64, 31, 112, 154);
|
||||
int fillColor8 = Color.argb(255, 80, 181, 233);
|
||||
int fillColor5 = Color.argb(64, 255, 255, 255);
|
||||
int fillColor7 = Color.argb(255, 41, 149, 205);
|
||||
int fillColor8 = Color.argb(255, 80, 181, 233);
|
||||
|
||||
// Resize to Target Frame
|
||||
canvas.save();
|
||||
|
|
@ -739,8 +739,8 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForGold.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor13 = Color.argb(191, 191, 125, 26);
|
||||
int fillColor12 = Color.argb(128, 191, 125, 26);
|
||||
int fillColor13 = Color.argb(191, 191, 125, 26);
|
||||
int fillColor5 = Color.argb(64, 255, 255, 255);
|
||||
int fillColor3 = Color.argb(128, 255, 255, 255);
|
||||
int fillColor10 = Color.argb(255, 255, 166, 35);
|
||||
|
|
@ -893,9 +893,9 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForGem.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor5 = Color.argb(64, 255, 255, 255);
|
||||
int fillColor3 = Color.argb(128, 255, 255, 255);
|
||||
int fillColor15 = Color.argb(89, 27, 153, 107);
|
||||
int fillColor5 = Color.argb(64, 255, 255, 255);
|
||||
int fillColor14 = Color.argb(255, 36, 204, 143);
|
||||
|
||||
// Resize to Target Frame
|
||||
|
|
@ -1102,8 +1102,8 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForHourglass.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor19 = Color.argb(255, 79, 42, 147);
|
||||
int fillColor18 = Color.argb(255, 154, 98, 255);
|
||||
int fillColor19 = Color.argb(255, 79, 42, 147);
|
||||
int fillColor17 = Color.argb(230, 255, 255, 255);
|
||||
int fillColor16 = Color.argb(204, 169, 220, 246);
|
||||
|
||||
|
|
@ -1520,14 +1520,14 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForWarrior.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor23 = Color.argb(255, 229, 65, 77);
|
||||
int fillColor = Color.argb(255, 240, 97, 102);
|
||||
int fillColor42 = Color.argb(255, 255, 149, 152);
|
||||
int fillColor43 = Color.argb(255, 200, 43, 43);
|
||||
int fillColor41 = Color.argb(255, 255, 149, 152);
|
||||
int fillColor21 = Color.argb(255, 255, 182, 184);
|
||||
int fillColor20 = Color.argb(255, 255, 181, 183);
|
||||
int fillColor42 = Color.argb(255, 255, 149, 152);
|
||||
int fillColor22 = Color.argb(255, 242, 123, 134);
|
||||
int fillColor41 = Color.argb(255, 255, 149, 152);
|
||||
int fillColor23 = Color.argb(255, 229, 65, 77);
|
||||
int fillColor = Color.argb(255, 240, 97, 102);
|
||||
|
||||
// Local Variables
|
||||
boolean lightBackground = !darkBackground;
|
||||
|
|
@ -2694,9 +2694,9 @@ public class HabiticaIcons {
|
|||
|
||||
public static void drawDifficultyStars(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, float difficulty) {
|
||||
// Local Variables
|
||||
float _1StarDifficulty = difficulty >= 1f ? 1f : (difficulty >= 0.5f ? 0.5f : 0f);
|
||||
float _4StarDifficulty = difficulty >= 4f ? 1f : (difficulty >= 3.5f ? 0.5f : 0f);
|
||||
float _2StarDifficulty = difficulty >= 2f ? 1f : (difficulty >= 1.5f ? 0.5f : 0f);
|
||||
float _1StarDifficulty = difficulty >= 1f ? 1f : (difficulty >= 0.5f ? 0.5f : 0f);
|
||||
float _3StarDifficulty = difficulty >= 3f ? 1f : (difficulty >= 2.5f ? 0.5f : 0f);
|
||||
|
||||
// Resize to Target Frame
|
||||
|
|
@ -2778,8 +2778,8 @@ public class HabiticaIcons {
|
|||
int fillColor25 = Color.argb(255, 225, 224, 227);
|
||||
|
||||
// Local Variables
|
||||
boolean isFull = singleDifficulty == 1f;
|
||||
boolean isHalf = singleDifficulty == 0.5f;
|
||||
boolean isFull = singleDifficulty == 1f;
|
||||
|
||||
// Resize to Target Frame
|
||||
canvas.save();
|
||||
|
|
@ -3962,12 +3962,12 @@ public class HabiticaIcons {
|
|||
|
||||
// Local Colors
|
||||
int indicatorLocked = Color.argb(255, 237, 236, 238);
|
||||
int fillColor39 = Color.argb(255, 189, 168, 255);
|
||||
int fillColor40 = Color.argb(255, 165, 161, 172);
|
||||
int strokeColor = Color.argb(255, 97, 51, 180);
|
||||
int fillColor38 = Color.argb(255, 165, 161, 172);
|
||||
int strokeColor2 = Color.argb(255, 189, 168, 255);
|
||||
int shadowTint = Color.argb(255, 26, 24, 29);
|
||||
int fillColor38 = Color.argb(255, 165, 161, 172);
|
||||
int fillColor40 = Color.argb(255, 165, 161, 172);
|
||||
int fillColor39 = Color.argb(255, 189, 168, 255);
|
||||
int strokeColor2 = Color.argb(255, 189, 168, 255);
|
||||
|
||||
// Local Shadows
|
||||
PaintCodeShadow shadow = CacheForItemIndicator.shadow.get(PaintCodeColor.colorByChangingAlpha(shadowTint, (int) (Color.alpha(shadowTint) * 0.12f * 255f)), 0f, 1f, 1f);
|
||||
|
|
@ -4386,13 +4386,13 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForRogue.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor36 = Color.argb(255, 97, 51, 180);
|
||||
int fillColor19 = Color.argb(255, 79, 42, 147);
|
||||
int fillColor47 = Color.argb(255, 198, 182, 228);
|
||||
int fillColor45 = Color.argb(255, 155, 129, 226);
|
||||
int fillColor44 = Color.argb(255, 204, 190, 237);
|
||||
int fillColor46 = Color.argb(255, 122, 84, 192);
|
||||
int fillColor48 = Color.argb(255, 137, 102, 199);
|
||||
int fillColor36 = Color.argb(255, 97, 51, 180);
|
||||
int fillColor45 = Color.argb(255, 155, 129, 226);
|
||||
int fillColor47 = Color.argb(255, 198, 182, 228);
|
||||
int fillColor44 = Color.argb(255, 204, 190, 237);
|
||||
int fillColor19 = Color.argb(255, 79, 42, 147);
|
||||
|
||||
// Local Variables
|
||||
boolean lightBackground = !darkBackground;
|
||||
|
|
@ -5183,18 +5183,18 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForHealer.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor10 = Color.argb(255, 255, 166, 35);
|
||||
int fillColor56 = Color.argb(255, 255, 166, 35);
|
||||
int fillColor50 = Color.argb(255, 226, 158, 69);
|
||||
int fillColor55 = Color.argb(255, 253, 198, 126);
|
||||
int fillColor53 = Color.argb(255, 206, 129, 41);
|
||||
int fillColor54 = Color.argb(255, 207, 130, 41);
|
||||
int fillColor52 = Color.argb(255, 253, 198, 126);
|
||||
int fillColor59 = Color.argb(255, 255, 228, 201);
|
||||
int fillColor51 = Color.argb(255, 229, 144, 37);
|
||||
int fillColor58 = Color.argb(255, 229, 144, 37);
|
||||
int fillColor50 = Color.argb(255, 226, 158, 69);
|
||||
int fillColor10 = Color.argb(255, 255, 166, 35);
|
||||
int fillColor51 = Color.argb(255, 229, 144, 37);
|
||||
int fillColor57 = Color.argb(255, 255, 221, 181);
|
||||
int fillColor49 = Color.argb(255, 255, 215, 168);
|
||||
int fillColor56 = Color.argb(255, 255, 166, 35);
|
||||
int fillColor55 = Color.argb(255, 253, 198, 126);
|
||||
int fillColor54 = Color.argb(255, 207, 130, 41);
|
||||
int fillColor53 = Color.argb(255, 206, 129, 41);
|
||||
|
||||
// Local Variables
|
||||
boolean lightBackground = !darkBackground;
|
||||
|
|
@ -6020,17 +6020,17 @@ public class HabiticaIcons {
|
|||
Paint paint = CacheForMage.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor68 = Color.argb(255, 31, 110, 162);
|
||||
int fillColor60 = Color.argb(255, 182, 225, 247);
|
||||
int fillColor67 = Color.argb(255, 83, 180, 229);
|
||||
int fillColor66 = Color.argb(255, 107, 196, 233);
|
||||
int fillColor61 = Color.argb(255, 39, 138, 191);
|
||||
int fillColor65 = Color.argb(255, 107, 196, 233);
|
||||
int fillColor60 = Color.argb(255, 182, 225, 247);
|
||||
int fillColor68 = Color.argb(255, 31, 110, 162);
|
||||
int fillColor64 = Color.argb(255, 77, 178, 214);
|
||||
int fillColor69 = Color.argb(255, 169, 219, 245);
|
||||
int fillColor66 = Color.argb(255, 107, 196, 233);
|
||||
int fillColor62 = Color.argb(255, 83, 180, 229);
|
||||
int fillColor63 = Color.argb(255, 42, 160, 207);
|
||||
int fillColor70 = Color.argb(255, 132, 207, 242);
|
||||
int fillColor62 = Color.argb(255, 83, 180, 229);
|
||||
int fillColor69 = Color.argb(255, 169, 219, 245);
|
||||
int fillColor61 = Color.argb(255, 39, 138, 191);
|
||||
int fillColor67 = Color.argb(255, 83, 180, 229);
|
||||
|
||||
// Local Variables
|
||||
boolean lightBackground = !darkBackground;
|
||||
|
|
@ -6557,6 +6557,296 @@ public class HabiticaIcons {
|
|||
canvas.restore();
|
||||
}
|
||||
|
||||
private static class CacheForHourglassShop {
|
||||
private static Paint paint = new Paint();
|
||||
private static RectF originalFrame = new RectF(0f, 0f, 42f, 53f);
|
||||
private static RectF resizedFrame = new RectF();
|
||||
private static RectF rectangleRect = new RectF();
|
||||
private static Path rectanglePath = new Path();
|
||||
private static RectF group = new RectF();
|
||||
private static Path clipPath = new Path();
|
||||
private static RectF rectangle2Rect = new RectF();
|
||||
private static Path rectangle2Path = new Path();
|
||||
private static RectF group2 = new RectF();
|
||||
private static Path clip2Path = new Path();
|
||||
private static RectF rectangle4Rect = new RectF();
|
||||
private static Path rectangle4Path = new Path();
|
||||
private static RectF bezierRect = new RectF();
|
||||
private static Path bezierPath = new Path();
|
||||
private static RectF bezier2Rect = new RectF();
|
||||
private static Path bezier2Path = new Path();
|
||||
private static RectF bezier3Rect = new RectF();
|
||||
private static Path bezier3Path = new Path();
|
||||
private static RectF bezier4Rect = new RectF();
|
||||
private static Path bezier4Path = new Path();
|
||||
private static RectF bezier5Rect = new RectF();
|
||||
private static Path bezier5Path = new Path();
|
||||
private static RectF bezier6Rect = new RectF();
|
||||
private static Path bezier6Path = new Path();
|
||||
}
|
||||
|
||||
public static void drawHourglassShop(Canvas canvas) {
|
||||
HabiticaIcons.drawHourglassShop(canvas, new RectF(0f, 0f, 42f, 53f), ResizingBehavior.AspectFit);
|
||||
}
|
||||
|
||||
public static void drawHourglassShop(Canvas canvas, RectF targetFrame, ResizingBehavior resizing) {
|
||||
// General Declarations
|
||||
Stack<Matrix> currentTransformation = new Stack<Matrix>();
|
||||
currentTransformation.push(new Matrix());
|
||||
Paint paint = CacheForHourglassShop.paint;
|
||||
|
||||
// Local Colors
|
||||
int fillColor19 = Color.argb(255, 79, 42, 147);
|
||||
int fillColor18 = Color.argb(255, 154, 98, 255);
|
||||
int fillColor17 = Color.argb(230, 255, 255, 255);
|
||||
int fillColor16 = Color.argb(204, 169, 220, 246);
|
||||
|
||||
// Resize to Target Frame
|
||||
canvas.save();
|
||||
RectF resizedFrame = CacheForHourglassShop.resizedFrame;
|
||||
HabiticaIcons.resizingBehaviorApply(resizing, CacheForHourglassShop.originalFrame, targetFrame, resizedFrame);
|
||||
canvas.translate(resizedFrame.left, resizedFrame.top);
|
||||
canvas.scale(resizedFrame.width() / 42f, resizedFrame.height() / 53f);
|
||||
|
||||
// Rectangle
|
||||
RectF rectangleRect = CacheForHourglassShop.rectangleRect;
|
||||
rectangleRect.set(19.5f, 0f, 22.5f, 10f);
|
||||
Path rectanglePath = CacheForHourglassShop.rectanglePath;
|
||||
rectanglePath.reset();
|
||||
rectanglePath.addRoundRect(rectangleRect, 1.4f, 1.4f, Path.Direction.CW);
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor18);
|
||||
canvas.drawPath(rectanglePath, paint);
|
||||
|
||||
// Group
|
||||
{
|
||||
RectF group = CacheForHourglassShop.group;
|
||||
group.set(-0.6f, 5.4f, 8.6f, 14.6f);
|
||||
canvas.save();
|
||||
|
||||
// Clip
|
||||
Path clipPath = CacheForHourglassShop.clipPath;
|
||||
clipPath.reset();
|
||||
clipPath.addRoundRect(group, 1.4f, 1.4f, Path.Direction.CW);
|
||||
canvas.clipPath(clipPath);
|
||||
|
||||
// Rectangle 2
|
||||
canvas.save();
|
||||
canvas.translate(4f, 10f);
|
||||
currentTransformation.peek().postTranslate(4f, 10f);
|
||||
canvas.rotate(45f);
|
||||
currentTransformation.peek().postRotate(45f);
|
||||
RectF rectangle2Rect = CacheForHourglassShop.rectangle2Rect;
|
||||
rectangle2Rect.set(-10f, -6.5f, 10f, 6.5f);
|
||||
Path rectangle2Path = CacheForHourglassShop.rectangle2Path;
|
||||
rectangle2Path.reset();
|
||||
rectangle2Path.moveTo(rectangle2Rect.left, rectangle2Rect.top);
|
||||
rectangle2Path.lineTo(rectangle2Rect.right, rectangle2Rect.top);
|
||||
rectangle2Path.lineTo(rectangle2Rect.right, rectangle2Rect.bottom);
|
||||
rectangle2Path.lineTo(rectangle2Rect.left, rectangle2Rect.bottom);
|
||||
rectangle2Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor18);
|
||||
canvas.drawPath(rectangle2Path, paint);
|
||||
canvas.restore();
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
// Group 2
|
||||
{
|
||||
RectF group2 = CacheForHourglassShop.group2;
|
||||
group2.set(32.5f, 5.4f, 41.7f, 14.6f);
|
||||
canvas.save();
|
||||
|
||||
// Clip 2
|
||||
Path clip2Path = CacheForHourglassShop.clip2Path;
|
||||
clip2Path.reset();
|
||||
clip2Path.addRoundRect(group2, 1.4f, 1.4f, Path.Direction.CW);
|
||||
canvas.clipPath(clip2Path);
|
||||
|
||||
// Rectangle 4
|
||||
canvas.save();
|
||||
canvas.translate(37.1f, 10f);
|
||||
currentTransformation.peek().postTranslate(37.1f, 10f);
|
||||
canvas.rotate(-45f);
|
||||
currentTransformation.peek().postRotate(-45f);
|
||||
RectF rectangle4Rect = CacheForHourglassShop.rectangle4Rect;
|
||||
rectangle4Rect.set(-10f, -6.5f, 10f, 6.5f);
|
||||
Path rectangle4Path = CacheForHourglassShop.rectangle4Path;
|
||||
rectangle4Path.reset();
|
||||
rectangle4Path.moveTo(rectangle4Rect.left, rectangle4Rect.top);
|
||||
rectangle4Path.lineTo(rectangle4Rect.right, rectangle4Rect.top);
|
||||
rectangle4Path.lineTo(rectangle4Rect.right, rectangle4Rect.bottom);
|
||||
rectangle4Path.lineTo(rectangle4Rect.left, rectangle4Rect.bottom);
|
||||
rectangle4Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor18);
|
||||
canvas.drawPath(rectangle4Path, paint);
|
||||
canvas.restore();
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
// Bezier
|
||||
RectF bezierRect = CacheForHourglassShop.bezierRect;
|
||||
bezierRect.set(10f, 16f, 31.14f, 52.24f);
|
||||
Path bezierPath = CacheForHourglassShop.bezierPath;
|
||||
bezierPath.reset();
|
||||
bezierPath.moveTo(10f, 44.69f);
|
||||
bezierPath.lineTo(10f, 48.74f);
|
||||
bezierPath.cubicTo(10f, 49.21f, 10.21f, 49.67f, 10.6f, 49.95f);
|
||||
bezierPath.cubicTo(14.79f, 53.01f, 26.35f, 53.01f, 30.55f, 49.95f);
|
||||
bezierPath.cubicTo(30.93f, 49.67f, 31.14f, 49.21f, 31.14f, 48.74f);
|
||||
bezierPath.lineTo(31.14f, 44.69f);
|
||||
bezierPath.cubicTo(31.14f, 41f, 29.25f, 37.46f, 26.38f, 35.35f);
|
||||
bezierPath.cubicTo(25.54f, 34.73f, 25.54f, 33.51f, 26.38f, 32.89f);
|
||||
bezierPath.cubicTo(29.25f, 30.78f, 31.14f, 27.24f, 31.14f, 23.55f);
|
||||
bezierPath.lineTo(31.14f, 19.5f);
|
||||
bezierPath.cubicTo(31.14f, 19.03f, 30.93f, 18.58f, 30.55f, 18.3f);
|
||||
bezierPath.cubicTo(26.35f, 15.23f, 14.79f, 15.23f, 10.6f, 18.3f);
|
||||
bezierPath.cubicTo(10.21f, 18.58f, 10f, 19.03f, 10f, 19.5f);
|
||||
bezierPath.lineTo(10f, 23.55f);
|
||||
bezierPath.cubicTo(10f, 27.24f, 11.89f, 30.78f, 14.76f, 32.89f);
|
||||
bezierPath.cubicTo(15.6f, 33.51f, 15.6f, 34.73f, 14.76f, 35.35f);
|
||||
bezierPath.cubicTo(11.89f, 37.46f, 10f, 41f, 10f, 44.69f);
|
||||
bezierPath.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
bezierPath.setFillType(Path.FillType.EVEN_ODD);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor16);
|
||||
canvas.drawPath(bezierPath, paint);
|
||||
|
||||
// Bezier 2
|
||||
RectF bezier2Rect = CacheForHourglassShop.bezier2Rect;
|
||||
bezier2Rect.set(13.02f, 19.02f, 28.12f, 49.22f);
|
||||
Path bezier2Path = CacheForHourglassShop.bezier2Path;
|
||||
bezier2Path.reset();
|
||||
bezier2Path.moveTo(20.57f, 19.02f);
|
||||
bezier2Path.cubicTo(24.01f, 19.02f, 26.68f, 19.64f, 28.12f, 20.36f);
|
||||
bezier2Path.lineTo(28.12f, 23.55f);
|
||||
bezier2Path.cubicTo(28.12f, 26.21f, 26.77f, 28.86f, 24.59f, 30.46f);
|
||||
bezier2Path.cubicTo(23.43f, 31.32f, 22.73f, 32.69f, 22.73f, 34.12f);
|
||||
bezier2Path.cubicTo(22.73f, 35.56f, 23.43f, 36.93f, 24.59f, 37.78f);
|
||||
bezier2Path.cubicTo(26.77f, 39.39f, 28.12f, 42.03f, 28.12f, 44.69f);
|
||||
bezier2Path.lineTo(28.12f, 47.89f);
|
||||
bezier2Path.cubicTo(26.68f, 48.6f, 24.01f, 49.22f, 20.57f, 49.22f);
|
||||
bezier2Path.cubicTo(17.14f, 49.22f, 14.46f, 48.6f, 13.02f, 47.89f);
|
||||
bezier2Path.lineTo(13.02f, 44.69f);
|
||||
bezier2Path.cubicTo(13.02f, 42.03f, 14.37f, 39.39f, 16.55f, 37.78f);
|
||||
bezier2Path.cubicTo(17.72f, 36.93f, 18.41f, 35.56f, 18.41f, 34.12f);
|
||||
bezier2Path.cubicTo(18.41f, 32.69f, 17.72f, 31.32f, 16.55f, 30.46f);
|
||||
bezier2Path.cubicTo(14.37f, 28.86f, 13.02f, 26.21f, 13.02f, 23.55f);
|
||||
bezier2Path.lineTo(13.02f, 20.36f);
|
||||
bezier2Path.cubicTo(14.46f, 19.64f, 17.14f, 19.02f, 20.57f, 19.02f);
|
||||
bezier2Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
bezier2Path.setFillType(Path.FillType.EVEN_ODD);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor17);
|
||||
canvas.drawPath(bezier2Path, paint);
|
||||
|
||||
// Bezier 3
|
||||
RectF bezier3Rect = CacheForHourglassShop.bezier3Rect;
|
||||
bezier3Rect.set(15.58f, 21.29f, 25.96f, 27.66f);
|
||||
Path bezier3Path = CacheForHourglassShop.bezier3Path;
|
||||
bezier3Path.reset();
|
||||
bezier3Path.moveTo(20.92f, 21.29f);
|
||||
bezier3Path.cubicTo(18.34f, 21.29f, 15.61f, 21.53f, 15.59f, 22.17f);
|
||||
bezier3Path.cubicTo(15.56f, 22.68f, 15.57f, 23.68f, 17.67f, 24.74f);
|
||||
bezier3Path.cubicTo(19.7f, 25.77f, 20.08f, 27.66f, 21.18f, 27.66f);
|
||||
bezier3Path.cubicTo(22.47f, 27.66f, 22.54f, 26.57f, 24.11f, 25.49f);
|
||||
bezier3Path.cubicTo(25.72f, 24.38f, 25.98f, 22.88f, 25.96f, 22.29f);
|
||||
bezier3Path.cubicTo(25.94f, 21.46f, 23.49f, 21.29f, 20.92f, 21.29f);
|
||||
bezier3Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
bezier3Path.setFillType(Path.FillType.EVEN_ODD);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor18);
|
||||
canvas.drawPath(bezier3Path, paint);
|
||||
|
||||
// Bezier 4
|
||||
RectF bezier4Rect = CacheForHourglassShop.bezier4Rect;
|
||||
bezier4Rect.set(21.76f, 21.32f, 25.96f, 27.39f);
|
||||
Path bezier4Path = CacheForHourglassShop.bezier4Path;
|
||||
bezier4Path.reset();
|
||||
bezier4Path.moveTo(24.11f, 25.49f);
|
||||
bezier4Path.cubicTo(25.72f, 24.38f, 25.98f, 22.88f, 25.96f, 22.29f);
|
||||
bezier4Path.cubicTo(25.94f, 21.63f, 24.41f, 21.39f, 22.49f, 21.32f);
|
||||
bezier4Path.cubicTo(23.03f, 21.59f, 23.72f, 22.17f, 23.55f, 23.32f);
|
||||
bezier4Path.cubicTo(23.37f, 24.51f, 21.49f, 25.83f, 21.8f, 26.89f);
|
||||
bezier4Path.cubicTo(21.86f, 27.09f, 21.96f, 27.26f, 22.08f, 27.39f);
|
||||
bezier4Path.cubicTo(22.64f, 27.01f, 23.01f, 26.25f, 24.11f, 25.49f);
|
||||
bezier4Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
bezier4Path.setFillType(Path.FillType.EVEN_ODD);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor19);
|
||||
canvas.drawPath(bezier4Path, paint);
|
||||
|
||||
// Bezier 5
|
||||
RectF bezier5Rect = CacheForHourglassShop.bezier5Rect;
|
||||
bezier5Rect.set(15.23f, 36.87f, 25.61f, 45.73f);
|
||||
Path bezier5Path = CacheForHourglassShop.bezier5Path;
|
||||
bezier5Path.reset();
|
||||
bezier5Path.moveTo(20.57f, 36.87f);
|
||||
bezier5Path.cubicTo(19.79f, 36.87f, 19.59f, 38.3f, 18.45f, 39.19f);
|
||||
bezier5Path.cubicTo(17.05f, 40.28f, 15.73f, 41.62f, 15.36f, 43.54f);
|
||||
bezier5Path.cubicTo(15.06f, 45.13f, 15.33f, 45.33f, 15.7f, 45.44f);
|
||||
bezier5Path.cubicTo(16.06f, 45.55f, 18.85f, 46.03f, 21.59f, 45.44f);
|
||||
bezier5Path.cubicTo(24.33f, 44.86f, 25.85f, 43.77f, 25.58f, 42.65f);
|
||||
bezier5Path.cubicTo(25.33f, 41.59f, 24.56f, 40.68f, 23.15f, 39.63f);
|
||||
bezier5Path.cubicTo(21.8f, 38.63f, 21.36f, 36.87f, 20.57f, 36.87f);
|
||||
bezier5Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
bezier5Path.setFillType(Path.FillType.EVEN_ODD);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor18);
|
||||
canvas.drawPath(bezier5Path, paint);
|
||||
|
||||
// Bezier 6
|
||||
RectF bezier6Rect = CacheForHourglassShop.bezier6Rect;
|
||||
bezier6Rect.set(15.32f, 42.59f, 25.52f, 45.73f);
|
||||
Path bezier6Path = CacheForHourglassShop.bezier6Path;
|
||||
bezier6Path.reset();
|
||||
bezier6Path.moveTo(15.7f, 45.44f);
|
||||
bezier6Path.cubicTo(16.06f, 45.55f, 18.85f, 46.03f, 21.59f, 45.44f);
|
||||
bezier6Path.cubicTo(23.76f, 44.98f, 25.17f, 44.19f, 25.52f, 43.33f);
|
||||
bezier6Path.cubicTo(25.52f, 43.31f, 25.52f, 43.29f, 25.51f, 43.28f);
|
||||
bezier6Path.cubicTo(25.36f, 42.69f, 23.07f, 42.34f, 20.22f, 42.8f);
|
||||
bezier6Path.cubicTo(17.51f, 43.24f, 15.31f, 44.14f, 15.32f, 45.15f);
|
||||
bezier6Path.cubicTo(15.4f, 45.33f, 15.54f, 45.39f, 15.7f, 45.44f);
|
||||
bezier6Path.close();
|
||||
|
||||
paint.reset();
|
||||
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
bezier6Path.setFillType(Path.FillType.EVEN_ODD);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(fillColor19);
|
||||
canvas.drawPath(bezier6Path, paint);
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
|
||||
// Canvas Images
|
||||
// Tab
|
||||
|
|
@ -6913,6 +7203,18 @@ public class HabiticaIcons {
|
|||
return imageOfCheckmark;
|
||||
}
|
||||
|
||||
private static Bitmap imageOfHourglassShop = null;
|
||||
public static Bitmap imageOfHourglassShop() {
|
||||
if (imageOfHourglassShop != null)
|
||||
return imageOfHourglassShop;
|
||||
|
||||
imageOfHourglassShop = Bitmap.createBitmap(42, 53, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(imageOfHourglassShop);
|
||||
HabiticaIcons.drawHourglassShop(canvas);
|
||||
|
||||
return imageOfHourglassShop;
|
||||
}
|
||||
|
||||
|
||||
// Resizing Behavior
|
||||
public static void resizingBehaviorApply(ResizingBehavior behavior, RectF rect, RectF target, RectF result) {
|
||||
|
|
|
|||
|
|
@ -420,4 +420,17 @@ public class HabiticaIconsHelper {
|
|||
|
||||
return imageOfMageLightBg;
|
||||
}
|
||||
|
||||
private static Bitmap imageOfHourglassShop = null;
|
||||
public static Bitmap imageOfHourglassShop() {
|
||||
if (imageOfHourglassShop != null)
|
||||
return imageOfHourglassShop;
|
||||
|
||||
imageOfHourglassShop = Bitmap.createBitmap(scaleSize(42), scaleSize(53), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(imageOfHourglassShop);
|
||||
canvas.scale(displayDensity, displayDensity);
|
||||
HabiticaIcons.drawHourglassShop(canvas);
|
||||
|
||||
return imageOfHourglassShop;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.habitrpg.android.habitica.ui.views.insufficientCurrency;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by phillip on 27.09.17.
|
||||
*/
|
||||
|
||||
abstract public class InsufficientCurrencyDialog extends AlertDialog {
|
||||
|
||||
@BindView(R.id.imageView)
|
||||
ImageView imageView;
|
||||
@BindView(R.id.textView)
|
||||
TextView textView;
|
||||
|
||||
public InsufficientCurrencyDialog(Context context) {
|
||||
super(context);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View view = inflater.inflate(R.layout.dialog_insufficient_currency, null);
|
||||
ButterKnife.bind(this, view);
|
||||
setView(view);
|
||||
|
||||
this.setButton(AlertDialog.BUTTON_NEUTRAL, context.getString(R.string.close), (dialogInterface, i) -> {
|
||||
this.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.habitrpg.android.habitica.ui.views.insufficientCurrency;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenGemPurchaseFragmentCommand;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* Created by phillip on 27.09.17.
|
||||
*/
|
||||
|
||||
public class InsufficientGemsDialog extends InsufficientCurrencyDialog {
|
||||
|
||||
public InsufficientGemsDialog(Context context) {
|
||||
super(context);
|
||||
|
||||
imageView.setImageResource(R.drawable.gems_84);
|
||||
textView.setText(R.string.insufficientGems);
|
||||
|
||||
setButton(AlertDialog.BUTTON_POSITIVE, context.getString(R.string.purchase_gems), (dialogInterface, i) -> {
|
||||
EventBus.getDefault().post(new OpenGemPurchaseFragmentCommand());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.habitrpg.android.habitica.ui.views.insufficientCurrency;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
|
||||
|
||||
public class InsufficientGoldDialog extends InsufficientCurrencyDialog {
|
||||
public InsufficientGoldDialog(Context context) {
|
||||
super(context);
|
||||
|
||||
imageView.setImageBitmap(HabiticaIconsHelper.imageOfGoldReward());
|
||||
textView.setText(context.getString(R.string.insufficientGold));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.habitrpg.android.habitica.ui.views.insufficientCurrency;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenGemPurchaseFragmentCommand;
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
public class InsufficientHourglassesDialog extends InsufficientCurrencyDialog {
|
||||
public InsufficientHourglassesDialog(Context context) {
|
||||
super(context);
|
||||
|
||||
imageView.setImageBitmap(HabiticaIconsHelper.imageOfHourglassShop());
|
||||
textView.setText(R.string.insufficientHourglasses);
|
||||
|
||||
|
||||
setButton(AlertDialog.BUTTON_POSITIVE, context.getString(R.string.get_hourglasses), (dialogInterface, i) -> {
|
||||
EventBus.getDefault().post(new OpenGemPurchaseFragmentCommand());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,10 @@ 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.HabiticaSnackbar;
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientCurrencyDialog;
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientGemsDialog;
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientGoldDialog;
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientHourglassesDialog;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
|
@ -110,7 +114,6 @@ public class PurchaseDialog extends AlertDialog {
|
|||
}
|
||||
|
||||
if (shopItem != null && !shopItem.canBuy(user)) {
|
||||
buyButton.setEnabled(false);
|
||||
priceLabel.setCantAfford(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -202,7 +205,7 @@ public class PurchaseDialog extends AlertDialog {
|
|||
|
||||
@OnClick(R.id.buyButton)
|
||||
void onBuyButtonClicked() {
|
||||
if (shopItem.canBuy(user) || !shopItem.getCurrency().equals("gems")) {
|
||||
if (shopItem.canBuy(user)) {
|
||||
Observable<Void> observable;
|
||||
if ((shopIdentifier!= null && shopIdentifier.equals(Shop.TIME_TRAVELERS_SHOP)) || "mystery_set".equals(shopItem.purchaseType)) {
|
||||
if (shopItem.purchaseType.equals("gear")) {
|
||||
|
|
@ -236,7 +239,17 @@ public class PurchaseDialog extends AlertDialog {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
EventBus.getDefault().post(new OpenGemPurchaseFragmentCommand());
|
||||
InsufficientCurrencyDialog dialog = null;
|
||||
if ("gold".equals(shopItem.currency)) {
|
||||
dialog = new InsufficientGoldDialog(getContext());
|
||||
} else if ("gems".equals(shopItem.currency)) {
|
||||
dialog = new InsufficientGemsDialog(getContext());
|
||||
} else if ("hourglasses".equals(shopItem.currency)) {
|
||||
dialog = new InsufficientHourglassesDialog(getContext());
|
||||
}
|
||||
if (dialog != null) {
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue