public void configure(Context ctx, int xmlCfgId) { try { Fig.configure(ctx, this, xmlCfgId); } catch (FigException e) { throw new RuntimeException(e); } }
/** * Provided as a convenience to users; allows instantiation and xml configuration * to take place in a single line * * @param ctx * @param xmlCfgId Id of the xml config file within /res/xml */ public XYRegionFormatter(Context ctx, int xmlCfgId) { // prevent configuration of classes derived from this one: if (getClass().equals(XYRegionFormatter.class)) { try { Fig.configure(ctx, this, xmlCfgId); } catch (FigException e) { throw new RuntimeException(e); } } }
Fig.configure(getContext(), this, attrHash); } catch (FigException e) { throw new RuntimeException(e);
@Test public void testConfigure() throws Exception { HashMap<String, String> params = new HashMap<String, String>(); String param1 = "this is a test."; String param2 = Plot.RenderMode.USE_BACKGROUND_THREAD.toString(); String param3 = "#FF0000"; params.put("title.text", param1); params.put("renderMode", param2); params.put("backgroundPaint.color", param3); Fig.configure(RuntimeEnvironment.application, plot, params); assertEquals(param1, plot.getTitle().getText()); assertEquals(Plot.RenderMode.USE_BACKGROUND_THREAD, plot.getRenderMode()); assertEquals(Color.parseColor(param3), plot.getBackgroundPaint().getColor()); }
@Test public void testConfigure() throws Exception { Plot plot = new MockPlot("MockPlot"); HashMap<String, String> params = new HashMap<String, String>(); String param1 = "this is a test."; String param2 = "use_background_thread"; String param3 = "#FF0000"; params.put("title.text", param1); params.put("renderMode", param2); params.put("backgroundPaint.color", param3); Fig.configure(RuntimeEnvironment.application, plot, params); assertEquals(param1, plot.getTitle().getText()); assertEquals(Plot.RenderMode.USE_BACKGROUND_THREAD, plot.getRenderMode()); assertEquals(Color.parseColor(param3), plot.getBackgroundPaint().getColor()); }