iapp 悬浮窗权限

iapp 悬浮窗权限,第1张

判断有没有悬浮窗权限,没有就跳转到权限设置界面可以放到myu模块里面调用对于一些必须要有悬浮窗权限才能实现的功能//判断悬浮窗权限 java(uxfqx,null,"android.provider.Settings.canDrawOverlays","android.content.Context",activity)//tw(uxfqx)f(uxfqx==false) {   sit(a, "action", "android.intent.action.VIEW")  sit(a, "action", "android.settings.action.MANAGE_OVERLAY_PERMISSION")  cls("android.content.ContextWrapper",类)  javax(one,activity,类,"getPackageName")  ss("package:"+one,pk)  sit(a, "data", pk)  uit(a, "chooser", "设置悬浮窗权限")   tw("请打开悬浮窗权限") } else {   syso("悬浮窗权限正常") }------------------------------------空城旧念-------------------------

iapp 调用图库选择图片

javags(agc,"android.content.Intent","android.content.Intent.ACTION_GET_CONTENT")

javanew(it,"android.content.Intent","String",agc)

java(c,it,"android.content.Intent.setType","String","image/*")

javags(ca,"android.content.Intent","android.content.Intent.CATEGORY_OPENABLE")

java(c,it,"android.content.Intent.addCategory","String",ca)

java(c,activity,"android.app.Activity.startActivityForResult","android.content.Intent",it,"int",2)

回调事件javags(er,activity,"android.app.Activity","RESULT_OK")

f(st_lC==er)

{

  f(st_sC==2)

  {

    java(uri,st_iT,"android.content.Intent.getData")

    call(path, "mjava", "uri.getRealPath", activity, uri)

    fdir(a)

    ss(a+"/",a)

    sr(path,a,"%",path)

    us(控件id,"src",path)

  }

}

uri.mjava

import android.content.ContentUris

import android.content.Intent

import android.net.Uri

import android.provider.DocumentsContract

import android.provider.MediaStore

import android.database.Cursor

import android.content.Context

public static String getRealPath(Context context, Uri uri)

{

  String imagePath = null

  if(DocumentsContract.isDocumentUri(context, uri))

  {         

    String docId = DocumentsContract.getDocumentId(uri)         

    if ("com.android.providers.media.documents".equals(uri.getAuthority()))            

    {                

      String id = docId.split(":")[1]         

      String selection = MediaStore.Images.Media._ID + "=" + id 

      imagePath = getImagePath(context, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection)

    }            

    else if ("com.android.providers.downloads.documents".equals(uri.getAuthority()))            

    {                

      Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(docId))

      imagePath = getImagePath(context, contentUri, null)

    }

  }

  else if("content".equalsIgnoreCase(uri.getScheme()))

  {

    imagePath = getImagePath(context, uri, null)

  }

  else if("file".equalsIgnoreCase(uri.getScheme()))

  {

    imagePath = uri.getPath()

  }

  return imagePath

}

public String getImagePath(Context context, Uri uri, String selection)

{

  String path = null

  Cursor cursor = context.getContentResolver().query(uri, null, selection, null, null)

  if (cursor != null)

  {

    if (cursor.moveToFirst())

    {

      path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA))

    }

    cursor.close()

  }

  return path

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7534075.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-06
下一篇 2023-04-06

发表评论

登录后才能评论

评论列表(0条)

保存