Java Code Examples for android.view.View.isInEditMode()

The following are Jave code examples for showing how to use isInEditMode() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: GitHub   File: ViewGroupMvpViewStateDelegateImpl.java   Source Code and License Vote up 7 votes
/**
 * Creates a new instance
 *
 * @param delegateCallback the callback
 * @param keepPresenter true, if you want to keep the presenter and view state during screen
 * orientation changes etc.
 */
public ViewGroupMvpViewStateDelegateImpl(@NonNull View view,
    @NonNull ViewGroupMvpViewStateDelegateCallback<V, P, VS> delegateCallback,
    boolean keepPresenter) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }
  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }
  this.delegateCallback = delegateCallback;
  this.keepPresenter = keepPresenter;
  this.isInEditMode = view.isInEditMode();
  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 2
Project: GitHub   File: ViewGroupMvpDelegateImpl.java   Source Code and License Vote up 7 votes
public ViewGroupMvpDelegateImpl(@NonNull View view,
    @NonNull ViewGroupDelegateCallback<V, P> delegateCallback,
    boolean keepPresenterDuringScreenOrientationChange) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }

  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }

  this.delegateCallback = delegateCallback;
  this.keepPresenterDuringScreenOrientationChange = keepPresenterDuringScreenOrientationChange;

  isInEditMode = view.isInEditMode();

  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 3
Project: GitHub   File: ViewGroupMviDelegateImpl.java   Source Code and License Vote up 7 votes
public ViewGroupMviDelegateImpl(@NonNull View view,
    @NonNull ViewGroupMviDelegateCallback<V, P> delegateCallback,
    boolean keepPresenterDuringScreenOrientationChange) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }
  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }
  this.delegateCallback = delegateCallback;
  this.keepPresenterDuringScreenOrientationChange = keepPresenterDuringScreenOrientationChange;
  this.isInEditMode = view.isInEditMode();
  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 4
Project: GitHub   File: ViewGroupMvpViewStateDelegateImpl.java   Source Code and License Vote up 7 votes
/**
 * Creates a new instance
 *
 * @param delegateCallback the callback
 * @param keepPresenter true, if you want to keep the presenter and view state during screen
 * orientation changes etc.
 */
public ViewGroupMvpViewStateDelegateImpl(@NonNull View view,
    @NonNull ViewGroupMvpViewStateDelegateCallback<V, P, VS> delegateCallback,
    boolean keepPresenter) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }
  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }
  this.delegateCallback = delegateCallback;
  this.keepPresenter = keepPresenter;
  this.isInEditMode = view.isInEditMode();
  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 5
Project: GitHub   File: ViewGroupMvpDelegateImpl.java   Source Code and License Vote up 7 votes
public ViewGroupMvpDelegateImpl(@NonNull View view,
    @NonNull ViewGroupDelegateCallback<V, P> delegateCallback,
    boolean keepPresenterDuringScreenOrientationChange) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }

  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }

  this.delegateCallback = delegateCallback;
  this.keepPresenterDuringScreenOrientationChange = keepPresenterDuringScreenOrientationChange;

  isInEditMode = view.isInEditMode();

  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 6
Project: GitHub   File: ViewGroupMviDelegateImpl.java   Source Code and License Vote up 7 votes
public ViewGroupMviDelegateImpl(@NonNull View view,
    @NonNull ViewGroupMviDelegateCallback<V, P> delegateCallback,
    boolean keepPresenterDuringScreenOrientationChange) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }
  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }
  this.delegateCallback = delegateCallback;
  this.keepPresenterDuringScreenOrientationChange = keepPresenterDuringScreenOrientationChange;
  this.isInEditMode = view.isInEditMode();
  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 7
Project: CSipSimple   File: CallTypeIconsView.java   Source Code and License Vote up 7 votes
public Resources(Context context, View v) {
    final android.content.res.Resources r = context.getResources();
    Theme t = null;
    if(!v.isInEditMode()) {
        t = Theme.getCurrentTheme(context);
    }
    if(t != null) {
        incoming = t.getDrawableResource("ic_call_incoming");
        outgoing = t.getDrawableResource("ic_call_outgoing");
        missed = t.getDrawableResource("ic_call_missed");
        iconMargin = t.getDimension("call_log_icon_margin");
    }
    if(incoming == null) {
        incoming = r.getDrawable(R.drawable.ic_call_incoming_holo_dark);
    }
    if(outgoing == null) {
        outgoing = r.getDrawable(R.drawable.ic_call_outgoing_holo_dark);
    }
    if(missed == null) {
        missed = r.getDrawable(R.drawable.ic_call_missed_holo_dark);
    }
    if(iconMargin == null) {
        iconMargin = r.getDimensionPixelSize(R.dimen.call_log_icon_margin);
    }
}
 
Example 8
Project: letv   File: ViewUtil.java   Source Code and License Vote up 7 votes
public static boolean refreshHeight(View view, int aimHeight) {
    if (view.isInEditMode()) {
        return false;
    }
    Log.d(TAG, String.format("refresh Height %d %d", new Object[]{Integer.valueOf(view.getHeight()), Integer.valueOf(aimHeight)}));
    if (view.getHeight() == aimHeight || Math.abs(view.getHeight() - aimHeight) == StatusBarHeightUtil.getStatusBarHeight(view.getContext())) {
        return false;
    }
    int validPanelHeight = KeyboardUtil.getValidPanelHeight(view.getContext());
    LayoutParams layoutParams = view.getLayoutParams();
    if (layoutParams == null) {
        view.setLayoutParams(new LayoutParams(-1, validPanelHeight));
    } else {
        layoutParams.height = validPanelHeight;
        view.requestLayout();
    }
    return true;
}
 
Example 9
Project: Watermark   File: ViewGroupMvpDelegateImpl.java   Source Code and License Vote up 7 votes
public ViewGroupMvpDelegateImpl(@NonNull View view,
    @NonNull ViewGroupDelegateCallback<V, P> delegateCallback,
    boolean keepPresenterDuringScreenOrientationChange) {
  if (view == null) {
    throw new NullPointerException("View is null!");
  }

  if (delegateCallback == null) {
    throw new NullPointerException("MvpDelegateCallback is null!");
  }

  this.delegateCallback = delegateCallback;
  this.keepPresenterDuringScreenOrientationChange = keepPresenterDuringScreenOrientationChange;

  isInEditMode = view.isInEditMode();

  if (!isInEditMode) {
    this.activity = PresenterManager.getActivity(delegateCallback.getContext());
  } else {
    this.activity = null;
  }
}
 
Example 10
Project: OSchina_resources_android   File: UiUtil.java   Source Code and License Vote up 7 votes
public static boolean changeViewHeight(final View view, final int aimHeight) {
    if (view.isInEditMode()) {
        return false;
    }

    if (view.getHeight() == aimHeight) {
        return false;
    }

    ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    if (layoutParams == null) {
        layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                aimHeight);
        view.setLayoutParams(layoutParams);
    } else {
        layoutParams.height = aimHeight;
        view.requestLayout();
    }

    return true;
}
 
Example 11
Project: boohee_v5.6   File: ViewUtil.java   Source Code and License Vote up 7 votes
public static boolean refreshHeight(View view, int aimHeight) {
    if (view.isInEditMode()) {
        return false;
    }
    Log.d(TAG, String.format("refresh Height %d %d", new Object[]{Integer.valueOf(view.getHeight()), Integer.valueOf(aimHeight)}));
    if (view.getHeight() == aimHeight || Math.abs(view.getHeight() - aimHeight) == StatusBarHeightUtil.getStatusBarHeight(view.getContext())) {
        return false;
    }
    int validPanelHeight = KeyboardUtil.getValidPanelHeight(view.getContext());
    LayoutParams layoutParams = view.getLayoutParams();
    if (layoutParams == null) {
        view.setLayoutParams(new LayoutParams(-1, validPanelHeight));
    } else {
        layoutParams.height = validPanelHeight;
        view.requestLayout();
    }
    return true;
}
 
Example 12
Project: EasyEmoji   File: ViewUtil.java   Source Code and License Vote up 6 votes
public static boolean refreshHeight(final View view, final int aimHeight) {
    if (view.isInEditMode()) {
        return false;
    }

    if (view.getHeight() == aimHeight) {
        return false;
    }

    if (Math.abs(view.getHeight() - aimHeight) ==
            StatusBarHeightUtil.getStatusBarHeight(view.getContext())) {
        return false;
    }

    final int validPanelHeight = KeyboardManagerImpl.getValidPanelHeight(view.getContext());
    ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    if (layoutParams == null) {
        layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                validPanelHeight);
        view.setLayoutParams(layoutParams);
    } else {
        layoutParams.height = validPanelHeight;
        view.requestLayout();
    }

    return true;
}
 
Example 13
Project: ImitateButterKnife   File: Utils.java   Source Code and License Vote up 6 votes
/**
 * getResourceEntryName
 * @param view
 * @param id
 * @return
 */
private static String getResourceEntryName(View view, @IdRes int id) {
    if (view.isInEditMode()) {
        return "<unavailable while editing>";
    }
    return view.getContext().getResources().getResourceEntryName(id);
}
 
Example 14
Project: CXJPadProject   File: ViewUtil.java   Source Code and License Vote up 6 votes
public static boolean refreshHeight(final View view, final int aimHeight) {
    if (view.isInEditMode()) {
        return false;
    }
    Log.d(TAG, String.format("refresh Height %d %d", view.getHeight(), aimHeight));

    if (view.getHeight() == aimHeight) {
        return false;
    }

    if (Math.abs(view.getHeight() - aimHeight) ==
            StatusBarHeightUtil.getStatusBarHeight(view.getContext())) {
        return false;
    }

    final int validPanelHeight = KeyboardUtil.getValidPanelHeight(view.getContext());
    ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    if (layoutParams == null) {
        layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                validPanelHeight);
        view.setLayoutParams(layoutParams);
    } else {
        layoutParams.height = validPanelHeight;
        view.requestLayout();
    }

    return true;
}
 
Example 15
Project: boohee_v5.6   File: WindowDecorActionBar.java   Source Code and License Vote up 6 votes
public WindowDecorActionBar(View layout) {
    if ($assertionsDisabled || layout.isInEditMode()) {
        init(layout);
        return;
    }
    throw new AssertionError();
}
 
Example 16
Project: GitHub   File: Utils.java   Source Code and License Vote up 5 votes
private static String getResourceEntryName(View view, @IdRes int id) {
  if (view.isInEditMode()) {
    return "<unavailable while editing>";
  }
  return view.getContext().getResources().getResourceEntryName(id);
}
 
Example 17
Project: Phial   File: Precondition.java   Source Code and License Vote up 5 votes
public static void calledFromTools(View view) {
    if (!view.isInEditMode()) {
        throw new IllegalArgumentException("should be called only from AndroidStudioTools");
    }
}
 
Example 18
Project: butterknife-parent   File: Utils.java   Source Code and License Vote up 5 votes
private static String getResourceEntryName(View view, @IdRes int id) {
  if (view.isInEditMode()) {
    return "<unavailable while editing>";
  }
  return view.getContext().getResources().getResourceEntryName(id);
}