コード例 #1
0
  private boolean shouldCloseDrawers(float x, float y) {
    View activitedDrawer = null;
    if (mLeftPercent > 0.0f) {
      activitedDrawer = mLeftDrawer;
    } else if (mRightPercent > 0.0f) {
      activitedDrawer = mRightDrawer;
    }
    if (activitedDrawer == null) {
      return false;
    }

    int xInt = (int) x;
    int yInt = (int) y;

    if (activitedDrawer instanceof DrawerLayoutChild) {
      DrawerLayoutChild dlc = (DrawerLayoutChild) activitedDrawer;
      int paddingTop = dlc.getLayoutPaddingTop();
      int paddingBottom = dlc.getLayoutPaddingBottom();
      if (yInt < paddingTop || yInt >= getHeight() - paddingBottom) {
        return false;
      }
    }

    return !ViewUtils.isViewUnder(activitedDrawer, xInt, yInt, 0);
  }
コード例 #2
0
ファイル: GuideHelper.java プロジェクト: NeoFocus/Nimingban
 private static ViewGroup getParent(Activity activity) {
   ViewGroup parent = (ViewGroup) activity.getWindow().getDecorView();
   View view = ViewUtils.getChild(parent, android.R.id.content);
   if (view instanceof ViewGroup) {
     parent = (ViewGroup) view;
   }
   return parent;
 }
コード例 #3
0
  @Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.scene_excluded_languages);
    setNavigationIcon(R.drawable.v_arrow_left_dark_x24);

    if (null == savedInstanceState) {
      onInit();
    } else {
      onRestore(savedInstanceState);
    }

    mCancel = ViewUtils.$$(this, R.id.cancel);
    mOk = ViewUtils.$$(this, R.id.ok);
    mSelectAll = ViewUtils.$$(this, R.id.select_all);
    mDeselectAll = ViewUtils.$$(this, R.id.deselect_all);
    mInvertSelection = ViewUtils.$$(this, R.id.invert_selection);
    mRecyclerView = (EasyRecyclerView) ViewUtils.$$(this, R.id.recycler_view);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setClipToPadding(false);
    mAdapter = new LanguageAdapter();
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    mCancel.setOnClickListener(this);
    mOk.setOnClickListener(this);
    mSelectAll.setOnClickListener(this);
    mDeselectAll.setOnClickListener(this);
    mInvertSelection.setOnClickListener(this);

    Ripple.addRipple(mCancel, false);
    Ripple.addRipple(mOk, false);
    Ripple.addRipple(mSelectAll, false);
    Ripple.addRipple(mDeselectAll, false);
    Ripple.addRipple(mInvertSelection, false);
  }
コード例 #4
0
 private boolean isDrawerUnder(int x, int y) {
   return ViewUtils.isViewUnder(mLeftDrawer, x, y, 0)
       || ViewUtils.isViewUnder(mRightDrawer, x, y, 0);
 }