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

Java Permiso类代码示例

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

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



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

示例1: onCreate

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;

    // * must add this line *
    Permiso.getInstance().setActivity(this);

    setContentView(R.layout.activity_fragment_demo);
    DemoSupportFragment fragment = new DemoSupportFragment();
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fm.beginTransaction();
    fragmentTransaction.replace(R.id.frame_layout, fragment);
    fragmentTransaction.commit();

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
开发者ID:NoelChew,项目名称:MultiPickerWrapper,代码行数:19,代码来源:DemoSupportFragmentActivity.java


示例2: onCreate

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Permiso.getInstance().setActivity(this);
    context = this;
    setContentView(R.layout.activity_demo);

    btnCheckPermissions = (Button) findViewById(R.id.button_check_permissions);
    btnCheckPermissions.setOnClickListener(btnCheckPermissionsOnClickListener);

    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    linearLayoutManager = new LinearLayoutManager(context);
    recyclerView.setLayoutManager(linearLayoutManager);

    adapter = new DangerousActionAdapter(context, GetDangerousActionArrayList.getDangerousActions(), listener);
    recyclerView.setAdapter(adapter);

    getPermissionArray = GetPermissionArrayList.getPermissionArrayList(context);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
开发者ID:NoelChew,项目名称:PermisoWrapper,代码行数:24,代码来源:DemoActivity.java


示例3: onResume

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    mWebView.onResume();
    Permiso.getInstance().setActivity(this);

    // Check if we need to show a page reload snackbar
    if (requiresReload) {
        Snackbar reloadSnackbar = Snackbar.make(mCoordinatorLayoutView, R.string.hide_editor_newsfeed_snackbar, Snackbar.LENGTH_LONG);
        reloadSnackbar.setAction(R.string.menu_refresh, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mWebView.reload();
            }
        });
        reloadSnackbar.show();
        requiresReload = false;
    }
    registerForContextMenu(mWebView);
}
 
开发者ID:JakeLane,项目名称:Toffeed,代码行数:21,代码来源:MainActivity.java


示例4: onSingleClick

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
/**
 * Request a single permission and display whether or not it was granted or denied.
 */
private void onSingleClick() {
    // A request for a single permission
    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
        @Override
        public void onPermissionResult(Permiso.ResultSet resultSet) {
            if (resultSet.isPermissionGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                Toast.makeText(MainActivity.this, R.string.permission_granted, Toast.LENGTH_SHORT).show();
            } else if (resultSet.isPermissionPermanentlyDenied(Manifest.permission.WRITE_EXTERNAL_STORAGE)){
                Toast.makeText(MainActivity.this, R.string.permission_permanently_denied, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(MainActivity.this, R.string.permission_denied, Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
            PermisoDialogFragment.Builder builder = new PermisoDialogFragment.Builder(
                    R.string.permission_rationale,
                    R.string.needed_for_html_demo_purposes,
                    android.R.string.ok);
            builder.setHtmlInterpretation(true);
            Permiso.getInstance().showRationaleInDialog(builder, callback);
        }
    }, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:29,代码来源:MainActivity.java


示例5: onCreate

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_non_permiso);

    //
    // First, tell Permiso that you're using this activity
    //
    Permiso.getInstance().setActivity(this);

    findViewById(R.id.btn_request).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onRequestClick();
        }
    });
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:18,代码来源:NonPermisoActivity.java


示例6: onRequestClick

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
private void onRequestClick() {
    //
    // And that's it! Now you can make permission requests as usual
    //
    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
        @Override
        public void onPermissionResult(Permiso.ResultSet resultSet) {
            if (resultSet.isPermissionGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                Toast.makeText(NonPermisoActivity.this, R.string.permission_granted, Toast.LENGTH_SHORT).show();
            } else if (resultSet.isPermissionPermanentlyDenied(Manifest.permission.WRITE_EXTERNAL_STORAGE)){
                Toast.makeText(NonPermisoActivity.this, R.string.permission_permanently_denied, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(NonPermisoActivity.this, R.string.permission_denied, Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
            Permiso.getInstance().showRationaleInDialog(getString(R.string.permission_rationale), getString(R.string.needed_for_demo_purposes), null, callback);
        }
    }, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:23,代码来源:NonPermisoActivity.java


示例7: requestPhoto

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
private void requestPhoto() {

        Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
            @Override
            @SuppressWarnings("ResourceType")
            public void onPermissionResult(Permiso.ResultSet resultSet) {
                if (resultSet.areAllPermissionsGranted()) {
                    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
                        requestMedia(takePictureIntent, RESULT_IMAGE);
                    }
                }
            }

            @Override
            public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
                FlowRunActivity.this.showRationaleDialog(R.string.permission_camera, callback);
            }

        }, Manifest.permission.CAMERA);
    }
 
开发者ID:rapidpro,项目名称:surveyor,代码行数:22,代码来源:FlowRunActivity.java


示例8: requestAudio

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
private void requestAudio() {
    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
        @Override
        @SuppressWarnings("ResourceType")
        public void onPermissionResult(Permiso.ResultSet resultSet) {
            if (resultSet.areAllPermissionsGranted()) {
                Intent intent = new Intent(FlowRunActivity.this, AudioCaptureActivity.class);
                intent.putExtra(SurveyorIntent.EXTRA_MEDIA_FILE, m_submission.createMediaFile("m4a").getAbsolutePath());
                startActivityForResult(intent, RESULT_AUDIO);
            }
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
            FlowRunActivity.this.showRationaleDialog(R.string.permission_camera, callback);
        }

    }, Manifest.permission.RECORD_AUDIO);
}
 
开发者ID:rapidpro,项目名称:surveyor,代码行数:20,代码来源:FlowRunActivity.java


示例9: onCreate

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    Permiso.getInstance().setActivity(this);

    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult()
    {
        @Override
        public void onPermissionResult(Permiso.ResultSet resultSet)
        {
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions)
        {
            Permiso.getInstance().showRationaleInDialog(
                    getString(R.string.title_request_permissions),
                    getString(R.string.message_request_permissions),
                    null,
                    callback);
        }
    }, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
 
开发者ID:ChristopherGittner,项目名称:OSMBugs,代码行数:26,代码来源:BugMapActivity.java


示例10: onResume

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();

    // * must add this line *
    Permiso.getInstance().setActivity(this);
}
 
开发者ID:NoelChew,项目名称:MultiPickerWrapper,代码行数:8,代码来源:DemoSupportFragmentActivity.java


示例11: onCreate

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    Permiso.getInstance().setActivity(this);
    setContentView(R.layout.activity_fragment_demo);
    DemoFragment fragment = new DemoFragment();
    FragmentManager fm = getFragmentManager();
    FragmentTransaction fragmentTransaction = fm.beginTransaction();
    fragmentTransaction.replace(R.id.frame_layout, fragment);
    fragmentTransaction.commit();

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
开发者ID:NoelChew,项目名称:PermisoWrapper,代码行数:16,代码来源:DemoFragmentActivity.java


示例12: onCreate

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    Permiso.getInstance().setActivity(this);
    setContentView(R.layout.activity_fragment_demo);
    DemoSupportFragment fragment = new DemoSupportFragment();
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fm.beginTransaction();
    fragmentTransaction.replace(R.id.frame_layout, fragment);
    fragmentTransaction.commit();

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
开发者ID:NoelChew,项目名称:PermisoWrapper,代码行数:16,代码来源:DemoSupportFragmentActivity.java


示例13: onRationaleRequested

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
    Permiso.getInstance().showRationaleInDialog(context.getString(R.string.app_name),
            context.getString(R.string.ncutils_permission_rationale_general) +
                    getPermissionGroupStrings(context, permissions) +
                    context.getString(R.string.ncutils_permission_rationale_general_part2) +
                    formatRationaleStrings(context, rationaleStringResourceArrayList),
            null,
            callback);
}
 
开发者ID:NoelChew,项目名称:PermisoWrapper,代码行数:11,代码来源:PermisoWrapper.java


示例14: onMultipleClick

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
/**
 * Request multiple permissions and display how many were granted.
 */
private void onMultipleClick() {
    // A request for two permissions
    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
        @Override
        public void onPermissionResult(Permiso.ResultSet resultSet) {
            int numGranted = 0;
            if (resultSet.isPermissionGranted(Manifest.permission.READ_CONTACTS)) {
                numGranted++;
            }
            if (resultSet.isPermissionGranted(Manifest.permission.READ_CALENDAR)) {
                numGranted++;
            }
            String message = getString(R.string.x_permissions_granted, numGranted);
            Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
            Permiso.getInstance().showRationaleInDialog(
                    getString(R.string.permission_rationale),
                    getString(R.string.needed_for_demo_purposes),
                    null,
                    callback);
        }
    }, Manifest.permission.READ_CONTACTS, Manifest.permission.READ_CALENDAR);
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:30,代码来源:MainActivity.java


示例15: requestPermissions

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
private void requestPermissions(final String requestNumber) {
    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
        @Override
        public void onPermissionResult(Permiso.ResultSet resultSet) {
            if (resultSet.areAllPermissionsGranted()) {
                Toast.makeText(
                        MainActivity.this,
                        getString(R.string.permission_granted) + " (" + requestNumber + ")",
                        Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(
                        MainActivity.this,
                        getString(R.string.permission_denied) + " (" + requestNumber + ")",
                        Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
            Permiso.getInstance().showRationaleInDialog(
                    getString(R.string.permission_rationale),
                    getString(R.string.needed_for_demo_purposes),
                    null,
                    callback);
        }
    }, Manifest.permission.CAMERA);
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:28,代码来源:MainActivity.java


示例16: onResume

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    //
    // Second, we also have to set the activity here to handle transitioning between activities
    //
    Permiso.getInstance().setActivity(this);
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:10,代码来源:NonPermisoActivity.java


示例17: onRequestPermissionsResult

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    //
    // Third, forward the results of this method to Permiso
    //
    Permiso.getInstance().onRequestPermissionResult(requestCode, permissions, grantResults);
}
 
开发者ID:greysonp,项目名称:permiso,代码行数:10,代码来源:NonPermisoActivity.java


示例18: onRequestPermissionsResult

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    Permiso.getInstance().onRequestPermissionResult(requestCode, permissions, grantResults);
}
 
开发者ID:ChristopherGittner,项目名称:OSMBugs,代码行数:8,代码来源:BugMapActivity.java


示例19: onRequestPermissionsResult

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    Permiso.getInstance().onRequestPermissionResult(requestCode, permissions, grantResults);
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:6,代码来源:MainActivity.java


示例20: onResume

import com.greysonparrelli.permiso.Permiso; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Permiso.getInstance().setActivity(this);
}
 
开发者ID:NoelChew,项目名称:PermisoWrapper,代码行数:6,代码来源:DemoActivity.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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