· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Android Mirroring/Droid Timer

[edit ]

DroidAtScreenApplication.java


  • import java.util.Timer;
  • private Timer timer;
  • private void initAndroid()
    • timer = new Timer("Screenshot Retrievers");
      • Creates a new timer whose associated thread has the specified name.
 @Override^M
 public Timer getTimer() {^M
 return timer;^M
 }^M

[edit ]

DeviceFrame.java


 public void startRetriever() {^M
 retriever = new Retriever();^M
 app.getTimer().schedule(retriever, 0, 500);^M
 }

  • schedule(TimerTask task, Date firstTime, long period)
    • 走舛廃 獣娃(firstTime) 採斗 析舛 娃維(period)生稽 走舛廃 拙穣(task)聖 呪楳廃陥.
  • schedule(TimerTask task, long delay, long period)
    • 析舛 獣娃(delay)戚 走貝 板拭 析舛 娃維(period)生稽 走舛廃 拙穣(task)聖 呪楳廃陥.

  • private final class AnimationTimer extends Timer
 public AnimationTimer(int delay, ActionListener listener) {
 super(delay, listener);
 }
  • AnimationTimer timer = new AnimationTimer(1, animationActionListener);

  • import java.util.TimerTask;
  • private TimerTask retriever;

[edit ]

AnimationTimer


  • updateDeviceFramePositionsOnScreen(DeviceFrame newFrame) 拭 税廃 DeviceFrame 制亀酔税 戚疑
  • animation 生稽 坦軒?
  • public class DeviceFrame extends JFrame implements Comparable<DeviceFrame>
    • private final class AnimationActionListener implements ActionListener
      • public void setLocation(int x, int y)
 public void setLocation(int x, int y) {^M
 this.x = x;^M
 this.y = y;^M
 }^M
      • public void actionPerformed(ActionEvent e)
 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
    • private final class AnimationTimer extends Timer
      • public AnimationTimer(int delay, ActionListener listener)
        • super(delay, listener);
    • AnimationActionListener animationActionListener = new AnimationActionListener();
    • AnimationTimer timer = new AnimationTimer(1, animationActionListener);

 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

[edit ]

updateDeviceFramePositionsOnScreen(DeviceFrame newFrame)


  • DroidAtScreenApplication.java
    • public void updateDeviceFramePositionsOnScreen(DeviceFrame newFrame)
      • centerFrameLocationOnScreenRegion(frame, width, height, offset, true);
      • animate 稽 呪楳馬澗 戚政亜 巷譲昔亜?
      • 2016年10月1日 原酔什 吐戚 搾舛雌疑拙

    • private void centerFrameLocationOnScreenRegion(DeviceFrame frame, int screenWidth, int screenHeight, int offset, boolean animate)
      • frame.setLocation(x + screenWidth * offset, y, animate);

  • DeviceFrame.java
 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

ID
Password
Executive ability is prominent in your make-up.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2016年10月01日 08:26:25
Processing time 0.0058 sec

AltStyle によって変換されたページ (->オリジナル) /