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


Java Permission类代码示例

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


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

示例1: onCreate

import org.md2k.mcerebrum.commons.permission.Permission; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    Permission.requestPermission(this, new PermissionCallback() {
        @Override
        public void OnResponse(boolean isGranted) {
            if(isGranted)
                getFragmentManager().beginTransaction().replace(R.id.layout_preference_fragment,
                        new PrefsFragmentSettings()).commit();
            else {
                Toasty.error(getApplicationContext(), "!PERMISSION DENIED !!! Could not continue...", Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    });

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

}
 
开发者ID:MD2Korg,项目名称:mCerebrum-AutoSense,代码行数:24,代码来源:ActivitySettings.java

示例2: update

import org.md2k.mcerebrum.commons.permission.Permission; //导入依赖的package包/类
@Override
public void update(final Context context){
    MCerebrum.setBackgroundService(context, ServiceAutoSenses.class);
    MCerebrum.setConfigureActivity(context, ActivitySettings.class);
    MCerebrum.setPermissionActivity(context, ActivityPermission.class);
    MCerebrum.setConfigured(context, Configuration.isConfigured());
    MCerebrum.setConfigureExact(context, Configuration.isEqualDefault());
    MCerebrum.setReportActivity(context, ActivityPlot.class);
    if(!MCerebrum.getPermission(context)){
        if(Permission.hasPermission(context))
            MCerebrum.setPermission(context, true);
        else{
            Intent intent = new Intent(context, ActivityPermission.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-AutoSense,代码行数:19,代码来源:MyMCerebrumInit.java

示例3: onCreate

import org.md2k.mcerebrum.commons.permission.Permission; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Permission.requestPermission(this, new PermissionCallback() {
        @Override
        public void OnResponse(boolean isGranted) {
            if (!isGranted) {
                Toast.makeText(getApplicationContext(), "!PERMISSION DENIED !!! Could not continue...", Toast.LENGTH_SHORT).show();
                finish();
            } else {
                setContentView(R.layout.activity_plot_choice);
                getFragmentManager().beginTransaction().replace(R.id.layout_preference_fragment,
                        new PrefsFragmentPlot()).commit();

            }

        }
    });
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-AutoSense,代码行数:24,代码来源:ActivityPlotChoice.java

示例4: update

import org.md2k.mcerebrum.commons.permission.Permission; //导入依赖的package包/类
@Override
public void update(final Context context) {
    MCerebrum.setBackgroundService(context, ServiceStreamProcessor.class);
    MCerebrum.setConfigureActivity(context, ActivitySettings.class);
    MCerebrum.setPermissionActivity(context, ActivityPermission.class);
    MCerebrum.setConfigured(context, true);
    MCerebrum.setConfigureExact(context, true);
    if(!Permission.hasPermission(context)){
        Intent intent = new Intent(context, ActivityPermission.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-StreamProcessor,代码行数:14,代码来源:MyMCerebrumInit.java

示例5: onCreate

import org.md2k.mcerebrum.commons.permission.Permission; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set up Crashlytics, disabled for debug builds
    Crashlytics crashlyticsKit = new Crashlytics.Builder()
            .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
            .build();

    // Initialize Fabric with the debug-disabled crashlytics.
    Fabric.with(this, crashlyticsKit, new Crashlytics());
    mHandler = new Handler();
    setContentView(R.layout.activity_main);

    Permission.requestPermission(this, new PermissionCallback() {
        @Override
        public void OnResponse(boolean isGranted) {
            if (!isGranted) {
                Toasty.error(getApplicationContext(), "!PERMISSION DENIED !!! Could not continue...", Toast.LENGTH_SHORT).show();
                finish();
            } else {
                if(getIntent().hasExtra("RUN") && getIntent().getBooleanExtra("RUN", false)) {
                    Intent intent = new Intent(ActivityMain.this, ServiceAutoSenses.class);
                    startService(intent);
                    finish();
                }else if(getIntent().hasExtra("PERMISSION") && getIntent().getBooleanExtra("PERMISSION", false)) {
                    finish();
                } else {
                    load();
                }
            }
        }
    });
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-AutoSense,代码行数:35,代码来源:ActivityMain.java

示例6: onCreate

import org.md2k.mcerebrum.commons.permission.Permission; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    if (Permission.hasPermission(this)) {
        load();
    } else {
        Toasty.error(getApplicationContext(), "!PERMISSION DENIED !!! Could not continue...", Toast.LENGTH_SHORT).show();
        stopSelf();
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-AutoSense,代码行数:11,代码来源:ServiceAutoSenses.java


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