Giter Site home page Giter Site logo

seekarc's Introduction

SeekArc

What is a SeekArc?

So what the heck is a SeekArc? Essentially it’s a SeekBar that has been wrapped around a circle. It acts like a SeekBar and generally has the same settings. You can even add a Listener to it as you would with a SeekBar. So if its in a circle why not call it a SeekCircle? The answer is that the SeekArc does have a few more setting than the SeekBar one of these is the sweepAngle, which means that the SeekArc doesn’t have to be drawn as a full circle, and can be drawn as a circle, semi-circle or quarter arc or whatever you like. Supports min SDK 8.

Video demo of the sample project

Using the SeekArc

Using the SeekArc is straightforward. There are a number of settings from sweep angle to rotation that can be set. One of the less obvious settings is the radius or diameter of the SeekArc. When I developed the SeekArc I thought about adding an attribute for defining the diameter of the circle. In the end I decided against this. I thought a more flexible approach would be to allow the SeekArc to expand to the size of its container layout. This way the SeekArc can grow in size with a layout that has widths or heights of match parent. Also it is still possible to set the SeekArc to a specific size by setting the container layouts width and height to specific dp values. This sizing approach gives the best of both worlds. To further adjust how the arc fits in its container a padding attribute can also be used.

To help with understanding how to use the SeeekArc I’ve put together a sample app with a number of controls that can be used to adjust the attributes of the SeekArc. This is by far the best way to get a good understanding of how to use the SeekArc. From the sample app you’ll see that it is possible to set attributes such as:

  • Sweep angle
  • Rotation
  • Clockwise (which way do you want the progress to increase clockwise/anticlockwise),
  • Arc and progress width
  • Rounded corners
  • Touch inside enable/disable.
  • Enabled - enables/disables touch and the thumbnail

To use it in your code

Simply add the View to your layout (There are several custom attributes)

    <com.triggertrap.seekarc.SeekArc
        android:id="@+id/seekArc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:padding="30dp"
        seekarc:rotation="180"
        seekarc:startAngle="30"
        seekarc:sweepAngle="300"
        seekarc:touchInside="true" />

Adding to your project

This library is not yet released in Maven Central, until then you can add as a library module or use JitPack.io.

Add remote maven url

    repositories {
        maven {
            url "https://jitpack.io"
        }
    }

Now add a library dependency (remember to check for latest release)

    dependencies {
        compile 'com.github.Triggertrap:SeekArc:v1.1'
    }

#Recent changes

Version 1.1

After a long hiatus we've recently integrated many of the PRs/changes submitted by others so a big thanks for all the contributions. We'll endevour to respond to PRs and updates quicker in future. The following changes have been included in v1.1.

  • converted to gradle
  • latest Android SDK/tools
  • removed dependency on color that holo blue that caused issues on API < 14.
  • changes to make compatible with scroll view changes including example in sample app
  • added 'enabled' option that if set to false disables touch and visibility of the thumbnail
  • set color progress and arc programmatically
  • mProgress typo
  • fixed setting progress via xml
  • sample updates to show some of the new functionality
  • readme and jitpack.io notes

Version 1.0

  • init release

Sample Project

You can see the SeekArc working in the sample application. Just check out the library and sample application as two separate projects and import them into eclipse. Make sure that the Sample app is setup to correctly use the library project. The sample app will let you explore the attributes that can be set on the SeekArc.

License


The MIT License (MIT)

Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies 

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

seekarc's People

Contributors

ascorbic avatar scottyab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seekarc's Issues

How to implement??

I added exactly what it says to add in the readme, but I get this when I try to compile:

"Caused by: java.lang.ClassNotFoundException: Didn't find class "com.triggertrap.seekarc.SeekArc" on path: DexPathList[[zip file "/data/app/com.(package name etc)"

Surely there must be another step??

SeekArc Infinite is possible?

Good morning,

I wonder if you can make infinite SeekArc?
For example, it would be 0-100, but the value was not reset when you arrive at 100 instead went to 101 and so on.

I thank you for the help

setMax / getMax unavailable

The methods setMax and getMax are unavailable when adding this library to the project remotely using Gradle. I had to download a zip of the master and add the library manually as a module dependency to access these methods.

SeekArc fills when progress set to 0

I have a SeekArc with a rotation and sweep-angle, like in the example. When the progress is set to 0, the arc should be empty, but instead it fills completely, even past where the seep angle ends. This is only happening on my Galaxy S7 running Android 6.0.1.

Using Readme example not showing

I have followed the readme exactly to make the additions to my build.gradle files, synced and made the a layout with the additions:
xmlns:seekarc="http://schemas.android.com/apk/res-auto"

and

<com.triggertrap.seekarc.SeekArc
        android:id="@+id/seekArc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:padding="30dp"
        seekarc:rotation="180"
        seekarc:startAngle="30"
        seekarc:sweepAngle="300"
        seekarc:touchInside="true" />

Which are nested in a cardview however absolutely nothing shows up. I have tried going through the readme completely several times now and can't figure out why.

About code problem

Dear friend:
long time ago, I was download this project for study how to draw view! but i do't understand you calculate the Thumb position at all !
int arcStart = (int)mProgressSweep + mStartAngle + mRotation + 90;
mThumbXPos = (int) (mArcRadius * Math.cos(Math.toRadians(arcStart)));
mThumbYPos = (int) (mArcRadius * Math.sin(Math.toRadians(arcStart)));
and in onDraw function:
canvas.translate.(mTranslateX - mThumbXPos,mTranslateY - mThumbYPos);

why arcStart value need add mRotation and 90 ???? if you viewed my question please tell me? thank very much!! and it is very nice to solved the diff quadrant problem!!

Disable

SetEnabled(false) is ignored.
I added a quick fix in my project by simply checking if it is enabled at updateProgress method (may not be the best solution though)

Gradient coloring for seek arc

Hi
I need to color the seek arc. Using the Linear gradient.

mProgressPaint.setShader(new LinearGradient(0, 0, 0, getHeight(), new int[]{blue, green,red} ,new float[]{0,0.5f,1},Shader.TileMode.MIRROR));

The above piece of code is not displaying the gradient properly, need blue in the beginning, green in middle and red at the end.Colors are distributes un-evenly.

Any help is much appreciated.

Setting up the Seekarc in eclipse android project

Hi,

I want to make an app for android 4.4 and implement the seekarc.
So I've taken these actions:
copy Seekarc into my res folder.
Either the com.triggertrap.seekarc or my own com.example.seekarktest

I copied the drawables and the xml there in a not standard present folder "drawable"
copied the png's also in xhdpi to be sure, just in case.

I copied the values, attr, colors and styles

Anyway i end up in an unbound prefix parsing error , adding
<com.example.seekarctest.SeekArc Or com.triggertrap.seekarc.SeekArc in the activity_main layout results in an unbound prefix error.

I work with eclipse, am new to android. Did my best to import your lib and project, but there's no eclipse support for running the imported gradle projects.

Could you help me out?

Locking the SeekArc when 360 is reached, instead of starting from 0

Hi Neil,

thanks for the awesome work on this fantastic widget. I'm trying to adapt it to avoid more than one "full-turn". that means, when you reach 360 degrees, I want the SeekArc to get stuck in there, instead of starting again from zero. I Had no success yet.

Would you suggest any way to approach this requirement? any ideas or pseudo-code that comes in your mind?
If I find an elegant solution, i'll define a new attribute like lockFullTurn or similar, and send you a PR

Thanks in advance :)

Set max programmatically

Hi! Thank you for your great work, its great. I have one question, how can I set seekarc:max="value" programmatically? to set it dynamically. Thank you

Creating a marker at discrete progress

Am looking to create an image marker at a different points of the arc...could you give some assistance.
am using the seek bar as a plotter showing where different users left their thumb.

also when creating the seekArc via code the setThumb method is available

Enable Disable SeekArc from different threads doesn't work

Hello guys!

I'm really not sure if this is a real issue, but is it possible, that the seekArc faces issues, when I call setEnabled(true) from one Thread and then setEnabled(false) from another? I try to disable the seekArc initially and the enable it on a button press, but it seems like this call is just ignored. Even if it tried to runOnUiThread(new Runnable() {...});

Does anyone have an idea about this? I appreciate any help!
Robert Nickel

Attribute "max" and "progress" has already been defined

Hello dear friend!
I have this error:
Myproject\app\build\intermediates\res\merged\debug\values\values.xml
Error:(128) Attribute "progress" has already been defined
Error:(128) Attribute "max" has already been defined
Please fix this!

Disable touch events

attribute and code way of disabling touch events and ideally remove the scrubber. - Great library btw, i'll send PR with this when I have a sec

Error when sync Gradle dependency

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
    is also present at [com.github.Triggertrap:SeekArc:v1.1] AndroidManifest.xml:36:9-45 value=(@drawable/ic_launcher).
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-18:19 to override.

My Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.root5solutions.musicplayer">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "com.example.root5solutions.musicplayer"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    maven {
        url "https://jitpack.io"
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.github.Triggertrap:SeekArc:v1.1'
    testCompile 'junit:junit:4.12'
}

2 Arcs in an Acticity

Hi ,
Thanks a lot for this wonder full work. I was understanding your seek Arc Library and tried to make 2 Seek Arcs facing each other in an Activity . One Clockwise and other anticlockwise with following code in xml
<com.triggertrap.seekarc.SeekArc
android:id="@+id/circularSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:padding="30dp"
app:arcColor="#000000"
app:clockwise="true"
app:progressColor="#FF6600"
app:rotation="180"
app:startAngle="0"
app:sweepAngle="360"
app:thumb="@drawable/mobile_portrait_l" />

    <com.triggertrap.seekarc.SeekArc
        android:id="@+id/circularSeekBar1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:padding="30dp"
        app:arcColor="@android:color/holo_red_dark"
        app:clockwise="false"
        app:progressColor="#FF6600"
        app:rotation="180"
        app:startAngle="0"
        app:sweepAngle="360"
        app:thumb="@drawable/rotated_r_large" />

Now since they have a common centre and by using them in a frame layout the circles coincides.
But when i try to seek the the left circle i am not able to do so. After debugging i found that when i try to seek left circle it calculates the progress angle of the right (anti clockwise) circle and thus gives the wrong progress angle. This happens even if i take the 2 arcs facing each other.

Please provide a solution for this.

Reconnecting Crashes app

Disconnecting an open device and then reconnecting the same device to the tablet crashed the application. Doesn't anyone know of a way to automatically close/disconnect the usb device and automatically open/connect the usb device?

Cannot easily drag to min or max

Thanks for the excellent library 👍 I guess you don't have much time for maintenance, so I'm just creating this issue here to reference it in an upcoming pull request.

Issue:
When dragging the handle to the start or end points, progress is not always set to zero or max, leaving a small offset. Usually happens when initial value is not min/max. In this case, I need to retry a couple of times, dragging slowly trying to get the right position...

Programmatically set the arc's value,

I am new to this forum. I apologize if this is not the right place for such questions..

My question: is there a way/workaround/whatever that will
allow me to programmatically set the arc's current value,
something like seekArc.setValue(val);

Thanks,
Gilad
[email protected]

SeekArc with two different color

Hello @neild001 ,
can u plz help me out
img_0292

I want to fill two colors in a curve. As I attached screen shot of here you can see two colors (one is gray and attached red colored line). I can draw gray curve line but not able to draw red line which is attached with gray line.
So requested you to plz tell me about fill curve with two different color.

Unable set max value programatically

I have created an object of SeekArc. And if I try to set the Max value programatically like seekbar.setMax(int) , I am getting an error saying, cannot resolve method setMax(int). I tried to do the same in your sample project as well and ended up in the same result. Kindly fix this as soon as possible.

Placing Buttons inside the Arc

It appears as though if a button is placed inside the seekArc then it becomes inaccessible.
I am using the Frame layout to place an ImageButton inside of a seekArc.
Changing the seekArc's touchInside attribute does not affect this functionality, and the issue persists.

Accessing class variable inside onProgressChanged()

I am attempting to set a variable x, which is contained by my class fragment. The class fragment contains a seekArc, and that seekArc's onSeekArcChangeListener. I am attempting to change variable x, which cannot be final, from inside the onProgressChanged method within the onSeekArcChangeListener. When I attempt to x.setVar() I get an error that x ==n. Does anyone have any advice on how to do this?

Manifest error while building project

I followed the instructions, but I couldn't build the project.

dependencies { implementation 'com.github.mreram:SeekArc:v1.6' }

When I build a project, I get this error. AS 3.4

Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:12:13-47 is also present at [com.github.mreram:SeekArc:v1.6] AndroidManifest.xml:36:9-45 value=(@drawable/ic_launcher). Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:10:5-24:19 to override.

Do you guys need a hand with maintenance?

Hey folks - not sure if an issue is precisely the right place for this, but it seems like the current SeekArc dev team is a little wrapped up with other things. :) PRs/issues are building up, and I'm wondering if perhaps another contributor or two might help to ease the load? I for one would be happy to volunteer, as I bet would a few others. Please let us know what you think? Thanks!

minimize the height when use just half circle (forexample)

my application just need 120deg from the circle , but the script need the full circle diameter as a layaoutframe height as in the shape :
1
total height of arc area = (min (height,width)-padding/2) >> arc diameter ..
but height 2 is not scrollable in (scroll view) .. and i dont need this area because my arc is not a full circle ..
how i can erase this (2) area .. or make it scrollable in framelayout ??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.