本文整理汇总了Java中com.anthonycr.grant.PermissionsManager类的典型用法代码示例。如果您正苦于以下问题:Java PermissionsManager类的具体用法?Java PermissionsManager怎么用?Java PermissionsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PermissionsManager类属于com.anthonycr.grant包,在下文中一共展示了PermissionsManager类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BrowserApp.getAppComponent().inject(this);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preference_bookmarks);
mActivity = getActivity();
mSync = new BookmarkLocalSync(mActivity);
initPrefs();
PermissionsManager permissionsManager = PermissionsManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
permissionsManager.requestPermissionsIfNecessaryForResult(getActivity(), REQUIRED_PERMISSIONS, null);
}
}
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:18,代码来源:BookmarkSettingsFragment.java
示例2: onCreate
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Requesting all the permissions in the manifest
PermissionsManager.getInstance().requestAllManifestPermissionsIfNecessary(this, new PermissionsResultAction() {
@Override
public void onGranted() {
Toast.makeText(MainActivity.this, R.string.message_granted, Toast.LENGTH_SHORT).show();
writeToStorage("Hello, World!");
readFromStorage();
}
@Override
public void onDenied(String permission) {
String message = String.format(Locale.getDefault(), getString(R.string.message_denied), permission);
Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
}
});
boolean hasPermission = PermissionsManager.getInstance().hasPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
Log.d(TAG, "Has " + Manifest.permission.READ_EXTERNAL_STORAGE + " permission: " + hasPermission);
Button writeStorage = (Button) findViewById(R.id.button_write_storage);
Button readStorage = (Button) findViewById(R.id.button_read_storage);
Button readContacts = (Button) findViewById(R.id.button_read_contacts);
Button getLocation = (Button) findViewById(R.id.button_get_location);
this.textView = (TextView) findViewById(R.id.text);
writeStorage.setOnClickListener(this);
readStorage.setOnClickListener(this);
readContacts.setOnClickListener(this);
getLocation.setOnClickListener(this);
}
开发者ID:wudongze,项目名称:Grant-master,代码行数:36,代码来源:MainActivity.java
示例3: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
Log.i(TAG, "Activity-onRequestPermissionsResult() PermissionsManager.notifyPermissionsChange()");
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
开发者ID:wudongze,项目名称:Grant-master,代码行数:8,代码来源:MainActivity.java
示例4: checkPermissions
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
private void checkPermissions() {
PermissionsManager.getInstance().requestAllManifestPermissionsIfNecessary(this, new PermissionsResultAction() {
@Override
public void onGranted() {
}
@Override
public void onDenied(String permission) {
String message = String.format(Locale.getDefault(), getString(R.string.message_denied), permission);
Toast.makeText(MyBrowserActivity.this, message, Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:wade-fs,项目名称:MediaManager,代码行数:14,代码来源:MyBrowserActivity.java
示例5: onCreate
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Requesting all the permissions in the manifest
PermissionsManager.getInstance().requestAllManifestPermissionsIfNecessary(this, new PermissionsResultAction() {
@Override
public void onGranted() {
Toast.makeText(MainActivity.this, R.string.message_granted, Toast.LENGTH_SHORT).show();
writeToStorage("Hello, World!");
readFromStorage();
}
@Override
public void onDenied(String permission) {
String message = String.format(Locale.getDefault(), getString(R.string.message_denied), permission);
Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
}
});
boolean hasPermission = PermissionsManager.getInstance().hasPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
Log.d(TAG, "Has " + Manifest.permission.READ_EXTERNAL_STORAGE + " permission: " + hasPermission);
Button writeStorage = (Button) findViewById(R.id.button_write_storage);
Button readStorage = (Button) findViewById(R.id.button_read_storage);
Button readContacts = (Button) findViewById(R.id.button_read_contacts);
Button getLocation = (Button) findViewById(R.id.button_get_location);
this.textView = (TextView) findViewById(R.id.text);
writeStorage.setOnClickListener(this);
readStorage.setOnClickListener(this);
readContacts.setOnClickListener(this);
getLocation.setOnClickListener(this);
}
开发者ID:anthonycr,项目名称:Grant,代码行数:37,代码来源:MainActivity.java
示例6: checkPermissions
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
private void checkPermissions() {
PermissionsManager.getInstance().requestAllManifestPermissionsIfNecessary(this, new PermissionsResultAction() {
@Override
public void onGranted() {
}
@Override
public void onDenied(String permission) {
String message = String.format(Locale.getDefault(), getString(R.string.message_denied), permission);
Toast.makeText(AbstractBrowserActivity.this, message, Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:DF1E,项目名称:SimpleExplorer,代码行数:14,代码来源:AbstractBrowserActivity.java
示例7: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
开发者ID:Dentacoin,项目名称:aftercare-app-android,代码行数:5,代码来源:DCActivity.java
示例8: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:6,代码来源:SettingsActivity.java
示例9: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
开发者ID:imesong,项目名称:themePlugin,代码行数:6,代码来源:BaseActivity.java
示例10: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
PermissionsManager.getInstance().notifyPermissionsChange(permissions,grantResults);
}
开发者ID:imesong,项目名称:themePlugin,代码行数:6,代码来源:BaseFragmentActivity.java
示例11: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
开发者ID:SpongeBobSun,项目名称:Prodigal,代码行数:5,代码来源:MainActivity.java
示例12: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(final int requestCode,
@NonNull final String[] permissions,
@NonNull final int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
开发者ID:MikeFot,项目名称:Android--Beacon-Scanner-Service,代码行数:7,代码来源:MainActivity.java
示例13: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
开发者ID:alt236,项目名称:Bluetooth-LE-Library---Android,代码行数:7,代码来源:MainActivity.java
示例14: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
/**
* Handle the callback that permissions requested have been granted or not.
* This method should act upon the results of the permissions request.
*
* @param requestCode the request code sent when initially making the request
* @param permissions the array of the permissions that was requested
* @param grantResults the results of the permissions requests that provides
* information on whether the request was granted or not
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:15,代码来源:BrowserActivity.java
注:本文中的com.anthonycr.grant.PermissionsManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论