当前位置: 首页>>代码示例>>Java>>正文


Java SparseArrayCompat.valueAt方法代码示例

本文整理汇总了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);
}
 
开发者ID:iflove,项目名称:UIKit-ViewBlock,代码行数:26,代码来源:UIKitHelper.java

示例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());
    }
}
 
开发者ID:boxme,项目名称:ParallaxHeaderViewPager,代码行数:20,代码来源:ParallaxViewPagerChangeListener.java

示例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());
    }
}
 
开发者ID:w446108264,项目名称:StickyHeaderViewPager,代码行数:17,代码来源:StickHeaderViewPager.java

示例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()));
		}
	}
}
 
开发者ID:kmshack,项目名称:Android-ParallaxHeaderViewPager,代码行数:25,代码来源:MainActivity.java

示例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();
}
 
开发者ID:sephiroth74,项目名称:HListViewAnimations,代码行数:22,代码来源:SimpleHListActivity.java

示例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];
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:46,代码来源:HListView.java

示例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);
}
 
开发者ID:8enet,项目名称:AppOpsX,代码行数:11,代码来源:ExportFragment.java

示例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)));// 修正滚出去的偏移量
    }
}
 
开发者ID:nggirl,项目名称:RefreshTabView,代码行数:13,代码来源:MainActivity.java

示例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()));
    }

}
 
开发者ID:GarimaMathur07,项目名称:Android-ParallaxHeader,代码行数:16,代码来源:MainActivity.java

示例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)));// 修正滚出去的偏移量
}
 
开发者ID:FreeSunny,项目名称:RefreashTabView,代码行数:9,代码来源:MainActivity.java

示例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)));
}
 
开发者ID:zpwan110,项目名称:Android-ParallaxHeaderViewPager-master,代码行数:8,代码来源:MainActivity.java

示例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());
}
 
开发者ID:boxme,项目名称:ParallaxHeaderViewPager,代码行数:14,代码来源:ParallaxViewPagerChangeListener.java

示例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());
}
 
开发者ID:w446108264,项目名称:StickyHeaderViewPager,代码行数:12,代码来源:StickHeaderViewPager.java

示例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()));
    }
}
 
开发者ID:mrhether,项目名称:HeaderViewPager,代码行数:8,代码来源:MainActivity.java

示例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()));	
	}
}
 
开发者ID:kmshack,项目名称:Android-ParallaxHeaderViewPager,代码行数:13,代码来源:MainActivity.java


注:本文中的android.support.v4.util.SparseArrayCompat.valueAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。