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

项目:RelativeRadioGroup    文件:RelativeRadioGroup.java   
/**
 * {@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);
    }
}
项目:FilterLibrary    文件:PhotoFilter.java   
@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;
}
项目:Cable-Android    文件:AttachmentRegionDecoder.java   
@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());
}
项目:VBrowser-Android    文件:DownloadForegroundService.java   
@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;
}
项目:ImHome    文件:AlarmUtils.java   
@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()));
}
项目:Lunary-Ethereum-Wallet    文件:AppLockActivity.java   
@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();
    }
}
项目:CollegeDoc    文件:PdfView.java   
@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();
    }
}
项目:silly-android    文件:Coloring.java   
/**
 * 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);
}
项目:betterHotels    文件:TripListActivity.java   
@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);
        }
    });
}
项目:AutoInputAuthCode    文件:AuthCode.java   
@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();
}
项目:Cable-Android    文件:AttachmentRegionDecoder.java   
@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;
  }
}
项目:FilterLibrary    文件:PhotoFilter.java   
@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;
}
项目:FilterLibrary    文件:PhotoFilter.java   
@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;
}
项目:betterHotels    文件:GalleryActivity.java   
@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();
        }
    });
}
项目:Amazing    文件:ScreenRecordActivity.java   
@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();
}
项目:GitHub    文件:ImageFormatKeyframesFragment.java   
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
  mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setOldController(mSimpleDraweeView.getController())
      .setUri(URI_KEYFRAMES_ANIMATION)
      .setAutoPlayAnimations(true)
      .build();
  mSimpleDraweeView.setController(controller);

  final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
  switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked
          ? new CheckerBoardDrawable(getResources())
          : null);
    }
  });
}
项目:LikeWechatPhotoViewer    文件:MainActivity.java   
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public View instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    photoView.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float x, float y) {
            playZoomOutAnim();
        }
    });
    PicInfo picInfo = picUrls.get(position);
    sceneHelp.showExpandedView(photoView, picInfo);
    container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return photoView;
}
项目:Floo    文件:ContainerActivity.java   
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void setResultAndBackToPage2(View view) {
    Floo.stack(this)
        .target(Urls.indexUrl("https://chunchun.io/page2"))
        .result("https://play.google.com/store/apps/details?id=com.drakeet.purewriter")
        .start();
}
项目:neatle    文件:Device.java   
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
    BluetoothGattCallback target;
    synchronized (lock) {
        target = currentCallback;
    }
    target.onMtuChanged(gatt, mtu, status);
}
项目:Spyglass    文件:WithDefaultToInDimension.java   
@TargetApi(21)
@RequiresApi(21)
public WithDefaultToInDimension(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {

    super(context, attrs, defStyleAttr, defStyleRes);
    init(attrs, defStyleAttr, defStyleRes);
}
项目:rtmp-rtsp-stream-client-java    文件:VideoEncoder.java   
/**
 * choose the video encoder by mime. API 21+
 */
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private MediaCodecInfo chooseVideoEncoderAPI21(String mime) {
  MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
  MediaCodecInfo[] mediaCodecInfos = mediaCodecList.getCodecInfos();
  for (MediaCodecInfo mci : mediaCodecInfos) {
    if (!mci.isEncoder()) {
      continue;
    }
    String[] types = mci.getSupportedTypes();
    for (String type : types) {
      if (type.equalsIgnoreCase(mime)) {
        Log.i(TAG, String.format("videoEncoder %s type supported: %s", mci.getName(), type));
        MediaCodecInfo.CodecCapabilities codecCapabilities = mci.getCapabilitiesForType(mime);
        for (int color : codecCapabilities.colorFormats) {
          Log.i(TAG, "Color supported: " + color);
          //check if encoder support any yuv420 color
          if (color == FormatVideoEncoder.YUV420PLANAR.getFormatCodec()
              || color == FormatVideoEncoder.YUV420SEMIPLANAR.getFormatCodec()
              || color == FormatVideoEncoder.YUV420PACKEDPLANAR.getFormatCodec()) {
            return mci;
          }
        }
      }
    }
  }
  return null;
}
项目:Spyglass    文件:WithDefaultToInteger.java   
@TargetApi(21)
@RequiresApi(21)
public WithDefaultToInteger(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {

    super(context, attrs, defStyleAttr, defStyleRes);
    init(attrs, defStyleAttr, defStyleRes);
}
项目:Spyglass    文件:WithDefaultToNull.java   
@TargetApi(21)
@RequiresApi(21)
public WithDefaultToNull(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {

    super(context, attrs, defStyleAttr, defStyleRes);
    init(attrs, defStyleAttr, defStyleRes);
}
项目:RxNetwork    文件:RxNetworkInfo.java   
@RequiresApi(LOLLIPOP)
@Nullable
static NetworkCapabilities getCapabilities(@NonNull Network network,
    @NonNull ConnectivityManager connectivityManager) {

  NetworkCapabilities networkCapabilities = null;

  try {
    networkCapabilities = connectivityManager.getNetworkCapabilities(network);
  } catch (Exception exc) {
    logger.log(WARNING,
        "Could not retrieve network capabilities from provided network: " + exc.getMessage());
  }

  return networkCapabilities;
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:Images.java   
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public boolean captureScreen(String path) {
    mScriptRuntime.requiresApi(21);
    Image image = mScreenCapturer.capture();
    if (image != null) {
        saveImage(image, path);
        image.close();
        return true;
    }
    return false;
}
项目:antea    文件:AnteaService.java   
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onServiceConnected() {
    super.onServiceConnected();
    AccessibilityServiceInfo info = this.getServiceInfo();
    info.eventTypes = AccessibilityEvent.TYPE_VIEW_CLICKED | AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED | AccessibilityEvent.TYPE_VIEW_LONG_CLICKED;
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
    this.setServiceInfo(info);

    clipboardManager.addPrimaryClipChangedListener(this);
}
项目:Spyglass    文件:WithUseString.java   
@RequiresApi(21)
@TargetApi(21)
public WithUseString(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {

    super(context, attrs, defStyleAttr, defStyleRes);
    init(attrs, defStyleAttr, defStyleRes);
}
项目:Phoenix-for-VK    文件:AppNotificationChannels.java   
@RequiresApi(api = Build.VERSION_CODES.O)
public static NotificationChannel getGroupInvitesChannel(Context context){
    String channelName = context.getString(R.string.group_invites_channel);
    NotificationChannel channel = new NotificationChannel(GROUP_INVITES_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW);
    channel.enableLights(true);
    channel.enableVibration(true);
    return channel;
}
项目:Spyglass    文件:WithDefaultToMmDimensionResource.java   
@TargetApi(21)
@RequiresApi(21)
public WithDefaultToMmDimensionResource(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {

    super(context, attrs, defStyleAttr, defStyleRes);
    init(attrs, defStyleAttr, defStyleRes);
}
项目:LocaleChanger    文件:SystemLocaleRetriever.java   
@RequiresApi(api = Build.VERSION_CODES.N)
private static List<Locale> mapToListOfLocales(LocaleList localeList) {
    List<Locale> locales = new ArrayList<>();
    for (int i = 0; i < localeList.size(); i++) {
        locales.add(localeList.get(i));
    }
    return locales;
}
项目:Auto.js    文件:AutoJs.java   
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void request() {
    Activity activity = mAppUtils.getCurrentActivity();
    if (activity instanceof OnActivityResultDelegate.DelegateHost) {
        ScreenCaptureRequester requester = new ActivityScreenCaptureRequester(
                ((OnActivityResultDelegate.DelegateHost) activity).getOnActivityResultDelegateMediator(), activity);
        requester.setOnActivityResultCallback(mCallback);
        requester.request();
    } else {
        ScreenCaptureRequestActivity.request(mContext, mCallback);
    }
}
项目:TubiPlayer    文件:WebviewActivity.java   
@RequiresApi(Build.VERSION_CODES.KITKAT)
private void initVpaidWebview(WebView view, Handler handler) {
    tubiVPAID = new TubiVPAID(view, handler,null);

    tubiVPAID.init(null);

    webView.setVisibility(View.VISIBLE);
    webView.bringToFront();
    webView.invalidate();

    webView.addJavascriptInterface(tubiVPAID, "TubiNativeJSInterface");
    webView.loadUrl(VPAID_URL);

}
项目:Camera-Roll-Android-App    文件:AlbumActivity.java   
@Override
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
    if (sharedElementReturnPosition != -1 && album != null &&
            sharedElementReturnPosition < album.getAlbumItems().size()) {
        String newTransitionName = album.getAlbumItems().get(sharedElementReturnPosition).getPath();
        View layout = recyclerView.findViewWithTag(newTransitionName);
        View newSharedElement = layout != null ? layout.findViewById(R.id.image) : null;
        if (newSharedElement != null) {
            names.clear();
            names.add(newTransitionName);
            sharedElements.clear();
            sharedElements.put(newTransitionName, newSharedElement);
        }
        sharedElementReturnPosition = -1;
    } else {
        View navigationBar = findViewById(android.R.id.navigationBarBackground);
        View statusBar = findViewById(android.R.id.statusBarBackground);
        if (navigationBar != null) {
            names.add(navigationBar.getTransitionName());
            sharedElements.put(navigationBar.getTransitionName(), navigationBar);
        }
        if (statusBar != null) {
            names.add(statusBar.getTransitionName());
            sharedElements.put(statusBar.getTransitionName(), statusBar);
        }
    }
}
项目:Bigbang    文件:TotleSwitchTile.java   
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onClick() {
    Log.d(LOG_TAG, "onClick state = " + Integer.toString(getQsTile().getState()));
    Icon icon;
    String title;
    if (toggleState == STATE_ON) {
        toggleState = STATE_OFF;
        title = getResources().getString(R.string.notify_total_switch_off);
        icon =  Icon.createWithResource(getApplicationContext(), R.drawable.notify_off);
        getQsTile().setState(Tile.STATE_INACTIVE);// 更改成非活跃状态
    } else {
        toggleState = STATE_ON;
        title = getResources().getString(R.string.notify_total_switch_on);
        icon = Icon.createWithResource(getApplicationContext(), R.drawable.notify_on);
        getQsTile().setState(Tile.STATE_ACTIVE);//更改成活跃状态
    }
    getQsTile().setIcon(icon);//设置图标
    getQsTile().setLabel(title);
    getQsTile().updateTile();//更新Tile

    Intent intent = new Intent();
    intent.setClass(this, TotalSwitchActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivityAndCollapse(intent);

}
项目:MySelfDemo    文件:MyView2.java   
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void drawRoundRect(Canvas canvas) {
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setColor(Color.BLACK);
    paint.setAntiAlias(true);
    canvas.drawRoundRect(100, 100, 500, 300, 150, 50, paint); //参数的意思是: left top right bottom 的坐标   rx 是圆角的横向的左标  ry是圆角的纵向坐标
}
项目:Spyglass    文件:WithDefaultToFractionUsingParentFractionAndBaseMultiplier.java   
@TargetApi(21)
@RequiresApi(21)
public WithDefaultToFractionUsingParentFractionAndBaseMultiplier(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {

    super(context, attrs, defStyleAttr, defStyleRes);
    init(attrs, defStyleAttr, defStyleRes);
}
项目:GitHub    文件:StatusBarUtil.java   
/** android 6.0设置字体颜色 */
    @RequiresApi(Build.VERSION_CODES.M)
    private static void darkModeForM(Window window, boolean dark) {
//        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
//        window.setStatusBarColor(Color.TRANSPARENT);

        int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
        if (dark) {
            systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        } else {
            systemUiVisibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
        window.getDecorView().setSystemUiVisibility(systemUiVisibility);
    }
项目:GitHub    文件:CustomPopWindow.java   
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public CustomPopWindow showAsDropDown(View anchor, int xOff, int yOff, int gravity){
    if(mPopupWindow!=null){
        mPopupWindow.showAsDropDown(anchor,xOff,yOff,gravity);
    }
    return this;
}
项目:PrivacyStreams    文件:AccessibilityUtils.java   
/**
 *
 * @param root
 * @param appName
 * @return
 */

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static String getBrowserCurrentUrl(AccessibilityNodeInfo root, String appName){
    try{
        AccessibilityNodeInfo bar = root.findAccessibilityNodeInfosByViewId(getUrlResourceId(appName)).get(0);
        if(bar!=null){
            return bar.getText().toString();
        }
    }
    catch (Exception exception){
        return null;
    }
    return null;
}
项目:GroupingMessages    文件:MainActivity.java   
@RequiresApi(api = Build.VERSION_CODES.M)
private boolean addPermission(List<String> permissionsList, String permission) {
    if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
        permissionsList.add(permission);
        // Check for Rationale Option
        if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permission))
            return false;
    }
    return true;
}