List of usage examples for android.util SparseArray SparseArray
public SparseArray(int initialCapacity)
From source file:com.nightlynexus.viewstatepageradapter.ViewStatePagerAdapter.java
/** * @param capacity the initial capacity of the collection of attached Views. */// w w w . j a va2 s . c o m public ViewStatePagerAdapter(int capacity) { attached = new SparseArray<>(capacity); }
From source file:com.dreamspace.superman.UI.Adapters.IndexContainerPagerAdapter.java
public IndexContainerPagerAdapter(FragmentManager fm, List<Catalog> categoryList) { super(fm);/*w w w .j a va 2s. c om*/ mCategoryList = categoryList; fragments = new SparseArray<>(getCount()); }
From source file:com.planyourexchange.pageflow.PageFlowPagerAdapter.java
public PageFlowPagerAdapter(FragmentManager fragmentManager, SparseArray<Bundle> bundleSparse) { super(fragmentManager); fragmentList = PageFlow.newFragmentList(); int size = fragmentList.size(); if (bundleSparse == null) { this.bundleSparse = new SparseArray<>(size); } else {/*from w w w .jav a 2 s.c o m*/ this.bundleSparse = bundleSparse; } selectionListenerSparse = new SparseArray<>(size); // -- Hard Coding English Language for now and maybe ever!!! Bundle bundle = new Bundle(); bundle.putParcelable(KEY_ID, Parcels.wrap("English")); addBundleToFragment(PageFlow.COUNTRIES.getPosition(), bundle); }
From source file:me.futuretechnology.blops.ui.util.FeedsAdapter.java
/** * Constructor./* w ww .ja v a2 s . co m*/ * * @param context a general app context: e.g. getApplication() */ public FeedsAdapter(Context context, FragmentManager fm) { super(fm); mTxtBookmarks = context.getText(R.string.tab_bookmarks); mTxtMyNews = context.getText(R.string.tab_my_news); mFeedsManager = FeedsManager.getInstance(); mFragments = new SparseArray<Fragment>(mFeedsManager.getFeedsCount() + 1); mFeedState = new HashMap<String, Integer>(mFeedsManager.getFeedsCount() + 1); EventBus.getDefault().register(this); }
From source file:org.cyanogenmod.theme.chooser.AudiblePreviewFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPkgName = getArguments().getString(PKG_EXTRA); mMediaPlayers = new SparseArray<MediaPlayer>(3); }
From source file:com.android.email.provider.EmailMessageCursor.java
public EmailMessageCursor(final Context c, final Cursor cursor, final String htmlColumn, final String textColumn) { super(cursor); mHtmlColumnIndex = cursor.getColumnIndex(htmlColumn); mTextColumnIndex = cursor.getColumnIndex(textColumn); final int cursorSize = cursor.getCount(); mHtmlParts = new SparseArray<String>(cursorSize); mTextParts = new SparseArray<String>(cursorSize); final ContentResolver cr = c.getContentResolver(); while (cursor.moveToNext()) { final int position = cursor.getPosition(); final long messageId = cursor.getLong(cursor.getColumnIndex(BaseColumns._ID)); try {//from w w w . j a v a2s .c o m if (mHtmlColumnIndex != -1) { final Uri htmlUri = Body.getBodyHtmlUriForMessageWithId(messageId); final InputStream in = cr.openInputStream(htmlUri); final String underlyingHtmlString; try { underlyingHtmlString = IOUtils.toString(in); } finally { in.close(); } final String sanitizedHtml = HtmlSanitizer.sanitizeHtml(underlyingHtmlString); mHtmlParts.put(position, sanitizedHtml); } } catch (final IOException e) { LogUtils.v(LogUtils.TAG, e, "Did not find html body for message %d", messageId); } try { if (mTextColumnIndex != -1) { final Uri textUri = Body.getBodyTextUriForMessageWithId(messageId); final InputStream in = cr.openInputStream(textUri); final String underlyingTextString; try { underlyingTextString = IOUtils.toString(in); } finally { in.close(); } mTextParts.put(position, underlyingTextString); } } catch (final IOException e) { LogUtils.v(LogUtils.TAG, e, "Did not find text body for message %d", messageId); } } cursor.moveToPosition(-1); }
From source file:com.fabernovel.alertevoirie.utils.JSONAdapter.java
public JSONAdapter(Context context, JSONArray data, int cellLayout, String[] from, int[] to, String jsonObjectName, String categoryField, int categoryLayout) { this(context, data, cellLayout, from, to, jsonObjectName); this.categoryField = categoryField; this.categoryLayout = categoryLayout; String currentCat = null;/* w w w.j a v a 2 s .c om*/ categories = new SparseArray<String>(2); if (data != null) for (int i = 0, j = 0; i < data.length(); i++, j++) { String cat = getCategoryOfItem(i); Log.d(Constants.PROJECT_TAG, "catgorie : " + cat); if (!cat.equals(currentCat)) { Log.d(Constants.PROJECT_TAG, "category " + j + " : " + cat); categories.put(j++, cat); currentCat = cat; } } }
From source file:com.zhangtielei.demos.badge_number.tabs.adapter.MainTabsPagerAdapter.java
public MainTabsPagerAdapter(FragmentManager fm, ViewPager viewPager) { mFragmentManager = fm;//from w ww. ja va 2 s.c o m this.viewPager = viewPager; if (DEBUG) { Log.d(LOG_TAG, "FRAGMENT_COUNT " + FRAGMENT_COUNT); } fragmentMap = new SparseArray<Fragment>(FRAGMENT_COUNT); initFragmentAccess(FRAGMENT_COUNT); }
From source file:com.irccloud.android.data.ServersDataSource.java
public ServersDataSource() { servers = new SparseArray<>(10); }
From source file:com.irccloud.android.data.ChannelsDataSource.java
public ChannelsDataSource() { channels = new SparseArray<>(100); }