PhilJay / CircleDisplay

Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.
288 stars 103 forks source link

CircleDisplay

Android View for displaying and selecting (by touch) values / percentages in a circle-shaped View, with animations.

Features

Core features:

alt tag

Usage

Simply copy the CircleDisplay.java file into your project. No annoying library imports, you ONLY need that single file.

For using the CircleDisplay, define it in .xml:

    <com.philjay.circledisplay.CircleDisplay
        android:id="@+id/circleDisplay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    CircleDisplay cd = (CircleDisplay) findViewById(R.id.circleDisplay);

or create it in code:

    CircleDisplay cd = new CircleDisplay(Context);

Style your CircleDisplay, and show values.

Styling methods:

Showing stuff:

Selecting values:

Full example:

    CircleDisplay cd = (CircleDisplay) findViewById(R.id.circleDisplay);
    cd.setAnimDuration(3000);
    cd.setValueWidthPercent(55f);
    cd.setTextSize(36f);
    cd.setColor(Color.GREEN);
    cd.setDrawText(true);
    cd.setDrawInnerCircle(true);
    cd.setFormatDigits(1);
    cd.setTouchEnabled(true);
    cd.setSelectionListener(this);
    cd.setUnit("%");
    cd.setStepSize(0.5f);
    // cd.setCustomText(...); // sets a custom array of text
    cd.showValue(75f, 100f, true);

License

Copyright 2014 Philipp Jahoda

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.