private ViewFactory viewFactory = new ViewFactory() { public View makeView() { LayoutInflater inflater = LayoutInflater.from(TextSwitcherTest.this); TextView textView = (TextView) inflater.inflate(R.layout.textView, null); return textView; } };
@Override public void run() { EditorUI eui = Utilities.getEditorUI(ep); if (eui == null) { firePropertyChange (PROP_SHORT_DESCRIPTION, null, toolTip); return ; } ToolTipUI.Expandable expandable = (var != null) ? new ToolTipUI.Expandable(expression, var) : null; ToolTipUI.Pinnable pinnable = new ToolTipUI.Pinnable( expression, line.getLineNumber(), "org.netbeans.modules.javascript2.debug.PIN_VALUE_PROVIDER"); // NOI18N ToolTipUI toolTipUI = ViewFactory.getDefault().createToolTip(toolTip, expandable, pinnable); ToolTipSupport tts = toolTipUI.show(ep); if (tts != null) { handleToolTipClose(engine, tts); } } });
private ToolTipView(JPDADebugger debugger, String expression, ObjectVariable v, String icon) { this.debugger = debugger; ToolTipView.expression = expression; variable = v; this.name = TOOLTIP_VIEW_NAME; JComponent c = ViewFactory.getDefault().createViewComponent( icon, ToolTipView.TOOLTIP_VIEW_NAME, "NetbeansDebuggerJPDAToolTipNode", null); setLayout (new BorderLayout ()); add (c, BorderLayout.CENTER); //NOI18N debuggerStateChangeListener = new DebuggerStateChangeListener(); debugger.addPropertyChangeListener(JPDADebugger.PROP_STATE, debuggerStateChangeListener); }
@Override public void run() { EditorUI eui = Utilities.getEditorUI(ep); if (eui == null) { firePropertyChange (PROP_SHORT_DESCRIPTION, null, toolTip); return ; } ToolTipUI.Expandable expandable = (var != null) ? new ToolTipUI.Expandable(expression, var) : null; ToolTipUI.Pinnable pinnable = new ToolTipUI.Pinnable( expression, line.getLineNumber(), "org.netbeans.modules.debugger.jpda.PIN_VALUE_PROVIDER"); // NOI18N ToolTipUI toolTipUI = ViewFactory.getDefault().createToolTip(toolTip, expandable, pinnable); ToolTipSupport tts = toolTipUI.show(ep); if (tts != null) { DebuggerStateChangeListener.attach(d, tts); } } });
mSwitcher.setFactory(new ViewFactory() {
mSwitcher = (TextSwitcher) findViewById(R.id.textSwitcher); mSwitcher.setFactory(new ViewFactory() { public View makeView() { // create new textView and set the properties like clolr, size etc TextView myText = new TextView(MainActivity.this); myText.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); myText.setTextSize(36); myText.setTextColor(Color.BLUE); return myText; } }); // Declare the in and out animations and initialize them Animation in = AnimationUtils.loadAnimation(this,android.R.anim.slide_in_left); Animation out = AnimationUtils.loadAnimation(this,android.R.anim.slide_out_right); // set the animation type of textSwitcher mSwitcher.setInAnimation(in); mSwitcher.setOutAnimation(out);
public class CustomTextSwitcher extends TextSwitcher { private static final long SHOW_TEXT_ANIMATION_TIME = 100; public CustomTextSwitcher(Context context, AttributeSet attrs) { super(context, attrs); init(attrs); } private void init(AttributeSet attrs) { this.setFactory(new ViewFactory() { @Override public View makeView() { return new TextView(new ContextThemeWrapper(context, attrs.getStyleAttribute()), null, 0); } }); Animation in = AnimationUtils.loadAnimation(context, android.R.anim.fade_in); Animation out = AnimationUtils.loadAnimation(context, android.R.anim.fade_out); in.setDuration(SHOW_TEXT_ANIMATION_TIME); out.setDuration(SHOW_TEXT_ANIMATION_TIME); this.setInAnimation(in); this.setOutAnimation(out); } }
sw.setFactory(new ViewFactory() {
mSwitcher.setFactory(new ViewFactory() {
vs.setFactory(new ViewFactory(){