本文整理匯總了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);
}