List of usage examples for android.support.v4.util SparseArrayCompat size
public int size()
From source file:Main.java
public static <C> List<C> asList(SparseArrayCompat<C> sparseArray) { if (sparseArray == null) return null; List<C> arrayList = new ArrayList<C>(sparseArray.size()); for (int i = 0; i < sparseArray.size(); i++) arrayList.add(sparseArray.valueAt(i)); return arrayList; }
From source file:Main.java
public static <T> List<T> asList(SparseArrayCompat<T> sparseArray) { if (sparseArray == null) { return null; }//w ww. j a v a 2 s .c o m List<T> list = new ArrayList<>(sparseArray.size()); for (int i = 0; i < sparseArray.size(); i++) { list.add(sparseArray.valueAt(i)); } return list; }
From source file:com.facebook.litho.ComponentHostUtils.java
static List<?> extractContent(SparseArrayCompat<MountItem> items) { final int size = items.size(); if (size == 1) { return Collections.singletonList(items.valueAt(0).getContent()); }//from w w w .j a v a 2 s .c o m final List<Object> content = new ArrayList<>(size); for (int i = 0; i < size; i++) { content.add(items.valueAt(i).getContent()); } return content; }
From source file:net.xisberto.phonetodesktop.ui.LinkListActivity.java
public static <C> ArrayList<C> asArrayList(SparseArrayCompat<C> sparseArray) { if (sparseArray == null) return null; ArrayList<C> arrayList = new ArrayList<>(sparseArray.size()); for (int i = 0; i < sparseArray.size(); i++) arrayList.add(sparseArray.valueAt(i)); return arrayList; }
From source file:com.dm.material.dashboard.candybar.helpers.ReportBugsHelper.java
public static void checkForBugs(@NonNull Context context) { new AsyncTask<Void, Void, Boolean>() { MaterialDialog dialog;// www. j a va2s. c o m StringBuilder sb; File folder; String file; @Override protected void onPreExecute() { super.onPreExecute(); sb = new StringBuilder(); folder = FileHelper.getCacheDirectory(context); file = folder.toString() + "/" + "reportbugs.zip"; MaterialDialog.Builder builder = new MaterialDialog.Builder(context); builder.content(R.string.report_bugs_building).progress(true, 0).progressIndeterminateStyle(true); dialog = builder.build(); dialog.show(); } @Override protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); SparseArrayCompat<String> files = new SparseArrayCompat<>(); sb.append(DeviceHelper.getDeviceInfo(context)); String brokenAppFilter = buildBrokenAppFilter(context, folder); if (brokenAppFilter != null) files.append(files.size(), brokenAppFilter); String activityList = buildActivityList(context, folder); if (activityList != null) files.append(files.size(), activityList); String stackTrace = Preferences.getPreferences(context).getLatestCrashLog(); String crashLog = buildCrashLog(context, folder, stackTrace); if (crashLog != null) files.append(files.size(), crashLog); FileHelper.createZip(files, file); return true; } catch (Exception e) { Log.d(Tag.LOG_TAG, Log.getStackTraceString(e)); return false; } } return false; } @Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); dialog.dismiss(); if (aBoolean) { File zip = new File(file); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { context.getResources().getString(R.string.dev_email) }); intent.putExtra(Intent.EXTRA_SUBJECT, "Report Bugs " + (context.getString(R.string.app_name))); intent.putExtra(Intent.EXTRA_TEXT, sb.toString()); Uri uri = FileHelper.getUriFromFile(context, context.getPackageName(), zip); intent.putExtra(Intent.EXTRA_STREAM, uri); context.startActivity( Intent.createChooser(intent, context.getResources().getString(R.string.email_client))); } else { Toast.makeText(context, R.string.report_bugs_failed, Toast.LENGTH_LONG).show(); } dialog = null; sb.setLength(0); } }.execute(); }
From source file:com.bmd.android.collection.internal.SparseArrayCompatReversIterator.java
public SparseArrayCompatReversIterator(final SparseArrayCompat<V> array) { super(array.size()); mSparseArray = array; }
From source file:com.bmd.android.collection.internal.SparseArrayCompatIterator.java
public SparseArrayCompatIterator(final SparseArrayCompat<V> array) { super(array.size()); mSparseArray = array; }
From source file:net.xisberto.work_schedule.settings.BootCompletedReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(context.getPackageName(), intent.getAction()); Database database = Database.getInstance(context); SparseArrayCompat<Period> periods = database.listPeriodsFromDay(Calendar.getInstance()); boolean updateWidgets = true; for (int i = 0; i < periods.size(); i++) { if (updateWidgets && periods.valueAt(i).enabled) { updateWidgets = false;/* w w w . jav a2s .c om*/ } periods.valueAt(i).setAlarm(context, updateWidgets); } }
From source file:com.dm.material.dashboard.candybar.databases.Database.java
private void resetDatabase(SQLiteDatabase db) { Cursor cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type=\'table\'", null); SparseArrayCompat<String> tables = new SparseArrayCompat<>(); if (cursor.moveToFirst()) { do {/* w ww. j a v a2 s . co m*/ tables.append(tables.size(), cursor.getString(0)); } while (cursor.moveToNext()); } cursor.close(); for (int i = 0; i < tables.size(); i++) { try { String dropQuery = "DROP TABLE IF EXISTS " + tables.get(i); if (!tables.get(i).equalsIgnoreCase("SQLITE_SEQUENCE")) db.execSQL(dropQuery); } catch (Exception ignored) { } } onCreate(db); }
From source file:com.dm.material.dashboard.candybar.adapters.RequestAdapter.java
public boolean isContainsRequested() { SparseArrayCompat<Request> requests = getSelectedApps(); boolean requested = false; for (int i = 0; i < requests.size(); i++) { if (requests.get(i).isRequested()) { requested = true;//w w w.j av a2 s .com break; } } return requested; }