• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PermissionCallback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中pl.tajchert.nammu.PermissionCallback的典型用法代码示例。如果您正苦于以下问题:Java PermissionCallback类的具体用法?Java PermissionCallback怎么用?Java PermissionCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PermissionCallback类属于pl.tajchert.nammu包,在下文中一共展示了PermissionCallback类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: showChooserDialog

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
public static void showChooserDialog(final BaseActivity activity, final Callback callback) {
    PhotoHelper.callback = callback;

    Nammu.askForPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {
        @Override
        public void permissionGranted() {
            Intent intent = CropImage.getPickImageChooserIntent(activity);
            activity.startActivityForResult(intent, CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE);
        }

        @Override
        public void permissionRefused() {
            callOnFailure(Failure.PERMISSION_DENIED);
        }
    });
}
 
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:17,代码来源:PhotoHelper.java


示例2: selectImage

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
@DebugLog
@OnClick(R.id.backdrop)
void selectImage() {

    int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
        Nammu.askForPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {

            @DebugLog
            @Override
            public void permissionGranted() {
                EasyImage.openGallery(NameActivity.this, 0);
                //Nothing, this sample saves to Public gallery so it needs permission
            }

            @DebugLog
            @Override
            public void permissionRefused() {
               // finish();
            }
        });
    }
    else {
        EasyImage.openGallery(NameActivity.this, 0);
    }
}
 
开发者ID:BackPackerDz,项目名称:PotRoom,代码行数:27,代码来源:NameActivity.java


示例3: askPermission

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
private void askPermission(String permissionName) {
    if (!Nammu.checkPermission(permissionName)) {
        if (Nammu.shouldShowRequestPermissionRationale(this, permissionName)) {
            Toast.makeText(this, R.string.permission_tips, Toast.LENGTH_SHORT).show();
            Nammu.askForPermission(MainActivity.this, permissionName, new PermissionCallback() {
                @Override
                public void permissionGranted() { }
                @Override
                public void permissionRefused() { }
            });
        } else {
            Nammu.askForPermission(MainActivity.this, permissionName, new PermissionCallback() {
                @Override
                public void permissionGranted() { }
                @Override
                public void permissionRefused() { }
            });
        }
    }
}
 
开发者ID:ChillingVan,项目名称:AndroidInstantVideo,代码行数:21,代码来源:MainActivity.java


示例4: callNumber

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
public static void callNumber(final Activity activity, String telNumber) {
    String number = "tel:" + telNumber;
    final Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number));

    PermissionHelper.verifyPermissions(
            new String[]{Manifest.permission.CALL_PHONE},
            new PermissionCallback() {
                @Override
                public void permissionGranted() {
                    activity.startActivity(callIntent);
                }

                @Override
                public void permissionRefused() {
                }
            });
}
 
开发者ID:ayz4sci,项目名称:permissionHelper,代码行数:18,代码来源:Helpers.java


示例5: clickButtChangeSettings

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
@OnClick(R.id.buttonSpecialChangeSettings) public void clickButtChangeSettings() {
  if (Nammu.checkSpecialPermission(Manifest.permission.WRITE_SETTINGS)) {
    Toast.makeText(this, "Access granted", Toast.LENGTH_SHORT).show();
  } else {
    Nammu.askForSpecialPermission(this, Manifest.permission.WRITE_SETTINGS,
        new PermissionCallback() {
          @Override public void permissionGranted() {
            Toast.makeText(MainActivity.this, "Access granted", Toast.LENGTH_SHORT).show();
          }

          @Override public void permissionRefused() {
            Log.d(TAG, "permissionRefused: ");
            Toast.makeText(MainActivity.this, "Access refused", Toast.LENGTH_SHORT).show();
          }
        });
  }
}
 
开发者ID:tajchert,项目名称:Nammu,代码行数:18,代码来源:MainActivity.java


示例6: setLocationEnabled

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
public static void setLocationEnabled(final Activity activity, final GoogleMap map) {
  if (activity == null || map == null) {
    return;
  }

  if (!setLocationIfPossible(activity, map)) {
    Nammu.askForPermission(activity, LOCATION_PERMISSION, new PermissionCallback() {
      @Override
      public void permissionGranted() {
        setLocationEnabled(activity, map);
      }

      @Override
      public void permissionRefused() {
        // Can't do anything here
      }
    });
  }
}
 
开发者ID:cdeange,项目名称:uwaterloo-api,代码行数:20,代码来源:MapUtils.java


示例7: loadHero

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
public final void loadHero(final HeroFileInfo heroPath) {

        Nammu.askForPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {
            @Override
            public void permissionGranted() {
                if (getHero() != null && preferences.getBoolean(DsaTabPreferenceActivity.KEY_AUTO_SAVE, true)) {
                    HeroSaveTask heroSaveTask = new HeroSaveTask(DsaTabActivity.this, getHero(),HeroExchange.getInstance());
                    heroSaveTask.execute();
                }
                setToolbarRefreshing(true);

                Bundle args = new Bundle();
                args.putSerializable(KEY_HERO_PATH, heroPath);
                getLoaderManager().restartLoader(LOADER_HERO, args, new HeroLoaderCallback(DsaTabActivity.this));
            }

            @Override
            public void permissionRefused() {
                ViewUtils.snackbar(DsaTabActivity.this, "Keine Berechtigung um Helden auf SD-Karte zu speichern.");
            }
        });

    }
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:24,代码来源:DsaTabActivity.java


示例8: verifyPermissions

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
public static void verifyPermissions(String[] requiredPermissions, PermissionCallback permissionCallback){
    for(String requiredPermission : requiredPermissions){
        if(!Nammu.checkPermission(requiredPermission)){
            permissionCallback.permissionRefused();
            return;
        }
    }
    permissionCallback.permissionGranted();
}
 
开发者ID:ayz4sci,项目名称:permissionHelper,代码行数:10,代码来源:PermissionHelper.java


示例9: onCreate

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    permissionHelper                = PermissionHelper.getInstance(this);

    Button requirePermissionButton  = (Button) findViewById(R.id.require_permission_button);
    TextView textView               = (TextView) findViewById(R.id.text_view);

    requirePermissionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            permissionHelper.verifyPermission(new String[]{"dial this number"},
                    new String[]{Manifest.permission.CALL_PHONE}, new PermissionCallback() {
                        @Override
                        public void permissionGranted() {
                            Helpers.callNumber(MainActivity.this, "1234");
                        }

                        @Override
                        public void permissionRefused() {

                        }
                    });
        }
    });

}
 
开发者ID:ayz4sci,项目名称:permissionHelper,代码行数:30,代码来源:MainActivity.java


示例10: pickPicture

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
@OnClick(R.id.fab)
public void pickPicture(){
    if(Util.isConnected(getContext(), true)) {
        Util.askForPermissions(getActivity(), new PermissionCallback() {
            @Override
            public void permissionGranted() {
                EasyImage.openChooserWithGallery(TranslateFragment.this, getString(R.string.select_an_image), REQUEST_PICK_PICTURE);
            }
            @Override
            public void permissionRefused() {
            }
        });
    }
}
 
开发者ID:adrielcafe,项目名称:NMSAlphabetAndroidApp,代码行数:15,代码来源:TranslateFragment.java


示例11: askForPermissions

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
public static void askForPermissions(final Activity activity, PermissionCallback callback){
    List<String> missingPermissions = new ArrayList<>();
    for(int i = 0; i < PERMISSIONS.length; i++){
        if(!Nammu.checkPermission(PERMISSIONS[i])){
            missingPermissions.add(PERMISSIONS[i]);
        }
    }
    if(missingPermissions.isEmpty()){
        callback.permissionGranted();
    } else {
        Nammu.askForPermission(activity, missingPermissions.toArray(new String[missingPermissions.size()]), callback);
    }
}
 
开发者ID:adrielcafe,项目名称:NMSAlphabetAndroidApp,代码行数:14,代码来源:Util.java


示例12: refresh

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
protected  void refresh() {
    if (getActivity()!=null) {
        Nammu.askForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {
            @Override
            public void permissionGranted() {
                refresh(REMOTE_LOADER);
            }

            @Override
            public void permissionRefused() {
                ViewUtils.snackbar(getActivity(), "Keine Berechtigung um Helden auf SD-Karte zu speichern.");
            }
        });
    }
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:16,代码来源:HeroChooserFragment.java


示例13: setPermissionCallback

import pl.tajchert.nammu.PermissionCallback; //导入依赖的package包/类
protected void setPermissionCallback(PermissionCallback permissionCallback){
    this.permissionCallback = permissionCallback;
}
 
开发者ID:ayz4sci,项目名称:permissionHelper,代码行数:4,代码来源:PermissionHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Registration类代码示例发布时间:2022-05-22
下一篇:
Java EntityProjectile类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap