Exemple #1
0
 public void onDestroy() {
   final Context context = getContext();
   for (BaseGraphView view : ViewUtil.views()) {
     if (view.getView().getContext() == context) {
       view.stop(null);
     }
   }
 }
Exemple #2
0
  public boolean onResume() {
    final Context context = getContext();
    boolean ret = false;

    for (BaseGraphView view : ViewUtil.views()) {
      if (view.getView().getContext() == context) {
        ret = view.onResume() || ret;
      }
    }
    return ret;
  }
Exemple #3
0
  public boolean onPause() {
    Log.d(FileUtil.TAG, "onPause");
    final Context context = getContext();
    boolean ret = false;

    for (BaseGraphView view : ViewUtil.views()) {
      if (view.getView().getContext() == context) {
        ret = view.onPause() || ret;
      }
    }
    return ret;
  }
Exemple #4
0
  public ImageView getImageViewForSurface() {
    if (mView == null || mView.getView() == null) {
      return null;
    }

    final ViewGroup layout = (ViewGroup) mView.getView().getParent();

    if (layout != null) {
      for (int i = layout.getChildCount() - 1; i >= 0; i--) {
        final View lastView = layout.getChildAt(i);
        if (lastView.getClass() == ImageView.class) {
          return (ImageView) lastView;
        }
      }
    }
    return null;
  }
Exemple #5
0
  public void close(Bitmap snapshot, final IGraphView.OnViewDetachedListener listener) {
    if (mView != null && mView.getView() != null) {
      final ViewGroup layout = (ViewGroup) mView.getView().getParent();
      final ImageView imageView = getImageViewForSurface();

      if (imageView != null) {
        imageView.setImageBitmap(snapshot);
        imageView.setVisibility(View.VISIBLE);
        layout.bringChildToFront(imageView);

        // remove SurfaceView delayed
        mView
            .getView()
            .post(
                new Runnable() {
                  @Override
                  public void run() {
                    mView.getView().removeCallbacks(this);
                    mView.onPause();
                    mView.stop(listener);
                    layout.removeAllViews();
                    mView = null;
                  }
                });
      } else {
        mView.onPause();
        mView.stop(listener);
        if (layout != null) {
          layout.removeAllViews();
        } else {
          mView.tearDown();
        }
        mView = null;
      }
    }
  }
Exemple #6
0
 public int cmdViewHandle() {
   final GiCoreView v = mView != null ? mView.coreView() : null;
   return v != null ? v.viewAdapterHandle() : 0;
 }
Exemple #7
0
 public GiCoreView coreView() {
   return mView != null ? mView.coreView() : null;
 }
Exemple #8
0
 public Context getContext() {
   return mView != null ? mView.getView().getContext() : null;
 }
Exemple #9
0
 public ViewGroup getParent() {
   return mView != null ? (ViewGroup) mView.getView().getParent() : null;
 }
Exemple #10
0
 public View getView() {
   return mView != null ? mView.getView() : null;
 }
Exemple #11
0
 public void createDummyView(Context context, int width, int height) {
   final StdGraphView view = new StdGraphView(context, (BaseGraphView) null);
   view.layout(0, 0, width, height);
   mView = view;
   mView.coreView().onSize(BaseViewAdapter.getMainAdapter(mView), width, height);
 }