Java 类android.support.annotation.Keep 实例源码

项目:android_ui    文件:SeekBarWidget.java   
/**
 * 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();
    }
}
项目:usb-with-serial-port    文件:UsbSerialProber.java   
/**
 * 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;
}
项目:Pioneer    文件:DataInitializer.java   
@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");
        }
    }
}
项目:Pioneer    文件:DataInitializer.java   
@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");
        }
    }
}
项目:appcan-android    文件:EUExBase.java   
/**
 * 获取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;
}
项目:android-state    文件:TestProguard.java   
@Keep
public void verifyValue(int value) {
    if (test1 != value) {
        throw new IllegalStateException();
    }
    if (getTest2() != value) {
        throw new IllegalStateException();
    }
    if (test3 != value) {
        throw new IllegalStateException();
    }
}
项目:android-state    文件:TestProguardBundler.java   
@Keep
public void setValue(int value) {
    mData2.int1 = value;
    mData2.int2 = value;
    mDataReflOtherName.int1 = value;
    mDataReflOtherName.int2 = value;
}
项目:android-state    文件:TestProguardBundler.java   
@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();
    }
}
项目:LaunchEnr    文件:AllAppsBackgroundDrawable.java   
@Override
@Keep
public void setAlpha(int alpha) {
    mHand.setAlpha(alpha);
    for (int i = 0; i < mIcons.length; i++) {
        mIcons[i].setAlpha(alpha);
    }
    invalidateSelf();
}
项目:Chidori    文件:MainActivity.java   
@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);
}
项目:Chidori    文件:MainActivity.java   
@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);
}
项目:EpubReaderAndroid    文件:InternalEpubBridge.java   
@Keep
@JavascriptInterface
public void onLocationChanged(String xPath) {
    if (xPath == null) {
        return;
    }
    xPathSubject.onNext(xPath);
}
项目:Tangram-Android    文件:SlideCard.java   
@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) {
    }
}
项目:OpenYOLO-Android    文件:LoginViewModel.java   
/**
 * 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);
}
项目:Here    文件:SpannedGridLayoutManager.java   
@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);
}
项目:RetroMusicPlayer    文件:SpannedGridLayoutManager.java   
@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);
}
项目:Android-Migrator    文件:SQLiteMigrations.java   
/**
 * New migrations from default assets folder.
 *
 * @param context current application context.
 */
@Keep
public SQLiteMigrations(
    @NonNull final Context context
) {
    this(context, DEFAULT_FOLDER);
}
项目:Android-Migrator    文件:SQLiteMigrations.java   
/**
 * 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;
}
项目:BizareChat    文件:ChatRoomFragment.java   
@Subscribe(threadMode = ThreadMode.MAIN)
@Keep
public void onPrivateMessageEvent(PrivateMessageEvent event) {
    if (presenter.getType() == DialogsType.PRIVATE_CHAT) {
        presenter.processPrivateMessage(event.getMessage());
    }
}
项目:BizareChat    文件:ChatRoomFragment.java   
@Subscribe(threadMode = ThreadMode.MAIN)
@Keep
public void onPublicMessageEvent(PublicMessageEvent event) {
    if (presenter.getType() != DialogsType.PRIVATE_CHAT) {
        presenter.processPublicMessage(event.getMessage());
    }
}
项目:android-recaptcha    文件:RecaptchaV1Task.java   
@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();
        }
      }
    }
  });
}
项目:usb-with-serial-port    文件:UsbSerialProber.java   
/**
 * 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;
}
项目:android-multipleGridRecyclerView-library    文件:SpannedGridLayoutManager.java   
@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);
}
项目:ocreader    文件:FABLayout.java   
@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);
        }
    }
}
项目:ocreader    文件:ItemPagerActivity.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Keep
@Override
void setStatusBarColor(int backgroundColor) {
    int statusbarColor = changeLightness(backgroundColor, 0.7f);
    getWindow().setStatusBarColor(statusbarColor);
    super.setStatusBarColor(backgroundColor);
}
项目:react-native-navigation    文件:SharedElementTransition.java   
@Keep
public void setTextColor(double[] color) {
    if (child instanceof TextView) {
        ViewUtils.setSpanColor(spannableText, ColorUtils.labToColor(color));
        ((TextView) child).setText(spannableText);
    }
}
项目:android-proguards    文件:StaggeredDistanceSlide.java   
@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();
}
项目:kits    文件:SpannedGridLayoutManager.java   
@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    文件:DrawerBehavior.java   
@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;
}
项目:bachamada    文件:MainActivity.java   
@Keep
public void onEvent(final OnDeleteFCEvent deleteFCEvent) {

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

}
项目:Jockey    文件:GestureView.java   
/**
 * Sets the current radius of the overlay background. This method is used by an
 * {@link ObjectAnimator} to animate completion events and shouldn't be used by external
 * classes because it will be overwritten.
 * @param radius The new radius of the background overlay
 */
@Keep
@SuppressWarnings("unused")
public void setRadius(int radius) {
    if (mOverlayEdge != null && mOverlayOrigin != null) {
        mOverlayEdge.x = mOverlayOrigin.x + radius;
        invalidate();
    }
}
项目:plaid    文件:StaggeredDistanceSlide.java   
@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();
}
项目:appcan-android    文件:BDebug.java   
@Keep
public static void sendUDPLog(String log){
    if (WDataManager.sRootWgt==null||WDataManager.sRootWgt.m_appdebug==0|| TextUtils.isEmpty(WDataManager.sRootWgt.m_logServerIp)){
        return;
    }
    Intent intent=new Intent(BConstant.app,DebugService.class);
    intent.putExtra(DebugService.KEY_TYPE_DEBUG,DebugService.TYPE_LOG);
    intent.putExtra(DebugService.KEY_LOG_DATA,log);
    BConstant.app.startService(intent);
}
项目:appcan-android    文件:BUtility.java   
/**
 * 获取真实的路径,同时拷贝res协议文件到sd卡缓存目录
 *
 * @param mBrwView
 * @param url      AppCan协议路径
 * @return
 */
@Keep
public static String getRealPathWithCopyRes(EBrowserView mBrwView, String url) {
    String realPath = makeRealPath(url, mBrwView);
    if (realPath.startsWith("/") && !realPath.startsWith("/data")) {
        return realPath;
    }
    return getResLocalPath(mBrwView.getContext(), realPath);
}
项目:appcan-android    文件:EUExBase.java   
@Keep
public static void callBackJs(EBrowserView eBrowserView,String methodName, String jsonData){
    if (eBrowserView == null) {
        BDebug.e("mBrwView is null...");
        return;
    }
    String js = SCRIPT_HEADER + "if(" + methodName + "){"
            + methodName + "('" + jsonData + "');}else{console.log('function "+methodName +" not found.')}";
    callbackToJs(eBrowserView,js);
}
项目:appcan-android    文件:EUExBase.java   
@Keep
public static void callBackJsObject(EBrowserView eBrowserView,String methodName, Object value){
    if (eBrowserView == null) {
        BDebug.e("mBrwView is null...");
        return;
    }
    String js = SCRIPT_HEADER + "if(" + methodName + "){"
            + methodName + "(" + value + ");}else{console.log('function "+methodName +" not found.')}";
    callbackToJs(eBrowserView,js);
}
项目:appcan-android    文件:EUExBase.java   
/**
 * 异步回调到JS
 * @param callbackId 回调ID,该值由插件接口被调用时传入
 * @param hasNext 是否有下一次回调。没有传false ,有传true
 * @param args 参数可以是任何对象,直接回调对象可使用DataHelper.gson.toJsonTree()方法
 */
@Keep
public void callbackToJs(int callbackId,boolean hasNext,Object... args){
    if (null != mBrwView) {

        int flag=hasNext?1:0;
        final StringBuilder sb=new StringBuilder("javascript:uexCallback.callback(");
        sb.append(callbackId).append(",").append(flag);
        for (Object obj:args){
            sb.append(",");
            boolean isStrArg = obj instanceof String;
            if (isStrArg) {
                sb.append("\'");
            }
            sb.append(String.valueOf(obj));
            if (isStrArg) {
                sb.append("\'");
            }
         }
        sb.append(");");
        BDebug.i(sb.toString());
        //在主线程回调
        if (mContext!=null&&mContext instanceof Activity){
            ((Activity)mContext).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (null != mBrwView) {
                        mBrwView.loadUrl(sb.toString());
                    }
                }
            });
        }else{
            callbackToJs(mBrwView,sb.toString());
        }
     }
}
项目:appcan-android    文件:EUExBase.java   
/**
 * 区分接口收到的参数,简单判断字符串是否是json格式的String,没有必要完整校验一遍
 * @param str
 * @return
 */
@Keep
boolean isJsonString(String str){
    if (TextUtils.isEmpty(str)){
        return false;
    }
    return str.startsWith("{") && str.endsWith("}")||
            str.startsWith("[") && str.endsWith("]");
}
项目:appcan-android    文件:EUExBase.java   
/**
 * 判断数组的第一个是否存在并且是Json格式
 * @param params
 * @return
 */
@Keep
boolean isFirstParamExistAndIsJson(String[] params){
    if (params==null||params.length==0){
        return false;
    }
    return isJsonString(params[0]);
}
项目:sketch    文件:Sketch.java   
/**
 * 修整内存缓存,4.0 以下你需要重写 {@link Application#onTrimMemory(int)} 方法,然后调用这个方法
 *
 * @param level 修剪级别,对应 APP 的不同状态,对应 {@link ComponentCallbacks2} 里的常量
 */
@Keep
public void onTrimMemory(int level) {
    SLog.w(null, "Trim of memory, level= %s", SketchUtils.getTrimLevelName(level));

    configuration.getMemoryCache().trimMemory(level);
    configuration.getBitmapPool().trimMemory(level);
}