List of usage examples for android.support.v4.util CircularArray CircularArray
public CircularArray(int i)
From source file:Main.java
public static <T> CircularArray<T> emptyArray() { return new CircularArray<>(1); }
From source file:com.appsimobile.appsii.module.HotspotLoader.java
public static CircularArray<HotspotItem> loadHotspots(Context c) { ContentResolver r = c.getContentResolver(); Cursor cursor = r.query(HomeContract.Hotspots.CONTENT_URI, HotspotQuery.PROJECTION, null, null, null); if (cursor != null) { CircularArray<HotspotItem> result = new CircularArray<>(cursor.getCount()); try {//from ww w . j a va 2 s. c o m while (cursor.moveToNext()) { long id = cursor.getLong(HotspotQuery.ID); float height = cursor.getFloat(HotspotQuery.HEIGHT); float ypos = cursor.getFloat(HotspotQuery.Y_POSITION); boolean left = cursor.getInt(HotspotQuery.LEFT_BORDER) == 1; boolean needsConfiguration = cursor.getInt(HotspotQuery.NEEDS_CONFIGURATION) == 1; long defaultPageId = cursor.isNull(HotspotQuery._DEFAULT_PAGE) ? -1L : cursor.getLong(HotspotQuery._DEFAULT_PAGE); String name = cursor.getString(HotspotQuery.NAME); HotspotItem conf = new HotspotItem(); conf.init(id, name, height, ypos, left, needsConfiguration, defaultPageId); result.addLast(conf); } } finally { cursor.close(); } return result; } return CollectionUtils.emptyArray(); }
From source file:com.appsimobile.appsii.SidebarHotspot.java
void reloadHotspotData() { Log.d("SidebarHotspot", "reloading hotspots"); if (mHotspotItem == null) return;// www .ja va 2s .c o m final long hotspotId = mHotspotItem.mId; final Context context = getContext(); if (mLoadDataTask != null) mLoadDataTask.cancel(true); mLoadDataTask = new AsyncTask<Void, Void, CircularArray<HotspotPageEntry>>() { @Override protected CircularArray<HotspotPageEntry> doInBackground(Void... params) { Cursor c = context.getContentResolver().query(HotspotPagesQuery.createUri(hotspotId), HotspotPagesQuery.PROJECTION, null, null, HomeContract.HotspotDetails.POSITION + " ASC"); CircularArray<HotspotPageEntry> result = new CircularArray<>(c.getCount()); while (c.moveToNext()) { HotspotPageEntry entry = new HotspotPageEntry(); entry.mEnabled = c.getInt(HotspotPagesQuery.ENABLED) == 1; entry.mPageId = c.getLong(HotspotPagesQuery.PAGE_ID); entry.mHotspotId = c.getLong(HotspotPagesQuery.HOTSPOT_ID); entry.mPageName = c.getString(HotspotPagesQuery.PAGE_NAME); entry.mHotspotName = c.getString(HotspotPagesQuery.HOTSPOT_NAME); entry.mPosition = c.getInt(HotspotPagesQuery.POSITION); entry.mPageType = c.getInt(HotspotPagesQuery.PAGE_TYPE); result.addLast(entry); } c.close(); return result; } @Override protected void onPostExecute(CircularArray<HotspotPageEntry> hotspotPageEntries) { onHotspotEntriesLoaded(hotspotPageEntries); } }; mLoadDataTask.execute(); }
From source file:com.appsimobile.appsii.Appsi.java
@Override public int onStartCommand(@Nullable Intent intent, int flags, int startId) { Log.d(TAG, "onStartCommand() called with: " + "intent = [" + intent + "], flags = [" + flags + "], startId = [" + startId + "]"); startAppsiService();//from w ww .ja v a 2 s .c om // force initialize the home config to make everything a bit smoother // and this makes sure we don't have to wait for it when opening the // sidebar for the first time. // mHomeItemConfigurationHelper String action = intent == null ? null : intent.getAction(); if (ACTION_TRY_PAGE.equals(action)) { HotspotPageEntry entry = intent.getParcelableExtra("entry"); HotspotItem hotspotItem = intent.getParcelableExtra("hotspot"); if (entry != null && hotspotItem != null) { CircularArray<HotspotPageEntry> entries = new CircularArray<>(1); entries.addFirst(entry); openSidebar(hotspotItem, entries, 0, true); } } return Service.START_STICKY; }