本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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();
}
});
}
示例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);
}
示例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();
}
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例11: onRequestPermissionsResult
import com.anthonycr.grant.PermissionsManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
PermissionsManager.getInstance().notifyPermissionsChange(permissions, grantResults);
}
示例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);
}
示例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);
}
示例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);
}