本文整理汇总了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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
});
}
示例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();
}
}