当前位置: 首页>>代码示例>>Java>>正文


Java RestrictTo类代码示例

本文整理汇总了Java中android.support.annotation.RestrictTo的典型用法代码示例。如果您正苦于以下问题:Java RestrictTo类的具体用法?Java RestrictTo怎么用?Java RestrictTo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RestrictTo类属于android.support.annotation包,在下文中一共展示了RestrictTo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onJobCompleted

import android.support.annotation.RestrictTo; //导入依赖的package包/类
/**
 * Notify the scheduler that a job finished executing.
 *
 * Handle scheduler changes by cancelling it in the old scheduler and scheduling it in the new scheduler.
 */
@RestrictTo(RestrictTo.Scope.LIBRARY)
public void onJobCompleted(int jobId, boolean needsReschedule) {
    synchronized (JobStore.LOCK) {
        JobStatus jobStatus = jobStore.getJob(jobId);
        if (jobStatus != null) {
            jobStore.remove(jobId);
            if (needsReschedule) {
                jobStore.add(getRescheduleJobForFailure(jobStatus));
            } else if (jobStatus.isPeriodic()) {
                jobStore.add(getRescheduleJobForPeriodic(jobStatus));
            }
            getSchedulerForTag(context, jobStatus.getSchedulerTag()).onJobCompleted(jobId, needsReschedule);
        }
    }
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:21,代码来源:JobScheduler.java

示例2: call

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@Override
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public <T> Observable<T> queue(final Operation<T> operation) {
    return Observable.create(new Action1<Emitter<T>>() {
        @Override
        public void call(Emitter<T> tEmitter) {
            final FIFORunnableEntry entry = new FIFORunnableEntry<>(operation, tEmitter);
            tEmitter.setCancellation(new Cancellable() {
                @Override
                public void cancel() throws Exception {
                    if (queue.remove(entry)) {
                        logOperationRemoved(operation);
                    }
                }
            });
            logOperationQueued(operation);
            queue.add(entry);
        }
    }, Emitter.BackpressureMode.NONE);
}
 
开发者ID:Polidea,项目名称:RxAndroidBle,代码行数:21,代码来源:ClientOperationQueueImpl.java

示例3: call

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@Override
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public synchronized <T> Observable<T> queue(final Operation<T> operation) {
    if (!shouldRun) {
        return Observable.error(disconnectionException);
    }
    return Observable.create(new Action1<Emitter<T>>() {
        @Override
        public void call(Emitter<T> tEmitter) {
            final FIFORunnableEntry entry = new FIFORunnableEntry<>(operation, tEmitter);

            tEmitter.setCancellation(new Cancellable() {
                @Override
                public void cancel() throws Exception {
                    if (queue.remove(entry)) {
                        logOperationRemoved(operation);
                    }
                }
            });

            logOperationQueued(operation);
            queue.add(entry);
        }
    }, Emitter.BackpressureMode.NONE);
}
 
开发者ID:Polidea,项目名称:RxAndroidBle,代码行数:26,代码来源:ConnectionOperationQueueImpl.java

示例4: getValueInternal

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@RestrictTo(RestrictTo.Scope.LIBRARY)
public T getValueInternal(
    float startFrame,
    float endFrame,
    T startValue,
    T endValue,
    float linearKeyframeProgress,
    float interpolatedKeyframeProgress,
    float overallProgress
) {
  if (value != null) {
    return value;
  }
  return getValue(startFrame, endFrame, startValue, endValue, linearKeyframeProgress,
      interpolatedKeyframeProgress, overallProgress);
}
 
开发者ID:airbnb,项目名称:lottie-android,代码行数:17,代码来源:LottieValueCallback.java

示例5: matches

import android.support.annotation.RestrictTo; //导入依赖的package包/类
/**
 * Returns whether they key matches at the specified depth.
 */
@SuppressWarnings("RedundantIfStatement")
@RestrictTo(RestrictTo.Scope.LIBRARY)
public boolean matches(String key, int depth) {
  if (isContainer(key)) {
    // This is an artificial layer we programatically create.
    return true;
  }
  if (depth >= keys.size()) {
    return false;
  }
  if (keys.get(depth).equals(key) ||
      keys.get(depth).equals("**") ||
      keys.get(depth).equals("*")) {
    return true;
  }
  return false;
}
 
开发者ID:airbnb,项目名称:lottie-android,代码行数:21,代码来源:KeyPath.java

示例6: incrementDepthBy

import android.support.annotation.RestrictTo; //导入依赖的package包/类
/**
 * For a given key and depth, returns how much the depth should be incremented by when
 * resolving a keypath to children.
 *
 * This can be 0 or 2 when there is a globstar and the next key either matches or doesn't match
 * the current key.
 */
@RestrictTo(RestrictTo.Scope.LIBRARY)
public int incrementDepthBy(String key, int depth) {
  if (isContainer(key)) {
    // If it's a container then we added programatically and it isn't a part of the keypath.
    return 0;
  }
  if (!keys.get(depth).equals("**")) {
    // If it's not a globstar then it is part of the keypath.
    return 1;
  }
  if (depth == keys.size() - 1) {
    // The last key is a globstar.
    return 0;
  }
  if (keys.get(depth + 1).equals(key)) {
    // We are a globstar and the next key is our current key so consume both.
    return 2;
  }
  return 0;
}
 
开发者ID:airbnb,项目名称:lottie-android,代码行数:28,代码来源:KeyPath.java

示例7: inflateFromResource

import android.support.annotation.RestrictTo; //导入依赖的package包/类
/**
 * Inflates a preference hierarchy from XML. If a preference hierarchy is
 * given, the new preference hierarchies will be merged in.
 *
 * @param context The context of the resource.
 * @param resId The resource ID of the XML to inflate.
 * @param rootPreferences Optional existing hierarchy to merge the new
 *            hierarchies into.
 * @return The root hierarchy (if one was not provided, the new hierarchy's
 *         root).
 * @hide
 */
@RestrictTo(LIBRARY_GROUP)
public PreferenceScreen inflateFromResource(Context context, int resId,
                                            PreferenceScreen rootPreferences) {
    // Block commits
    setNoCommit(true);

    final PreferenceInflater inflater = new PreferenceInflater(context, this);
    inflater.setDefaultPackages(getDefaultPackages());
    rootPreferences = (PreferenceScreen) inflater.inflate(resId, rootPreferences);
    rootPreferences.onAttachedToHierarchy(this);

    // Unblock commits
    setNoCommit(false);

    return rootPreferences;
}
 
开发者ID:RikkaW,项目名称:MaterialPreference,代码行数:29,代码来源:PreferenceManager.java

示例8: InvalidationTracker

import android.support.annotation.RestrictTo; //导入依赖的package包/类
/**
 * Used by the generated code.
 *
 * @hide
 */
@SuppressWarnings("WeakerAccess")
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public InvalidationTracker(RoomDatabase database, String... tableNames) {
    mDatabase = database;
    mObservedTableTracker = new ObservedTableTracker(tableNames.length);
    mTableIdLookup = new ArrayMap<>();
    final int size = tableNames.length;
    mTableNames = new String[size];
    for (int id = 0; id < size; id++) {
        final String tableName = tableNames[id].toLowerCase(Locale.US);
        mTableIdLookup.put(tableName, id);
        mTableNames[id] = tableName;
    }
    mTableVersions = new long[tableNames.length];
    Arrays.fill(mTableVersions, 0);
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:22,代码来源:InvalidationTracker.java

示例9: getItemViewType

import android.support.annotation.RestrictTo; //导入依赖的package包/类
/**
 * @hide
 * @deprecated
 */
@Override
@Deprecated
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public final int getItemViewType(int position) {
  if (isHeader(position)) {
    return getHeaderViewType(positionManager.sectionId(position));
  } else if (isFooter(position)) {
    return getFooterViewType(positionManager.footerId(position));
  } else {
    ItemCoord sectionAndPos = getRelativePosition(position);
    return getItemViewType(
        sectionAndPos.section(),
        // offset section view positions
        sectionAndPos.relativePos(),
        position - (sectionAndPos.section() + 1));
  }
}
 
开发者ID:afollestad,项目名称:sectioned-recyclerview,代码行数:22,代码来源:SectionedRecyclerViewAdapter.java

示例10: onBindViewHolder

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@RestrictTo(RestrictTo.Scope.LIBRARY) @Override
public final void onBindViewHolder(BaseViewHolder holder, int adapterPosition,
    List<Object> payloads) {
  ItemBinder baseBinder = binders.get(holder.getItemViewType());

  int totalCount = 0;
  for (BaseDataManager dataManager : dataManagers) {
    totalCount += dataManager.getCount();
    if (adapterPosition < totalCount) {
      int itemPosition = getItemPositionInManager(adapterPosition);
      if (dataManager instanceof DataGroupManager) {
        dataManager = ((DataGroupManager) dataManager).getDataManagerForPosition(itemPosition);
      }
      //noinspection unchecked
      holder.setItem(dataManager.getItem(itemPosition));
      break;
    }
  }

  if (null == payloads || payloads.size() == 0) {
    //noinspection unchecked
    baseBinder.bindViewHolder(holder, holder.getItem());
  } else {
    //noinspection unchecked
    baseBinder.bindViewHolder(holder, holder.getItem(), payloads);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:CoreRecyclerAdapter.java

示例11: getItemCount

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@RestrictTo(RestrictTo.Scope.LIBRARY) @Override public final int getItemCount() {
  int itemCount = 0;
  for (BaseDataManager dataManager : dataManagers) {
    itemCount += dataManager.size();
  }
  return itemCount;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:CoreRecyclerAdapter.java

示例12: getItemViewType

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@RestrictTo(RestrictTo.Scope.LIBRARY) @Override
public final int getItemViewType(int adapterPosition) {
  ItemBinder baseBinder = getBinderForPosition(adapterPosition);
  if (null != baseBinder) {
    return binders.indexOf(baseBinder);
  }
  return super.getItemViewType(adapterPosition);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:CoreRecyclerAdapter.java

示例13: PersistableBundle

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@RestrictTo(RestrictTo.Scope.LIBRARY)
public PersistableBundle(android.os.PersistableBundle bundle) {
    map = new HashMap<>(bundle.size());
    for (String key : bundle.keySet()) {
        Object value = bundle.get(key);
        if (value == null || value instanceof String || value instanceof Integer || value instanceof Long
                || value instanceof Double || value instanceof Boolean || value instanceof String[]
                || value instanceof int[] || value instanceof long[] || value instanceof double[]
                || value instanceof boolean[]) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1 && key.startsWith(PREFIX_BOOLEAN_COMPAT)) {
                key = key.substring(PREFIX_BOOLEAN_COMPAT.length());
                if (value instanceof Integer) {
                    Integer intValue = (Integer) value;
                    value = intValue != 0;
                } else if (value instanceof int[]) {
                    int[] intArrayValue = (int[]) value;
                    boolean[] boolArrayValue = new boolean[intArrayValue.length];
                    for (int i = 0; i < boolArrayValue.length; i++) {
                        boolArrayValue[i] = intArrayValue[i] != 0;
                    }
                    value = boolArrayValue;
                }
            }
            map.put(key, value);
        } else if (value instanceof android.os.PersistableBundle) {
            map.put(key, new PersistableBundle((android.os.PersistableBundle) value));
        } else {
            throw new IllegalArgumentException("Unsupported value type key=" + key + " value=" + value);
        }
    }
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:33,代码来源:PersistableBundle.java

示例14: toMap

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@RestrictTo(RestrictTo.Scope.LIBRARY)
public Map<String, ?> toMap(int depth) {
    if (depth <= 0) {
        return null;
    }
    Map<String, Object> map = new HashMap<>(this.map);
    for (String key : map.keySet()) {
        Object object = map.get(key);
        if (object instanceof PersistableBundle) {
            map.put(key, ((PersistableBundle) object).toMap(depth - 1));
        }
    }
    return map;
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:15,代码来源:PersistableBundle.java

示例15: JobParameters

import android.support.annotation.RestrictTo; //导入依赖的package包/类
@RestrictTo(RestrictTo.Scope.LIBRARY)
public JobParameters(int jobId, PersistableBundle extras, Bundle transientExtras, boolean overrideDeadlineExpired,
                     Uri[] triggeredContentUris, String[] triggeredContentAuthorities) {
    this.jobId = jobId;
    this.extras = extras;
    this.transientExtras = transientExtras;
    this.overrideDeadlineExpired = overrideDeadlineExpired;
    this.triggeredContentUris = triggeredContentUris;
    this.triggeredContentAuthorities = triggeredContentAuthorities;
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:11,代码来源:JobParameters.java


注:本文中的android.support.annotation.RestrictTo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。