图像处理

StickerView -- 贴纸 view (托拽、缩放、合

2016-08-22  本文已影响0人  HL_Coder

简介#

代码是从github的:https://github.com/wuapnjie/StickerView fork 来

StikerView --- 贴纸 view (托拽、缩放、合成保存等功能)

扩展介绍- android M 之后的权限代码处理#

Google Play Services and Runtime Permissions
android 权限的处理方式:
在android M(6.0) 开始,权限的确认需要在用户首次使用时确认(之前是安装的时候确认)。那么相应的代码逻辑也要发生改变了----- 主要就是用户同意权限怎么着,不同意怎么着 if...else 的处理方式。

if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
    // Check Permissions Now
    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION);
} else {
    // permission has been granted, continue as usual
    Location myLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
}



public void onRequestPermissionsResult(int requestCode,
                                       String[] permissions,
                                       int[] grantResults) {
    if (requestCode == REQUEST_LOCATION) {
        if(grantResults.length == 1
                && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            // We can now safely use the API we requested access to
            Location myLocation =
                    LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
        } else {
            // Permission was denied or request was cancelled
        }
    }
}

代码实现分析#

   public void addSticker(Sticker sticker)
   public void addSticker(Bitmap stickerBitmap)
   public void addSticker(Bitmap stickerBitmap)
上一篇 下一篇

猜你喜欢

热点阅读