java类android.support.annotation.Keep的实例源码

SeekBarWidget.java 文件源码 项目:android_ui 阅读 49 收藏 0 点赞 0 评论 0
/**
 * Specifies a transformation for the discrete components. Depends on the implementation,
 * this can change alpha value of some discrete components or theirs current scale for example.
 * <p>
 * This method can be used to animate revealing/concealing of the discrete components or theirs
 * immediate hiding/showing.
 *
 * @param transformation The desired transformation from the range {@code [0.0, 1.0]}.
 *                       Transformation {@code 0.0} means that discrete components will be
 *                       hided, {@code 1.0} means that they will be visible.
 */
@Keep
void setDiscreteTransformation(float transformation) {
    if (this.transformation != transformation) {
        this.transformation = transformation;
        // Scale up/down the discrete indicator and the thumb in a way when one is fully scaled
        // up the other is fully scaled down and reversed.
        setThumbScale(1 - transformation);
        setDiscreteIndicatorScale(transformation);

        // Fade in/out the text of discrete indicator during the indicator is at least 75% transformed/visible.
        if (transformation > 0.75) {
            final int alpha = Math.round((transformation - 0.75f) / 0.25f * 255);
            setDiscreteIndicatorTextAlpha(alpha);
        } else {
            setDiscreteIndicatorTextAlpha(0);
        }

        // Fade in/out discrete interval.
        setDiscreteIntervalAlpha(Math.round(transformation * 255));
        invalidate();
    }
}
UsbSerialProber.java 文件源码 项目:usb-with-serial-port 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Probes a single device for a compatible driver.
 *
 * @param usbDevice the usb device to probe
 *
 * @return a new {@link UsbSerialDriver} compatible with this device, or
 * {@code null} if none available.
 */
@Keep
public UsbSerialDriver probeDevice(final UsbDevice usbDevice) {
    final int vendorId = usbDevice.getVendorId();
    final int productId = usbDevice.getProductId();
    final Class<? extends UsbSerialDriver> driverClass = mProbeTable.findDriver(vendorId, productId);
    if (driverClass != null) {
        final UsbSerialDriver driver;
        try {
            final Constructor<? extends UsbSerialDriver> constructor = driverClass.getConstructor(UsbDevice.class);
            driver = constructor.newInstance(usbDevice);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return driver;
    }
    return null;
}
DataInitializer.java 文件源码 项目:Pioneer 阅读 43 收藏 0 点赞 0 评论 0
@Subscribe @Keep
public void onAppInitializeRequest(AppInitializeRequestEvent event) {
    // 构造的时候无法执行注入, 推迟到需要的时候再注入
    initialize();

    File dbInCache = new File(cacheDir, "db/store.db");
    if (cacheDir != null && !dbInCache.exists()) {
        appBus.post(new AppInitializeReportEvent("正在缓存数据库"));
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            return;
        }
        if (IoUtils.ensureDirsExist(dbInCache.getParentFile())) {
            IoUtils.copyAssets(AppMain.app().getAssets(), Assets.STORE_DB, dbInCache);
        } else {
            Timber.w("Can't ensure cache dir");
        }
    }
}
DataInitializer.java 文件源码 项目:Pioneer 阅读 33 收藏 0 点赞 0 评论 0
@Subscribe @Keep
public void onAppInitializeRequest(AppInitializeRequestEvent event) {
    // 构造的时候无法执行注入, 推迟到需要的时候再注入
    initialize();

    File dbInCache = new File(cacheDir, "db/store.db");
    if (cacheDir != null && !dbInCache.exists()) {
        appBus.post(new AppInitializeReportEvent("正在缓存数据库"));
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            return;
        }
        if (IoUtils.ensureDirsExist(dbInCache.getParentFile())) {
            IoUtils.copyAssets(AppMain.app().getAssets(), Assets.STORE_DB, dbInCache);
        } else {
            Timber.w("Can't ensure cache dir");
        }
    }
}
EUExBase.java 文件源码 项目:appcan-android 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 获取callbackId ,-1为无效值
 * @param callbackIdStr
 * @return 为空或转换失败时返回-1
 */
@Keep
int valueOfCallbackId(String callbackIdStr){
    int callbackId=-1;
    if (TextUtils.isEmpty(callbackIdStr)||callbackIdStr.equals("null")){
        return callbackId;
    }
    try{
        callbackId=Integer.parseInt(callbackIdStr);
    }catch (Exception e){
        if (BDebug.DEBUG){
            e.printStackTrace();
        }
    }
    return callbackId;
}
TestProguard.java 文件源码 项目:android-state 阅读 35 收藏 0 点赞 0 评论 0
@Keep
public void verifyValue(int value) {
    if (test1 != value) {
        throw new IllegalStateException();
    }
    if (getTest2() != value) {
        throw new IllegalStateException();
    }
    if (test3 != value) {
        throw new IllegalStateException();
    }
}
TestProguardBundler.java 文件源码 项目:android-state 阅读 28 收藏 0 点赞 0 评论 0
@Keep
public void setValue(int value) {
    mData2.int1 = value;
    mData2.int2 = value;
    mDataReflOtherName.int1 = value;
    mDataReflOtherName.int2 = value;
}
TestProguardBundler.java 文件源码 项目:android-state 阅读 34 收藏 0 点赞 0 评论 0
@Keep
public void verifyValue(int value) {
    if (mData2.int1 != value) {
        throw new IllegalStateException();
    }
    if (mData2.int2 != value) {
        throw new IllegalStateException();
    }
    if (mDataReflOtherName.int1 != value) {
        throw new IllegalStateException();
    }
    if (mDataReflOtherName.int2 != value) {
        throw new IllegalStateException();
    }
}
AllAppsBackgroundDrawable.java 文件源码 项目:LaunchEnr 阅读 35 收藏 0 点赞 0 评论 0
@Override
@Keep
public void setAlpha(int alpha) {
    mHand.setAlpha(alpha);
    for (int i = 0; i < mIcons.length; i++) {
        mIcons[i].setAlpha(alpha);
    }
    invalidateSelf();
}
MainActivity.java 文件源码 项目:Chidori 阅读 33 收藏 0 点赞 0 评论 0
@Keep
public void onEvent(String action) {
    // 垃圾小米 rom 里把 append 方法给删了
    // mTextView.append("接收到消息:" + t + "\n");

    mTextView.setText(null);
    String str = mTextView.getText().toString();
    mTextView.setText(str + "接收到:" + action + "\n");

    Log.d("kymjs", "kymjs=======demo=====" + action);
}
MainActivity.java 文件源码 项目:Chidori 阅读 33 收藏 0 点赞 0 评论 0
@Keep
public void onEvent(String action) {
    // 垃圾小米 rom 里把 append 方法给删了
    // mTextView.append("接收到消息:" + t + "\n");
    String str = mTextView.getText().toString();
    mTextView.setText(str + "接收到:" + action + "\n");

    Log.d("kymjs", "kymjs======sample======" + action);
}
InternalEpubBridge.java 文件源码 项目:EpubReaderAndroid 阅读 32 收藏 0 点赞 0 评论 0
@Keep
@JavascriptInterface
public void onLocationChanged(String xPath) {
    if (xPath == null) {
        return;
    }
    xPathSubject.onNext(xPath);
}
SlideCard.java 文件源码 项目:Tangram-Android 阅读 32 收藏 0 点赞 0 评论 0
@Keep
public void parseMeta(Event event) {
    try {
        if (mTotalPageCount != Integer.MAX_VALUE) {
            storeCache();
        }
        mIndex = Integer.parseInt(event.args.get(KEY_INDEX));
        mTotalPageCount = Integer.parseInt(event.args.get(KEY_PAGE_COUNT));
    } catch (Exception e) {
    }
}
LoginViewModel.java 文件源码 项目:OpenYOLO-Android 阅读 36 收藏 0 点赞 0 评论 0
/**
 * Creates the view model, with the required application reference.
 */
@Keep
public LoginViewModel(Application application) {
    super(application);
    mApplication = OpenYoloDemoApplication.getInstance(application);
    mUserDataSource = mApplication.getUserRepository();
    mCredentialClient = CredentialClient.getInstance(mApplication);
}
SpannedGridLayoutManager.java 文件源码 项目:Here 阅读 34 收藏 0 点赞 0 评论 0
@Keep /* XML constructor, see RecyclerView#createLayoutManager */
public SpannedGridLayoutManager(
        Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.SpannedGridLayoutManager, defStyleAttr, defStyleRes);
    columns = a.getInt(R.styleable.SpannedGridLayoutManager_spanCount, 1);
    parseAspectRatio(a.getString(R.styleable.SpannedGridLayoutManager_aspectRatio));
    // TODO use this!
    int orientation = a.getInt(
            R.styleable.SpannedGridLayoutManager_android_orientation, RecyclerView.VERTICAL);
    a.recycle();
    setAutoMeasureEnabled(true);
}
SpannedGridLayoutManager.java 文件源码 项目:RetroMusicPlayer 阅读 39 收藏 0 点赞 0 评论 0
@Keep /* XML constructor, see RecyclerView#createLayoutManager */
public SpannedGridLayoutManager(
        Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.SpannedGridLayoutManager, defStyleAttr, defStyleRes);
    columns = a.getInt(R.styleable.SpannedGridLayoutManager_spanCount, 1);
    parseAspectRatio(a.getString(R.styleable.SpannedGridLayoutManager_aspectRatio));
    // TODO use this!
    int orientation = a.getInt(
            R.styleable.SpannedGridLayoutManager_android_orientation, RecyclerView.VERTICAL);
    a.recycle();
    setAutoMeasureEnabled(true);
}
SQLiteMigrations.java 文件源码 项目:Android-Migrator 阅读 29 收藏 0 点赞 0 评论 0
/**
 * New migrations from default assets folder.
 *
 * @param context current application context.
 */
@Keep
public SQLiteMigrations(
    @NonNull final Context context
) {
    this(context, DEFAULT_FOLDER);
}
SQLiteMigrations.java 文件源码 项目:Android-Migrator 阅读 80 收藏 0 点赞 0 评论 0
/**
 * New migrations from custom assets folder.
 *
 * @param context current application content.
 * @param folder  custom folder.
 */
@Keep
public SQLiteMigrations(
    @NonNull final Context context,
    @NonNull final String folder
) {
    this.context = context;
    this.folder = folder;
}
ChatRoomFragment.java 文件源码 项目:BizareChat 阅读 31 收藏 0 点赞 0 评论 0
@Subscribe(threadMode = ThreadMode.MAIN)
@Keep
public void onPrivateMessageEvent(PrivateMessageEvent event) {
    if (presenter.getType() == DialogsType.PRIVATE_CHAT) {
        presenter.processPrivateMessage(event.getMessage());
    }
}
ChatRoomFragment.java 文件源码 项目:BizareChat 阅读 31 收藏 0 点赞 0 评论 0
@Subscribe(threadMode = ThreadMode.MAIN)
@Keep
public void onPublicMessageEvent(PublicMessageEvent event) {
    if (presenter.getType() != DialogsType.PRIVATE_CHAT) {
        presenter.processPublicMessage(event.getMessage());
    }
}
RecaptchaV1Task.java 文件源码 项目:android-recaptcha 阅读 28 收藏 0 点赞 0 评论 0
@Keep
@JavascriptInterface
public void onGetChallenge(String challenge) {
  if (failureRunnable != null) {
    handler.removeCallbacks(failureRunnable);
    failureRunnable = null;
  } else {
    // FailureRunnable has run
    return;
  }

  final String finalChallenge = challenge;
  final String finalImage = image;
  final boolean success = !TextUtils.isEmpty(challenge) || !TextUtils.isEmpty(image);

  handler.post(new Runnable() {
    @Override
    public void run() {
      if (!destroyed) {
        destroyed = true;
        webView.destroy();
        if (success) {
          callback.onSuccess(finalChallenge, finalImage);
        } else {
          callback.onFailure();
        }
      }
    }
  });
}
UsbSerialProber.java 文件源码 项目:usb-with-serial-port 阅读 36 收藏 0 点赞 0 评论 0
/**
 * Finds and builds all possible {@link UsbSerialDriver UsbSerialDrivers}
 * from the currently-attached {@link UsbDevice} hierarchy. This method does
 * not require permission from the Android USB system, since it does not
 * open any of the devices.
 *
 * @param usbManager
 * @return a list, possibly empty, of all compatible drivers
 */
@Keep
public List<UsbSerialDriver> findAllDrivers(final UsbManager usbManager) {
    final List<UsbSerialDriver> result = new ArrayList<UsbSerialDriver>();
    HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
    Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
    while (deviceIterator.hasNext()) {
        UsbDevice usbDevice = deviceIterator.next();
        UsbSerialDriver driver = probeDevice(usbDevice);
        if (driver != null) {
            result.add(driver);
        }
    }
    return result;
}
SpannedGridLayoutManager.java 文件源码 项目:android-multipleGridRecyclerView-library 阅读 35 收藏 0 点赞 0 评论 0
@Keep /* XML constructor, see RecyclerView#createLayoutManager */
public SpannedGridLayoutManager(
        Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.SpannedGridLayoutManager, defStyleAttr, defStyleRes);
    columns = a.getInt(R.styleable.SpannedGridLayoutManager_spanCount, 1);
    parseAspectRatio(a.getString(R.styleable.SpannedGridLayoutManager_aspectRatio));
    // TODO use this!
    int orientation = a.getInt(
            R.styleable.SpannedGridLayoutManager_android_orientation, RecyclerView.VERTICAL);
    a.recycle();
    setAutoMeasureEnabled(true);
}
FABLayout.java 文件源码 项目:ocreader 阅读 35 收藏 0 点赞 0 评论 0
@Keep
public void setFabBackgroundColor(int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ColorStateList colorStateList = ColorStateList.valueOf(color);
        for (int i = 0; i < getChildCount(); i++) {
            View view = getChildAt(i);
            if (view instanceof FloatingActionButton)
                view.setBackgroundTintList(colorStateList);
        }
    }
}
ItemPagerActivity.java 文件源码 项目:ocreader 阅读 34 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Keep
@Override
void setStatusBarColor(int backgroundColor) {
    int statusbarColor = changeLightness(backgroundColor, 0.7f);
    getWindow().setStatusBarColor(statusbarColor);
    super.setStatusBarColor(backgroundColor);
}
SharedElementTransition.java 文件源码 项目:react-native-navigation 阅读 34 收藏 0 点赞 0 评论 0
@Keep
public void setTextColor(double[] color) {
    if (child instanceof TextView) {
        ViewUtils.setSpanColor(spannableText, ColorUtils.labToColor(color));
        ((TextView) child).setText(spannableText);
    }
}
StaggeredDistanceSlide.java 文件源码 项目:android-proguards 阅读 34 收藏 0 点赞 0 评论 0
@Keep
public StaggeredDistanceSlide(Context context, AttributeSet attrs) {
    super(context, attrs);
    final TypedArray a =
            context.obtainStyledAttributes(attrs, R.styleable.StaggeredDistanceSlide);
    spread = a.getInteger(R.styleable.StaggeredDistanceSlide_spread, spread);
    a.recycle();
}
SpannedGridLayoutManager.java 文件源码 项目:kits 阅读 43 收藏 0 点赞 0 评论 0
@Keep /* XML constructor, see RecyclerView#createLayoutManager */
public SpannedGridLayoutManager(
        Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.SpannedGridLayoutManager, defStyleAttr, defStyleRes);
    columns = a.getInt(R.styleable.SpannedGridLayoutManager_spanCount, 1);
    parseAspectRatio(a.getString(R.styleable.SpannedGridLayoutManager_aspectRatio));
    // TODO use this!
    int orientation = a.getInt(
            R.styleable.SpannedGridLayoutManager_android_orientation, RecyclerView.VERTICAL);
    a.recycle();
    setAutoMeasureEnabled(true);
}
DrawerBehavior.java 文件源码 项目:DrawerBehavior 阅读 32 收藏 0 点赞 0 评论 0
@Keep @SuppressWarnings("unused") // Instantiated reflectively from layout XML.
public DrawerBehavior(Context context, AttributeSet attrs) {
  super(context, attrs);
  TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DrawerBehavior);
  int gravity =
      a.getInteger(R.styleable.DrawerBehavior_android_layout_gravity, GravityCompat.END);
  a.recycle();

  validateGravity(gravity);
  this.gravity = gravity;
}
MainActivity.java 文件源码 项目:bachamada 阅读 32 收藏 0 点赞 0 评论 0
@Keep
public void onEvent(final OnDeleteFCEvent deleteFCEvent) {

    mDbHelper.deleteFC(deleteFCEvent.getId());
    updateBpmMinMax();
    mZoneBPMFrag.updateZone();

}


问题


面经


文章

微信
公众号

扫码关注公众号