@Test public void testInit_withAttrs() { Plot plot = new MockPlot("MockPlot"); AttributeSet attrs = mock(AttributeSet.class); plot.init(RuntimeEnvironment.application, attrs, 0); }
protected final void init(Context context, AttributeSet attrs, int defStyle) { PixelUtils.init(context); layoutManager = new LayoutManager(); title = new TextLabelWidget(layoutManager, new Size(25, SizeMode.ABSOLUTE, 100, SizeMode.ABSOLUTE), TextOrientation.HORIZONTAL); title.position(0, HorizontalPositioning.RELATIVE_TO_CENTER, 0, VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.TOP_MIDDLE); title.getLabelPaint().setTextSize( PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP)); onPreInit(); layoutManager.moveToTop(title); if(context != null && attrs != null) { loadAttrs(attrs, defStyle); } onAfterConfig(); layoutManager.onPostInit(); if (renderMode == RenderMode.USE_BACKGROUND_THREAD) { renderThread = new Thread(new Runnable() { @Override public void run() { keepRunning = true; while (keepRunning) { isIdle = false; synchronized (pingPong) { Canvas c = pingPong.getCanvas(); renderOnCanvas(c); pingPong.swap(); } synchronized (renderSync) { postInvalidate(); if (keepRunning) { try { renderSync.wait(); } catch (InterruptedException e) { keepRunning = false; } } } } pingPong.recycle(); } }, "Androidplot renderThread"); } }
Plot extends View implements Resizable { protected final void init(Context context, AttributeSet attrs, int defStyle) { PixelUtils.init(context); layoutManager = new LayoutManager(); title = new TextLabelWidget(layoutManager, new Size(25, SizeMode.ABSOLUTE, 100, SizeMode.ABSOLUTE), TextOrientation.HORIZONTAL); title.position(0, HorizontalPositioning.RELATIVE_TO_CENTER, 0, VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.TOP_MIDDLE); title.getLabelPaint().setTextSize( PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP)); onPreInit(); layoutManager.moveToTop(title); if(context != null && attrs != null) { loadAttrs(attrs, defStyle); } onAfterConfig(); layoutManager.onPostInit(); if (renderMode == RenderMode.USE_BACKGROUND_THREAD) { renderThread = new Thread(new Runnable() { @Override public void run() { keepRunning = true; while (keepRunning) { isIdle = false; synchronized (pingPong) { Canvas c = pingPong.getCanvas(); renderOnCanvas(c); pingPong.swap(); } synchronized (renderSync) { postInvalidate(); if (keepRunning) { try { renderSync.wait(); } catch (InterruptedException e) { keepRunning = false; } } } } pingPong.recycle(); } }, "Androidplot renderThread"); } } }
Plot extends View implements Resizable { protected final void init(Context context, AttributeSet attrs, int defStyle) { PixelUtils.init(context); layoutManager = new LayoutManager(); title = new TextLabelWidget(layoutManager, new Size(25, SizeMode.ABSOLUTE, 100, SizeMode.ABSOLUTE), TextOrientation.HORIZONTAL); title.position(0, HorizontalPositioning.RELATIVE_TO_CENTER, 0, VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.TOP_MIDDLE); title.getLabelPaint().setTextSize( PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP)); onPreInit(); layoutManager.moveToTop(title); if(context != null && attrs != null) { loadAttrs(attrs, defStyle); } onAfterConfig(); layoutManager.onPostInit(); if (renderMode == RenderMode.USE_BACKGROUND_THREAD) { renderThread = new Thread(new Runnable() { @Override public void run() { keepRunning = true; while (keepRunning) { isIdle = false; synchronized (pingPong) { Canvas c = pingPong.getCanvas(); renderOnCanvas(c); pingPong.swap(); } synchronized (renderSync) { postInvalidate(); if (keepRunning) { try { renderSync.wait(); } catch (InterruptedException e) { keepRunning = false; } } } } pingPong.recycle(); } }, "Androidplot renderThread"); } } Plot(Context context, String title);  Plot(Context context, String title, RenderMode mode);  Plot(Context context, AttributeSet attrs);  Plot(Context context, AttributeSet attrs, int defStyle); }
Plot extends View implements Resizable { protected final void init(Context context, AttributeSet attrs, int defStyle) { PixelUtils.init(context); layoutManager = new LayoutManager(); title = new TextLabelWidget(layoutManager, new Size(25, SizeMode.ABSOLUTE, 100, SizeMode.ABSOLUTE), TextOrientation.HORIZONTAL); title.position(0, HorizontalPositioning.RELATIVE_TO_CENTER, 0, VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.TOP_MIDDLE); title.getLabelPaint().setTextSize( PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP)); onPreInit(); layoutManager.moveToTop(title); if(context != null && attrs != null) { loadAttrs(attrs, defStyle); } onAfterConfig(); layoutManager.onPostInit(); if (renderMode == RenderMode.USE_BACKGROUND_THREAD) { renderThread = new Thread(new Runnable() { @Override public void run() { keepRunning = true; while (keepRunning) { isIdle = false; synchronized (pingPong) { Canvas c = pingPong.getCanvas(); renderOnCanvas(c); pingPong.swap(); } synchronized (renderSync) { postInvalidate(); if (keepRunning) { try { renderSync.wait(); } catch (InterruptedException e) { keepRunning = false; } } } } pingPong.recycle(); } }, "Androidplot renderThread"); } } Plot(Context context, String title);  Plot(Context context, String title, RenderMode mode);  Plot(Context context, AttributeSet attrs);  Plot(Context context, AttributeSet attrs, int defStyle); DisplayDimensions getDisplayDimensions(); HashMap<Class<? extends RendererType>, RendererType> getRenderers(); RegistryType getRegistry(); void setRegistry(RegistryType registry); TextLabelWidget getTitle(); void setTitle(TextLabelWidget title); void setTitle(String title); void setRenderMode(RenderMode mode); RenderMode getRenderMode(); synchronized boolean addListener(PlotListener listener); synchronized boolean removeListener(PlotListener listener); synchronized boolean addSeries(FormatterType formatter, SeriesType... series); synchronized boolean addSeries(SeriesType series, FormatterType formatter); synchronized boolean removeSeries(SeriesType series, Class<? extends RendererType> rendererClass); synchronized void removeSeries(SeriesType series); void clear(); boolean isEmpty(); FormatterType getFormatter(SeriesType series, Class<? extends RendererType> rendererClass); T getRenderer(Class<T> rendererClass); List<RendererType> getRendererList(); void setMarkupEnabled(boolean enabled); void redraw(); @Override synchronized void layout(final DisplayDimensions dims); void setBorderStyle(BorderStyle style, Float radiusX, Float radiusY); LayoutManager getLayoutManager(); void setLayoutManager(LayoutManager layoutManager); Paint getBackgroundPaint(); void setBackgroundPaint(Paint backgroundPaint); void setPlotMargins(float left, float top, float right, float bottom); void setPlotPadding(float left, float top, float right, float bottom); float getPlotMarginTop(); void setPlotMarginTop(float plotMarginTop); float getPlotMarginBottom(); void setPlotMarginBottom(float plotMarginBottom); float getPlotMarginLeft(); void setPlotMarginLeft(float plotMarginLeft); float getPlotMarginRight(); void setPlotMarginRight(float plotMarginRight); float getPlotPaddingTop(); void setPlotPaddingTop(float plotPaddingTop); float getPlotPaddingBottom(); void setPlotPaddingBottom(float plotPaddingBottom); float getPlotPaddingLeft(); void setPlotPaddingLeft(float plotPaddingLeft); float getPlotPaddingRight(); void setPlotPaddingRight(float plotPaddingRight); Paint getBorderPaint(); void setBorderPaint(Paint borderPaint); }
Plot extends View implements Resizable { protected final void init(Context context, AttributeSet attrs, int defStyle) { PixelUtils.init(context); layoutManager = new LayoutManager(); title = new TextLabelWidget(layoutManager, new Size(25, SizeMode.ABSOLUTE, 100, SizeMode.ABSOLUTE), TextOrientation.HORIZONTAL); title.position(0, HorizontalPositioning.RELATIVE_TO_CENTER, 0, VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.TOP_MIDDLE); title.getLabelPaint().setTextSize( PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP)); onPreInit(); layoutManager.moveToTop(title); if(context != null && attrs != null) { loadAttrs(attrs, defStyle); } onAfterConfig(); layoutManager.onPostInit(); if (renderMode == RenderMode.USE_BACKGROUND_THREAD) { renderThread = new Thread(new Runnable() { @Override public void run() { keepRunning = true; while (keepRunning) { isIdle = false; synchronized (pingPong) { Canvas c = pingPong.getCanvas(); renderOnCanvas(c); pingPong.swap(); } synchronized (renderSync) { postInvalidate(); if (keepRunning) { try { renderSync.wait(); } catch (InterruptedException e) { keepRunning = false; } } } } pingPong.recycle(); } }, "Androidplot renderThread"); } } Plot(Context context, String title);  Plot(Context context, String title, RenderMode mode);  Plot(Context context, AttributeSet attrs);  Plot(Context context, AttributeSet attrs, int defStyle); DisplayDimensions getDisplayDimensions(); HashMap<Class<? extends RendererType>, RendererType> getRenderers(); RegistryType getRegistry(); void setRegistry(RegistryType registry); TextLabelWidget getTitle(); void setTitle(TextLabelWidget title); void setTitle(String title); void setRenderMode(RenderMode mode); RenderMode getRenderMode(); synchronized boolean addListener(PlotListener listener); synchronized boolean removeListener(PlotListener listener); synchronized boolean addSeries(FormatterType formatter, SeriesType... series); synchronized boolean addSeries(SeriesType series, FormatterType formatter); synchronized boolean removeSeries(SeriesType series, Class<? extends RendererType> rendererClass); synchronized void removeSeries(SeriesType series); void clear(); boolean isEmpty(); FormatterType getFormatter(SeriesType series, Class<? extends RendererType> rendererClass); T getRenderer(Class<T> rendererClass); List<RendererType> getRendererList(); void setMarkupEnabled(boolean enabled); void redraw(); @Override synchronized void layout(final DisplayDimensions dims); void setBorderStyle(BorderStyle style, Float radiusX, Float radiusY); LayoutManager getLayoutManager(); void setLayoutManager(LayoutManager layoutManager); Paint getBackgroundPaint(); void setBackgroundPaint(Paint backgroundPaint); void setPlotMargins(float left, float top, float right, float bottom); void setPlotPadding(float left, float top, float right, float bottom); float getPlotMarginTop(); void setPlotMarginTop(float plotMarginTop); float getPlotMarginBottom(); void setPlotMarginBottom(float plotMarginBottom); float getPlotMarginLeft(); void setPlotMarginLeft(float plotMarginLeft); float getPlotMarginRight(); void setPlotMarginRight(float plotMarginRight); float getPlotPaddingTop(); void setPlotPaddingTop(float plotPaddingTop); float getPlotPaddingBottom(); void setPlotPaddingBottom(float plotPaddingBottom); float getPlotPaddingLeft(); void setPlotPaddingLeft(float plotPaddingLeft); float getPlotPaddingRight(); void setPlotPaddingRight(float plotPaddingRight); Paint getBorderPaint(); void setBorderPaint(Paint borderPaint);  }