private void clickAdapterView(AdapterView parent) {
   final int position = parent.getPositionForView(MaterialRippleLayout.this);
   final long itemId = parent.getAdapter() != null ? parent.getAdapter().getItemId(position) : 0;
   if (position != AdapterView.INVALID_POSITION) {
     parent.performItemClick(MaterialRippleLayout.this, position, itemId);
   }
 }
Beispiel #2
0
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   String str =
       parent.getAdapter().getItem(position) == null
           ? null
           : parent.getAdapter().getItem(position).toString();
   if (TextUtils.isEmpty(str)) {
     PhotoUtils.showSelectDialog(mActivity);
   }
 }
 @Override
 public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
   if (((ManualArtChooserAdapter) arg0.getAdapter()).covers[arg2] != null) {
     AlbumArtUtils.saveAlbumCoverInSdCard(
         ((ManualArtChooserAdapter) arg0.getAdapter()).covers[arg2],
         String.valueOf(mAlbumId),
         true); // forces resolution above minimum to avoid being
     // overriden the next time we search for covers
     AlbumArtUtils.saveSmallAlbumCoverInSdCard(
         ((ManualArtChooserAdapter) arg0.getAdapter()).covers[arg2],
         String.valueOf(mAlbumId));
     Toast.makeText(getApplicationContext(), R.string.album_art_changed, Toast.LENGTH_SHORT)
         .show();
   }
 }
  /**
   * Handles selection or click of the left-bar items..
   *
   * @param parent
   * @param view
   * @param position
   * @param id
   */
  private void handleLeftBarItemSelection(AdapterView<?> parent, View view, int position, long id) {
    // Get instance of selected item and set as current fragment
    try {
      Log.d(
          MainActivity.class.getName(),
          "HandleLeftBarItemSelection: selected position " + position);

      // Create fragment
      Fragment fragment =
          (Fragment)
              Class.forName(
                      ((LeftBarItemsListAdapter) parent.getAdapter()).getItem(position).className)
                  .getConstructor()
                  .newInstance();

      // Set fragment
      setActiveFragment(fragment);
    } catch (Exception e) {
      StringWriter errors = new StringWriter();
      e.printStackTrace(new PrintWriter(errors));
      String errorReason = errors.toString();
      Log.d(
          MainActivity.class.getName(), "HandleLeftBarItemSelection: Exception: \n" + errorReason);
    }
  }
 // AdapterView#OnItemClickListener
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   ActivityChooserViewAdapter adapter = (ActivityChooserViewAdapter) parent.getAdapter();
   final int itemViewType = adapter.getItemViewType(position);
   switch (itemViewType) {
     case ActivityChooserViewAdapter.ITEM_VIEW_TYPE_FOOTER:
       {
         showPopupUnchecked(ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED);
       }
       break;
     case ActivityChooserViewAdapter.ITEM_VIEW_TYPE_ACTIVITY:
       {
         dismissPopup();
         if (mIsSelectingDefaultActivity) {
           // The item at position zero is the default already.
           if (position > 0) {
             mAdapter.getDataModel().setDefaultActivity(position);
           }
         } else {
           // If the default target is not shown in the list, the first
           // item in the model is default action => adjust index
           position = mAdapter.getShowDefaultActivity() ? position : position + 1;
           Intent launchIntent = mAdapter.getDataModel().chooseActivity(position);
           if (launchIntent != null) {
             mContext.startActivity(launchIntent);
           }
         }
       }
       break;
     default:
       throw new IllegalArgumentException();
   }
 }
  @OnItemSelected(R.id.spinner2)
  void onSubItemSelected(AdapterView<?> parent, View view, int position, long id) {
    String item = (String) parent.getAdapter().getItem(position);
    Log.d(TAG, "sub select=" + item);

    selectResource(getBaseClassPath(mSpinner.getSelectedItemPosition()), item);
  }
  @Override
  public boolean onItemLongClick(
      final AdapterView<?> parent, final View view, final int position, final long id) {
    if (parent == mLvDebug) {
      final IITC_LogAdapter adapter = ((IITC_LogAdapter) parent.getAdapter());
      final Log.Message item = adapter.getItem(position);

      final PopupMenu popupMenu = new PopupMenu(this, view);
      popupMenu.getMenuInflater().inflate(R.menu.debug, popupMenu.getMenu());

      popupMenu.setOnMenuItemClickListener(
          new PopupMenu.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(final MenuItem menuitem) {
              switch (menuitem.getItemId()) {
                case R.id.menu_copy:
                  mIitcWebView.getJSInterface().copy(item.toString());
                  return true;
                case R.id.menu_delete:
                  adapter.remove(item);
                  return true;
              }
              return false;
            }
          });

      popupMenu.show();
    }
    return false;
  }
 public void onItemClick(
     AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong) {
   paramAdapterView = paramAdapterView.getAdapter().getItem(paramInt);
   if ((paramAdapterView instanceof Category)) {
     paramView = (Category) paramAdapterView;
     if (paramView.f() > 0) {
       AppData.a(EventIri.NearbyMoreCategoriesCategory, "category", paramView.d());
       paramAdapterView = new Intent(a.getIntent());
       paramAdapterView.putExtra("category", paramView);
       a.startActivityForResult(paramAdapterView, 101);
     }
   } else {
     return;
   }
   paramAdapterView = paramView;
   if (TextUtils.isEmpty(paramView.d())) {
     paramAdapterView = null;
   }
   if (PickCategory.a(a)) {
     AppData.a(EventIri.NearbyMoreCategoriesCategory, "category", paramAdapterView.d());
     a.startActivity(ActivityNearby.a(a, paramAdapterView.d(), paramAdapterView));
     return;
   }
   paramView = new Intent(a.getIntent());
   paramView.putExtra("category", paramAdapterView);
   a.setResult(-1, paramView);
   a.finish();
 }
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      // TODO Auto-generated method stub
      DiemPhoBien d1 = (DiemPhoBien) parent.getAdapter().getItem(position);

      // MainActivity.fragmentManager
      // .beginTransaction()
      // .setCustomAnimations(R.animator.slide_in_from_right,
      // R.animator.slide_out_to_left)
      // .replace(
      // R.id.frame_container,
      // new BustDetailFragment(b.getName(), b.getNumber(),
      // b.getTime(), b.getFreq(), b.getGo(), b
      // .getBack(), "BusList", isSearch))
      // .commit();
      if (!isKeyboardOpen) {
        GoogleAnalytic.sendActiontracker(
            MainActivity.mTracker,
            "Danh sách điểm phổ biến Screen",
            "View Diem_Pho_Bien Item",
            "Diem_Pho_Bien Item: " + d1.getName());
        textSearch.setText("");
        d.clear();
        d.add(d1);
        adapter.notifyDataSetChanged();
      }
      InputMethodManager imm =
          (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(textSearch.getWindowToken(), 0);
      isKeyboardOpen = false;
    }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    PicGridViewMultiSelectAdapter picGridViewAdapter =
        (PicGridViewMultiSelectAdapter) parent.getAdapter();

    String item = picGridViewAdapter.getItem(position);
    String path = mImgDir.getAbsolutePath() + "/" + item;

    ImageButton mSelected = (ImageButton) view.findViewById(R.id.id_item_select);
    ImageView mImg = (ImageView) view.findViewById(R.id.id_item_image);

    if (picGridViewAdapter.isContains(path)) {
      picGridViewAdapter.removeSelected(path, mSelected, mImg, titleRight);
    } else {
      if (paths != null && paths.size() >= MAX_SELECT_NUMBER) {
        Toast.makeText(
                PicGridViewMultiSelectActivity.this,
                "最多选择" + MAX_SELECT_NUMBER + "张图片。",
                Toast.LENGTH_SHORT)
            .show();
        return;
      } else {
        picGridViewAdapter.addSelected(path, mSelected, mImg, titleRight);
      }
    }
  }
 @Override
 public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
   Task task = (Task) arg0.getAdapter().getItem(arg2);
   Intent intent = new Intent(this, DetailTaskActivity.class);
   intent.putExtra("task", task);
   startActivity(intent);
 }
        @Override
        public void onItemFlingerEnd(
            OnItemFlingerResponder responder,
            AdapterView<?> parent,
            View view,
            int position,
            long id) {

          try {
            // Response if the item can be removed
            SearchResultAdapter adapter = (SearchResultAdapter) parent.getAdapter();
            SearchResult result = adapter.getItem(position);
            if (result != null && result.getFso() != null) {
              DeleteActionPolicy.removeFileSystemObject(
                  SearchActivity.this, result.getFso(), null, SearchActivity.this, responder);
              return;
            }

            // Cancels the flinger operation
            responder.cancel();

          } catch (Exception e) {
            ExceptionUtil.translateException(SearchActivity.this, e, true, false);
            responder.cancel();
          }
        }
 @Override
 public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
   // deletePosition=position;
   DownloadedBean downloadedBean = (DownloadedBean) parent.getAdapter().getItem(position);
   DialogUtils.showDelDialog(getContext(), "确定删除该文件?", new DialogOnClicListener(downloadedBean));
   return true;
 }
Beispiel #14
0
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    // TODO Auto-generated method stub

    Object itemAdapter = parent.getAdapter();

    if (itemAdapter instanceof EmotionGvAdapter) {
      // 点击的是表情
      EmotionGvAdapter emotionGvAdapter = (EmotionGvAdapter) itemAdapter;

      if (position == emotionGvAdapter.getCount() - 1) {
        // 如果点击了最后一个回退按钮,则调用删除键事件
        msg.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));

      } else {

        // 如果点击了表情,则添加到输入框中
        String emotionName = (String) emotionGvAdapter.getItem(position);

        // 获取当前光标位置,在指定位置上添加表情图片文本
        int curPosition = msg.getSelectionStart();
        StringBuilder sb = new StringBuilder(msg.getText().toString());
        sb.insert(curPosition, emotionName);

        // 特殊文字处理,将表情等转换一下

        msg.setText(StringUtils.getEmotionContent(this, msg, sb.toString()));

        // 将光标设置到新增完表情的右侧
        msg.setSelection(curPosition + emotionName.length());
      }
    }
  }
Beispiel #15
0
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
          for (int i = 0; i < serviceTypeArrayList.size(); i++) {
            if (i != position) {
              serviceTypeArrayList.get(i).setSelected(false);
            }
          }
          ImageView imgChecked;
          for (int i = 0; i < adapterView.getAdapter().getCount(); i++) {
            View v1 = adapterView.getChildAt(i);
            if (v1 != null) {
              imgChecked = (ImageView) v1.findViewById(R.id.service_type_imageView);
              imgChecked.setVisibility(View.GONE);
            }
          }
          imgChecked = (ImageView) view.findViewById(R.id.service_type_imageView);
          ServiceType serviceType = serviceTypeArrayList.get(position);

          if (!serviceType.isSelected()) {
            imgChecked.setVisibility(View.VISIBLE);
            serviceType.setSelected(true);
            new SharedPreferencesManager(BookServiceActivity.this)
                .setValue(Constant.VALUE_CURRENT_KEY, serviceType.getName());
          } else {
            imgChecked.setVisibility(View.VISIBLE);
          }
        }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   if (parent.getAdapter() == mAdapter) {
     //   UILauncher.launchLabelOptionUI(getFragmentManager(),
     //      mAdapter.getItem(position).getName());
   }
 }
  @Override
  public void bind(final AdapterView<?> view, final Command command) {
    adapterViewListeners.addOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ItemClickEvent itemClickEvent = new ItemClickEvent(parent, view, position, id);
            command.invoke(itemClickEvent);
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {
            ItemClickEvent itemClickEvent =
                new ItemClickEvent(parent, null, AdapterView.INVALID_POSITION, 0);
            command.invoke(itemClickEvent);
          }
        });

    view.getAdapter()
        .registerDataSetObserver(
            new DataSetObserver() {
              public void onChanged() {
                int position = view.getSelectedItemPosition();

                if (position >= view.getCount()) return;

                ItemClickEvent itemClickEvent =
                    new ItemClickEvent(view, view.getChildAt(position), position, 0);
                command.invoke(itemClickEvent);
              }
            });
  }
 public CursorAdapter getCursorAdapter() {
   final AdapterView<CursorAdapter> adapterView = getAdapterView();
   if (adapterView != null) {
     return adapterView.getAdapter();
   } else {
     return null;
   }
 }
  /**
   * Simple event to raise when the component is clicked. Implementation of
   * AdapterView.OnItemClickListener
   */
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Spannable item = (Spannable) parent.getAdapter().getItem(position);
    this.selection = item.toString();
    this.selectionIndex = adapterCopy.getPosition(item) + 1; // AI lists are 1-based

    AfterPicking();
  }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   Intent intent = new Intent(getActivity(), ProductDetailActivity.class);
   intent.putExtra(
       Constants.HOMEPAGE_PRODUCT_ID,
       ((Goods) parent.getAdapter().getItem(position)).getGoodsid());
   intent.putExtra(
       Constants.HOMEPAGE_PRODUCT_NAME,
       ((Goods) parent.getAdapter().getItem(position)).getGoodsName());
   intent.putExtra(
       Constants.HOMEPAGE_PRODUCT_DESC,
       ((Goods) parent.getAdapter().getItem(position)).getGoodsDesc());
   intent.putExtra(
       Constants.HOMEPAGE_PRODUCT_THUMB,
       ((Goods) parent.getAdapter().getItem(position)).getGoodsThumb());
   startActivity(intent);
 }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   SavedStatus savedStatus = (SavedStatus) parent.getAdapter().getItem(position);
   if (savedStatus == null) // Header
   return;
   setStatus(savedStatus.getStatusMode(), savedStatus.getStatusText());
   finish();
 }
Beispiel #22
0
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long rowId) {
      int viewType = mTodosListAdapter.getItemViewType(position);
      LogUtils.d(TAG, "onItemClick viewType =" + viewType + " position=" + position);

      boolean selectDoneItem = false;
      switch (viewType) {
        case TodosListAdapter.TYPE_TODOS_HEADER:
          mTodosListAdapter.setTodosExpand(!mTodosListAdapter.isTodosExpand());
          break;
        case TodosListAdapter.TYPE_TODOS_FOOTER:
          if (!mTodosListAdapter.isEditing()) {
            Intent intentAdd = new Intent(TodosActivity.this, EditTodoActivity.class);
            startActivityForResult(intentAdd, REQUEST_ADD_NEW);
          }
          break;
        case TodosListAdapter.TYPE_DONES_HEADER:
          mTodosListAdapter.setDonesExpand(!mTodosListAdapter.isDonesExPand());
          break;
        case TodosListAdapter.TYPE_DONES_ITEM:
          selectDoneItem = true;
        case TodosListAdapter.TYPE_TODOS_ITEM:
          if (mTodosListAdapter.isEditing()) {
            if (mTodosListAdapter.getSelectedNum() == 0) {
              // its status is re-select, switch the type.
              int editType =
                  selectDoneItem ? TodosListAdapter.EDIT_DONES : TodosListAdapter.EDIT_TODOS;
              mTodosListAdapter.setEditingType(editType);
              // update change state icon
              updateChangeStateIcon(editType);
            }
            final boolean todosEditAble =
                viewType == TodosListAdapter.TYPE_TODOS_ITEM
                    && mTodosListAdapter.getEditType() == TodosListAdapter.EDIT_TODOS;
            final boolean donesEditAble =
                viewType == TodosListAdapter.TYPE_DONES_ITEM
                    && mTodosListAdapter.getEditType() == TodosListAdapter.EDIT_DONES;
            if (todosEditAble || donesEditAble) {
              Object tag = view.getTag();
              if (tag != null && tag instanceof TodosListAdapter.ViewHolder) {
                TodosListAdapter.ViewHolder holder = (TodosListAdapter.ViewHolder) tag;
                final boolean checked = holder.mTodoInfoCheckBox.isChecked();
                holder.mTodoInfoCheckBox.setChecked(!checked);
                mTodosListAdapter.selectItem(position, !checked);
              }
            }
            updateBottomBarWidgetState();
            updateActionModeTitle();
          } else {
            Intent intentDetails = new Intent(TodosActivity.this, EditTodoActivity.class);
            TodoInfo info = (TodoInfo) adapterView.getAdapter().getItem(position);
            intentDetails.putExtra(Utils.KEY_PASSED_DATA, info);
            startActivityForResult(intentDetails, REQUEST_SHOW_DETAILS);
          }
          break;
        default:
          break;
      }
    }
  @Override
  public void onItemClick(
      final AdapterView<?> parent, final View view, final int position, final long id) {

    final SectionListAdapter sectionListAdapter = (SectionListAdapter) parent.getAdapter();

    final MapListSectionAdapter mapListSectionAdapter =
        (MapListSectionAdapter) sectionListAdapter.getAdapter(position);

    // /
    final Object item = sectionListAdapter.getItem(position);
    if (item instanceof MapListEntry) {
      final MapListEntry clickedEntry = (MapListEntry) item;

      final List<MapListEntry> mapListEntryList =
          mapListSectionAdapter.mapListSection.getMapListEntryList();

      // uncheck all entries in section:
      for (final MapListEntry mapListEntry : mapListEntryList) mapListEntry.setChecked(false);

      // recheck checked entry:
      clickedEntry.setChecked(true);

      // handle sat differently
      final String value = clickedEntry.getValue();
      final RMBTMainActivity activity = getRMBTMainActivity();
      if (MapProperties.MAP_SAT_KEY.equals(clickedEntry.getKey()))
        activity.setMapTypeSatellite(MapProperties.MAP_SAT_VALUE.equals(value));
      else if (MapProperties.MAP_OVERLAY_KEY.equals(clickedEntry.getKey())) {
        if (MapProperties.MAP_AUTO_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_AUTO);
        else if (MapProperties.MAP_HEATMAP_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_HEATMAP);
        else if (MapProperties.MAP_POINTS_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_POINTS);
        else if (MapProperties.MAP_SHAPES_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_SHAPES);
      } else
        // set new filter options:
        activity.updateMapFilter();

      // reload list view:
      ((SectionListAdapter) parent.getAdapter()).notifyDataSetChanged();
    }
  }
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
          String key = ((TextItem) a.getAdapter().getItem(position)).text;
          BibleReference ref = crossReference.get(key);

          Intent intent = new Intent();
          intent.putExtra("linkOSIS", ref.getPath());
          setResult(RESULT_OK, intent);
          finish();
        }
 @Override
 public void onItemClick(AdapterView<?> data, View view, int position, long arg3) {
   SubjectVo tv = (SubjectVo) data.getAdapter().getItem(position);
   Intent mIntent = new Intent(this, SubjectInfoActivity.class);
   Bundle mBundle = new Bundle();
   mBundle.putSerializable(Def.OBJ, tv);
   mIntent.putExtra(Def.OBJ_Bundle, mBundle);
   startActivity(mIntent);
 }
    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
      if (numberOfPasses > 0) {
        Cursor c = (Cursor) parent.getAdapter().getItem(pos);

        institutionId = c.getString(0);
        institutionSelected = c.getString(1);
        ((CreateModifyAccountActivity) ParentActivity).setIsDirty(true);
      } else numberOfPasses++;
    }
 @Override
 public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
   MobclickAgent.onEvent(getActivity(), "8");
   SysManager.analysis(R.string.c_type_click, R.string.c008);
   SystemPromotionDiscovery module =
       (SystemPromotionDiscovery) arg0.getAdapter().getItem(arg2);
   Intent intent = new Intent(getActivity(), WebViewActivity_.class);
   intent.putExtra("targetUri", module.detailUrl);
   intent.putExtra("targetType", WebViewType.getValue(WebViewType.Discovery));
   startActivity(intent);
 }
  @Override
  public void onItemClick(AdapterView<?> rawAdapter, View arg1, int index, long arg3) {
    if (!noQuiz) {

      @SuppressWarnings("unchecked")
      ArrayAdapter<Quiz> adapter = (ArrayAdapter<Quiz>) rawAdapter.getAdapter();
      Intent intent = new Intent(this, ShowQuizActivity.class);
      intent.putExtra("QuizID", adapter.getItem(index).getID());
      startActivity(intent);
    }
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    City city = (City) parent.getAdapter().getItem(position);

    // return the whole City information to Caller Activity
    Intent intent = new Intent();
    intent.putExtra(SEARCH_CITY_RESULT, (Parcelable) city);
    setResult(RESULT_OK, intent);

    finish();
  }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   Object item = parent.getAdapter().getItem(position);
   if (item instanceof ThrowPhoto) {
     ThrowPhoto throwPhoto = (ThrowPhoto) item;
     Bundle arguments = new Bundle();
     arguments.putParcelable(ThrowPhotoShowFragment.EXTRA_THROW_PHOTO, throwPhoto);
     UILauncher.launchFragmentInNewActivity(
         mContext, ThrowPhotoShowFragment.class, arguments);
   }
 }