本文整理汇总了Java中android.support.v4.util.SparseArrayCompat.valueAt方法的典型用法代码示例。如果您正苦于以下问题:Java SparseArrayCompat.valueAt方法的具体用法?Java SparseArrayCompat.valueAt怎么用?Java SparseArrayCompat.valueAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.util.SparseArrayCompat
的用法示例。
在下文中一共展示了SparseArrayCompat.valueAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachChildViewBlock
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
private void attachChildViewBlock(@NonNull UIKitComponent component, SparseArrayCompat<String>
childViewBlockClassNamesArray, int index, View childView) {
int childViewChildAtId = childView.getId();
int indexOfKey = childViewBlockClassNamesArray.indexOfKey(childViewChildAtId);
if (indexOfKey < 0) {
indexOfKey = childViewBlockClassNamesArray.indexOfKey(index);
}
if (indexOfKey < 0) {
return;
}
String name = childViewBlockClassNamesArray.valueAt(indexOfKey);
if (name == null) {
return;
}
ViewBlock parentBlock = component.getViewBlock();
ViewBlock viewBlock = createViewBlock(childView, childViewChildAtId, name);
if (viewBlock != null) {
addViewBlockToViewBlockManager(viewBlock, parentBlock, component.getViewBlockManager());
}
childViewBlockClassNamesArray.removeAt(indexOfKey);
}
示例2: onPageScrolled
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
int currentItem = mViewPager.getCurrentItem();
if (positionOffsetPixels > 0) {
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mAdapter.getScrollTabHolders();
ScrollTabHolder fragmentContent;
if (position < currentItem) {
// Revealed the previous page
fragmentContent = scrollTabHolders.valueAt(position);
} else {
// Revealed the next page
fragmentContent = scrollTabHolders.valueAt(position + 1);
}
fragmentContent.adjustScroll((int) (mHeader.getHeight() + mHeader.getTranslationY()),
mHeader.getHeight());
}
}
示例3: onPageScrolled
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
int currentItem = mViewPager.getCurrentItem();
if (positionOffsetPixels > 0) {
SparseArrayCompat<ScrollHolder> scrollTabHolders = mAdapter.getScrollTabHolders();
ScrollHolder fragmentContent;
if (position < currentItem) {
fragmentContent = scrollTabHolders.valueAt(position);
} else {
fragmentContent = scrollTabHolders.valueAt(position + 1);
}
fragmentContent.adjustScroll((int) (mStickheader.getHeight() + mStickheader.getTranslationY()), mStickheader.getHeight());
}
}
示例4: onPageScrolled
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (positionOffsetPixels > 0) {
int currentItem = mViewPager.getCurrentItem();
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mPagerAdapter.getScrollTabHolders();
ScrollTabHolder currentHolder;
if (position < currentItem) {
currentHolder = scrollTabHolders.valueAt(position);
} else {
currentHolder = scrollTabHolders.valueAt(position + 1);
}
if (NEEDS_PROXY) {
// TODO is not good
currentHolder.adjustScroll(mHeader.getHeight() - mLastY);
mHeader.postInvalidate();
} else {
currentHolder.adjustScroll((int) (mHeader.getHeight() + mHeader.getTranslationY()));
}
}
}
示例5: deleteSelectedItems
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
private void deleteSelectedItems() {
SparseArrayCompat<Boolean> checkedItems = listView.getCheckedItemPositions();
ArrayList<Integer> sorted = new ArrayList<Integer>(checkedItems.size());
Log.i(LOG_TAG, "deleting: " + checkedItems.size());
for (int i = 0; i < checkedItems.size(); i++) {
if (checkedItems.valueAt(i)) {
sorted.add(checkedItems.keyAt(i));
}
}
Collections.sort(sorted);
for (int i = sorted.size() - 1; i >= 0; i--) {
int position = sorted.get(i);
Log.d(LOG_TAG, "Deleting item at: " + position);
mAdapter.mItems.remove(position);
}
mAdapter.notifyDataSetChanged();
}
示例6: getCheckItemIds
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Returns the set of checked items ids. The result is only valid if the
* choice mode has not been set to {@link #CHOICE_MODE_NONE}.
*
* @return A new array which contains the id of each checked item in the
* list.
*
* @deprecated Use {@link #getCheckedItemIds()} instead.
*/
@Deprecated
public long[] getCheckItemIds() {
// Use new behavior that correctly handles stable ID mapping.
if (mAdapter != null && mAdapter.hasStableIds()) {
return getCheckedItemIds();
}
// Old behavior was buggy, but would sort of work for adapters without
// stable IDs.
// Fall back to it to support legacy apps.
if (mChoiceMode != AbsListView.CHOICE_MODE_NONE && mCheckStates != null && mAdapter != null) {
final SparseArrayCompat<Boolean> states = mCheckStates;
final int count = states.size();
final long[] ids = new long[count];
final ListAdapter adapter = mAdapter;
int checkedCount = 0;
for (int i = 0; i < count; i++) {
if (states.valueAt(i)) {
ids[checkedCount++] = adapter.getItemId(states.keyAt(i));
}
}
// Trim array if needed. mCheckStates may contain false values
// resulting in checkedCount being smaller than count.
if (checkedCount == count) {
return ids;
} else {
final long[] result = new long[checkedCount];
System.arraycopy(ids, 0, result, 0, checkedCount);
return result;
}
}
return new long[0];
}
示例7: export
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
private void export() {
SparseArrayCompat<AppInfo> checkedApps = adapter.getCheckedApps();
final int size = checkedApps.size();
AppInfo[] appInfos = new AppInfo[size];
for (int i = 0; i < size; i++) {
appInfos[i] = checkedApps.valueAt(i);
}
mPresenter.export(appInfos);
}
示例8: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
tabs.onPageSelected(position);
reLocation = true;
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = adapter.getScrollTabHolders();
ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
if (NEED_RELAYOUT) {
currentHolder.adjustScroll((int) (header.getHeight() + headerTop));// 修正滚出去的偏移量
} else {
currentHolder.adjustScroll((int) (header.getHeight() + ViewHelper.getTranslationY(header)));// 修正滚出去的偏移量
}
}
示例9: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mPagerAdapter.getScrollTabHolders();
ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
if (NEEDS_PROXY) {
//TODO is not good
currentHolder.adjustScroll(mHeader.getHeight() - mLastY);
mHeader.postInvalidate();
} else {
currentHolder.adjustScroll((int) (mHeader.getHeight() + mHeader.getTranslationY()));
}
}
示例10: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
tabs.onPageSelected(position);
reLocation = true;
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = adapter.getScrollTabHolders();
ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
currentHolder.adjustScroll((int) (header.getHeight() + ViewHelper.getTranslationY(header)));// 修正滚出去的偏移量
}
示例11: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mPagerAdapter.getScrollTabHolders();
ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
currentHolder.adjustScroll((int) (mHeader.getHeight() + ViewHelper.getTranslationY(mHeader)));
}
示例12: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mAdapter.getScrollTabHolders();
if (scrollTabHolders == null || scrollTabHolders.size() != mNumFragments) {
return;
}
ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
currentHolder.adjustScroll(
(int) (mHeader.getHeight() + mHeader.getTranslationY()),
mHeader.getHeight());
}
示例13: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
SparseArrayCompat<ScrollHolder> scrollTabHolders = mAdapter.getScrollTabHolders();
if (scrollTabHolders == null || scrollTabHolders.size() != mAdapter.getCount()) {
return;
}
ScrollHolder currentHolder = scrollTabHolders.valueAt(position);
currentHolder.adjustScroll((int) (mStickheader.getHeight() + mStickheader.getTranslationY()), mStickheader.getHeight());
}
示例14: adjustScrollOfView
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
private void adjustScrollOfView(int position) {
SparseArrayCompat<ScrollAdjustable> scrollTabHolders = mPagerAdapter.getScrollTabHolders();
ScrollAdjustable currentHolder = scrollTabHolders.valueAt(position);
if (currentHolder != null) {
currentHolder.adjustScrollHeight((int) (mHeader.getHeight() + mHeader.getTranslationY()));
}
}
示例15: onPageSelected
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mPagerAdapter.getScrollTabHolders();
ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
if(NEEDS_PROXY){
//TODO is not good
currentHolder.adjustScroll(mHeader.getHeight()-mLastY);
mHeader.postInvalidate();
}else{
currentHolder.adjustScroll((int) (mHeader.getHeight() +mHeader.getTranslationY()));
}
}