Coder Social home page Coder Social logo

jorgecastilloprz / androidfillableloaders Goto Github PK

View Code? Open in Web Editor NEW
2.0K 54.0 269.0 1.49 MB

Android fillable progress view working with SVG paths. This is a nice option too if you want to create an interesting branding logo for your app. Based on the iOS project: https://github.com/poolqf/FillableLoaders

License: Apache License 2.0

Java 100.00%

androidfillableloaders's People

Contributors

athkalia avatar jorgecastilloprz avatar letme avatar truizlop avatar vbauer 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidfillableloaders's Issues

SVG is not drawn

I have created a svg file and pasted it to Paths interface:

fillableLoader = loaderBuilder.parentView((FrameLayout) rootView)
          .svgPath(Paths.myPath)
          .layoutParams(params)
          .originalDimensions(140, 140)
          .strokeColor(Color.parseColor("#fa9ade"))
          .fillColor(Color.parseColor("#1c9ade"))
          .strokeDrawingDuration(2000)
          .clippingTransform(new WavesClippingTransform())
          .fillDuration(10000)
          .build();

Here is the svg path:

 
M100.9,2.2c-0.7-0.8-1.7-1.2-2.8-1.2H3.9c-1.1,0-2.1,0.4-2.8,1.2C0.5,2.9,0,4.1,0.3,5l11.2,118.2
			c0.2,1.9,1.8,3.3,3.7,3.3h72.6c1.9,0,3.6-1.4,3.8-3.3L101.9,5C101.9,4.1,101.5,2.9,100.9,2.2z M84.4,119.2H18.6L8.2,8.5H94
			L84.4,119.2z M21.5,112.8c0.1,1.4,1.3,2.6,2.8,2.6h54.1c1.4,0,2.7-1.1,2.8-2.6l7.7-91.8c0-0.1,0-0.1,0-0.1v-0.4
			c0-0.1,0-0.1,0.3-0.2c-0.1,0-0.1-0.1-0.1-0.2c-0.1-0.1-0.1-0.3-0.2-0.4c0-0.1,0-0.1,0-0.1c-0.1-0.1-0.2-0.3-0.3-0.4
			c-0.1-0.1-0.1-0.1-0.2-0.2c-0.1-0.1-0.1-0.1-0.2-0.2c-0.1,0-0.1-0.1-0.2-0.1s-0.1-0.1-0.2-0.1c0,0-0.1-0.1-0.2-0.1
			c-0.1,0-0.1-0.1-0.2-0.1c-0.2,0-0.3-0.1-0.6-0.1h-0.7c-0.1,0-0.3,0.1-0.4,0.1c-0.1,0-0.1,0.1-0.2,0.1c-0.1,0-0.2,0-0.3,0.1
			c-4.7,2.4-10.2,2.4-14.9,0c-0.9-0.4-1.9-0.4-2.7,0c-4.7,2.4-10.2,2.4-14.9,0c-0.9-0.4-1.9-0.4-2.7,0c-4.7,2.4-10.2,2.4-14.9,0
			c-0.9-0.4-1.9-0.4-2.7,0c-4.7,2.4-10.2,2.4-14.9,0c-0.2-0.1-0.3-0.1-0.6-0.2h-0.1c-0.1-0.1-0.2-0.1-0.3-0.1h-0.7
			c-0.2,0-0.3,0.1-0.4,0.1c-0.1,0-0.1,0.1-0.2,0.1c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2,0.1
			c-0.1,0.1-0.1,0.1-0.2,0.2c-0.1,0.1-0.1,0.1-0.2,0.2c-0.1,0.1-0.1,0.2-0.2,0.3l-0.1,0.1c-0.1,0.2-0.2,0.3-0.2,0.6
			c-0.1,0.1-0.1,0.2-0.1,0.3s0,0.1,0,0.2V21L21.5,112.8z


So, I do not understand why it doesn't work.
Can anyone help?

Background Color

Hi!
Is it possible to set the background color of the loader? Actually we can only set the color of the loader and of the stroke. I think it would be a good idea for next version of this library.

Possible to set fill according to numeric value?

Is is possible to set the fill level based on a numeric value? For example, from 0 to 5. I want to use a specific svg as the loader design but fill it based on the total value of ratings from 0 to 5. Please let me know if this is possible as soon as you can. Thank you.

Typo errors

In the first paragraph, the Android FillableLoaders, section, "providing" must be written as "provide".
The line "Android Open Source library providing an interesting fillable progress view working with SVG paths." must be written as:
"Android Open Source library provides an interesting fillable progress view working with SVG paths.

In the "How to" section, under the third program diagram, the line is written as "Or if you rather you can do it by code using the FillableLoaderBuilder class." This line should be written as, " Or if you, rather, you can do it by code using the FillableLoaderBuilder class.
Thank you.

Paint overriding

Both fillPaint and initFillPaint are private. Sometimes changing this paint is really necessary.

For example, at the moment using smth like this from the client code is impossible:

bitmapShader = new BitmapShader(patternBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
fillPaint.setShader(bitmapShader); 

Set the fill level manually

Hi,

as far as I see there is no possibility to set the fill level by hand. This would be nice in order to turn it into an actual loader. Currently you specify a time value for the loader, which is not quite the intention of a loader. Consider a process like a call against an API or database or whatever. Depending on the current status of the request one could set the fill level as a percentage scale. Another possibility would be to restart the loader once he is done (aka repeat mode). I think this is even easier to implement and usually more appropriate for loaders since one does not always have a way to get the current requests state.

Let me know if my explanation was helpful or if you need more information.

Best regards
dasheck

want to change fillColor

hi,
i want to change fillcolor according to my if condition, how can i do this?

if (somevalue = 20){
fillableLoader.setFillColor(Color.parseColor("#4CAF50"));
}
else {
fillableLoader.setFillColor(Color.parseColor("#CDDC39"));
}
i done something like this but its not working, color is not changing.
please help me out.
thank you

The shape doesn't maintain it's scale

Hi. I'm new and trying to use FillebaleLoaders but my problem is my svg path is different from what is being drawn. I just want to my shapes fill the area ,keeps it's scale and remain in the center

fill the vector without drawing it

hi. thanks for this awesome library.
I want to fill the vector but I don't want to draw it. I need the vector to be appeared by a fade animation then fill the vector.

how should I do this?
.

github.jorgecastillo.svg.SvgPathParser.ParsePath()

I am new in Android Studio Development

could you please guide me how to resolve this error to find the null point of string path error in SvgPathParser class parsePath() function pathstring not found.

android dex

hello
can you update your library to android dex, because the plugin doesn't works
compileSdkVersion 28

thanks

NullPointerException: Attempt to invoke virtual method 'int android.content.res.TypedArray.getDimensionPixelSize(int, int)' on a null object reference

hi, got a crash log from device HUAWEI like when load this view:
Fatal Exception: java.lang.RuntimeException: Unable to start activity

ComponentInfo{com.mz.tkw/com.mz.tkwui.SplashActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class com.github.jorgecastillo.FillableLoader
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2638)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
       at android.app.ActivityThread.access$900(ActivityThread.java:196)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:210)
       at android.app.ActivityThread.main(ActivityThread.java:5988)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class com.github.jorgecastillo.FillableLoader
       at android.view.LayoutInflater.inflate(LayoutInflater.java:561)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:437)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(SourceFile:292)
       at android.support.v7.app.AppCompatActivity.setContentView(SourceFile:140)
       at com.mz.tkwui.SplashActivity.setContentView(SourceFile:51)
       at android.app.Activity.performCreate(Activity.java:6444)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
       at android.app.ActivityThread.access$900(ActivityThread.java:196)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:210)
       at android.app.ActivityThread.main(ActivityThread.java:5988)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by android.view.InflateException: Binary XML file line #10: Error inflating class com.github.jorgecastillo.FillableLoader
       at android.view.LayoutInflater.createView(LayoutInflater.java:672)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:731)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:862)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:537)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:437)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(SourceFile:292)
       at android.support.v7.app.AppCompatActivity.setContentView(SourceFile:140)
       at com.magez.ScreenEffect.ui.activities.SplashActivity_.onCreate(SourceFile:40)
       at android.app.Activity.performCreate(Activity.java:6444)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
       at android.app.ActivityThread.access$900(ActivityThread.java:196)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:210)
       at android.app.ActivityThread.main(ActivityThread.java:5988)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.newInstance(Constructor.java)
       at android.view.LayoutInflater.createView(LayoutInflater.java:641)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:731)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:862)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:537)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:437)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(SourceFile:292)
       at android.support.v7.app.AppCompatActivity.setContentView(SourceFile:140)
       at com.magez.ScreenEffect.ui.activities.SplashActivity_.setContentView(SourceFile:51)
       at com.magez.ScreenEffect.ui.activities.SplashActivity_.onCreate(SourceFile:40)
       at android.app.Activity.performCreate(Activity.java:6444)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
       at android.app.ActivityThread.access$900(ActivityThread.java:196)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:210)
       at android.app.ActivityThread.main(ActivityThread.java:5988)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.res.TypedArray.getDimensionPixelSize(int, int)' on a null object reference
       at com.github.jorgecastillo.attributes.AttributeExtractorImpl.getStrokeWidth(SourceFile:72)
       at com.github.jorgecastillo.FillableLoader.initAttrs(SourceFile:139)
       at com.github.jorgecastillo.FillableLoader.(SourceFile)
       at java.lang.reflect.Constructor.newInstance(Constructor.java)
       at android.view.LayoutInflater.createView(LayoutInflater.java:641)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:731)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:862)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:537)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:437)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(SourceFile:292)
       at android.support.v7.app.AppCompatActivity.setContentView(SourceFile:140)
       at com.magez.ScreenEffect.ui.activities.SplashActivity_.setContentView(SourceFile:51)
       at com.magez.ScreenEffect.ui.activities.SplashActivity_.onCreate(SourceFile:40)
       at android.app.Activity.performCreate(Activity.java:6444)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
       at android.app.ActivityThread.access$900(ActivityThread.java:196)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:210)
       at android.app.ActivityThread.main(ActivityThread.java:5988)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)

Is there any suggestion?

Get Properties of Loader

I am manually changing the percentage of my Fillable Loader. However, is there a way to also get the percentage of the loader, such as a getPercentage() method? In fact, is there a getter for any property? I find that this may be useful at some time.

Attribute XXXX has been defined

Hi Jorge,

I use the library but when i make build, AS shows me the message:

Error:(2) Attribute "strokeWidth" has already been defined
Error:(2) Attribute "fillColor" has already been defined
Error:(2) Attribute "strokeColor" has already been defined

I think that the names of these attributes are too generic and conflict with other popular libraries and can not use yours.

 I hope that solutions soon, greetings.

How to change Fill Direction

Hi dev, would it be possible to get fill direction to come from the left to right, rather than from Bottom Top

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.