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


Java PermissionGroupInfo.loadLabel方法代码示例

本文整理汇总了Java中android.content.pm.PermissionGroupInfo.loadLabel方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionGroupInfo.loadLabel方法的具体用法?Java PermissionGroupInfo.loadLabel怎么用?Java PermissionGroupInfo.loadLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.pm.PermissionGroupInfo的用法示例。


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

示例1: doPermissionCheck

import android.content.pm.PermissionGroupInfo; //导入方法依赖的package包/类
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) {
    PackageManager pm = context.getPackageManager();
    try {
        PermissionInfo info = pm.getPermissionInfo(permission, 0);
        PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null;
        CharSequence permLabel = info.loadLabel(pm);
        CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel;
        collector.addResult(context.getString(R.string.self_check_name_permission, permLabel),
                context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative,
                context.getString(R.string.self_check_resolution_permission, groupLabel),
                new SelfCheckGroup.CheckResolver() {

                    @Override
                    public void tryResolve(Fragment fragment) {
                        fragment.requestPermissions(new String[]{permission}, 0);
                    }
                });
    } catch (PackageManager.NameNotFoundException e) {
        Log.w(TAG, e);
    }
}
 
开发者ID:microg,项目名称:android_external_MicroGUiTools,代码行数:22,代码来源:PermissionCheckGroup.java

示例2: parsePermissions

import android.content.pm.PermissionGroupInfo; //导入方法依赖的package包/类
public static List<ApkPermission> parsePermissions(Context context, List<String> permissionArray) {
    List<ApkPermission> list = new ArrayList<>();
    CharSequence csPermissionGroupLabel;
    CharSequence csPermissionLabel;
    PackageManager pm = context.getPackageManager();

    List<PermissionGroupInfo> lstGroups = pm.getAllPermissionGroups(PackageManager.PERMISSION_GRANTED);
    for (String permission : permissionArray) {

        for (PermissionGroupInfo pgi : lstGroups) {
            try {
                List<PermissionInfo> lstPermissions = pm.queryPermissionsByGroup(pgi.name, PackageManager.PERMISSION_GRANTED);
                for (PermissionInfo pi : lstPermissions) {
                    if (pi.name.equals(permission)) {
                        csPermissionLabel = pi.loadLabel(pm);
                        csPermissionGroupLabel = pgi.loadLabel(pm);
                        list.add(new ApkPermission(csPermissionGroupLabel.toString(), csPermissionLabel.toString()));
                    }
                }
            } catch (Exception e) {
                Logger.printException(e);
            }
        }
    }

    Collections.sort(list, new Comparator<ApkPermission>() {
        @Override
        public int compare(ApkPermission lhs, ApkPermission rhs) {
            return lhs.getName().compareTo(rhs.getName());
        }
    });

    return list;
}
 
开发者ID:Aptoide,项目名称:aptoide-client,代码行数:35,代码来源:AptoideUtils.java

示例3: permissions

import android.content.pm.PermissionGroupInfo; //导入方法依赖的package包/类
public static ArrayList<ApkPermission> permissions(Context context, ArrayList<String> permissionArray) {
    PackageManager pm = context.getPackageManager();

    CharSequence csPermissionGroupLabel;
    CharSequence csPermissionLabel;
    List<PermissionGroupInfo> lstGroups = pm.getAllPermissionGroups(0);
    ArrayList<ApkPermission> list = new ArrayList<>();

    if (permissionArray != null) {
        for (int i = 0; i != permissionArray.size(); i++) {
            String permission = permissionArray.get(i);

            for (PermissionGroupInfo pgi : lstGroups) {
                try {
                    List<PermissionInfo> lstPermissions = pm.queryPermissionsByGroup(pgi.name, 0);
                    for (PermissionInfo pi : lstPermissions) {
                        if (pi.name.equals(permission)) {
                            csPermissionLabel = pi.loadLabel(pm);
                            csPermissionGroupLabel = pgi.loadLabel(pm);
                            list.add(new ApkPermission(csPermissionGroupLabel.toString(), csPermissionLabel.toString()));
                        }
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
        Collections.sort(list, new Comparator<ApkPermission>() {
            @Override
            public int compare(ApkPermission lhs, ApkPermission rhs) {
                return lhs.getName().compareTo(rhs.getName());
            }
        });
    }

    return list;
}
 
开发者ID:Aptoide,项目名称:aptoide-client,代码行数:38,代码来源:PermissionsActivity.java

示例4: getApkPermissions

import android.content.pm.PermissionGroupInfo; //导入方法依赖的package包/类
public ArrayList<ApkPermission> getApkPermissions() throws JSONException {

        JSONArray permissionArray = response.getJSONArray("permissions");
        PackageManager pm = BackupAppsApplication.getContext().getPackageManager();

        CharSequence csPermissionGroupLabel;
        CharSequence csPermissionLabel;
        List<PermissionGroupInfo> lstGroups = pm.getAllPermissionGroups(0);


        ArrayList<ApkPermission> list = new ArrayList<ApkPermission>();
        for(int i = 0; i!= permissionArray.length(); i++){
            String permission = permissionArray.getString(i);

            for (PermissionGroupInfo pgi : lstGroups) {
                csPermissionGroupLabel = pgi.loadLabel(pm);
                //Log.e("perm", pgi.name + ": " + csPermissionGroupLabel.toString());

                try {
                    List<PermissionInfo> lstPermissions = pm.queryPermissionsByGroup(pgi.name, 0);
                    for (PermissionInfo pi : lstPermissions) {
                        csPermissionLabel = pi.loadLabel(pm);

                        if(pi.name.equals(permission))
                            list.add(new ApkPermission(csPermissionGroupLabel.toString(), csPermissionLabel.toString()));
                            //Log.e("perm", "   " + pi.name + ": " + csPermissionLabel.toString());
                        }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }

        return list;

    }
 
开发者ID:Aptoide,项目名称:aptoide-backup-apps,代码行数:37,代码来源:WebserviceGetApkInfo.java

示例5: parsePermissions

import android.content.pm.PermissionGroupInfo; //导入方法依赖的package包/类
public static List<ApkPermission> parsePermissions(Context context,
    List<String> permissionArray) {
  List<ApkPermission> list = new ArrayList<>();
  CharSequence csPermissionGroupLabel;
  CharSequence csPermissionLabel;
  PackageManager pm = context.getPackageManager();

  List<PermissionGroupInfo> lstGroups =
      pm.getAllPermissionGroups(PackageManager.PERMISSION_GRANTED);
  for (String permission : permissionArray) {

    for (PermissionGroupInfo pgi : lstGroups) {
      try {
        List<PermissionInfo> lstPermissions =
            pm.queryPermissionsByGroup(pgi.name, PackageManager.PERMISSION_GRANTED);
        for (PermissionInfo pi : lstPermissions) {
          if (pi.name.equals(permission)) {
            csPermissionLabel = pi.loadLabel(pm);
            csPermissionGroupLabel = pgi.loadLabel(pm);
            list.add(new ApkPermission(csPermissionGroupLabel.toString(),
                csPermissionLabel.toString()));
          }
        }
      } catch (Exception e) {
        Logger.e(TAG, e);
        throw new RuntimeException(e);
      }
    }
  }

  Collections.sort(list, (lhs, rhs) -> lhs.getName()
      .compareTo(rhs.getName()));

  return list;
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:36,代码来源:AptoideUtils.java

示例6: afterOnCreateView

import android.content.pm.PermissionGroupInfo; //导入方法依赖的package包/类
@Override
    protected void afterOnCreateView(View view) {
        super.afterOnCreateView(view);

        mDescribeTextView = (TextView) view.findViewById(R.id.describe);
        mLabelTextView = (TextView) view.findViewById(R.id.label);
        mValueTextView = (TextView) view.findViewById(R.id.value);

        PermissionGroupInfo info = null;
        CharSequence describe = null;
        CharSequence label = null;

        PackageManager pm = getActivity().getPackageManager();

        try {
            info = pm.getPermissionGroupInfo(mPermissionGroupName, PackageManager.GET_META_DATA);
            label = info.loadLabel(pm);
            describe = info.loadDescription(pm);

            mPermissons = pm.queryPermissionsByGroup(mPermissionGroupName, PackageManager.GET_META_DATA);
//            Logs.i(TAG, "permissons = " + permissions);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        mDescribeTextView.setText(describe);
        mLabelTextView.setText(label);
        mValueTextView.setText(mPermissionGroupName);

        getUIKits().getToolBar().getToolbar().setTitle("权限组详细信息");
        getUIKits().getCollapsingToolbarLayout().setTitleEnabled(false);
        getUIKits().getCollapsingToolbarLayout().setBackgroundResource(R.color.google_blue_400);

    }
 
开发者ID:binkery,项目名称:allinone,代码行数:35,代码来源:PermissionGroupDetailFragment.java


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