當前位置: 首頁>>代碼示例>>Java>>正文


Java Rationale類代碼示例

本文整理匯總了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();


}
 
開發者ID:gizwits,項目名稱:GOpenSource_AppKit_Android_AS,代碼行數:30,代碼來源:GosMainActivity.java

示例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);
}
 
開發者ID:gizwits,項目名稱:GOpenSource_AppKit_Android_AS,代碼行數:37,代碼來源:GosMainActivity.java


注:本文中的com.yanzhenjie.permission.Rationale類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。