android.widget.AdapterView Java Examples

The following examples show how to use android.widget.AdapterView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: socialauth-android   Author: 3pillarlabs   File: AlbumActivity.java    License: MIT License 6 votes vote down vote up
public void getData(final List<Album> albumList) {
	final GridView view = new GridView(this);
	getGridProperties(view);

	view.setAdapter(new AlbumsAdapter(AlbumActivity.this, 0, albumList));

	String[] urls = new String[albumList.size()];
	for (int i = 0; i < albumList.size(); i++) {
		urls[i] = albumList.get(i).getCoverPhoto();
	}

	view.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
			showPhoto(view, albumList, position);
			photoListFlag = true;
		}
	});
	dataSectionView.addView(view);
}
 
Example #2
Source Project: delion   Author: derry   File: BookmarkFolderSelectActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Moves bookmark from original parent to selected folder. In creation mode, directly add the
 * new bookmark to selected folder instead of moving.
 */
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
    FolderListEntry entry = (FolderListEntry) adapter.getItemAtPosition(position);
    if (mIsCreatingFolder) {
        BookmarkId selectedFolder = null;
        if (entry.mType == FolderListEntry.TYPE_NORMAL) {
            selectedFolder = entry.mId;
        } else {
            assert false : "New folder items should not be clickable in creating mode";
        }
        Intent intent = new Intent();
        intent.putExtra(INTENT_SELECTED_FOLDER, selectedFolder.toString());
        setResult(RESULT_OK, intent);
        finish();
    } else if (entry.mType == FolderListEntry.TYPE_NEW_FOLDER) {
        BookmarkAddEditFolderActivity.startAddFolderActivity(this, mBookmarksToMove);
    } else if (entry.mType == FolderListEntry.TYPE_NORMAL) {
        mModel.moveBookmarks(mBookmarksToMove, entry.mId);
        BookmarkUtils.setLastUsedParent(this, entry.mId);
        finish();
    }
}
 
Example #3
Source Project: video-player   Author: yashketkar   File: LiveTVFragment.java    License: MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_livetv, container, false);

    progressBar = (ProgressBar) view.findViewById(R.id.livetv_progress_bar);

    progressBar.setVisibility(ProgressBar.VISIBLE);
    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(adapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example #4
Source Project: Mizuu   Author: MizzleDK   File: UnidentifiedMovies.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	mList = (ListView) findViewById(R.id.listView1);
	mList.setChoiceMode(ListView.CHOICE_MODE_NONE);
	mList.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
			Intent intent = new Intent(UnidentifiedMovies.this, IdentifyMovie.class);
			intent.putExtra("fileName", mFilepaths.get(arg2).getFullFilepath());
			startActivityForResult(intent, 0);
		}
	});

	loadData();

	LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(LocalBroadcastUtils.UPDATE_MOVIE_LIBRARY));
}
 
Example #5
Source Project: BonetCalendarView   Author: ebonet   File: ListBtYearViewProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public View getView() {
	mListView = (ListView) LayoutInflater.from(getCalendar().getContext()).inflate(R.layout.month_list_view, null);
	mListView.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
			if(! (getCalendar() ==null))
				getCalendar().notifyMonthChanged(new BtMonth(getYear(),position));
		}
	
	});

	mAdapter = new MonthListAdapter(getCalendar(),getYear());
	
	mListView.setAdapter(mAdapter);
	
	return mListView;
}
 
Example #6
Source Project: zxingfragmentlib   Author: mitoyarzun   File: BrowseBookListener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
  if (position < 1) {
    // Clicked header, ignore it
    return;
  }
  int itemOffset = position - 1;
  if (itemOffset >= items.size()) {
    return;
  }
  String pageId = items.get(itemOffset).getPageId();
  String query = SearchBookContentsResult.getQuery();
  if (LocaleManager.isBookSearchUrl(activity.getISBN()) && !pageId.isEmpty()) {
    String uri = activity.getISBN();
    int equals = uri.indexOf('=');
    String volumeId = uri.substring(equals + 1);
    String readBookURI = "http://books.google." +
        LocaleManager.getBookSearchCountryTLD(activity) +
        "/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);                    
    activity.startActivity(intent);
  }
}
 
Example #7
Source Project: android   Author: mapzen   File: OverlayActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
  switch (position) {
    case 0:
      // do nothing
      break;
    case 1:
      enableTransitOverlay();
      break;
    case 2:
      enableBikeOverlay();
      break;
    case 3:
      enablePathOverlay();
      break;
    case 4:
      disableOverlays();
    default:
      break;
  }
}
 
Example #8
Source Project: MTransition   Author: HJ-Money   File: Page1.java    License: Apache License 2.0 6 votes vote down vote up
private void init() {
    genDatas();
    mPage.mListView.setAdapter(new Page1.DemoListAdapter());
    mPage.mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            final MTransition transition = MTransitionManager.getInstance().createTransition("example");
            transition.fromPage().setContainer(mPage, new ITransitPrepareListener() {
                @Override
                public void onPrepare(MTransitionView container) {
                    transition.fromPage().addTransitionView("icon", view.findViewById(R.id.item_icon));
                    transition.fromPage().addTransitionView("name", view.findViewById(R.id.item_name));
                    transition.fromPage().addTransitionView("snapshot", view.findViewById(R.id.item_snapshot));
                    transition.fromPage().addTransitionView("container", mPage);
                }
            });
            transition.getBundle().putObject("bean", mBeans.get(position));
            ((Example9Activity) getContext()).enterOtherPage();
        }
    });
}
 
Example #9
Source Project: Passbook   Author: zhuqianqian   File: NavigationDrawerFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    NavMenuItem item = null;
    if(id == mCategory) {
        return;
    }
    if(mMenuList!=null) {
        item = (NavMenuItem)mMenuList.getItemAtPosition(position);
        if(item.mType == NavMenuItem.MENU_SELECTION) {
            mAdapter.selectItem(view, position);
            mCategory = (int)id;
        }
        mMenuList.setItemChecked(mCategory2Navigation.get(mCategory),  true);
    }

    if (mDrawerLayout != null) {
        mDrawerLayout.closeDrawer(mFragmentContainerView);
    }
    if (mCallback != null && item !=null) {
        mCallback.onNavigationDrawerItemSelected(item.mType, item.mId);
    }
}
 
Example #10
Source Project: ZXing-Standalone-library   Author: tarun0   File: BrowseBookListener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
  if (position < 1) {
    // Clicked header, ignore it
    return;
  }
  int itemOffset = position - 1;
  if (itemOffset >= items.size()) {
    return;
  }
  String pageId = items.get(itemOffset).getPageId();
  String query = SearchBookContentsResult.getQuery();
  if (LocaleManager.isBookSearchUrl(activity.getISBN()) && !pageId.isEmpty()) {
    String uri = activity.getISBN();
    int equals = uri.indexOf('=');
    String volumeId = uri.substring(equals + 1);
    String readBookURI = "http://books.google." +
        LocaleManager.getBookSearchCountryTLD(activity) +
        "/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);                    
    activity.startActivity(intent);
  }
}
 
Example #11
Source Project: AnimatedGridView   Author: mikepenz   File: HeaderGridView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public int getItemViewType(int position) {
    int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
    if (position < numHeadersAndPlaceholders && (position % mNumColumns != 0)) {
        // Placeholders get the last view type number
        return mAdapter != null ? mAdapter.getViewTypeCount() : 1;
    }
    if (mAdapter != null && position >= numHeadersAndPlaceholders) {
        int adjPosition = position - numHeadersAndPlaceholders;
        int adapterCount = mAdapter.getCount();
        if (adjPosition < adapterCount) {
            return mAdapter.getItemViewType(adjPosition);
        }
    }

    return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}
 
Example #12
Source Project: o2oa   Author: o2oa   File: SearchGroupActivity.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
private void initListener() {
    final Intent intent = new Intent();
    mLv_searchGroup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Object itemAtPosition = parent.getItemAtPosition(position);
            if (itemAtPosition instanceof UserInfo) {
                UserInfo info = ((UserInfo) itemAtPosition);
                if (info.isFriend()) {
                    intent.setClass(SearchGroupActivity.this, FriendInfoActivity.class);
                    intent.putExtra("fromSearch", true);
                } else {
                    intent.setClass(SearchGroupActivity.this, GroupNotFriendActivity.class);
                }
                intent.putExtra(JGApplication.TARGET_ID, info.getUserName());
                intent.putExtra(JGApplication.TARGET_APP_KEY, info.getAppKey());
                startActivity(intent);
            }
        }
    });
}
 
Example #13
Source Project: BLEChat   Author: godstale   File: RecycleUtils.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void recursiveRecycle(View root) {
    if (root == null)
        return;
    
    // root.setBackgroundDrawable(null);		// Deprecated
    if (root instanceof ViewGroup) {
        ViewGroup group = (ViewGroup)root;
        int count = group.getChildCount();
        for (int i = 0; i < count; i++) {
            recursiveRecycle(group.getChildAt(i));
        }
 
        if (!(root instanceof AdapterView)) {
            group.removeAllViews();
        }
    }
   
    if (root instanceof ImageView) {
        ((ImageView)root).setImageDrawable(null);
    }
    root = null;
    
    return;
}
 
Example #14
Source Project: openvidonn   Author: dgomes   File: BluetoothDevicesFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView()");
    View view = inflater.inflate(R.layout.fragment_bluetoothdevices, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(devicesList);

    return view;
}
 
Example #15
Source Project: jmessage-android-uikit   Author: jpush   File: AlbumListActivity.java    License: MIT License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    List<String> childList = mGruopMap.get(list.get(position).getFolderName());
    Intent intent = new Intent();
    intent.setClass(AlbumListActivity.this, PickPictureActivity.class);
    intent.putExtra("albumName", list.get(position).getFolderName());
    intent.putStringArrayListExtra("data", (ArrayList<String>) childList);
    startActivityForResult(intent, REQUEST_CODE_SELECT_PICTURE);
}
 
Example #16
Source Project: android-open-project-demo   Author: android-cn   File: DynamicListView.java    License: Apache License 2.0 5 votes vote down vote up
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int pos, long id) {
    if (mResIdOfDynamicTouchChild == 0) {
        mDynamicTouchChildTouched = true;
        makeCellMobile();
        return true;
    }
    return false;
}
 
Example #17
Source Project: XERUNG   Author: mityung   File: AllUser.java    License: Apache License 2.0 5 votes vote down vote up
private void setOnClick(){

        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                gUPostion = i-1;
                ContactBean cb = gMemberList.get(i-1);
                if (cb.getUID().trim().equals("0")) {
                    comman.alertDialog(getActivity(), "Pending Request", cb.getName() + " has not accepted yet.");
                    return;
                }
                gUNumber = cb.getNumber();
                Intent intent = new Intent(getActivity(), GroupUserProfile.class);
                intent.putExtra("Name", cb.getName());
                intent.putExtra("OrignalName", cb.getOrignalName());
                intent.putExtra("MyPhoneBook", cb.getMyPhoneBookName());
                intent.putExtra("Number", cb.getNumber());
                intent.putExtra("Uid", cb.getUID());
                intent.putExtra("UserType", cb.getRequestFlag());
                intent.putExtra("TableName", "MG" + Vars.gUID);
                intent.putExtra("Index", "" + i);
                intent.putExtra("IsMyContact", cb.getIsMyContact());
                intent.putExtra("AdminFlag", cb.getAdminFlag());
                startActivityForResult(intent, 10001);
            }
        });
    }
 
Example #18
Source Project: AndroidChromium   Author: JackyAndroid   File: AutofillProfileEditor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (position != mCurrentCountryPos) {
        mCurrentCountryPos = position;
        mUseSavedProfileLanguage = false;
        // If all fields are empty (e.g. the user just entered the form and the first thing
        // they did was select a country), focus on the first form element. Otherwise, don't.
        resetFormFields(position, allFieldsEmpty());
        mNoCountryItemIsSelected = false;
        setSaveButtonEnabled(true);
    }
}
 
Example #19
Source Project: DongWeather   Author: LuoPeiQin   File: DragSortController.java    License: Apache License 2.0 5 votes vote down vote up
public int viewIdHitPosition(MotionEvent ev, int id) {
    final int x = (int) ev.getX();
    final int y = (int) ev.getY();

    int touchPos = mDslv.pointToPosition(x, y); // includes headers/footers

    final int numHeaders = mDslv.getHeaderViewsCount();
    final int numFooters = mDslv.getFooterViewsCount();
    final int count = mDslv.getCount();

    // Log.d("mobeta", "touch down on position " + itemnum);
    // We're only interested if the touch was on an
    // item that's not a header or footer.
    if (touchPos != AdapterView.INVALID_POSITION && touchPos >= numHeaders
            && touchPos < (count - numFooters)) {
        final View item = mDslv.getChildAt(touchPos - mDslv.getFirstVisiblePosition());
        final int rawX = (int) ev.getRawX();
        final int rawY = (int) ev.getRawY();

        View dragBox = id == 0 ? item : (View) item.findViewById(id);
        if (dragBox != null) {
            dragBox.getLocationOnScreen(mTempLoc);

            if (rawX > mTempLoc[0] && rawY > mTempLoc[1] &&
                    rawX < mTempLoc[0] + dragBox.getWidth() &&
                    rawY < mTempLoc[1] + dragBox.getHeight()) {

                mItemX = item.getLeft();
                mItemY = item.getTop();

                return touchPos;
            }
        }
    }

    return MISS;
}
 
Example #20
Source Project: school_shop   Author: Owater   File: ImageFileActivity.java    License: MIT License 5 votes vote down vote up
private void initView() {
	gridView = (GridView)findViewById(R.id.imageFile_act_fileGridView);
	
	initToolbar(getResources().getString(R.string.title_activity_picture_file));
	helper = AlbumHelper.getHelper();
	helper.init(getApplicationContext());
	contentList = helper.getImagesBucketList(false);
	folderAdapter = new FolderAdapter(this,contentList);
	gridView.setAdapter(folderAdapter);
	dataList = new ArrayList<ImageItem>();
	for(int i = 0; i<contentList.size();i++){
		dataList.addAll(contentList.get(i).imageList);
	}
	
	gridView.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
			ShowFilePhotoActivity.dataList = (ArrayList<ImageItem>) ImageFileActivity.contentList.get(position).imageList;
			Intent intent = new Intent();
			String folderName = ImageFileActivity.contentList.get(position).bucketName;
			intent.putExtra("folderName", folderName);
			intent.setClass(ImageFileActivity.this, ShowFilePhotoActivity.class);
			startActivityForResult(intent, 100);
		}
	});
}
 
Example #21
Source Project: Overchan-Android   Author: miku-nyan   File: DragSortController.java    License: GNU General Public License v3.0 5 votes vote down vote up
public int viewIdHitPosition(MotionEvent ev, int id) {
    final int x = (int) ev.getX();
    final int y = (int) ev.getY();

    int touchPos = mDslv.pointToPosition(x, y); // includes headers/footers

    final int numHeaders = mDslv.getHeaderViewsCount();
    final int numFooters = mDslv.getFooterViewsCount();
    final int count = mDslv.getCount();

    // Log.d("mobeta", "touch down on position " + itemnum);
    // We're only interested if the touch was on an
    // item that's not a header or footer.
    if (touchPos != AdapterView.INVALID_POSITION && touchPos >= numHeaders
            && touchPos < (count - numFooters)) {
        final View item = mDslv.getChildAt(touchPos - mDslv.getFirstVisiblePosition());
        final int rawX = (int) ev.getRawX();
        final int rawY = (int) ev.getRawY();

        View dragBox = id == 0 ? item : (View) item.findViewById(id);
        if (dragBox != null) {
            dragBox.getLocationOnScreen(mTempLoc);

            if (rawX > mTempLoc[0] && rawY > mTempLoc[1] &&
                    rawX < mTempLoc[0] + dragBox.getWidth() &&
                    rawY < mTempLoc[1] + dragBox.getHeight()) {

                mItemX = item.getLeft();
                mItemY = item.getTop();

                return touchPos;
            }
        }
    }

    return MISS;
}
 
Example #22
Source Project: DanDanPlayForAndroid   Author: xyoye   File: ScrollableHelper.java    License: MIT License 5 votes vote down vote up
private static boolean isAdapterViewTop(AdapterView adapterView) {
    if (adapterView != null) {
        int firstVisiblePosition = adapterView.getFirstVisiblePosition();
        View childAt = adapterView.getChildAt(0);
        return childAt == null || (firstVisiblePosition == 0 && childAt.getTop() == 0);
    }
    return false;
}
 
Example #23
Source Project: DropDownMenu   Author: baiiu   File: DoubleGridView.java    License: Apache License 2.0 5 votes vote down vote up
private void initAdapter(Context context) {

        mTopAdapter = new SimpleTextAdapter<String>(null, context) {
            @Override public String provideText(String phase) {
                return phase;
            }

            @Override protected void initCheckedTextView(FilterCheckedTextView checkedTextView) {
                checkedTextView.setPadding(0, UIUtil.dp(context, 3), 0, UIUtil.dp(context, 3));
                checkedTextView.setGravity(Gravity.CENTER);
                checkedTextView.setBackgroundResource(R.drawable.selector_filter_grid);
            }
        };

        mBottomAdapter = new SimpleTextAdapter<String>(null, context) {
            @Override public String provideText(String area) {
                return area;
            }

            @Override protected void initCheckedTextView(FilterCheckedTextView checkedTextView) {
                checkedTextView.setPadding(0, UIUtil.dp(context, 3), 0, UIUtil.dp(context, 3));
                checkedTextView.setBackgroundResource(R.drawable.selector_filter_grid);
                checkedTextView.setGravity(Gravity.CENTER);
            }
        };

        mTopGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            }
        });
    }
 
Example #24
Source Project: RevealLayout   Author: kyze8439690   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ListView list = new ListView(this);
    setContentView(list);
    String[] entries = new String[]{
            "SingleChildActivity",
            "MultiChildActivity",
            "FragmentActivity"
    };
    list.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, entries));
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
                case 0:
                    startActivity(new Intent(MainActivity.this, SingleChildActivity.class));
                    break;
                case 1:
                    startActivity(new Intent(MainActivity.this, MultiChildActivity.class));
                    break;
                case 2:
                    startActivity(new Intent(MainActivity.this, FragmentSampleActivity.class));
                    break;
            }
        }
    });
}
 
Example #25
Source Project: dynamic-support   Author: pranavpandey   File: DynamicSpinnerChoiceAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View getView(final int position,
           @Nullable View convertView, final @NonNull ViewGroup parent) {
	ViewHolder viewHolder;

       if (convertView == null) {
       	convertView = LayoutInflater.from(parent.getContext()).inflate(
       	        R.layout.ads_layout_array_item_popup, parent, false);
       	viewHolder = new ViewHolder(convertView);
       	convertView.setTag(viewHolder);
       } else {
       	viewHolder = (ViewHolder) convertView.getTag();
       }

       viewHolder.getText().setText((CharSequence) getItem(position));
       viewHolder.getSelector().setVisibility(
               mSelectedPosition == position ? View.VISIBLE : View.INVISIBLE);

       if (mIcons != null && mIcons.length == mEntries.length) {
           viewHolder.getIcon().setImageResource(mIcons[position]);
           viewHolder.getIcon().setVisibility(View.VISIBLE);
       } else {
           viewHolder.getIcon().setVisibility(View.GONE);
       }

       if (mOnItemClickListener != null) {
           viewHolder.getRoot().setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                   mOnItemClickListener.onItemClick((AdapterView<?>) parent,
                           view, position, getItemId(position));
                   mSelectedPosition = position;

                   notifyDataSetChanged();
               }
           });
       }

    return convertView;
   }
 
Example #26
Source Project: codeexamples-android   Author: vogellacompany   File: Animation2.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
    switch (position) {

    case 0:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_up_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_up_out));
        break;
    case 1:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_left_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_left_out));
        break;
    case 2:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                android.R.anim.fade_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                android.R.anim.fade_out));
        break;
    default:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                R.anim.hyperspace_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                R.anim.hyperspace_out));
        break;
    }
}
 
Example #27
Source Project: BmapLite   Author: ShadowGHO   File: AmapBusFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    BusPath bus = mAmapBusRouteAdapter.getList().get(position);

    Bundle bundle = new Bundle();
    bundle.putParcelable("bus", bus);
    bundle.putParcelable("route", mBusRouteResult);
    openActivity(RouteAmapBusActivity.class, bundle);

}
 
Example #28
Source Project: ProjectX   Author: AlexMofer   File: HeaderFooterViewListAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int getItemViewType(int position) {
    int numHeaders = getHeaderItemsCount() + getHeaderViewsCount();
    if (mAdapter != null && position >= numHeaders) {
        int adjPosition = position - numHeaders;
        int adapterCount = mAdapter.getCount();
        if (adjPosition < adapterCount) {
            return mAdapter.getItemViewType(adjPosition);
        }
    }

    return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}
 
Example #29
Source Project: FireFiles   Author: gigabytedevelopers   File: StandaloneActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (mIgnoreNextNavigation) {
        mIgnoreNextNavigation = false;
        return;
    }
    while (mState.stack.size() > position + 1) {
        mState.stackTouched = true;
        mState.stack.pop();
    }
    onCurrentDirectoryChanged(ANIM_UP);
}
 
Example #30
Source Project: color-picker   Author: dmfs   File: PaletteFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> gridView, View View, int position, long id)
{
    // pass the click event to the parent fragment
    Fragment parent = getParentFragment();
    if (parent instanceof OnColorSelectedListener)
    {
        OnColorSelectedListener listener = (OnColorSelectedListener) parent;
        listener.onColorSelected(mPalette.colorAt(position), mPalette.id(), mPalette.nameOfColorAt(position), mPalette.name());
    }
}