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


Java RequiresApi类代码示例

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


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

示例1: onChildViewAdded

import android.support.annotation.RequiresApi; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public void onChildViewAdded(View parent, View child) {
    if (parent == RelativeRadioGroup.this && child instanceof RadioButton) {
        int id = child.getId();
        // generates an id if it's missing
        if (id == View.NO_ID) {
            id = View.generateViewId();
            child.setId(id);
        }
        ((RadioButton) child).setOnCheckedChangeListener(mChildOnCheckedChangeListener);
    }

    if (mOnHierarchyChangeListener != null) {
        mOnHierarchyChangeListener.onChildViewAdded(parent, child);
    }
}
 
开发者ID:mmb4rn0,项目名称:RelativeRadioGroup,代码行数:20,代码来源:RelativeRadioGroup.java

示例2: seven

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public Bitmap seven(Context context, Bitmap bitmap){
    renderScript=RenderScript.create(context);
    outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
    inputAllocation=Allocation.createFromBitmap(renderScript,bitmap);
    outputAllocation=Allocation.createTyped(renderScript,inputAllocation.getType());
    final  ScriptIntrinsicColorMatrix colorMatrix7 = ScriptIntrinsicColorMatrix.create(renderScript, Element.U8_4(renderScript));
    colorMatrix7.setColorMatrix(new android.renderscript.Matrix4f(new float[]
            {
                    1.22994596833595f, 0.0209523774645382f, 0.383244054685119f, 0f,
                    0.450138899443543f, 1.18737418804171f, -0.106933249401007f, 0f
                    - 0.340084867779496f, 0.131673434493755f, 1.06368919471589f, 0f,
                    0f, 0f, 0f,
                    11.91f, 11.91f, 11.91f, 0f}));
    colorMatrix7.forEach(inputAllocation, outputAllocation);
    outputAllocation.copyTo(outBitmap);
    return outBitmap;
}
 
开发者ID:hgayan7,项目名称:FilterLibrary,代码行数:19,代码来源:PhotoFilter.java

示例3: init

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
@Override
public Point init(Context context, Uri uri) throws Exception {
  Log.w(TAG, "Init!");
  if (!PartAuthority.isLocalUri(uri)) {
    passthrough = new SkiaImageRegionDecoder();
    return passthrough.init(context, uri);
  }

  MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);

  if (masterSecret == null) {
    throw new IllegalStateException("No master secret available...");
  }

  InputStream inputStream = PartAuthority.getAttachmentStream(context, masterSecret, uri);

  this.bitmapRegionDecoder = BitmapRegionDecoder.newInstance(inputStream, false);
  inputStream.close();

  return new Point(bitmapRegionDecoder.getWidth(), bitmapRegionDecoder.getHeight());
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:23,代码来源:AttachmentRegionDecoder.java

示例4: createNotificationChannel

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(Build.VERSION_CODES.O)
private String createNotificationChannel(){
    String channelId = "VBrowserNotification";
    String channelName = "前台下载通知";
    NotificationChannel chan = new NotificationChannel(channelId,
            channelName, NotificationManager.IMPORTANCE_HIGH);
    chan.setLightColor(Color.BLUE);
    chan.setImportance(NotificationManager.IMPORTANCE_NONE);
    chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
    NotificationManager service = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    service.createNotificationChannel(chan);
    return channelId;
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:14,代码来源:DownloadForegroundService.java

示例5: setAlarm

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.N)
public static void setAlarm(Context context,int hour, int minute, int second) {
    Calendar calendar = Calendar.getInstance();
    Calendar rightNow = Calendar.getInstance();
    calendar.set(Calendar.HOUR, hour);
    int timeOffset = hour - calendar.get(Calendar.HOUR);
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.set(Calendar.HOUR, hour - timeOffset);
    calendar.set(Calendar.MINUTE, minute);
    calendar.set(Calendar.SECOND, second);

    Intent intent = new Intent(context, AlarmReceiver.class);
    pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
    alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

    //set the alarm repeat one day
    alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
    Log.i("setting", String.valueOf(calendar.getTime()));
    Log.i("actual", String.valueOf(rightNow.getTime()));
}
 
开发者ID:MessageOnTap,项目名称:ImHome,代码行数:22,代码来源:AlarmUtils.java

示例6: setupFingerprintStuff

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.M)
public void setupFingerprintStuff() {
    fingerprintManager = (FingerprintManager) this.getSystemService(Context.FINGERPRINT_SERVICE);
    fingerprintHelper = new FingerprintHelper(this);
    try {
        generateKey();

        if (cipherInit()) {
            cryptoObject = new FingerprintManager.CryptoObject(cipher);
            fingerprintHelper.startAuth(fingerprintManager, cryptoObject);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:17,代码来源:AppLockActivity.java

示例7: onActivityResult

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    //PDF
    if (resultCode == RESULT_OK) {
        if (requestCode == SELECT_PDF) {

            Uri selectedUri_PDF = data.getData();
            InputStream inputstream;
            try {
                inputstream = getContentResolver().openInputStream(selectedUri_PDF);
                pdfview.fromStream(inputstream).load();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                Toast.makeText(PdfView.this, "unable to open", Toast.LENGTH_SHORT).show();
            }
        }
    }
    else
    {
        startActivity(new Intent(PdfView.this,Subjects.class));
        finish();
    }
}
 
开发者ID:Shobhit-pandey,项目名称:CollegeDoc,代码行数:26,代码来源:PdfView.java

示例8: createRippleDrawable

import android.support.annotation.RequiresApi; //导入依赖的package包/类
/**
 * Creates a new {@link RippleDrawable} introduced in Lollipop.
 *
 * @param normalColor  Color for the idle/normal state
 * @param rippleColor  Color for the ripple effect
 * @param bounds       Clipping bounds for the ripple state. Set to {@code null} to get a borderless ripple
 * @param cornerRadius Set to round the corners on rectangular drawables, 0 to disable
 * @return A fully colored RippleDrawable, new instance each time
 */
@NonNull
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static RippleDrawable createRippleDrawable(@ColorInt final int normalColor, @ColorInt final int rippleColor, @Nullable final Rect bounds,
                                                  @IntRange(from = 0) final int cornerRadius) {
    Drawable maskDrawable = null;
    if (bounds != null) {
        // clip color is white
        maskDrawable = createColoredDrawable(Color.WHITE, bounds);
        if (maskDrawable instanceof GradientDrawable) {
            ((GradientDrawable) maskDrawable).setCornerRadius(cornerRadius);
        }
        maskDrawable.setBounds(bounds);
    }

    Drawable normalStateDrawable = null;
    // transparent has no idle state
    if (normalColor != Color.TRANSPARENT) {
        normalStateDrawable = createColoredDrawable(normalColor, bounds);
        if (normalStateDrawable instanceof GradientDrawable) {
            ((GradientDrawable) normalStateDrawable).setCornerRadius(cornerRadius);
        }
    }

    return new RippleDrawable(ColorStateList.valueOf(rippleColor), normalStateDrawable, maskDrawable);
}
 
开发者ID:milosmns,项目名称:silly-android,代码行数:35,代码来源:Coloring.java

示例9: onCreate

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_trips_list);
    initializeToolbar();

    ivHero1 = (ImageView) findViewById(R.id.iv_hero_1);
    trip1Layout = (ViewGroup) findViewById(R.id.trip_1_layout);
    trip1Layout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Pair<View, String> p1 = Pair.create((View) ivHero1, ivHero1.getTransitionName());
            ActivityOptionsCompat options = ActivityOptionsCompat.
                    makeSceneTransitionAnimation((TripListActivity.this), p1);
            Bundle bundle = options.toBundle();
            Intent i = new Intent(TripListActivity.this, TripDetailActivity.class);
            startActivity(i, bundle);
        }
    });
}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:22,代码来源:TripListActivity.java

示例10: handleMessage

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.GINGERBREAD)
@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    TextView mAuthCode = mTextViewRef.get();
    if (mAuthCode == null) {
        return;
    }
    if (!mAuthCode.getText().toString().isEmpty()) return;

    switch (msg.what) {
        case ReadSmsService.OBSERVER_SMS_CODE_MSG:
            mAuthCode.setText((String) msg.obj);
            break;
        case ReadSmsService.RECEIVER_SMS_CODE_MSG:
            mAuthCode.setText((String) msg.obj);
            break;
        default:
            break;
    }
    recycle();
}
 
开发者ID:xiong-it,项目名称:AutoInputAuthCode,代码行数:23,代码来源:AuthCode.java

示例11: decodeRegion

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
@Override
public Bitmap decodeRegion(Rect rect, int sampleSize) {
  Log.w(TAG, "Decode region: " + rect);

  if (passthrough != null) {
    return passthrough.decodeRegion(rect, sampleSize);
  }

  synchronized(this) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize      = sampleSize;
    options.inPreferredConfig = Bitmap.Config.RGB_565;

    Bitmap bitmap = bitmapRegionDecoder.decodeRegion(rect, options);

    if (bitmap == null) {
      throw new RuntimeException("Skia image decoder returned null bitmap - image format may not be supported");
    }

    return bitmap;
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:AttachmentRegionDecoder.java

示例12: fifteen

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public Bitmap fifteen(Context context, Bitmap bitmap){
    renderScript=RenderScript.create(context);
    outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
    inputAllocation=Allocation.createFromBitmap(renderScript,bitmap);
    outputAllocation=Allocation.createTyped(renderScript,inputAllocation.getType());
    final ScriptIntrinsicColorMatrix colorMatrix13 = ScriptIntrinsicColorMatrix.create(renderScript, Element.U8_4(renderScript));
    colorMatrix13.setColorMatrix(new android.renderscript.Matrix4f(new float[]
            {

                    2.10279132254252f,  -0.298212630531356f,       0.42128146417712f,   0f,
                    0.222897572029231f,     1.68701190285368f,     -0.883421304780577f,   0f,
                    -0.765688894571747f,   0.171200727677677f,    2.02213984060346f,     0f,
                    0                          ,  0                 ,0                ,1f


            }));
    colorMatrix13.forEach(inputAllocation, outputAllocation);
    outputAllocation.copyTo(outBitmap);
    return outBitmap;
}
 
开发者ID:hgayan7,项目名称:FilterLibrary,代码行数:22,代码来源:PhotoFilter.java

示例13: twelve

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public Bitmap twelve(Context context, Bitmap bitmap){
    renderScript=RenderScript.create(context);
    outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
    inputAllocation=Allocation.createFromBitmap(renderScript,bitmap);
    outputAllocation=Allocation.createTyped(renderScript,inputAllocation.getType());
    final ScriptIntrinsicColorMatrix colorMatrix12 = ScriptIntrinsicColorMatrix.create(renderScript, Element.U8_4(renderScript));
    colorMatrix12.setColorMatrix(new android.renderscript.Matrix4f(new float[]
            {
                    .309f, .409f, .309f, 0f,
                    .609f, .309f, .409f, 0f,
                    0.42f, .42f, .2f, 0f,
                    0f, 0f, 0f, 1f


            }));
    colorMatrix12.forEach(inputAllocation, outputAllocation);
    outputAllocation.copyTo(outBitmap);
    return outBitmap;
}
 
开发者ID:hgayan7,项目名称:FilterLibrary,代码行数:21,代码来源:PhotoFilter.java

示例14: onCreate

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gallery);

    parentLayout = (LinearLayout) findViewById(R.id.parent_view);
    ivHeroImage = (ImageView) findViewById(R.id.iv_image_gallery);
    ivClose = (ImageView) findViewById(R.id.iv_close);
    imageResource = getIntent().getIntExtra("image", R.drawable.img_city_1);
    ivHeroImage.setImageResource(imageResource);

    ivClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });
}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:20,代码来源:GalleryActivity.java

示例15: onActivityResult

import android.support.annotation.RequiresApi; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	if (requestCode != REQUEST_CODE) {
		return;
	}
	if (manager == null) {
		return;
	}
	mediaProjection = manager.getMediaProjection(resultCode, data);
	if (mediaProjection == null) {
		return;
	}
	onStartRecord();
}
 
开发者ID:FreeSunny,项目名称:Amazing,代码行数:17,代码来源:ScreenRecordActivity.java


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