hierarchyviewer2lib

16:36:26.520 INFO  jd.cli.Main - Decompiling hierarchyviewer2lib.jar
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.device.HvDeviceFactory;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;
import java.util.Map;

class HierarchyViewerDirector$1
  implements Runnable
{
  HierarchyViewerDirector$1(HierarchyViewerDirector paramHierarchyViewerDirector, IDevice paramIDevice) {}
  
  public void run()
  {
    if (!val$device.isOnline()) {
      return;
    }
    IHvDevice hvDevice;
    synchronized (HierarchyViewerDirector.access$000())
    {
      hvDevice = (IHvDevice)HierarchyViewerDirector.access$100(this$0).get(val$device);
      if (hvDevice == null)
      {
        hvDevice = HvDeviceFactory.create(val$device);
        hvDevice.initializeViewDebug();
        hvDevice.addWindowChangeListener(HierarchyViewerDirector.getDirector());
        HierarchyViewerDirector.access$100(this$0).put(val$device, hvDevice);
      }
      else
      {
        hvDevice.initializeViewDebug();
      }
    }
    DeviceSelectionModel.getModel().addDevice(hvDevice);
    this$0.focusChanged(val$device);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.ui.CaptureDisplay;
import org.eclipse.swt.graphics.Image;

class HierarchyViewerDirector$10$1
  implements Runnable
{
  HierarchyViewerDirector$10$1(HierarchyViewerDirector.10 param10, Image paramImage) {}
  
  public void run()
  {
    CaptureDisplay.show(this$1.val$shell, this$1.val$viewNode, val$image);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.10.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.ui.CaptureDisplay;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

class HierarchyViewerDirector$10
  implements Runnable
{
  HierarchyViewerDirector$10(HierarchyViewerDirector paramHierarchyViewerDirector, ViewNode paramViewNode, Shell paramShell) {}
  
  public void run()
  {
    final Image image = this$0.loadCapture(val$viewNode);
    if (image != null) {
      Display.getDefault().syncExec(new Runnable()
      {
        public void run()
        {
          CaptureDisplay.show(val$shell, val$viewNode, image);
        }
      });
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.10
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.models.ViewNode;

class HierarchyViewerDirector$11
  implements Runnable
{
  HierarchyViewerDirector$11(HierarchyViewerDirector paramHierarchyViewerDirector, ViewNode paramViewNode) {}
  
  public void run()
  {
    this$0.loadCapture(val$viewNode);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.11
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.device.DeviceBridge;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;
import java.util.HashSet;

class HierarchyViewerDirector$12
  implements Runnable
{
  HierarchyViewerDirector$12(HierarchyViewerDirector paramHierarchyViewerDirector) {}
  
  public void run()
  {
    IHvDevice[] hvDevicesA = DeviceSelectionModel.getModel().getDevices();
    IDevice[] devicesA = new IDevice[hvDevicesA.length];
    for (int i = 0; i < hvDevicesA.length; i++) {
      devicesA[i] = hvDevicesA[i].getDevice();
    }
    IDevice[] devicesB = DeviceBridge.getDevices();
    HashSet<IDevice> deviceSet = new HashSet();
    for (int i = 0; i < devicesB.length; i++) {
      deviceSet.add(devicesB[i]);
    }
    for (int i = 0; i < devicesA.length; i++) {
      if (deviceSet.contains(devicesA[i]))
      {
        this$0.windowsChanged(devicesA[i]);
        deviceSet.remove(devicesA[i]);
      }
      else
      {
        this$0.deviceDisconnected(devicesA[i]);
      }
    }
    for (IDevice device : deviceSet) {
      this$0.deviceConnected(device);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.12
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.ui.TreeView;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;

class HierarchyViewerDirector$13$1
  implements Runnable
{
  HierarchyViewerDirector$13$1(HierarchyViewerDirector.13 param13, DrawableViewNode paramDrawableViewNode, String paramString) {}
  
  public void run()
  {
    Image image = TreeView.paintToImage(val$viewNode);
    ImageLoader imageLoader = new ImageLoader();
    data = new ImageData[] { image.getImageData() };
    
    String extensionedFileName = val$fileName;
    if (!extensionedFileName.toLowerCase().endsWith(".png")) {
      extensionedFileName = extensionedFileName + ".png";
    }
    try
    {
      imageLoader.save(extensionedFileName, 5);
    }
    catch (SWTException e)
    {
      Log.e("hierarchyviewer", "Unable to save tree view as a PNG image at " + val$fileName);
    }
    image.dispose();
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.13.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.ui.TreeView;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

class HierarchyViewerDirector$13
  implements Runnable
{
  HierarchyViewerDirector$13(HierarchyViewerDirector paramHierarchyViewerDirector, Shell paramShell) {}
  
  public void run()
  {
    final DrawableViewNode viewNode = TreeViewModel.getModel().getTree();
    if (viewNode != null)
    {
      FileDialog fileDialog = new FileDialog(val$shell, 8192);
      fileDialog.setFilterExtensions(new String[] { "*.png" });
      
      fileDialog.setFilterNames(new String[] { "Portable Network Graphics File (*.png)" });
      
      fileDialog.setText("Choose where to save the tree image");
      final String fileName = fileDialog.open();
      if (fileName != null) {
        this$0.executeInBackground("Saving tree view", new Runnable()
        {
          public void run()
          {
            Image image = TreeView.paintToImage(viewNode);
            ImageLoader imageLoader = new ImageLoader();
            data = new ImageData[] { image.getImageData() };
            
            String extensionedFileName = fileName;
            if (!extensionedFileName.toLowerCase().endsWith(".png")) {
              extensionedFileName = extensionedFileName + ".png";
            }
            try
            {
              imageLoader.save(extensionedFileName, 5);
            }
            catch (SWTException e)
            {
              Log.e("hierarchyviewer", "Unable to save tree view as a PNG image at " + fileName);
            }
            image.dispose();
          }
        });
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.13
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;

class HierarchyViewerDirector$14$1
  implements Runnable
{
  HierarchyViewerDirector$14$1(HierarchyViewerDirector.14 param14, ImageData paramImageData, String paramString) {}
  
  public void run()
  {
    ImageLoader imageLoader = new ImageLoader();
    data = new ImageData[] { val$imageData };
    
    String extensionedFileName = val$fileName;
    if (!extensionedFileName.toLowerCase().endsWith(".png")) {
      extensionedFileName = extensionedFileName + ".png";
    }
    try
    {
      imageLoader.save(extensionedFileName, 5);
    }
    catch (SWTException e)
    {
      Log.e("hierarchyviewer", "Unable to save tree view as a PNG image at " + val$fileName);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.14.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

class HierarchyViewerDirector$14
  implements Runnable
{
  HierarchyViewerDirector$14(HierarchyViewerDirector paramHierarchyViewerDirector, Shell paramShell) {}
  
  public void run()
  {
    Image untouchableImage = PixelPerfectModel.getModel().getImage();
    if (untouchableImage != null)
    {
      final ImageData imageData = untouchableImage.getImageData();
      FileDialog fileDialog = new FileDialog(val$shell, 8192);
      fileDialog.setFilterExtensions(new String[] { "*.png" });
      
      fileDialog.setFilterNames(new String[] { "Portable Network Graphics File (*.png)" });
      
      fileDialog.setText("Choose where to save the screenshot");
      final String fileName = fileDialog.open();
      if (fileName != null) {
        this$0.executeInBackground("Saving pixel perfect", new Runnable()
        {
          public void run()
          {
            ImageLoader imageLoader = new ImageLoader();
            data = new ImageData[] { imageData };
            
            String extensionedFileName = fileName;
            if (!extensionedFileName.toLowerCase().endsWith(".png")) {
              extensionedFileName = extensionedFileName + ".png";
            }
            try
            {
              imageLoader.save(extensionedFileName, 5);
            }
            catch (SWTException e)
            {
              Log.e("hierarchyviewer", "Unable to save tree view as a PNG image at " + fileName);
            }
          }
        });
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.14
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.PsdFile;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

class HierarchyViewerDirector$15$1
  implements Runnable
{
  HierarchyViewerDirector$15$1(HierarchyViewerDirector.15 param15, Window paramWindow, String paramString) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$1.this$0, val$window.getDevice());
    PsdFile psdFile = hvDevice.captureLayers(val$window);
    if (psdFile != null)
    {
      String extensionedFileName = val$fileName;
      if (!extensionedFileName.toLowerCase().endsWith(".psd")) {
        extensionedFileName = extensionedFileName + ".psd";
      }
      try
      {
        psdFile.write(new FileOutputStream(extensionedFileName));
      }
      catch (FileNotFoundException e)
      {
        Log.e("hierarchyviewer", "Unable to write to file " + val$fileName);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.15.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.PsdFile;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

class HierarchyViewerDirector$15
  implements Runnable
{
  HierarchyViewerDirector$15(HierarchyViewerDirector paramHierarchyViewerDirector, Shell paramShell) {}
  
  public void run()
  {
    final Window window = TreeViewModel.getModel().getWindow();
    if (window != null)
    {
      FileDialog fileDialog = new FileDialog(val$shell, 8192);
      fileDialog.setFilterExtensions(new String[] { "*.psd" });
      
      fileDialog.setFilterNames(new String[] { "Photoshop Document (*.psd)" });
      
      fileDialog.setText("Choose where to save the window layers");
      final String fileName = fileDialog.open();
      if (fileName != null) {
        this$0.executeInBackground("Saving window layers", new Runnable()
        {
          public void run()
          {
            IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, window.getDevice());
            PsdFile psdFile = hvDevice.captureLayers(window);
            if (psdFile != null)
            {
              String extensionedFileName = fileName;
              if (!extensionedFileName.toLowerCase().endsWith(".psd")) {
                extensionedFileName = extensionedFileName + ".psd";
              }
              try
              {
                psdFile.write(new FileOutputStream(extensionedFileName));
              }
              catch (FileNotFoundException e)
              {
                Log.e("hierarchyviewer", "Unable to write to file " + fileName);
              }
            }
          }
        });
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.15
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;

class HierarchyViewerDirector$16
  implements Runnable
{
  HierarchyViewerDirector$16(HierarchyViewerDirector paramHierarchyViewerDirector, DrawableViewNode paramDrawableViewNode) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$selectedNode.viewNode.window.getDevice());
    hvDevice.invalidateView(val$selectedNode.viewNode);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.16
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;

class HierarchyViewerDirector$17
  implements Runnable
{
  HierarchyViewerDirector$17(HierarchyViewerDirector paramHierarchyViewerDirector, DrawableViewNode paramDrawableViewNode) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$selectedNode.viewNode.window.getDevice());
    hvDevice.requestLayout(val$selectedNode.viewNode);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.17
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;

class HierarchyViewerDirector$18
  implements Runnable
{
  HierarchyViewerDirector$18(HierarchyViewerDirector paramHierarchyViewerDirector, DrawableViewNode paramDrawableViewNode) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$selectedNode.viewNode.window.getDevice());
    hvDevice.outputDisplayList(val$selectedNode.viewNode);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.18
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;

class HierarchyViewerDirector$19
  implements Runnable
{
  HierarchyViewerDirector$19(HierarchyViewerDirector paramHierarchyViewerDirector, DrawableViewNode paramDrawableViewNode) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$selectedNode.viewNode.window.getDevice());
    hvDevice.loadProfileData(val$selectedNode.viewNode.window, val$selectedNode.viewNode);
    
    TreeViewModel.getModel().notifySelectionChanged();
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.19
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.Window;
import java.util.Map;

class HierarchyViewerDirector$2
  implements Runnable
{
  HierarchyViewerDirector$2(HierarchyViewerDirector paramHierarchyViewerDirector, IDevice paramIDevice) {}
  
  public void run()
  {
    IHvDevice hvDevice;
    synchronized ()
    {
      hvDevice = (IHvDevice)HierarchyViewerDirector.access$100(this$0).get(val$device);
      if (hvDevice != null) {
        HierarchyViewerDirector.access$100(this$0).remove(val$device);
      }
    }
    if (hvDevice == null) {
      return;
    }
    hvDevice.terminateViewDebug();
    hvDevice.removeWindowChangeListener(HierarchyViewerDirector.getDirector());
    DeviceSelectionModel.getModel().removeDevice(hvDevice);
    if (PixelPerfectModel.getModel().getDevice() == val$device) {
      PixelPerfectModel.getModel().setData(null, null, null);
    }
    Window treeViewWindow = TreeViewModel.getModel().getWindow();
    if ((treeViewWindow != null) && (treeViewWindow.getDevice() == val$device))
    {
      TreeViewModel.getModel().setData(null, null);
      HierarchyViewerDirector.access$202(this$0, "");
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;
import java.util.List;

class HierarchyViewerDirector$20
  implements Runnable
{
  HierarchyViewerDirector$20(HierarchyViewerDirector paramHierarchyViewerDirector, DrawableViewNode paramDrawableViewNode, String paramString, List paramList) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$selectedNode.viewNode.window.getDevice());
    hvDevice.invokeViewMethod(val$selectedNode.viewNode.window, val$selectedNode.viewNode, val$method, val$args);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.20
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;

class HierarchyViewerDirector$21
  implements Runnable
{
  HierarchyViewerDirector$21(HierarchyViewerDirector paramHierarchyViewerDirector) {}
  
  public void run()
  {
    DrawableViewNode tree = TreeViewModel.getModel().getTree();
    if (tree != null)
    {
      HierarchyViewerDirector.access$600(this$0, viewNode);
      
      TreeViewModel.getModel().notifySelectionChanged();
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.21
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;

class HierarchyViewerDirector$3
  implements Runnable
{
  HierarchyViewerDirector$3(HierarchyViewerDirector paramHierarchyViewerDirector, IDevice paramIDevice) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$device);
    hvDevice.reloadWindows();
    DeviceSelectionModel.getModel().updateDevice(hvDevice);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;

class HierarchyViewerDirector$4
  implements Runnable
{
  HierarchyViewerDirector$4(HierarchyViewerDirector paramHierarchyViewerDirector, IDevice paramIDevice) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$device);
    int focusedWindow = hvDevice.getFocusedWindow();
    DeviceSelectionModel.getModel().updateFocusedWindow(hvDevice, focusedWindow);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import org.eclipse.swt.graphics.Image;

class HierarchyViewerDirector$5
  implements Runnable
{
  HierarchyViewerDirector$5(HierarchyViewerDirector paramHierarchyViewerDirector, IDevice paramIDevice) {}
  
  public void run()
  {
    Image screenshotImage = HierarchyViewerDirector.access$400(this$0, HierarchyViewerDirector.access$300(this$0, val$device));
    if (screenshotImage != null) {
      PixelPerfectModel.getModel().setImage(screenshotImage);
    }
    synchronized (this$0)
    {
      HierarchyViewerDirector.access$510(this$0);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.IDevice;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;

class HierarchyViewerDirector$6
  implements Runnable
{
  HierarchyViewerDirector$6(HierarchyViewerDirector paramHierarchyViewerDirector, IDevice paramIDevice) {}
  
  public void run()
  {
    IHvDevice hvDevice = HierarchyViewerDirector.access$300(this$0, val$device);
    ViewNode viewNode = hvDevice.loadWindowData(Window.getFocusedWindow(hvDevice));
    if (viewNode != null) {
      PixelPerfectModel.getModel().setTree(viewNode);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.6
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import org.eclipse.swt.graphics.Image;

class HierarchyViewerDirector$7
  implements Runnable
{
  HierarchyViewerDirector$7(HierarchyViewerDirector paramHierarchyViewerDirector, IHvDevice paramIHvDevice) {}
  
  public void run()
  {
    Image screenshotImage = HierarchyViewerDirector.access$400(this$0, val$hvDevice);
    if (screenshotImage != null)
    {
      ViewNode viewNode = val$hvDevice.loadWindowData(Window.getFocusedWindow(val$hvDevice));
      if (viewNode != null) {
        PixelPerfectModel.getModel().setData(val$hvDevice.getDevice(), screenshotImage, viewNode);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.7
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;

class HierarchyViewerDirector$8
  implements Runnable
{
  HierarchyViewerDirector$8(HierarchyViewerDirector paramHierarchyViewerDirector, Window paramWindow) {}
  
  public void run()
  {
    HierarchyViewerDirector.access$202(this$0, "");
    
    IHvDevice hvDevice = val$window.getHvDevice();
    ViewNode viewNode = hvDevice.loadWindowData(val$window);
    if (viewNode != null)
    {
      viewNode.setViewCount();
      TreeViewModel.getModel().setData(val$window, viewNode);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.8
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

class HierarchyViewerDirector$9
  implements Runnable
{
  HierarchyViewerDirector$9(HierarchyViewerDirector paramHierarchyViewerDirector, Shell paramShell) {}
  
  public void run()
  {
    FileDialog fileDialog = new FileDialog(val$shell, 4096);
    fileDialog.setFilterExtensions(new String[] { "*.jpg;*.jpeg;*.png;*.gif;*.bmp" });
    
    fileDialog.setFilterNames(new String[] { "Image (*.jpg, *.jpeg, *.png, *.gif, *.bmp)" });
    
    fileDialog.setText("Choose an overlay image");
    String fileName = fileDialog.open();
    if (fileName != null) {
      try
      {
        Image image = new Image(Display.getDefault(), fileName);
        PixelPerfectModel.getModel().setOverlayImage(image);
      }
      catch (SWTException e)
      {
        Log.e("hierarchyviewer", "Unable to load image from " + fileName);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.9
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import java.util.TimerTask;

class HierarchyViewerDirector$PixelPerfectAutoRefreshTask
  extends TimerTask
{
  public void run()
  {
    HierarchyViewerDirector.getDirector().refreshPixelPerfect();
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewerlib.HierarchyViewerDirector.PixelPerfectAutoRefreshTask
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewerlib;

import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.hierarchyviewerlib.device.DeviceBridge;
import com.android.hierarchyviewerlib.device.HvDeviceFactory;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.device.WindowUpdater;
import com.android.hierarchyviewerlib.device.WindowUpdater.IWindowChangeListener;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.ViewNode;
import com.android.hierarchyviewerlib.models.Window;
import com.android.hierarchyviewerlib.ui.CaptureDisplay;
import com.android.hierarchyviewerlib.ui.TreeView;
import com.android.hierarchyviewerlib.ui.util.DrawableViewNode;
import com.android.hierarchyviewerlib.ui.util.PsdFile;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

public abstract class HierarchyViewerDirector
  implements AndroidDebugBridge.IDeviceChangeListener, WindowUpdater.IWindowChangeListener
{
  private static final boolean sIsUsingDdmProtocol;
  protected static HierarchyViewerDirector sDirector;
  public static final String TAG = "hierarchyviewer";
  
  static
  {
    String sHvProtoEnvVar = System.getenv("ANDROID_HVPROTO");
    sIsUsingDdmProtocol = "ddm".equalsIgnoreCase(sHvProtoEnvVar);
  }
  
  private int mPixelPerfectRefreshesInProgress = 0;
  private Timer mPixelPerfectRefreshTimer = new Timer();
  private boolean mAutoRefresh = false;
  public static final int DEFAULT_PIXEL_PERFECT_AUTOREFRESH_INTERVAL = 5;
  private int mPixelPerfectAutoRefreshInterval = 5;
  private PixelPerfectAutoRefreshTask mCurrentAutoRefreshTask;
  private String mFilterText = "";
  private static final Object mDevicesLock = new Object();
  private Map<IDevice, IHvDevice> mDevices = new HashMap(10);
  
  public static boolean isUsingDdmProtocol()
  {
    return sIsUsingDdmProtocol;
  }
  
  public void terminate()
  {
    WindowUpdater.terminate();
    mPixelPerfectRefreshTimer.cancel();
  }
  
  public static HierarchyViewerDirector getDirector()
  {
    return sDirector;
  }
  
  public void acquireBridge(AndroidDebugBridge bridge)
  {
    DeviceBridge.acquireBridge(bridge);
  }
  
  public void initDebugBridge()
  {
    DeviceBridge.initDebugBridge(getAdbLocation());
  }
  
  public void populateDeviceSelectionModel()
  {
    IDevice[] devices = DeviceBridge.getDevices();
    for (IDevice device : devices) {
      deviceConnected(device);
    }
  }
  
  public void startListenForDevices()
  {
    DeviceBridge.startListenForDevices(this);
  }
  
  public void stopListenForDevices()
  {
    DeviceBridge.stopListenForDevices(this);
  }
  
  public void deviceConnected(final IDevice device)
  {
    executeInBackground("Connecting device", new Runnable()
    {
      public void run()
      {
        if (!device.isOnline()) {
          return;
        }
        IHvDevice hvDevice;
        synchronized (HierarchyViewerDirector.mDevicesLock)
        {
          hvDevice = (IHvDevice)mDevices.get(device);
          if (hvDevice == null)
          {
            hvDevice = HvDeviceFactory.create(device);
            hvDevice.initializeViewDebug();
            hvDevice.addWindowChangeListener(HierarchyViewerDirector.getDirector());
            mDevices.put(device, hvDevice);
          }
          else
          {
            hvDevice.initializeViewDebug();
          }
        }
        DeviceSelectionModel.getModel().addDevice(hvDevice);
        focusChanged(device);
      }
    });
  }
  
  public void deviceDisconnected(final IDevice device)
  {
    executeInBackground("Disconnecting device", new Runnable()
    {
      public void run()
      {
        IHvDevice hvDevice;
        synchronized (HierarchyViewerDirector.mDevicesLock)
        {
          hvDevice = (IHvDevice)mDevices.get(device);
          if (hvDevice != null) {
            mDevices.remove(device);
          }
        }
        if (hvDevice == null) {
          return;
        }
        hvDevice.terminateViewDebug();
        hvDevice.removeWindowChangeListener(HierarchyViewerDirector.getDirector());
        DeviceSelectionModel.getModel().removeDevice(hvDevice);
        if (PixelPerfectModel.getModel().getDevice() == device) {
          PixelPerfectModel.getModel().setData(null, null, null);
        }
        Window treeViewWindow = TreeViewModel.getModel().getWindow();
        if ((treeViewWindow != null) && (treeViewWindow.getDevice() == device))
        {
          TreeViewModel.getModel().setData(null, null);
          mFilterText = "";
        }
      }
    });
  }
  
  public void windowsChanged(final IDevice device)
  {
    executeInBackground("Refreshing windows", new Runnable()
    {
      public void run()
      {
        IHvDevice hvDevice = HierarchyViewerDirector.this.getHvDevice(device);
        hvDevice.reloadWindows();
        DeviceSelectionModel.getModel().updateDevice(hvDevice);
      }
    });
  }
  
  public void focusChanged(final IDevice device)
  {
    executeInBackground("Updating focus", new Runnable()
    {
      public void run()
      {
        IHvDevice hvDevice = HierarchyViewerDirector.this.getHvDevice(device);
        int focusedWindow = hvDevice.getFocusedWindow();
        DeviceSelectionModel.getModel().updateFocusedWindow(hvDevice, focusedWindow);
      }
    });
  }
  
  public void deviceChanged(IDevice device, int changeMask)
  {
    if (((changeMask & 0x1) != 0) && (device.isOnline())) {
      deviceConnected(device);
    }
  }
  
  public void refreshPixelPerfect()
  {
    final IDevice device = PixelPerfectModel.getModel().getDevice();
    if (device != null)
    {
      boolean proceed = false;
      synchronized (this)
      {
        if (mPixelPerfectRefreshesInProgress <= 1)
        {
          proceed = true;
          mPixelPerfectRefreshesInProgress += 1;
        }
      }
      if (proceed) {
        executeInBackground("Refreshing pixel perfect screenshot", new Runnable()
        {
          public void run()
          {
            Image screenshotImage = HierarchyViewerDirector.this.getScreenshotImage(HierarchyViewerDirector.access$300(HierarchyViewerDirector.this, device));
            if (screenshotImage != null) {
              PixelPerfectModel.getModel().setImage(screenshotImage);
            }
            synchronized (HierarchyViewerDirector.this)
            {
              HierarchyViewerDirector.access$510(HierarchyViewerDirector.this);
            }
          }
        });
      }
    }
  }
  
  public void refreshPixelPerfectTree()
  {
    final IDevice device = PixelPerfectModel.getModel().getDevice();
    if (device != null) {
      executeInBackground("Refreshing pixel perfect tree", new Runnable()
      {
        public void run()
        {
          IHvDevice hvDevice = HierarchyViewerDirector.this.getHvDevice(device);
          ViewNode viewNode = hvDevice.loadWindowData(Window.getFocusedWindow(hvDevice));
          if (viewNode != null) {
            PixelPerfectModel.getModel().setTree(viewNode);
          }
        }
      });
    }
  }
  
  public void loadPixelPerfectData(final IHvDevice hvDevice)
  {
    executeInBackground("Loading pixel perfect data", new Runnable()
    {
      public void run()
      {
        Image screenshotImage = HierarchyViewerDirector.this.getScreenshotImage(hvDevice);
        if (screenshotImage != null)
        {
          ViewNode viewNode = hvDevice.loadWindowData(Window.getFocusedWindow(hvDevice));
          if (viewNode != null) {
            PixelPerfectModel.getModel().setData(hvDevice.getDevice(), screenshotImage, viewNode);
          }
        }
      }
    });
  }
  
  private Image getScreenshotImage(IHvDevice hvDevice)
  {
    return hvDevice == null ? null : hvDevice.getScreenshotImage();
  }
  
  public void loadViewTreeData(final Window window)
  {
    executeInBackground("Loading view hierarchy", new Runnable()
    {
      public void run()
      {
        mFilterText = "";
        
        IHvDevice hvDevice = window.getHvDevice();
        ViewNode viewNode = hvDevice.loadWindowData(window);
        if (viewNode != null)
        {
          viewNode.setViewCount();
          TreeViewModel.getModel().setData(window, viewNode);
        }
      }
    });
  }
  
  public void loadOverlay(final Shell shell)
  {
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        FileDialog fileDialog = new FileDialog(shell, 4096);
        fileDialog.setFilterExtensions(new String[] { "*.jpg;*.jpeg;*.png;*.gif;*.bmp" });
        
        fileDialog.setFilterNames(new String[] { "Image (*.jpg, *.jpeg, *.png, *.gif, *.bmp)" });
        
        fileDialog.setText("Choose an overlay image");
        String fileName = fileDialog.open();
        if (fileName != null) {
          try
          {
            Image image = new Image(Display.getDefault(), fileName);
            PixelPerfectModel.getModel().setOverlayImage(image);
          }
          catch (SWTException e)
          {
            Log.e("hierarchyviewer", "Unable to load image from " + fileName);
          }
        }
      }
    });
  }
  
  public void showCapture(final Shell shell, final ViewNode viewNode)
  {
    executeInBackground("Capturing node", new Runnable()
    {
      public void run()
      {
        final Image image = loadCapture(viewNode);
        if (image != null) {
          Display.getDefault().syncExec(new Runnable()
          {
            public void run()
            {
              CaptureDisplay.show(val$shell, val$viewNode, image);
            }
          });
        }
      }
    });
  }
  
  public Image loadCapture(ViewNode viewNode)
  {
    IHvDevice hvDevice = window.getHvDevice();
    Image image = hvDevice.loadCapture(window, viewNode);
    if (image != null)
    {
      image = image;
      
      TreeViewModel.getModel().notifySelectionChanged();
    }
    return image;
  }
  
  public void loadCaptureInBackground(final ViewNode viewNode)
  {
    executeInBackground("Capturing node", new Runnable()
    {
      public void run()
      {
        loadCapture(viewNode);
      }
    });
  }
  
  public void showCapture(Shell shell)
  {
    DrawableViewNode viewNode = TreeViewModel.getModel().getSelection();
    if (viewNode != null) {
      showCapture(shell, viewNode);
    }
  }
  
  public void refreshWindows()
  {
    executeInBackground("Refreshing windows", new Runnable()
    {
      public void run()
      {
        IHvDevice[] hvDevicesA = DeviceSelectionModel.getModel().getDevices();
        IDevice[] devicesA = new IDevice[hvDevicesA.length];
        for (int i = 0; i < hvDevicesA.length; i++) {
          devicesA[i] = hvDevicesA[i].getDevice();
        }
        IDevice[] devicesB = DeviceBridge.getDevices();
        HashSet<IDevice> deviceSet = new HashSet();
        for (int
1 2 3 4 5 6 7 8 9 10 11 12 13

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd