本文整理汇总了Java中android.support.annotation.Keep类的典型用法代码示例。如果您正苦于以下问题:Java Keep类的具体用法?Java Keep怎么用?Java Keep使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Keep类属于android.support.annotation包,在下文中一共展示了Keep类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDiscreteTransformation
import android.support.annotation.Keep; //导入依赖的package包/类
/**
* 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();
}
}
示例2: probeDevice
import android.support.annotation.Keep; //导入依赖的package包/类
/**
* 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;
}
示例3: onAppInitializeRequest
import android.support.annotation.Keep; //导入依赖的package包/类
@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");
}
}
}
示例4: valueOfCallbackId
import android.support.annotation.Keep; //导入依赖的package包/类
/**
* 获取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;
}
示例5: verifyValue
import android.support.annotation.Keep; //导入依赖的package包/类
@Keep
public void verifyValue(int value) {
if (test1 != value) {
throw new IllegalStateException();
}
if (getTest2() != value) {
throw new IllegalStateException();
}
if (test3 != value) {
throw new IllegalStateException();
}
}
示例6: setValue
import android.support.annotation.Keep; //导入依赖的package包/类
@Keep
public void setValue(int value) {
mData2.int1 = value;
mData2.int2 = value;
mDataReflOtherName.int1 = value;
mDataReflOtherName.int2 = value;
}
示例7: verifyValue
import android.support.annotation.Keep; //导入依赖的package包/类
@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();
}
}
示例8: setAlpha
import android.support.annotation.Keep; //导入依赖的package包/类
@Override
@Keep
public void setAlpha(int alpha) {
mHand.setAlpha(alpha);
for (int i = 0; i < mIcons.length; i++) {
mIcons[i].setAlpha(alpha);
}
invalidateSelf();
}
示例9: onEvent
import android.support.annotation.Keep; //导入依赖的package包/类
@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);
}
示例10: onEvent
import android.support.annotation.Keep; //导入依赖的package包/类
@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);
}
示例11: onLocationChanged
import android.support.annotation.Keep; //导入依赖的package包/类
@Keep
@JavascriptInterface
public void onLocationChanged(String xPath) {
if (xPath == null) {
return;
}
xPathSubject.onNext(xPath);
}
示例12: parseMeta
import android.support.annotation.Keep; //导入依赖的package包/类
@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) {
}
}
示例13: LoginViewModel
import android.support.annotation.Keep; //导入依赖的package包/类
/**
* 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);
}
示例14: SpannedGridLayoutManager
import android.support.annotation.Keep; //导入依赖的package包/类
@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);
}
示例15: SQLiteMigrations
import android.support.annotation.Keep; //导入依赖的package包/类
/**
* New migrations from default assets folder.
*
* @param context current application context.
*/
@Keep
public SQLiteMigrations(
@NonNull final Context context
) {
this(context, DEFAULT_FOLDER);
}