com.google.android.gms.common.util.ArrayUtils Java Examples

The following examples show how to use com.google.android.gms.common.util.ArrayUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecipientDatabase.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private List<RecipientSettings> getRecipientSettingsForSync(@Nullable String query, @Nullable String[] args) {
  SQLiteDatabase          db    = databaseHelper.getReadableDatabase();
  String                  table = TABLE_NAME + " LEFT OUTER JOIN " + IdentityDatabase.TABLE_NAME + " ON " + TABLE_NAME + "." + ID + " = " + IdentityDatabase.TABLE_NAME + "." + IdentityDatabase.RECIPIENT_ID
                                             + " LEFT OUTER JOIN " + GroupDatabase.TABLE_NAME + " ON " + TABLE_NAME + "." + GROUP_ID + " = " + GroupDatabase.TABLE_NAME + "." + GroupDatabase.GROUP_ID;
  List<RecipientSettings> out   = new ArrayList<>();

  String[] columns = ArrayUtils.concat(RECIPIENT_FULL_PROJECTION,
    new String[]{GroupDatabase.TABLE_NAME + "." + GroupDatabase.V2_MASTER_KEY });

  try (Cursor cursor = db.query(table, columns, query, args, null, null, null)) {
    while (cursor != null && cursor.moveToNext()) {
      out.add(getRecipientSettings(context, cursor));
    }
  }

  return out;
}
 
Example #2
Source File: BarcodeScanningProcessor.java    From fast_qr_reader_view with MIT License 5 votes vote down vote up
public BarcodeScanningProcessor(ArrayList<Integer> reqFormats) {
    // Note that if you know which format of barcode your app is dealing with, detection will be
    // faster to specify the supported barcode formats one by one, e.g.
    // new FirebaseVisionBarcodeDetectorOptions.Builder()
    //     .setBarcodeFormats(FirebaseVisionBarcode.FORMAT_QR_CODE)
    //     .build();
    int[] additionalFormats = Arrays.copyOfRange(ArrayUtils.toPrimitiveArray(reqFormats), 1, reqFormats.size());


    detector = FirebaseVision.getInstance().getVisionBarcodeDetector(new FirebaseVisionBarcodeDetectorOptions.Builder()
            // setBarcodeFormats is quite weird. I have to do all of these just to pass a bunch of ints
            .setBarcodeFormats(ArrayUtils.toPrimitiveArray(reqFormats)[0], additionalFormats)
            .build());
}
 
Example #3
Source File: OpenFitActivity.java    From OpenFit with MIT License 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String permissions[], @NonNull int[] grantResults) {
    Log.d(LOG_TAG, "permissions: "+Arrays.toString(permissions)+"   grantResults:"+Arrays.toString(grantResults));
    switch (requestCode) {
        case MY_APP_PERMISSIONS_REQUEST_CONSTANT: {
            if ( ArrayUtils.contains(grantResults, PackageManager.PERMISSION_DENIED) ){
                finish();
            }
            else {
                init();
            }
        }
    }
}