Exemple #1
0
 public static NodeIterator getAuthorizedChildNodes(Node node) throws Exception {
   NodeIterator iter = node.getNodes();
   while (iter.hasNext()) {
     if (!PermissionUtil.canRead(iter.nextNode())) iter.remove();
   }
   return iter;
 }
Exemple #2
0
 public static List<Node> getAuthorizedChildList(Node node) throws Exception {
   List<Node> children = new ArrayList<Node>();
   NodeIterator iter = node.getNodes();
   while (iter.hasNext()) {
     Node child = iter.nextNode();
     if (PermissionUtil.canRead(child)) children.add(child);
   }
   return children;
 }
 @Override
 public void onRequestPermissionsResult(
     int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
   if (requestCode == MainActivity.REQUEST_LOCATION) {
     if (PermissionUtil.verifyPermissions(grantResults)) {
       Toast.makeText(this, "Awesome, Thanks - Permission granted", Toast.LENGTH_SHORT).show();
       finish();
     } else {
       Snackbar.make(mLayout, "Y U NO GIVE PERMISSION?! ლ(ಠ_ಠლ) ", Snackbar.LENGTH_SHORT).show();
     }
   }
 }