當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。