本文整理匯總了Java中com.yanzhenjie.permission.Rationale類的典型用法代碼示例。如果您正苦於以下問題:Java Rationale類的具體用法?Java Rationale怎麽用?Java Rationale使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Rationale類屬於com.yanzhenjie.permission包,在下文中一共展示了Rationale類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.yanzhenjie.permission.Rationale; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gos_main);
context = GosMainActivity.this;
manager = new LocalActivityManager(this, true);
manager.dispatchCreate(savedInstanceState);
instance = this;
InitImageView();
initTextView();
initPagerViewer();
initHandler();
AndPermission.with(this)
.requestCode(REQUEST_CODE_SETTING)
.permission(Manifest.permission.ACCESS_FINE_LOCATION).rationale(new RationaleListener() {
@Override
public void showRequestPermissionRationale(int arg0, Rationale arg1) {
AndPermission.rationaleDialog(GosMainActivity.this, arg1).show();
}
})
.send();
}
示例2: onOptionsItemSelected
import com.yanzhenjie.permission.Rationale; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// activity.logoutToClean();
// finish();
break;
case R.id.action_QR_code:
AndPermission.with(this)
.requestCode(REQUEST_ZXINGCODE_SETTING)
.permission(Manifest.permission.CAMERA).rationale(new RationaleListener() {
@Override
public void showRequestPermissionRationale(int arg0, Rationale arg1) {
AndPermission.rationaleDialog(GosMainActivity.this, arg1).show();
}
})
.send();
break;
case R.id.action_addDevice:
if (!checkNetwork(GosMainActivity.this)) {
Toast.makeText(GosMainActivity.this, R.string.network_error, 2000).show();
} else {
intent = new Intent(GosMainActivity.this, GosAirlinkChooseDeviceWorkWiFiActivity.class);
startActivity(intent);
}
break;
}
return super.onOptionsItemSelected(item);
}