Exemplo n.º 1
0
  private void initializeViews() {
    mSelectionManager = new SelectionManager(mActivity, true);
    mSelectionManager.setSelectionListener(this);

    mConfig = Config.AlbumSetPage.get(mActivity);
    mSlotView = new SlotView(mActivity, mConfig.slotViewSpec);
    mAlbumSetView =
        new AlbumSetSlotRenderer(
            mActivity, mSelectionManager, mSlotView, mConfig.labelSpec, mConfig.placeholderColor);
    mSlotView.setSlotRenderer(mAlbumSetView);
    mSlotView.setListener(
        new SlotView.SimpleListener() {
          @Override
          public void onDown(int index) {
            AlbumSetPage.this.onDown(index);
          }

          @Override
          public void onUp(boolean followedByLongPress) {
            AlbumSetPage.this.onUp(followedByLongPress);
          }

          @Override
          public void onSingleTapUp(int slotIndex) {
            AlbumSetPage.this.onSingleTapUp(slotIndex);
          }

          @Override
          public void onLongTap(int slotIndex) {
            AlbumSetPage.this.onLongTap(slotIndex);
          }

          @Override
          public void onGestureLongTap(int slotIndex) {
            AlbumSetPage.this.onGestureLongTap(slotIndex);
          }
        });

    mActionModeHandler = new ActionModeHandler(mActivity, mSelectionManager);
    mActionModeHandler.setActionModeListener(
        new ActionModeListener() {
          @Override
          public boolean onActionItemClicked(MenuItem item) {
            return onItemSelected(item);
          }
        });
    mRootPane.addComponent(mSlotView);
  }
Exemplo n.º 2
0
 @Override
 public void addComponent(Object obj) {
   if (obj instanceof MGLView) {
     mRootView.addComponent((GLView) ((MGLView) obj).getComponent());
   }
 }