Android Mirroring/Droid Timer
DroidAtScreenApplication.java ¶
 
        @Override^M
        public Timer getTimer() {^M
                return timer;^M
        }^M
DeviceFrame.java ¶
        public void startRetriever() {^M
                retriever = new Retriever();^M
                app.getTimer().schedule(retriever, 0, 500);^M
        }
 
                public AnimationTimer(int delay, ActionListener listener) {
                        super(delay, listener);
                }
AnimationTimer ¶
 
                public void setLocation(int x, int y) {^M
                        this.x = x;^M
                        this.y = y;^M
                }^M
 
                public void actionPerformed(ActionEvent e) {^M
                        Point location = DeviceFrame.this.getLocation();^M
                        Point to = new Point(location);^M
                        if (Math.abs(to.x - this.x) < velocity) {^M
                                to.x = this.x;^M
                        } else {^M
                                if (to.x < this.x) {^M
                                        to.x += velocity;^M
                                } else if (to.x > this.x) {^M
                                        to.x -= velocity;^M
                                }^M
                        }^M
                        if (Math.abs(to.y - this.y) < velocity) {^M
                                to.y = this.y;^M
                        } else {^M
                                if (to.y < this.y) {^M
                                        to.y += velocity;^M
                                } else if (to.y > this.y) {^M
                                        to.y = this.y;^M
                                }^M
                        }^M
^M
                        DeviceFrame.this.setLocation(to);^M
^M
                        if (to.equals(location)) {^M
                                ((Timer) e.getSource()).stop();^M
                        }^M
                }^M
        public void setLocation(int x, int y, boolean animate) {^M
                if (animate) {^M
                        timer.stop();^M
                        animationActionListener.setLocation(x, y);^M
                        timer.setRepeats(true);^M
                        timer.setCoalesce(true);^M
                        timer.start();^M
                } else {^M
                        super.setLocation(x, y);^M
                }^M
        }^M
updateDeviceFramePositionsOnScreen(DeviceFrame newFrame) ¶
 
        public void setLocation(int x, int y, boolean animate) {^M
                if (animate) {^M
                        timer.stop();^M
                        animationActionListener.setLocation(x, y);^M
                        timer.setRepeats(true);^M
                        timer.setCoalesce(true);^M
                        timer.start();^M
                } else {^M
                        super.setLocation(x, y);^M
                }^M
        }^M
 | 
 You will overcome the attacks of jealous associates.  | 











