Пример #1
0
        @Override
        public void onTimeEvent(final int time) {
          mCanClose = true;
          if (mVideoData.showSkipButton && mSkipButton != null) {

            mSkipButton.setImageDrawable(
                mResourceManager.getResource(
                    mContext, ResourceManager.DEFAULT_SKIP_IMAGE_RESOURCE_ID));

            mSkipButton.setVisibility(View.VISIBLE);
          }
        }
Пример #2
0
  @BeforeClass
  public static void initialize() throws InterruptedException {
    Runtime rt = Runtime.getRuntime();

    rt.gc();
    freeMemory_preUse = rt.freeMemory();

    ResourceManager rm = new ResourceManager();

    for (int i = 0; i < 1000; i++) {
      Object key = Integer.toString(i);
      keyList.add(key);
      resourceList.add(rm.getResource(key));
    }

    rt.gc();
    freeMemory_useRes = rt.freeMemory();

    for (int i = 0; i < 1000; i++) {
      Object key = keyList.get(i);
      Resource res = resourceList.get(i);
      res.use(key);
    }

    for (int i = 0; i < 1000; i++) {
      Resource res = resourceList.get(i);
      res.release();
    }

    keyList.clear(); // リソースへの参照をすべて削除
    resourceList.clear(); // リソースへの参照をすべて削除

    rm.shutdown();
    rt.gc();

    rm.reaper.join();

    rt.gc();
    freeMemory_clearRes = rt.freeMemory();

    System.out.println("freeMemory_preUse  :" + freeMemory_preUse);
    System.out.println("freeMemory_useRes  :" + freeMemory_useRes);
    System.out.println("freeMemory_clearRes:" + freeMemory_clearRes);
  }