codeandmagic / gaugeview Goto Github PK
View Code? Open in Web Editor NEWAn Android library for drawing gauges on Canvas.
License: Apache License 2.0
An Android library for drawing gauges on Canvas.
License: Apache License 2.0
Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. The following classes could not be found:
- org.codeandmagic.android.gauge.GaugeView (Fix Build Path, Edit XML, Create Class)
Tip: Try to build the project. Tip: Try to refresh the layout. Failed to find '?attr/textEditSuggestionItemLayout' in current theme. (15 similar errors not shown) Tip: Try to refresh the layout.
Why is this marked in Android Arsenal as new when it is at least 1 to 4 years old? Nevertheless a great view...!
Get error with
app:outerShadowWidth="0.5"
mOuterShadowRect.width() / 2.0f
in:
paint.setShader(new RadialGradient(... , ... , here! , ...
public Paint getDefaultOuterShadowPaint() {
final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.FILL);
paint.setShader(new RadialGradient(CENTER, CENTER, mOuterShadowRect.width() / 2.0f, OUTER_SHADOW_COLORS, OUTER_SHADOW_POS,
TileMode.MIRROR));
return paint;
}
I'm trying to make Signal meter with dBm value. How can I change the start and the end value. It shoule start with -94 dBm (very bad signal) and end at 0 dBm (excellent signal strength).
Error when we set some of the view attributes:
<org.codeandmagic.android.gauge.GaugeView
android:id="@+id/gauge_view2"
android:layout_below="@id/gauge_view1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="10dp"
gauge:showOuterShadow="true"
gauge:showOuterRim="false"
gauge:showNeedle="false"
gauge:showRanges="false"
gauge:showText="true"
java.lang.NullPointerException
Exception details are logged in Window > Show View > Error LogThe graphics preview in the layout editor may not be accurate:
Paint.setShadowLayer is not supported. (Ignore for this session)
java.lang.NullPointerException
at android.content.res.BridgeResources.getString(BridgeResources.java:501)
at android.content.Context.getString(Context.java:334)
at org.codeandmagic.android.gauge.GaugeView.readAttrs(GaugeView.java:224)
at org.codeandmagic.android.gauge.GaugeView.(GaugeView.java:170)
at org.codeandmagic.android.gauge.GaugeView.(GaugeView.java:175)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:-2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:157)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
Error when we don't set the attributes:
<org.codeandmagic.android.gauge.GaugeView
android:id="@+id/gauge_view1"
android:layout_width="match_parent"
ava.lang.ArrayIndexOutOfBoundsException: 3
at android.graphics.Gradient_Delegate$GradientPaint.precomputeGradientColors(Gradient_Delegate.java:110)
at android.graphics.RadialGradient_Delegate$RadialGradientPaint.createContext(RadialGradient_Delegate.java:128)
at apple.awt.OSXSurfaceData.setupPaint(OSXSurfaceData.java:751)
at apple.awt.OSXSurfaceData.setupGraphicsState(OSXSurfaceData.java:1038)
at apple.awt.OSXSurfaceData.setupGraphicsState(OSXSurfaceData.java:1004)
at apple.awt.OSXSurfaceData.doOval(OSXSurfaceData.java:1283)
at apple.awt.CRenderer.fillOval(CRenderer.java:273)
at apple.awt.CRenderer.fillOval(CRenderer.java:261)
at sun.java2d.pipe.ValidatePipe.fillOval(ValidatePipe.java:90)
at sun.java2d.SunGraphics2D.fillOval(SunGraphics2D.java:2398)
at android.graphics.Canvas_Delegate$5.draw(Canvas_Delegate.java:708)
at com.android.layoutlib.bridge.impl.GcSnapshot.drawInLayer(GcSnapshot.java:613)
at com.android.layoutlib.bridge.impl.GcSnapshot.draw(GcSnapshot.java:583)
at android.graphics.Canvas_Delegate.draw(Canvas_Delegate.java:1190)
at android.graphics.Canvas_Delegate.native_drawOval(Canvas_Delegate.java:699)
at android.graphics.Canvas.native_drawOval(Canvas.java:-1)
at android.graphics.Canvas.drawOval(Canvas.java:979)
at org.codeandmagic.android.gauge.GaugeView.drawRim(GaugeView.java:630)
at org.codeandmagic.android.gauge.GaugeView.drawGauge(GaugeView.java:592)
at org.codeandmagic.android.gauge.GaugeView.onSizeChanged(GaugeView.java:576)
at android.view.View.sizeChange(View.java:14400)
at android.view.View.setFrame(View.java:14375)
at android.view.View.layout(View.java:14286)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
at android.view.View.layout(View.java:14289)
at android.view.ViewGroup.layout(ViewGroup.java:4559)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14289)
at android.view.ViewGroup.layout(ViewGroup.java:4559)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14289)
at android.view.ViewGroup.layout(ViewGroup.java:4559)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14289)
at android.view.ViewGroup.layout(ViewGroup.java:4559)
due to a change in the android Paint.measureText() the text in the GaugeView are not shown properly, since the value of measureText will be ceiled up to the next integer, the text is shown at the left side of the gauge and just one digit (without unit).
aosp-mirror/platform_frameworks_base@8e04840
I get the a XML error when i try to run the app. Here is a copy of my log cat:
06-09 14:46:04.019: E/dalvikvm(2568): Could not find class 'org.codeandmagic.android.gauge.GaugeView', referenced from method MainActivity.onCreate
06-09 14:46:04.019: W/dalvikvm(2568): VFY: unable to resolve check-cast 1091 (org/codeandmagic/android/gauge/GaugeView;) in MainActivity;
06-09 14:46:04.034: W/dalvikvm(2568): VFY: unable to resolve virtual method 6304: Lorg/codeandmagic/android/gauge/GaugeView;.setTargetValue (F)V
06-09 14:46:04.769: W/dalvikvm(2568): threadid=1: thread exiting with uncaught exception (group=0x418282d0)
06-09 14:46:04.819: E/AndroidRuntime(2568): FATAL EXCEPTION: main
06-09 14:46:04.819: E/AndroidRuntime(2568): java.lang.RuntimeException: Unable to start activity ComponentInfo{MainActivity}: android.view.InflateException: Binary XML file line #32: Error inflating class org.codeandmagic.android.gauge.GaugeView
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.ActivityThread.access$600(ActivityThread.java:151)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.os.Handler.dispatchMessage(Handler.java:99)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.os.Looper.loop(Looper.java:155)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.ActivityThread.main(ActivityThread.java:5493)
06-09 14:46:04.819: E/AndroidRuntime(2568): at java.lang.reflect.Method.invokeNative(Native Method)
06-09 14:46:04.819: E/AndroidRuntime(2568): at java.lang.reflect.Method.invoke(Method.java:511)
06-09 14:46:04.819: E/AndroidRuntime(2568): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
06-09 14:46:04.819: E/AndroidRuntime(2568): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)
06-09 14:46:04.819: E/AndroidRuntime(2568): at dalvik.system.NativeStart.main(Native Method)
06-09 14:46:04.819: E/AndroidRuntime(2568): Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class org.codeandmagic.android.gauge.GaugeView
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-09 14:46:04.819: E/AndroidRuntime(2568): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:365)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.Activity.setContentView(Activity.java:1912)
06-09 14:46:04.819: E/AndroidRuntime(2568): at com.Tim.Koers.minitoolbox.MainActivity.onCreate(MainActivity.java:21)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.Activity.performCreate(Activity.java:5066)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
06-09 14:46:04.819: E/AndroidRuntime(2568): ... 11 more
06-09 14:46:04.819: E/AndroidRuntime(2568): Caused by: java.lang.ClassNotFoundException: org.codeandmagic.android.gauge.GaugeView
06-09 14:46:04.819: E/AndroidRuntime(2568): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-09 14:46:04.819: E/AndroidRuntime(2568): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-09 14:46:04.819: E/AndroidRuntime(2568): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-09 14:46:04.819: E/AndroidRuntime(2568): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
06-09 14:46:04.819: E/AndroidRuntime(2568): ... 21 more
06-09 14:46:08.019: D/Process(2568): killProcess, pid=2568
06-09 14:46:08.034: D/Process(2568): dalvik.system.VMStack.getThreadStackTrace(Native Method)
06-09 14:46:08.034: D/Process(2568): java.lang.Thread.getStackTrace(Thread.java:599)
06-09 14:46:08.034: D/Process(2568): android.os.Process.killProcess(Process.java:944)
06-09 14:46:08.034: D/Process(2568): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:108)
06-09 14:46:08.034: D/Process(2568): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
06-09 14:46:08.034: D/Process(2568): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
06-09 14:46:08.034: D/Process(2568): dalvik.system.NativeStart.main(Native Method)
Thanks!
Tim
I am running the your code in LG Nexus(Loolipop) and all the scales is showing as zero(0) instead of 0,10,20,30,40,50,60,70,80,90,100. Please help me in resolving this.Thanks in advance
I just succeeded add this library to my project in Android Studio. But when I tried to compile it with gradle then I got this problem:
Error:(111) Attribute "showText" has already been defined
Is there any solution for that..?
--- trunk/gaugeview-library/src/org/codeandmagic/android/gauge/GaugeView.java (revision 11)
+++ trunk/gaugeview-library/src/org/codeandmagic/android/gauge/GaugeView.java (working copy)
@@ -235,8 +235,8 @@
private void readRanges(final Resources res, final int rangesId, final int colorsId) {
if (rangesId > 0 && colorsId > 0) {
-- final String[] ranges = res.getStringArray(R.array.ranges);
-- final String[] colors = res.getStringArray(R.array.rangeColors);
++ final String[] ranges = res.getStringArray(rangesId);
++ final String[] colors = res.getStringArray(colorsId);
if (ranges.length != colors.length) { throw new IllegalArgumentException(
"The ranges and colors arrays must have the same length."); }
Hi
I want to develop an application with this functionality. So I found GaugeView on github, I really like this project. But because I'm just starting out with github, so I do not know how to apply some of the features of this project to my application. I would be very appreciate if you could tell me the way to apply it to my application!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.