mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
@@ -159,9 +159,12 @@ public class ShowHabitFragment extends Fragment
|
|||||||
if(habit == null) return;
|
if(habit == null) return;
|
||||||
if(view == null) return;
|
if(view == null) return;
|
||||||
|
|
||||||
|
float todayValue = (float) habit.scores.getTodayValue();
|
||||||
|
float percentage = todayValue / Score.MAX_VALUE;
|
||||||
|
|
||||||
RingView scoreRing = (RingView) view.findViewById(R.id.scoreRing);
|
RingView scoreRing = (RingView) view.findViewById(R.id.scoreRing);
|
||||||
scoreRing.setColor(habit.color);
|
scoreRing.setColor(habit.color);
|
||||||
scoreRing.setPercentage((float) habit.scores.getTodayValue() / Score.MAX_VALUE);
|
scoreRing.setPercentage(percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateHeaders(View view)
|
private void updateHeaders(View view)
|
||||||
@@ -238,11 +241,12 @@ public class ShowHabitFragment extends Fragment
|
|||||||
{
|
{
|
||||||
new BaseTask()
|
new BaseTask()
|
||||||
{
|
{
|
||||||
|
float percentage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doInBackground()
|
protected void doInBackground()
|
||||||
{
|
{
|
||||||
if(dataViews == null) return;
|
if(dataViews == null) return;
|
||||||
updateScoreRing(getView());
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(HabitDataView view : dataViews)
|
for(HabitDataView view : dataViews)
|
||||||
@@ -255,6 +259,7 @@ public class ShowHabitFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(Integer... values)
|
protected void onProgressUpdate(Integer... values)
|
||||||
{
|
{
|
||||||
|
updateScoreRing(getView());
|
||||||
if(dataViews == null) return;
|
if(dataViews == null) return;
|
||||||
dataViews.get(values[0]).postInvalidate();
|
dataViews.get(values[0]).postInvalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class RingView extends View
|
|||||||
public void setColor(int color)
|
public void setColor(int color)
|
||||||
{
|
{
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
postInvalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxDiameter(float maxDiameter)
|
public void setMaxDiameter(float maxDiameter)
|
||||||
@@ -86,6 +87,7 @@ public class RingView extends View
|
|||||||
public void setPercentage(float percentage)
|
public void setPercentage(float percentage)
|
||||||
{
|
{
|
||||||
this.percentage = percentage;
|
this.percentage = percentage;
|
||||||
|
postInvalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
|
|||||||
Reference in New Issue
Block a user