本文整理汇总了Java中com.afollestad.assent.Assent.setActivity方法的典型用法代码示例。如果您正苦于以下问题:Java Assent.setActivity方法的具体用法?Java Assent.setActivity怎么用?Java Assent.setActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.afollestad.assent.Assent
的用法示例。
在下文中一共展示了Assent.setActivity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
// Sets this activity for Android M and up permissions.
Assent.setActivity(this, this);
// Gets fragment manager and current fragment in layout.
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = fragmentManager.findFragmentById(R.id.fragment_container);
// Check if the fragment exists, if not it adds a new one.
if (fragment == null) {
fragment = MainFragment.newInstance();
fragmentManager.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
}
}
示例2: onCreate
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setup);
((SpeculumApplication) getApplication()).createSetupComponent(this).inject(this);
ButterKnife.bind(this);
Assent.setActivity(this, this);
if (!Assent.isPermissionGranted(Assent.READ_CALENDAR)) {
Assent.requestPermissions(result -> {
// Permission granted or denied
if (!result.allPermissionsGranted()) {
Toast.makeText(SetupActivity.this, noPermissionForCalendar, Toast.LENGTH_SHORT).show();
}
}, 1, Assent.READ_CALENDAR);
}
cbVoiceCommands.setOnCheckedChangeListener(this);
rbSimpleLayout.setOnCheckedChangeListener(this);
}
示例3: onCreate
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
((SpeculumApplication) getApplication()).createMainComponent(this).inject(this);
Assent.setActivity(this, this);
Configuration configuration = objectStore.get();
boolean didLoadOldConfig = getIntent().getBooleanExtra(Constants.SAVED_CONFIGURATION_IDENTIFIER, false);
ViewStub viewStub = configuration.isSimpleLayout() ?
(ViewStub) findViewById(R.id.stub_simple) :
(ViewStub) findViewById(R.id.stub_verbose);
if (null != viewStub) viewStub.inflate();
ButterKnife.bind(this);
//never sleep
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
if (didLoadOldConfig)
showConfigurationSnackbar();
presenter.setConfiguration(configuration);
}
示例4: onCreate
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scan_text_screen);
Assent.setActivity(this, this);
mScannerView = new ZXingScannerView(this);
List<BarcodeFormat> formats = Collections.singletonList(BarcodeFormat.QR_CODE);
mScannerView.setFormats(formats);
mScannerView.setAspectTolerance(0.5f);
ViewGroup contentFrame = findViewById(R.id.content);
contentFrame.addView(mScannerView);
setupToolbar(true, false);
setTitle(getIntent().getStringExtra("title"));
}
示例5: onResume
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (Authenticator.getDefaultAccount(this) == null) {
NumberValidation.start(this);
finish();
return;
}
Assent.setActivity(this, this);
// hold message center
MessageCenterService.hold(this, true);
mFragment.startQuery();
}
示例6: onResume
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Assent.setActivity(this, this);
hideSystemUI();
presenter.start(Assent.isPermissionGranted(Assent.READ_CALENDAR));
}
示例7: onPause
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onPause() {
super.onPause();
presenter.finish();
if (isFinishing())
Assent.setActivity(this, null);
}
示例8: onResume
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Assent.setActivity(this, this);
mScannerView.setResultHandler(this);
if (Assent.isPermissionGranted(Assent.CAMERA)) {
startCamera();
}
else {
Assent.requestPermissions(this, REQUEST_PERMISSIONS, Assent.CAMERA);
}
}
示例9: onPause
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onPause() {
super.onPause();
if (isFinishing())
Assent.setActivity(this, null);
stopCamera();
}
示例10: onResume
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Assent.setActivity(this, this);
// ask for access to contacts
askPermissions();
}
示例11: onCreate
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Assent.setActivity(this, this);
setContentView(R.layout.contacts_list_screen);
setupToolbar(true, true);
boolean multiselect = getIntent().getBooleanExtra(MODE_MULTI_SELECT, false);
if (multiselect) {
boolean addUsers = getIntent().getBooleanExtra(MODE_ADD_USERS, false);
// FIXME using another string
setTitle(addUsers ? R.string.menu_invite_group : R.string.action_compose_group);
}
if (savedInstanceState == null) {
mFragment = ContactsListFragment.newInstance(multiselect);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_contacts_list, mFragment)
.commitAllowingStateLoss();
}
else {
mFragment = (ContactsListFragment) getSupportFragmentManager()
.findFragmentById(R.id.fragment_contacts_list);
}
if (!getIntent().getBooleanExtra("picker", false))
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (!Preferences.getContactsListVisited())
Toast.makeText(this, R.string.msg_do_refresh,
Toast.LENGTH_LONG).show();
}
示例12: onStart
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
Assent.setActivity(this, this);
if (!Assent.isPermissionGranted(Assent.READ_CONTACTS)) {
Toast.makeText(this, R.string.warn_contacts_denied, Toast.LENGTH_LONG).show();
}
}
示例13: onPause
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onPause() {
super.onPause();
if (isFinishing())
Assent.setActivity(this, null);
// release message center
MessageCenterService.release(this);
}
示例14: initRuntimePermissionRequest
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
private void initRuntimePermissionRequest() {
Assent.setActivity(this, this);
}
示例15: onResume
import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Assent.setActivity(this, this);
}