Java Code Examples for android.support.v4.util.ArrayMap#get()

The following examples show how to use android.support.v4.util.ArrayMap#get() . 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: Transition.java    From Transitions-Everywhere with Apache License 2.0 6 votes vote down vote up
/**
 * Match start/end values by Adapter transitionName. Adds matched values to mStartValuesList
 * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
 * startNames and endNames as a guide for which Views have unique transitionNames.
 */
private void matchNames(@NonNull ArrayMap<View, TransitionValues> unmatchedStart,
                        @NonNull ArrayMap<View, TransitionValues> unmatchedEnd,
                        @NonNull ArrayMap<String, View> startNames,
                        @NonNull ArrayMap<String, View> endNames) {
    int numStartNames = startNames.size();
    for (int i = 0; i < numStartNames; i++) {
        View startView = startNames.valueAt(i);
        if (startView != null && isValidTarget(startView)) {
            View endView = endNames.get(startNames.keyAt(i));
            if (endView != null && isValidTarget(endView)) {
                TransitionValues startValues = unmatchedStart.get(startView);
                TransitionValues endValues = unmatchedEnd.get(endView);
                if (startValues != null && endValues != null) {
                    mStartValuesList.add(startValues);
                    mEndValuesList.add(endValues);
                    unmatchedStart.remove(startView);
                    unmatchedEnd.remove(endView);
                }
            }
        }
    }
}
 
Example 2
Source File: BackStackRecord.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
/**
 * Remaps a name-to-View map, substituting different names for keys.
 *
 * @param inMap A list of keys found in the map, in the order in toGoInMap
 * @param toGoInMap A list of keys to use for the new map, in the order of inMap
 * @param namedViews The current mapping
 * @return A copy of namedViews with the keys coming from toGoInMap.
 */
private static ArrayMap<String, View> remapNames(ArrayList<String> inMap,
        ArrayList<String> toGoInMap, ArrayMap<String, View> namedViews) {
    if (namedViews.isEmpty()) {
        return namedViews;
    }
    ArrayMap<String, View> remappedViews = new ArrayMap<String, View>();
    int numKeys = inMap.size();
    for (int i = 0; i < numKeys; i++) {
        View view = namedViews.get(inMap.get(i));
        if (view != null) {
            remappedViews.put(toGoInMap.get(i), view);
        }
    }
    return remappedViews;
}
 
Example 3
Source File: Transition.java    From Transitions-Everywhere with Apache License 2.0 6 votes vote down vote up
/**
 * Match start/end values by Adapter view ID. Adds matched values to mStartValuesList
 * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
 * startIds and endIds as a guide for which Views have unique IDs.
 */
private void matchIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart,
                      @NonNull ArrayMap<View, TransitionValues> unmatchedEnd,
                      @NonNull SparseArray<View> startIds,
                      @NonNull SparseArray<View> endIds) {
    int numStartIds = startIds.size();
    for (int i = 0; i < numStartIds; i++) {
        View startView = startIds.valueAt(i);
        if (startView != null && isValidTarget(startView)) {
            View endView = endIds.get(startIds.keyAt(i));
            if (endView != null && isValidTarget(endView)) {
                TransitionValues startValues = unmatchedStart.get(startView);
                TransitionValues endValues = unmatchedEnd.get(endView);
                if (startValues != null && endValues != null) {
                    mStartValuesList.add(startValues);
                    mEndValuesList.add(endValues);
                    unmatchedStart.remove(startView);
                    unmatchedEnd.remove(endView);
                }
            }
        }
    }
}
 
Example 4
Source File: Transition.java    From Transitions-Everywhere with Apache License 2.0 6 votes vote down vote up
/**
 * Match start/end values by Adapter item ID. Adds matched values to mStartValuesList
 * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
 * startItemIds and endItemIds as a guide for which Views have unique item IDs.
 */
private void matchItemIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart,
                          @NonNull ArrayMap<View, TransitionValues> unmatchedEnd,
                          @NonNull LongSparseArray<View> startItemIds,
                          @NonNull LongSparseArray<View> endItemIds) {
    int numStartIds = startItemIds.size();
    for (int i = 0; i < numStartIds; i++) {
        View startView = startItemIds.valueAt(i);
        if (startView != null && isValidTarget(startView)) {
            View endView = endItemIds.get(startItemIds.keyAt(i));
            if (endView != null && isValidTarget(endView)) {
                TransitionValues startValues = unmatchedStart.get(startView);
                TransitionValues endValues = unmatchedEnd.get(endView);
                if (startValues != null && endValues != null) {
                    mStartValuesList.add(startValues);
                    mEndValuesList.add(endValues);
                    unmatchedStart.remove(startView);
                    unmatchedEnd.remove(endView);
                }
            }
        }
    }
}
 
Example 5
Source File: PluginManager.java    From Phantom with Apache License 2.0 5 votes vote down vote up
private void initHostCompileDependencies() {
    final AssetManager assetManager = mContext.getAssets();
    InputStream inputStream = null;
    try {
        inputStream = assetManager.open(COMPILE_DEPENDENCIES_FILE, AssetManager.ACCESS_BUFFER);
        final List<String> lines = IoUtils.readLines(inputStream, IoUtils.DEFAULT_CHARSET);

        ArrayMap<String, String> librariesMap = new ArrayMap<>();  // lib -> version
        for (String line : lines) {
            final String[] parts = line.split(":");
            if (parts.length == 3) {
                final String lib = parts[0] + ":" + parts[1];   // groupId:artifactId
                final String newVersion = parts[2];
                final String oldVersion = librariesMap.get(lib);
                if (oldVersion != null && new Version(newVersion).lessThan(new Version(oldVersion))) {
                    // skip lower version
                    continue;
                }

                librariesMap.put(lib, newVersion);
            }
        }
        mHostCompileDependencyMap = librariesMap;

        ArraySet<String> librariesSet = new ArraySet<>();
        for (Map.Entry entry : librariesMap.entrySet()) {
            librariesSet.add(entry.getKey() + ":" + entry.getValue());
        }
        mHostCompileDependencySet = librariesSet;

    } catch (IOException e) {
        VLog.w(e, "error initHostCompileDependencies");
        mHostCompileDependencyMap = Collections.emptyMap();
        mHostCompileDependencySet = Collections.emptySet();
    } finally {
        IoUtils.closeQuietly(inputStream);
    }
}
 
Example 6
Source File: BackStackRecord.java    From letv with Apache License 2.0 5 votes vote down vote up
private void setEpicenterIn(ArrayMap<String, View> namedViews, TransitionState state) {
    if (this.mSharedElementTargetNames != null && !namedViews.isEmpty()) {
        View epicenter = (View) namedViews.get(this.mSharedElementTargetNames.get(0));
        if (epicenter != null) {
            state.enteringEpicenterView.epicenter = epicenter;
        }
    }
}
 
Example 7
Source File: VideoListAdapter.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
public void setTimes(ArrayMap<String, Long> times) {
    boolean notify = false;
    // update times
    for (int i = 0; i < getCount(); ++i) {
        MediaWrapper media = getItem(i);
        Long time = times.get(media.getLocation());
        if (time != null) {
            media.setTime(time);
            notify = true;
        }
    }
    if (notify)
        notifyDataSetChanged();
}
 
Example 8
Source File: BackStackRecord.java    From letv with Apache License 2.0 4 votes vote down vote up
private boolean configureTransitions(int containerId, TransitionState state, boolean isBack, SparseArray<Fragment> firstOutFragments, SparseArray<Fragment> lastInFragments) {
    View sceneRoot = (ViewGroup) this.mManager.mContainer.onFindViewById(containerId);
    if (sceneRoot == null) {
        return false;
    }
    final Fragment inFragment = (Fragment) lastInFragments.get(containerId);
    Fragment outFragment = (Fragment) firstOutFragments.get(containerId);
    Object enterTransition = getEnterTransition(inFragment, isBack);
    Object sharedElementTransition = getSharedElementTransition(inFragment, outFragment, isBack);
    Object exitTransition = getExitTransition(outFragment, isBack);
    ArrayMap<String, View> namedViews = null;
    ArrayList<View> sharedElementTargets = new ArrayList();
    if (sharedElementTransition != null) {
        namedViews = remapSharedElements(state, outFragment, isBack);
        if (namedViews.isEmpty()) {
            sharedElementTransition = null;
            namedViews = null;
        } else {
            SharedElementCallback callback = isBack ? outFragment.mEnterTransitionCallback : inFragment.mEnterTransitionCallback;
            if (callback != null) {
                callback.onSharedElementStart(new ArrayList(namedViews.keySet()), new ArrayList(namedViews.values()), null);
            }
            prepareSharedElementTransition(state, sceneRoot, sharedElementTransition, inFragment, outFragment, isBack, sharedElementTargets);
        }
    }
    if (enterTransition == null && sharedElementTransition == null && exitTransition == null) {
        return false;
    }
    ArrayList<View> exitingViews = new ArrayList();
    exitTransition = captureExitingViews(exitTransition, outFragment, exitingViews, namedViews, state.nonExistentView);
    if (!(this.mSharedElementTargetNames == null || namedViews == null)) {
        View epicenterView = (View) namedViews.get(this.mSharedElementTargetNames.get(0));
        if (epicenterView != null) {
            if (exitTransition != null) {
                FragmentTransitionCompat21.setEpicenter(exitTransition, epicenterView);
            }
            if (sharedElementTransition != null) {
                FragmentTransitionCompat21.setEpicenter(sharedElementTransition, epicenterView);
            }
        }
    }
    ViewRetriever viewRetriever = new ViewRetriever() {
        public View getView() {
            return inFragment.getView();
        }
    };
    ArrayList<View> enteringViews = new ArrayList();
    ArrayMap<String, View> renamedViews = new ArrayMap();
    boolean allowOverlap = true;
    if (inFragment != null) {
        allowOverlap = isBack ? inFragment.getAllowReturnTransitionOverlap() : inFragment.getAllowEnterTransitionOverlap();
    }
    Object transition = FragmentTransitionCompat21.mergeTransitions(enterTransition, exitTransition, sharedElementTransition, allowOverlap);
    if (transition != null) {
        FragmentTransitionCompat21.addTransitionTargets(enterTransition, sharedElementTransition, sceneRoot, viewRetriever, state.nonExistentView, state.enteringEpicenterView, state.nameOverrides, enteringViews, namedViews, renamedViews, sharedElementTargets);
        excludeHiddenFragmentsAfterEnter(sceneRoot, state, containerId, transition);
        FragmentTransitionCompat21.excludeTarget(transition, state.nonExistentView, true);
        excludeHiddenFragments(state, containerId, transition);
        FragmentTransitionCompat21.beginDelayedTransition(sceneRoot, transition);
        FragmentTransitionCompat21.cleanupTransitions(sceneRoot, state.nonExistentView, enterTransition, enteringViews, exitTransition, exitingViews, sharedElementTransition, sharedElementTargets, transition, state.hiddenFragmentViews, renamedViews);
    }
    if (transition != null) {
        return true;
    }
    return false;
}
 
Example 9
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
private void __fetchRelationshipResourceIdHeuristicAscomExampleAndroidAutofillServiceModelResourceIdHeuristic(final ArrayMap<String, ArrayList<ResourceIdHeuristic>> _map) {
  final Set<String> __mapKeySet = _map.keySet();
  if (__mapKeySet.isEmpty()) {
    return;
  }
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT resourceIdHeuristic,packageName,fieldTypeName FROM `ResourceIdHeuristic` WHERE fieldTypeName IN (");
  final int _inputSize = __mapKeySet.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _stmt = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : __mapKeySet) {
    if (_item == null) {
      _stmt.bindNull(_argIndex);
    } else {
      _stmt.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_stmt);
  try {
    final int _itemKeyIndex = _cursor.getColumnIndex("fieldTypeName");
    if (_itemKeyIndex == -1) {
      return;
    }
    final int _cursorIndexOfMResourceIdHeuristic = _cursor.getColumnIndexOrThrow("resourceIdHeuristic");
    final int _cursorIndexOfMPackageName = _cursor.getColumnIndexOrThrow("packageName");
    final int _cursorIndexOfMFieldTypeName = _cursor.getColumnIndexOrThrow("fieldTypeName");
    while(_cursor.moveToNext()) {
      if (!_cursor.isNull(_itemKeyIndex)) {
        final String _tmpKey = _cursor.getString(_itemKeyIndex);
        ArrayList<ResourceIdHeuristic> _tmpCollection = _map.get(_tmpKey);
        if (_tmpCollection != null) {
          final ResourceIdHeuristic _item_1;
          final String _tmpMResourceIdHeuristic;
          _tmpMResourceIdHeuristic = _cursor.getString(_cursorIndexOfMResourceIdHeuristic);
          final String _tmpMPackageName;
          _tmpMPackageName = _cursor.getString(_cursorIndexOfMPackageName);
          final String _tmpMFieldTypeName;
          _tmpMFieldTypeName = _cursor.getString(_cursorIndexOfMFieldTypeName);
          _item_1 = new ResourceIdHeuristic(_tmpMResourceIdHeuristic,_tmpMFieldTypeName,_tmpMPackageName);
          _tmpCollection.add(_item_1);
        }
      }
    }
  } finally {
    _cursor.close();
  }
}
 
Example 10
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
private void __fetchRelationshipAutofillHintAscomExampleAndroidAutofillServiceModelAutofillHint(final ArrayMap<String, ArrayList<AutofillHint>> _map) {
  final Set<String> __mapKeySet = _map.keySet();
  if (__mapKeySet.isEmpty()) {
    return;
  }
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT autofillHint,fieldTypeName FROM `AutofillHint` WHERE fieldTypeName IN (");
  final int _inputSize = __mapKeySet.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _stmt = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : __mapKeySet) {
    if (_item == null) {
      _stmt.bindNull(_argIndex);
    } else {
      _stmt.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_stmt);
  try {
    final int _itemKeyIndex = _cursor.getColumnIndex("fieldTypeName");
    if (_itemKeyIndex == -1) {
      return;
    }
    final int _cursorIndexOfMAutofillHint = _cursor.getColumnIndexOrThrow("autofillHint");
    final int _cursorIndexOfMFieldTypeName = _cursor.getColumnIndexOrThrow("fieldTypeName");
    while(_cursor.moveToNext()) {
      if (!_cursor.isNull(_itemKeyIndex)) {
        final String _tmpKey = _cursor.getString(_itemKeyIndex);
        ArrayList<AutofillHint> _tmpCollection = _map.get(_tmpKey);
        if (_tmpCollection != null) {
          final AutofillHint _item_1;
          final String _tmpMAutofillHint;
          _tmpMAutofillHint = _cursor.getString(_cursorIndexOfMAutofillHint);
          final String _tmpMFieldTypeName;
          _tmpMFieldTypeName = _cursor.getString(_cursorIndexOfMFieldTypeName);
          _item_1 = new AutofillHint(_tmpMAutofillHint,_tmpMFieldTypeName);
          _tmpCollection.add(_item_1);
        }
      }
    }
  } finally {
    _cursor.close();
  }
}
 
Example 11
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public DatasetWithFilledAutofillFields getAutofillDatasetWithId(String datasetId) {
  final String _sql = "SELECT DISTINCT id, datasetName FROM FilledAutofillField, AutofillDataset WHERE AutofillDataset.id = FilledAutofillField.datasetId AND AutofillDataset.id = (?)";
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
  int _argIndex = 1;
  if (datasetId == null) {
    _statement.bindNull(_argIndex);
  } else {
    _statement.bindString(_argIndex, datasetId);
  }
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<FilledAutofillField>> _collectionFilledAutofillFields = new ArrayMap<String, ArrayList<FilledAutofillField>>();
    final int _cursorIndexOfMId = _cursor.getColumnIndexOrThrow("id");
    final int _cursorIndexOfMDatasetName = _cursor.getColumnIndexOrThrow("datasetName");
    final DatasetWithFilledAutofillFields _result;
    if(_cursor.moveToFirst()) {
      final AutofillDataset _tmpAutofillDataset;
      if (! (_cursor.isNull(_cursorIndexOfMId) && _cursor.isNull(_cursorIndexOfMDatasetName))) {
        final String _tmpMId;
        _tmpMId = _cursor.getString(_cursorIndexOfMId);
        final String _tmpMDatasetName;
        _tmpMDatasetName = _cursor.getString(_cursorIndexOfMDatasetName);
        _tmpAutofillDataset = new AutofillDataset(_tmpMId,_tmpMDatasetName,null);
      }  else  {
        _tmpAutofillDataset = null;
      }
      _result = new DatasetWithFilledAutofillFields();
      if (!_cursor.isNull(_cursorIndexOfMId)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMId);
        ArrayList<FilledAutofillField> _tmpCollection = _collectionFilledAutofillFields.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<FilledAutofillField>();
          _collectionFilledAutofillFields.put(_tmpKey, _tmpCollection);
        }
        _result.filledAutofillFields = _tmpCollection;
      }
      _result.autofillDataset = _tmpAutofillDataset;
    } else {
      _result = null;
    }
    __fetchRelationshipFilledAutofillFieldAscomExampleAndroidAutofillServiceModelFilledAutofillField(_collectionFilledAutofillFields);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
Example 12
Source File: PictureScanner.java    From PicturePicker with Apache License 2.0 4 votes vote down vote up
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {

    pictureFolderList.clear();

    if (data != null) {

        // new一个集合存储所有图片
        List<PictureItem> allPictureList = new ArrayList<>();

        //             图片目录路径和图片目录对象的映射
        ArrayMap<String, PictureFolder> path2PictureFolderMap = new ArrayMap<>();

        while (data.moveToNext()) {
            //得到图片的路径
            String picturePath = data.getString(data.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));

            if (!TextUtils.isEmpty(picturePath)) {
                File pictureFile = new File(picturePath);
                if (pictureFile.exists() && pictureFile.length() != 0) {

                    PictureItem pictureItem = new PictureItem();
                    pictureItem.pictureAbsPath = picturePath;
                    pictureItem.pictureAddTime = data.getLong(data.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_ADDED));
                    pictureItem.pictureHeight = data.getInt(data.getColumnIndexOrThrow(MediaStore.Images.Media.HEIGHT));
                    pictureItem.pictureWidth = data.getInt(data.getColumnIndexOrThrow(MediaStore.Images.Media.WIDTH));
                    pictureItem.pictureMimeType = data.getString(data.getColumnIndexOrThrow(MediaStore.Images.Media.MIME_TYPE));
                    pictureItem.pictureSize = data.getInt(data.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE));
                    pictureItem.pictureName = data.getString(data.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME));

                    //得到文件的父目录文件
                    File parentFile = pictureFile.getParentFile();

                    //得到父目录的路径并统一转为小写
                    String parentFilePath = parentFile.getAbsolutePath().toLowerCase();

                    //如果图片文件夹已经被存储
                    if (null != path2PictureFolderMap.get(parentFilePath)) {
                        path2PictureFolderMap.get(parentFilePath).pictureItemList.add(pictureItem);
                    } else {
                        PictureFolder pictureFolder = new PictureFolder();
                        pictureFolder.folderName = parentFile.getName();
                        pictureFolder.folderAbsPath = parentFilePath;
                        pictureFolder.pictureItemList = new ArrayList<>();
                        pictureFolder.pictureItemList.add(pictureItem);
                        //因为扫描时是按照加入时间降序排序,所以第一个图片为最新的,设为封面
                        pictureFolder.folderCover = pictureItem;
                        pictureFolderList.add(pictureFolder);
                        path2PictureFolderMap.put(parentFilePath, pictureFolder);
                    }

                    //把此图片加到“全部图片”里
                    allPictureList.add(pictureItem);
                }
            }
        }

        if (allPictureList.size() > 0) {
            PictureFolder folder = new PictureFolder();
            folder.folderName = context.getResources().getString(R.string.all_pictures);
            folder.pictureItemList = allPictureList;
            folder.folderCover = allPictureList.get(0);
            pictureFolderList.add(0, folder);
        }

        if (scanFinishListener != null) {
            scanFinishListener.onScanFinish(pictureFolderList);
        }
    }
}
 
Example 13
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
private void __fetchRelationshipResourceIdHeuristicAscomExampleAndroidAutofillServiceModelResourceIdHeuristic(final ArrayMap<String, ArrayList<ResourceIdHeuristic>> _map) {
  final Set<String> __mapKeySet = _map.keySet();
  if (__mapKeySet.isEmpty()) {
    return;
  }
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT resourceIdHeuristic,packageName,fieldTypeName FROM `ResourceIdHeuristic` WHERE fieldTypeName IN (");
  final int _inputSize = __mapKeySet.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _stmt = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : __mapKeySet) {
    if (_item == null) {
      _stmt.bindNull(_argIndex);
    } else {
      _stmt.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_stmt);
  try {
    final int _itemKeyIndex = _cursor.getColumnIndex("fieldTypeName");
    if (_itemKeyIndex == -1) {
      return;
    }
    final int _cursorIndexOfMResourceIdHeuristic = _cursor.getColumnIndexOrThrow("resourceIdHeuristic");
    final int _cursorIndexOfMPackageName = _cursor.getColumnIndexOrThrow("packageName");
    final int _cursorIndexOfMFieldTypeName = _cursor.getColumnIndexOrThrow("fieldTypeName");
    while(_cursor.moveToNext()) {
      if (!_cursor.isNull(_itemKeyIndex)) {
        final String _tmpKey = _cursor.getString(_itemKeyIndex);
        ArrayList<ResourceIdHeuristic> _tmpCollection = _map.get(_tmpKey);
        if (_tmpCollection != null) {
          final ResourceIdHeuristic _item_1;
          final String _tmpMResourceIdHeuristic;
          _tmpMResourceIdHeuristic = _cursor.getString(_cursorIndexOfMResourceIdHeuristic);
          final String _tmpMPackageName;
          _tmpMPackageName = _cursor.getString(_cursorIndexOfMPackageName);
          final String _tmpMFieldTypeName;
          _tmpMFieldTypeName = _cursor.getString(_cursorIndexOfMFieldTypeName);
          _item_1 = new ResourceIdHeuristic(_tmpMResourceIdHeuristic,_tmpMFieldTypeName,_tmpMPackageName);
          _tmpCollection.add(_item_1);
        }
      }
    }
  } finally {
    _cursor.close();
  }
}
 
Example 14
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
private void __fetchRelationshipFilledAutofillFieldAscomExampleAndroidAutofillServiceModelFilledAutofillField(final ArrayMap<String, ArrayList<FilledAutofillField>> _map) {
  final Set<String> __mapKeySet = _map.keySet();
  if (__mapKeySet.isEmpty()) {
    return;
  }
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT datasetId,textValue,dateValue,toggleValue,fieldTypeName FROM `FilledAutofillField` WHERE datasetId IN (");
  final int _inputSize = __mapKeySet.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _stmt = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : __mapKeySet) {
    if (_item == null) {
      _stmt.bindNull(_argIndex);
    } else {
      _stmt.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_stmt);
  try {
    final int _itemKeyIndex = _cursor.getColumnIndex("datasetId");
    if (_itemKeyIndex == -1) {
      return;
    }
    final int _cursorIndexOfMDatasetId = _cursor.getColumnIndexOrThrow("datasetId");
    final int _cursorIndexOfMTextValue = _cursor.getColumnIndexOrThrow("textValue");
    final int _cursorIndexOfMDateValue = _cursor.getColumnIndexOrThrow("dateValue");
    final int _cursorIndexOfMToggleValue = _cursor.getColumnIndexOrThrow("toggleValue");
    final int _cursorIndexOfMFieldTypeName = _cursor.getColumnIndexOrThrow("fieldTypeName");
    while(_cursor.moveToNext()) {
      if (!_cursor.isNull(_itemKeyIndex)) {
        final String _tmpKey = _cursor.getString(_itemKeyIndex);
        ArrayList<FilledAutofillField> _tmpCollection = _map.get(_tmpKey);
        if (_tmpCollection != null) {
          final FilledAutofillField _item_1;
          final String _tmpMDatasetId;
          _tmpMDatasetId = _cursor.getString(_cursorIndexOfMDatasetId);
          final String _tmpMTextValue;
          _tmpMTextValue = _cursor.getString(_cursorIndexOfMTextValue);
          final Long _tmpMDateValue;
          if (_cursor.isNull(_cursorIndexOfMDateValue)) {
            _tmpMDateValue = null;
          } else {
            _tmpMDateValue = _cursor.getLong(_cursorIndexOfMDateValue);
          }
          final Boolean _tmpMToggleValue;
          final Integer _tmp;
          if (_cursor.isNull(_cursorIndexOfMToggleValue)) {
            _tmp = null;
          } else {
            _tmp = _cursor.getInt(_cursorIndexOfMToggleValue);
          }
          _tmpMToggleValue = _tmp == null ? null : _tmp != 0;
          final String _tmpMFieldTypeName;
          _tmpMFieldTypeName = _cursor.getString(_cursorIndexOfMFieldTypeName);
          _item_1 = new FilledAutofillField(_tmpMDatasetId,_tmpMFieldTypeName,_tmpMTextValue,_tmpMDateValue,_tmpMToggleValue);
          _tmpCollection.add(_item_1);
        }
      }
    }
  } finally {
    _cursor.close();
  }
}
 
Example 15
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public DatasetWithFilledAutofillFields getAutofillDatasetWithId(String datasetId) {
  final String _sql = "SELECT DISTINCT id, datasetName FROM FilledAutofillField, AutofillDataset WHERE AutofillDataset.id = FilledAutofillField.datasetId AND AutofillDataset.id = (?)";
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
  int _argIndex = 1;
  if (datasetId == null) {
    _statement.bindNull(_argIndex);
  } else {
    _statement.bindString(_argIndex, datasetId);
  }
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<FilledAutofillField>> _collectionFilledAutofillFields = new ArrayMap<String, ArrayList<FilledAutofillField>>();
    final int _cursorIndexOfMId = _cursor.getColumnIndexOrThrow("id");
    final int _cursorIndexOfMDatasetName = _cursor.getColumnIndexOrThrow("datasetName");
    final DatasetWithFilledAutofillFields _result;
    if(_cursor.moveToFirst()) {
      final AutofillDataset _tmpAutofillDataset;
      if (! (_cursor.isNull(_cursorIndexOfMId) && _cursor.isNull(_cursorIndexOfMDatasetName))) {
        final String _tmpMId;
        _tmpMId = _cursor.getString(_cursorIndexOfMId);
        final String _tmpMDatasetName;
        _tmpMDatasetName = _cursor.getString(_cursorIndexOfMDatasetName);
        _tmpAutofillDataset = new AutofillDataset(_tmpMId,_tmpMDatasetName,null);
      }  else  {
        _tmpAutofillDataset = null;
      }
      _result = new DatasetWithFilledAutofillFields();
      if (!_cursor.isNull(_cursorIndexOfMId)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMId);
        ArrayList<FilledAutofillField> _tmpCollection = _collectionFilledAutofillFields.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<FilledAutofillField>();
          _collectionFilledAutofillFields.put(_tmpKey, _tmpCollection);
        }
        _result.filledAutofillFields = _tmpCollection;
      }
      _result.autofillDataset = _tmpAutofillDataset;
    } else {
      _result = null;
    }
    __fetchRelationshipFilledAutofillFieldAscomExampleAndroidAutofillServiceModelFilledAutofillField(_collectionFilledAutofillFields);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
Example 16
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public List<FieldTypeWithHeuristics> getFieldTypesForAutofillHints(List<String> autofillHints) {
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT DISTINCT typeName, autofillTypes, saveInfo, partition, strictExampleSet, textTemplate, dateTemplate FROM FieldType, AutofillHint WHERE FieldType.typeName = AutofillHint.fieldTypeName AND AutofillHint.autofillHint IN (");
  final int _inputSize = autofillHints.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(") UNION SELECT DISTINCT typeName, autofillTypes, saveInfo, partition, strictExampleSet, textTemplate, dateTemplate FROM FieldType, ResourceIdHeuristic WHERE FieldType.typeName = ResourceIdHeuristic.fieldTypeName");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : autofillHints) {
    if (_item == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<AutofillHint>> _collectionAutofillHints = new ArrayMap<String, ArrayList<AutofillHint>>();
    final ArrayMap<String, ArrayList<ResourceIdHeuristic>> _collectionResourceIdHeuristics = new ArrayMap<String, ArrayList<ResourceIdHeuristic>>();
    final int _cursorIndexOfMTypeName = _cursor.getColumnIndexOrThrow("typeName");
    final int _cursorIndexOfMAutofillTypes = _cursor.getColumnIndexOrThrow("autofillTypes");
    final int _cursorIndexOfMSaveInfo = _cursor.getColumnIndexOrThrow("saveInfo");
    final int _cursorIndexOfMPartition = _cursor.getColumnIndexOrThrow("partition");
    final int _cursorIndexOfStrictExampleSet = _cursor.getColumnIndexOrThrow("strictExampleSet");
    final int _cursorIndexOfTextTemplate = _cursor.getColumnIndexOrThrow("textTemplate");
    final int _cursorIndexOfDateTemplate = _cursor.getColumnIndexOrThrow("dateTemplate");
    final List<FieldTypeWithHeuristics> _result = new ArrayList<FieldTypeWithHeuristics>(_cursor.getCount());
    while(_cursor.moveToNext()) {
      final FieldTypeWithHeuristics _item_1;
      final FieldType _tmpFieldType;
      if (! (_cursor.isNull(_cursorIndexOfMTypeName) && _cursor.isNull(_cursorIndexOfMAutofillTypes) && _cursor.isNull(_cursorIndexOfMSaveInfo) && _cursor.isNull(_cursorIndexOfMPartition) && _cursor.isNull(_cursorIndexOfStrictExampleSet) && _cursor.isNull(_cursorIndexOfTextTemplate) && _cursor.isNull(_cursorIndexOfDateTemplate))) {
        final String _tmpMTypeName;
        _tmpMTypeName = _cursor.getString(_cursorIndexOfMTypeName);
        final Converters.IntList _tmpMAutofillTypes;
        final String _tmp;
        _tmp = _cursor.getString(_cursorIndexOfMAutofillTypes);
        _tmpMAutofillTypes = Converters.storedStringToIntList(_tmp);
        final Integer _tmpMSaveInfo;
        if (_cursor.isNull(_cursorIndexOfMSaveInfo)) {
          _tmpMSaveInfo = null;
        } else {
          _tmpMSaveInfo = _cursor.getInt(_cursorIndexOfMSaveInfo);
        }
        final Integer _tmpMPartition;
        if (_cursor.isNull(_cursorIndexOfMPartition)) {
          _tmpMPartition = null;
        } else {
          _tmpMPartition = _cursor.getInt(_cursorIndexOfMPartition);
        }
        final FakeData _tmpMFakeData;
        final Converters.StringList _tmpStrictExampleSet;
        final String _tmp_1;
        _tmp_1 = _cursor.getString(_cursorIndexOfStrictExampleSet);
        _tmpStrictExampleSet = Converters.storedStringToStringList(_tmp_1);
        final String _tmpTextTemplate;
        _tmpTextTemplate = _cursor.getString(_cursorIndexOfTextTemplate);
        final String _tmpDateTemplate;
        _tmpDateTemplate = _cursor.getString(_cursorIndexOfDateTemplate);
        _tmpMFakeData = new FakeData(_tmpStrictExampleSet,_tmpTextTemplate,_tmpDateTemplate);
        _tmpFieldType = new FieldType(_tmpMTypeName,_tmpMAutofillTypes,_tmpMSaveInfo,_tmpMPartition,_tmpMFakeData);
      }  else  {
        _tmpFieldType = null;
      }
      _item_1 = new FieldTypeWithHeuristics();
      if (!_cursor.isNull(_cursorIndexOfMTypeName)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMTypeName);
        ArrayList<AutofillHint> _tmpCollection = _collectionAutofillHints.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<AutofillHint>();
          _collectionAutofillHints.put(_tmpKey, _tmpCollection);
        }
        _item_1.autofillHints = _tmpCollection;
      }
      if (!_cursor.isNull(_cursorIndexOfMTypeName)) {
        final String _tmpKey_1 = _cursor.getString(_cursorIndexOfMTypeName);
        ArrayList<ResourceIdHeuristic> _tmpCollection_1 = _collectionResourceIdHeuristics.get(_tmpKey_1);
        if(_tmpCollection_1 == null) {
          _tmpCollection_1 = new ArrayList<ResourceIdHeuristic>();
          _collectionResourceIdHeuristics.put(_tmpKey_1, _tmpCollection_1);
        }
        _item_1.resourceIdHeuristics = _tmpCollection_1;
      }
      _item_1.fieldType = _tmpFieldType;
      _result.add(_item_1);
    }
    __fetchRelationshipAutofillHintAscomExampleAndroidAutofillServiceModelAutofillHint(_collectionAutofillHints);
    __fetchRelationshipResourceIdHeuristicAscomExampleAndroidAutofillServiceModelResourceIdHeuristic(_collectionResourceIdHeuristics);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
Example 17
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public List<FieldTypeWithHeuristics> getFieldTypesWithHints() {
  final String _sql = "SELECT DISTINCT typeName, autofillTypes, saveInfo, partition, strictExampleSet, textTemplate, dateTemplate FROM FieldType, AutofillHint WHERE FieldType.typeName = AutofillHint.fieldTypeName UNION SELECT DISTINCT typeName, autofillTypes, saveInfo, partition, strictExampleSet, textTemplate, dateTemplate FROM FieldType, ResourceIdHeuristic WHERE FieldType.typeName = ResourceIdHeuristic.fieldTypeName";
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<AutofillHint>> _collectionAutofillHints = new ArrayMap<String, ArrayList<AutofillHint>>();
    final ArrayMap<String, ArrayList<ResourceIdHeuristic>> _collectionResourceIdHeuristics = new ArrayMap<String, ArrayList<ResourceIdHeuristic>>();
    final int _cursorIndexOfMTypeName = _cursor.getColumnIndexOrThrow("typeName");
    final int _cursorIndexOfMAutofillTypes = _cursor.getColumnIndexOrThrow("autofillTypes");
    final int _cursorIndexOfMSaveInfo = _cursor.getColumnIndexOrThrow("saveInfo");
    final int _cursorIndexOfMPartition = _cursor.getColumnIndexOrThrow("partition");
    final int _cursorIndexOfStrictExampleSet = _cursor.getColumnIndexOrThrow("strictExampleSet");
    final int _cursorIndexOfTextTemplate = _cursor.getColumnIndexOrThrow("textTemplate");
    final int _cursorIndexOfDateTemplate = _cursor.getColumnIndexOrThrow("dateTemplate");
    final List<FieldTypeWithHeuristics> _result = new ArrayList<FieldTypeWithHeuristics>(_cursor.getCount());
    while(_cursor.moveToNext()) {
      final FieldTypeWithHeuristics _item;
      final FieldType _tmpFieldType;
      if (! (_cursor.isNull(_cursorIndexOfMTypeName) && _cursor.isNull(_cursorIndexOfMAutofillTypes) && _cursor.isNull(_cursorIndexOfMSaveInfo) && _cursor.isNull(_cursorIndexOfMPartition) && _cursor.isNull(_cursorIndexOfStrictExampleSet) && _cursor.isNull(_cursorIndexOfTextTemplate) && _cursor.isNull(_cursorIndexOfDateTemplate))) {
        final String _tmpMTypeName;
        _tmpMTypeName = _cursor.getString(_cursorIndexOfMTypeName);
        final Converters.IntList _tmpMAutofillTypes;
        final String _tmp;
        _tmp = _cursor.getString(_cursorIndexOfMAutofillTypes);
        _tmpMAutofillTypes = Converters.storedStringToIntList(_tmp);
        final Integer _tmpMSaveInfo;
        if (_cursor.isNull(_cursorIndexOfMSaveInfo)) {
          _tmpMSaveInfo = null;
        } else {
          _tmpMSaveInfo = _cursor.getInt(_cursorIndexOfMSaveInfo);
        }
        final Integer _tmpMPartition;
        if (_cursor.isNull(_cursorIndexOfMPartition)) {
          _tmpMPartition = null;
        } else {
          _tmpMPartition = _cursor.getInt(_cursorIndexOfMPartition);
        }
        final FakeData _tmpMFakeData;
        final Converters.StringList _tmpStrictExampleSet;
        final String _tmp_1;
        _tmp_1 = _cursor.getString(_cursorIndexOfStrictExampleSet);
        _tmpStrictExampleSet = Converters.storedStringToStringList(_tmp_1);
        final String _tmpTextTemplate;
        _tmpTextTemplate = _cursor.getString(_cursorIndexOfTextTemplate);
        final String _tmpDateTemplate;
        _tmpDateTemplate = _cursor.getString(_cursorIndexOfDateTemplate);
        _tmpMFakeData = new FakeData(_tmpStrictExampleSet,_tmpTextTemplate,_tmpDateTemplate);
        _tmpFieldType = new FieldType(_tmpMTypeName,_tmpMAutofillTypes,_tmpMSaveInfo,_tmpMPartition,_tmpMFakeData);
      }  else  {
        _tmpFieldType = null;
      }
      _item = new FieldTypeWithHeuristics();
      if (!_cursor.isNull(_cursorIndexOfMTypeName)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMTypeName);
        ArrayList<AutofillHint> _tmpCollection = _collectionAutofillHints.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<AutofillHint>();
          _collectionAutofillHints.put(_tmpKey, _tmpCollection);
        }
        _item.autofillHints = _tmpCollection;
      }
      if (!_cursor.isNull(_cursorIndexOfMTypeName)) {
        final String _tmpKey_1 = _cursor.getString(_cursorIndexOfMTypeName);
        ArrayList<ResourceIdHeuristic> _tmpCollection_1 = _collectionResourceIdHeuristics.get(_tmpKey_1);
        if(_tmpCollection_1 == null) {
          _tmpCollection_1 = new ArrayList<ResourceIdHeuristic>();
          _collectionResourceIdHeuristics.put(_tmpKey_1, _tmpCollection_1);
        }
        _item.resourceIdHeuristics = _tmpCollection_1;
      }
      _item.fieldType = _tmpFieldType;
      _result.add(_item);
    }
    __fetchRelationshipAutofillHintAscomExampleAndroidAutofillServiceModelAutofillHint(_collectionAutofillHints);
    __fetchRelationshipResourceIdHeuristicAscomExampleAndroidAutofillServiceModelResourceIdHeuristic(_collectionResourceIdHeuristics);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
Example 18
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public List<DatasetWithFilledAutofillFields> getDatasetsWithName(List<String> fieldTypes,
    String datasetName) {
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT DISTINCT id, datasetName FROM FilledAutofillField, AutofillDataset WHERE AutofillDataset.id = FilledAutofillField.datasetId AND AutofillDataset.datasetName = (");
  _stringBuilder.append("?");
  _stringBuilder.append(") AND FilledAutofillField.fieldTypeName IN (");
  final int _inputSize = fieldTypes.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 1 + _inputSize;
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  if (datasetName == null) {
    _statement.bindNull(_argIndex);
  } else {
    _statement.bindString(_argIndex, datasetName);
  }
  _argIndex = 2;
  for (String _item : fieldTypes) {
    if (_item == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<FilledAutofillField>> _collectionFilledAutofillFields = new ArrayMap<String, ArrayList<FilledAutofillField>>();
    final int _cursorIndexOfMId = _cursor.getColumnIndexOrThrow("id");
    final int _cursorIndexOfMDatasetName = _cursor.getColumnIndexOrThrow("datasetName");
    final List<DatasetWithFilledAutofillFields> _result = new ArrayList<DatasetWithFilledAutofillFields>(_cursor.getCount());
    while(_cursor.moveToNext()) {
      final DatasetWithFilledAutofillFields _item_1;
      final AutofillDataset _tmpAutofillDataset;
      if (! (_cursor.isNull(_cursorIndexOfMId) && _cursor.isNull(_cursorIndexOfMDatasetName))) {
        final String _tmpMId;
        _tmpMId = _cursor.getString(_cursorIndexOfMId);
        final String _tmpMDatasetName;
        _tmpMDatasetName = _cursor.getString(_cursorIndexOfMDatasetName);
        _tmpAutofillDataset = new AutofillDataset(_tmpMId,_tmpMDatasetName,null);
      }  else  {
        _tmpAutofillDataset = null;
      }
      _item_1 = new DatasetWithFilledAutofillFields();
      if (!_cursor.isNull(_cursorIndexOfMId)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMId);
        ArrayList<FilledAutofillField> _tmpCollection = _collectionFilledAutofillFields.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<FilledAutofillField>();
          _collectionFilledAutofillFields.put(_tmpKey, _tmpCollection);
        }
        _item_1.filledAutofillFields = _tmpCollection;
      }
      _item_1.autofillDataset = _tmpAutofillDataset;
      _result.add(_item_1);
    }
    __fetchRelationshipFilledAutofillFieldAscomExampleAndroidAutofillServiceModelFilledAutofillField(_collectionFilledAutofillFields);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
Example 19
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public List<DatasetWithFilledAutofillFields> getAllDatasets() {
  final String _sql = "SELECT DISTINCT id, datasetName FROM FilledAutofillField, AutofillDataset WHERE AutofillDataset.id = FilledAutofillField.datasetId";
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<FilledAutofillField>> _collectionFilledAutofillFields = new ArrayMap<String, ArrayList<FilledAutofillField>>();
    final int _cursorIndexOfMId = _cursor.getColumnIndexOrThrow("id");
    final int _cursorIndexOfMDatasetName = _cursor.getColumnIndexOrThrow("datasetName");
    final List<DatasetWithFilledAutofillFields> _result = new ArrayList<DatasetWithFilledAutofillFields>(_cursor.getCount());
    while(_cursor.moveToNext()) {
      final DatasetWithFilledAutofillFields _item;
      final AutofillDataset _tmpAutofillDataset;
      if (! (_cursor.isNull(_cursorIndexOfMId) && _cursor.isNull(_cursorIndexOfMDatasetName))) {
        final String _tmpMId;
        _tmpMId = _cursor.getString(_cursorIndexOfMId);
        final String _tmpMDatasetName;
        _tmpMDatasetName = _cursor.getString(_cursorIndexOfMDatasetName);
        _tmpAutofillDataset = new AutofillDataset(_tmpMId,_tmpMDatasetName,null);
      }  else  {
        _tmpAutofillDataset = null;
      }
      _item = new DatasetWithFilledAutofillFields();
      if (!_cursor.isNull(_cursorIndexOfMId)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMId);
        ArrayList<FilledAutofillField> _tmpCollection = _collectionFilledAutofillFields.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<FilledAutofillField>();
          _collectionFilledAutofillFields.put(_tmpKey, _tmpCollection);
        }
        _item.filledAutofillFields = _tmpCollection;
      }
      _item.autofillDataset = _tmpAutofillDataset;
      _result.add(_item);
    }
    __fetchRelationshipFilledAutofillFieldAscomExampleAndroidAutofillServiceModelFilledAutofillField(_collectionFilledAutofillFields);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
Example 20
Source File: AutofillDao_Impl.java    From android-AutofillFramework with Apache License 2.0 4 votes vote down vote up
@Override
public List<DatasetWithFilledAutofillFields> getDatasets(List<String> allAutofillHints) {
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT DISTINCT id, datasetName FROM FilledAutofillField, AutofillDataset WHERE AutofillDataset.id = FilledAutofillField.datasetId AND FilledAutofillField.fieldTypeName IN (");
  final int _inputSize = allAutofillHints.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : allAutofillHints) {
    if (_item == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<FilledAutofillField>> _collectionFilledAutofillFields = new ArrayMap<String, ArrayList<FilledAutofillField>>();
    final int _cursorIndexOfMId = _cursor.getColumnIndexOrThrow("id");
    final int _cursorIndexOfMDatasetName = _cursor.getColumnIndexOrThrow("datasetName");
    final List<DatasetWithFilledAutofillFields> _result = new ArrayList<DatasetWithFilledAutofillFields>(_cursor.getCount());
    while(_cursor.moveToNext()) {
      final DatasetWithFilledAutofillFields _item_1;
      final AutofillDataset _tmpAutofillDataset;
      if (! (_cursor.isNull(_cursorIndexOfMId) && _cursor.isNull(_cursorIndexOfMDatasetName))) {
        final String _tmpMId;
        _tmpMId = _cursor.getString(_cursorIndexOfMId);
        final String _tmpMDatasetName;
        _tmpMDatasetName = _cursor.getString(_cursorIndexOfMDatasetName);
        _tmpAutofillDataset = new AutofillDataset(_tmpMId,_tmpMDatasetName,null);
      }  else  {
        _tmpAutofillDataset = null;
      }
      _item_1 = new DatasetWithFilledAutofillFields();
      if (!_cursor.isNull(_cursorIndexOfMId)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMId);
        ArrayList<FilledAutofillField> _tmpCollection = _collectionFilledAutofillFields.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<FilledAutofillField>();
          _collectionFilledAutofillFields.put(_tmpKey, _tmpCollection);
        }
        _item_1.filledAutofillFields = _tmpCollection;
      }
      _item_1.autofillDataset = _tmpAutofillDataset;
      _result.add(_item_1);
    }
    __fetchRelationshipFilledAutofillFieldAscomExampleAndroidAutofillServiceModelFilledAutofillField(_collectionFilledAutofillFields);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}