Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 17 KiB |
@ -0,0 +1,14 @@
|
||||
update habits set color=0 where color=-2937041;
|
||||
update habits set color=1 where color=-1684967;
|
||||
update habits set color=2 where color=-415707;
|
||||
update habits set color=3 where color=-5262293;
|
||||
update habits set color=4 where color=-13070788;
|
||||
update habits set color=5 where color=-16742021;
|
||||
update habits set color=6 where color=-16732991;
|
||||
update habits set color=7 where color=-16540699;
|
||||
update habits set color=8 where color=-10603087;
|
||||
update habits set color=9 where color=-7461718;
|
||||
update habits set color=10 where color=-2614432;
|
||||
update habits set color=11 where color=-13619152;
|
||||
update habits set color=12 where color=-5592406;
|
||||
update habits set color=0 where color<0 or color>12;
|
@ -1,202 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.helpers.ColorHelper;
|
||||
import org.isoron.uhabits.models.Habit;
|
||||
|
||||
public class CheckmarkView extends View implements HabitDataView
|
||||
{
|
||||
private Paint pCard;
|
||||
private Paint pIcon;
|
||||
|
||||
private int primaryColor;
|
||||
private int timesColor;
|
||||
private int darkGrey;
|
||||
|
||||
private int width;
|
||||
private int height;
|
||||
private float leftMargin;
|
||||
private float topMargin;
|
||||
private float padding;
|
||||
private String label;
|
||||
|
||||
private String fa_check;
|
||||
private String fa_times;
|
||||
|
||||
private int check_status;
|
||||
|
||||
private Rect rect;
|
||||
private TextPaint textPaint;
|
||||
private StaticLayout labelLayout;
|
||||
private Habit habit;
|
||||
|
||||
public CheckmarkView(Context context)
|
||||
{
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public CheckmarkView(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context)
|
||||
{
|
||||
Typeface fontawesome =
|
||||
Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf");
|
||||
|
||||
pCard = new Paint();
|
||||
pCard.setAntiAlias(true);
|
||||
|
||||
pIcon = new Paint();
|
||||
pIcon.setAntiAlias(true);
|
||||
pIcon.setTypeface(fontawesome);
|
||||
pIcon.setTextAlign(Paint.Align.CENTER);
|
||||
|
||||
textPaint = new TextPaint();
|
||||
textPaint.setColor(Color.WHITE);
|
||||
textPaint.setAntiAlias(true);
|
||||
|
||||
fa_check = context.getString(R.string.fa_check);
|
||||
fa_times = context.getString(R.string.fa_times);
|
||||
|
||||
primaryColor = ColorHelper.palette[10];
|
||||
timesColor = Color.argb(128, 255, 255, 255);
|
||||
darkGrey = Color.argb(64, 0, 0, 0);
|
||||
|
||||
rect = new Rect();
|
||||
check_status = 0;
|
||||
label = "Habit";
|
||||
}
|
||||
|
||||
public void setHabit(Habit habit)
|
||||
{
|
||||
this.habit = habit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas)
|
||||
{
|
||||
super.onDraw(canvas);
|
||||
|
||||
drawBackground(canvas);
|
||||
drawCheckmark(canvas);
|
||||
drawLabel(canvas);
|
||||
}
|
||||
|
||||
private void drawBackground(Canvas canvas)
|
||||
{
|
||||
int color = (check_status == 2 ? primaryColor : darkGrey);
|
||||
|
||||
pCard.setColor(color);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
canvas.drawRoundRect(leftMargin, topMargin, width - leftMargin, height - topMargin, padding,
|
||||
padding, pCard);
|
||||
else
|
||||
canvas.drawRect(leftMargin, topMargin, width - leftMargin, height - topMargin, pCard);
|
||||
}
|
||||
|
||||
private void drawCheckmark(Canvas canvas)
|
||||
{
|
||||
String text = (check_status == 0 ? fa_times : fa_check);
|
||||
int color = (check_status == 2 ? Color.WHITE : timesColor);
|
||||
|
||||
pIcon.setColor(color);
|
||||
pIcon.setTextSize(width * 0.5f);
|
||||
pIcon.getTextBounds(text, 0, 1, rect);
|
||||
|
||||
int y = (int) ((0.67f * height - rect.bottom - rect.top) / 2);
|
||||
canvas.drawText(text, width / 2, y, pIcon);
|
||||
}
|
||||
|
||||
private void drawLabel(Canvas canvas)
|
||||
{
|
||||
canvas.save();
|
||||
float y;
|
||||
int nLines = labelLayout.getLineCount();
|
||||
|
||||
if(nLines == 1)
|
||||
y = height * 0.8f - padding;
|
||||
else
|
||||
y = height * 0.7f - padding;
|
||||
|
||||
canvas.translate(leftMargin + padding, y);
|
||||
|
||||
labelLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
setMeasuredDimension(width, (int) (width * 1.25));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight)
|
||||
{
|
||||
this.width = getMeasuredWidth();
|
||||
this.height = getMeasuredHeight();
|
||||
|
||||
leftMargin = (width * 0.015f);
|
||||
topMargin = (height * 0.015f);
|
||||
padding = 8 * leftMargin;
|
||||
textPaint.setTextSize(0.15f * width);
|
||||
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
public void refreshData()
|
||||
{
|
||||
this.check_status = habit.checkmarks.getTodayValue();
|
||||
this.primaryColor = Color.argb(230, Color.red(habit.color), Color.green(habit.color),
|
||||
Color.blue(habit.color));
|
||||
this.label = habit.name;
|
||||
|
||||
updateLabel();
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
private void updateLabel()
|
||||
{
|
||||
textPaint.setColor(Color.WHITE);
|
||||
labelLayout = new StaticLayout(label, textPaint,
|
||||
(int) (width - 2 * leftMargin - 2 * padding),
|
||||
Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.helpers.ColorHelper;
|
||||
import org.isoron.uhabits.helpers.UIHelper;
|
||||
import org.isoron.uhabits.models.Checkmark;
|
||||
import org.isoron.uhabits.models.Habit;
|
||||
import org.isoron.uhabits.models.Score;
|
||||
|
||||
public class CheckmarkWidgetView extends HabitWidgetView implements HabitDataView
|
||||
{
|
||||
private int activeColor;
|
||||
private float percentage;
|
||||
|
||||
@Nullable
|
||||
private String name;
|
||||
|
||||
@Nullable
|
||||
private RingView ring;
|
||||
private TextView label;
|
||||
private int checkmarkValue;
|
||||
|
||||
public CheckmarkWidgetView(Context context)
|
||||
{
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public CheckmarkWidgetView(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
ring = (RingView) findViewById(R.id.scoreRing);
|
||||
label = (TextView) findViewById(R.id.label);
|
||||
|
||||
if(ring != null) ring.setIsTransparencyEnabled(true);
|
||||
|
||||
if(isInEditMode())
|
||||
{
|
||||
percentage = 0.75f;
|
||||
name = "Wake up early";
|
||||
activeColor = ColorHelper.CSV_PALETTE[6];
|
||||
checkmarkValue = Checkmark.CHECKED_EXPLICITLY;
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHabit(@NonNull Habit habit)
|
||||
{
|
||||
super.setHabit(habit);
|
||||
this.name = habit.name;
|
||||
this.activeColor = ColorHelper.getColor(getContext(), habit.color);
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
if (backgroundPaint == null || frame == null || ring == null) return;
|
||||
|
||||
Context context = getContext();
|
||||
|
||||
String text;
|
||||
int backgroundColor;
|
||||
int foregroundColor;
|
||||
|
||||
switch (checkmarkValue)
|
||||
{
|
||||
case Checkmark.CHECKED_EXPLICITLY:
|
||||
text = getResources().getString(R.string.fa_check);
|
||||
backgroundColor = activeColor;
|
||||
foregroundColor =
|
||||
UIHelper.getStyledColor(context, R.attr.highContrastReverseTextColor);
|
||||
|
||||
setShadowAlpha(0x4f);
|
||||
rebuildBackground();
|
||||
|
||||
backgroundPaint.setColor(backgroundColor);
|
||||
frame.setBackgroundDrawable(background);
|
||||
break;
|
||||
|
||||
case Checkmark.CHECKED_IMPLICITLY:
|
||||
text = getResources().getString(R.string.fa_check);
|
||||
backgroundColor = UIHelper.getStyledColor(context, R.attr.cardBackgroundColor);
|
||||
foregroundColor = UIHelper.getStyledColor(context, R.attr.mediumContrastTextColor);
|
||||
break;
|
||||
|
||||
case Checkmark.UNCHECKED:
|
||||
default:
|
||||
text = getResources().getString(R.string.fa_times);
|
||||
backgroundColor = UIHelper.getStyledColor(context, R.attr.cardBackgroundColor);
|
||||
foregroundColor = UIHelper.getStyledColor(context, R.attr.mediumContrastTextColor);
|
||||
break;
|
||||
}
|
||||
|
||||
ring.setPercentage(percentage);
|
||||
ring.setColor(foregroundColor);
|
||||
ring.setBackgroundColor(backgroundColor);
|
||||
ring.setText(text);
|
||||
|
||||
label.setText(name);
|
||||
label.setTextColor(foregroundColor);
|
||||
|
||||
requestLayout();
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||
|
||||
float w = width;
|
||||
float h = width * 1.25f;
|
||||
float scale = Math.min(width / w, height / h);
|
||||
|
||||
w *= scale;
|
||||
h *= scale;
|
||||
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) w, MeasureSpec.EXACTLY);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) h, MeasureSpec.EXACTLY);
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshData()
|
||||
{
|
||||
if(habit == null) return;
|
||||
this.percentage = (float) habit.scores.getTodayValue() / Score.MAX_VALUE;
|
||||
this.checkmarkValue = habit.checkmarks.getTodayValue();
|
||||
refresh();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected Integer getInnerLayoutId()
|
||||
{
|
||||
return R.layout.widget_checkmark;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.models.Habit;
|
||||
|
||||
public class GraphWidgetView extends HabitWidgetView implements HabitDataView
|
||||
{
|
||||
|
||||
private final HabitDataView dataView;
|
||||
private TextView title;
|
||||
|
||||
public GraphWidgetView(Context context, HabitDataView dataView)
|
||||
{
|
||||
super(context);
|
||||
this.dataView = dataView;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
ViewGroup.LayoutParams params =
|
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
((View) dataView).setLayoutParams(params);
|
||||
|
||||
ViewGroup innerFrame = (ViewGroup) findViewById(R.id.innerFrame);
|
||||
innerFrame.addView(((View) dataView));
|
||||
|
||||
title = (TextView) findViewById(R.id.title);
|
||||
title.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHabit(@NonNull Habit habit)
|
||||
{
|
||||
super.setHabit(habit);
|
||||
dataView.setHabit(habit);
|
||||
title.setText(habit.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshData()
|
||||
{
|
||||
if(habit == null) return;
|
||||
dataView.refreshData();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected Integer getInnerLayoutId()
|
||||
{
|
||||
return R.layout.widget_graph;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.RoundRectShape;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.helpers.UIHelper;
|
||||
import org.isoron.uhabits.models.Habit;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public abstract class HabitWidgetView extends FrameLayout implements HabitDataView
|
||||
{
|
||||
@Nullable
|
||||
protected InsetDrawable background;
|
||||
|
||||
@Nullable
|
||||
protected Paint backgroundPaint;
|
||||
|
||||
@Nullable
|
||||
protected Habit habit;
|
||||
protected ViewGroup frame;
|
||||
|
||||
public void setShadowAlpha(int shadowAlpha)
|
||||
{
|
||||
this.shadowAlpha = shadowAlpha;
|
||||
}
|
||||
|
||||
private int shadowAlpha;
|
||||
|
||||
public HabitWidgetView(Context context)
|
||||
{
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public HabitWidgetView(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
inflate(getContext(), getInnerLayoutId(), this);
|
||||
shadowAlpha = (int) (255 * UIHelper.getStyledFloat(getContext(), R.attr.widgetShadowAlpha));
|
||||
rebuildBackground();
|
||||
}
|
||||
|
||||
protected abstract @NonNull Integer getInnerLayoutId();
|
||||
|
||||
protected void rebuildBackground()
|
||||
{
|
||||
Context context = getContext();
|
||||
|
||||
int backgroundAlpha =
|
||||
(int) (255 * UIHelper.getStyledFloat(context, R.attr.widgetBackgroundAlpha));
|
||||
|
||||
int shadowRadius = (int) UIHelper.dpToPixels(context, 2);
|
||||
int shadowOffset = (int) UIHelper.dpToPixels(context, 1);
|
||||
int shadowColor = Color.argb(shadowAlpha, 0, 0, 0);
|
||||
|
||||
float cornerRadius = UIHelper.dpToPixels(context, 5);
|
||||
float[] radii = new float[8];
|
||||
Arrays.fill(radii, cornerRadius);
|
||||
|
||||
RoundRectShape shape = new RoundRectShape(radii, null, null);
|
||||
ShapeDrawable innerDrawable = new ShapeDrawable(shape);
|
||||
|
||||
int insetLeftTop = Math.max(shadowRadius - shadowOffset, 0);
|
||||
int insetRightBottom = shadowRadius + shadowOffset;
|
||||
|
||||
background = new InsetDrawable(innerDrawable, insetLeftTop, insetLeftTop, insetRightBottom,
|
||||
insetRightBottom);
|
||||
backgroundPaint = innerDrawable.getPaint();
|
||||
backgroundPaint.setShadowLayer(shadowRadius, shadowOffset, shadowOffset, shadowColor);
|
||||
backgroundPaint.setColor(UIHelper.getStyledColor(context, R.attr.cardBackgroundColor));
|
||||
backgroundPaint.setAlpha(backgroundAlpha);
|
||||
|
||||
frame = (ViewGroup) findViewById(R.id.frame);
|
||||
if(frame != null) frame.setBackgroundDrawable(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHabit(@NonNull Habit habit)
|
||||
{
|
||||
this.habit = habit;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 822 B After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 610 B |
After Width: | Height: | Size: 610 B |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 164 B |