Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

2. Feb 13th ● ViewPager and new layout

Anna Wróbel edited this page Apr 12, 2017 · 1 revision

I changed the layout. I'm using ViewPager for swiping between Views (not Fragments). I also decided to stay with one main counter (all categories) and every category has its own "mini counter" where points are represented by dots. To remove dots I'm using a substring.

public void changeThreePointsBody(View v) {
    boolean isChecked = ((ToggleButton) v).isChecked();
    if (isChecked) {
        howMany += 3;
        howManyBody += "● ● ● ";
    } else {
        howMany -= 3;
        howManyBody = howManyBody.substring(0, howManyBody.length() - 6);
    }
    changeCareBody(howManyBody);
    changeCare(howMany);
}

I wanted my main counter to always be a circle, not an oval and I found this solution.

My code: EqualWidthHeightTextView.java, circle.xml drawable and in the layout file:

<pm.anna.takecare.EqualWidthHeightTextView
    android:id="@+id/howMany"
    style="@style/counter.main"
    android:text="0"
    />

I also recorded a new video showing how my app looks and behaves after these changes:

IMAGE ALT TEXT HERE