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(view == null) return;
|
||||
|
||||
float todayValue = (float) habit.scores.getTodayValue();
|
||||
float percentage = todayValue / Score.MAX_VALUE;
|
||||
|
||||
RingView scoreRing = (RingView) view.findViewById(R.id.scoreRing);
|
||||
scoreRing.setColor(habit.color);
|
||||
scoreRing.setPercentage((float) habit.scores.getTodayValue() / Score.MAX_VALUE);
|
||||
scoreRing.setPercentage(percentage);
|
||||
}
|
||||
|
||||
private void updateHeaders(View view)
|
||||
@@ -238,11 +241,12 @@ public class ShowHabitFragment extends Fragment
|
||||
{
|
||||
new BaseTask()
|
||||
{
|
||||
float percentage;
|
||||
|
||||
@Override
|
||||
protected void doInBackground()
|
||||
{
|
||||
if(dataViews == null) return;
|
||||
updateScoreRing(getView());
|
||||
|
||||
int count = 0;
|
||||
for(HabitDataView view : dataViews)
|
||||
@@ -255,6 +259,7 @@ public class ShowHabitFragment extends Fragment
|
||||
@Override
|
||||
protected void onProgressUpdate(Integer... values)
|
||||
{
|
||||
updateScoreRing(getView());
|
||||
if(dataViews == null) return;
|
||||
dataViews.get(values[0]).postInvalidate();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class RingView extends View
|
||||
public void setColor(int color)
|
||||
{
|
||||
this.color = color;
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
public void setMaxDiameter(float maxDiameter)
|
||||
@@ -86,6 +87,7 @@ public class RingView extends View
|
||||
public void setPercentage(float percentage)
|
||||
{
|
||||
this.percentage = percentage;
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
||||
Reference in New Issue
Block a user