当前位置: 首页>>代码示例>>Java>>正文


Java Assent.setActivity方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:BoydHogerheijde,项目名称:Beacon-Scanner-Android,代码行数:18,代码来源:MainActivity.java

示例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);
}
 
开发者ID:NielsMasdorp,项目名称:Speculum-Android,代码行数:21,代码来源:SetupActivity.java

示例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);
}
 
开发者ID:NielsMasdorp,项目名称:Speculum-Android,代码行数:26,代码来源:MainActivity.java

示例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"));
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:18,代码来源:ScanTextActivity.java

示例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();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:18,代码来源:ContactsListActivity.java

示例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));
}
 
开发者ID:NielsMasdorp,项目名称:Speculum-Android,代码行数:8,代码来源:MainActivity.java

示例7: onPause

import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onPause() {
    super.onPause();
    presenter.finish();
    if (isFinishing())
        Assent.setActivity(this, null);
}
 
开发者ID:NielsMasdorp,项目名称:Speculum-Android,代码行数:8,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:14,代码来源:ScanTextActivity.java

示例9: onPause

import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onPause() {
    super.onPause();
    if (isFinishing())
        Assent.setActivity(this, null);
    stopCamera();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:8,代码来源:ScanTextActivity.java

示例10: onResume

import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Assent.setActivity(this, this);
    // ask for access to contacts
    askPermissions();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:8,代码来源:NumberValidation.java

示例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();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:35,代码来源:ContactsListActivity.java

示例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();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:9,代码来源:ContactsListActivity.java

示例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);
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:9,代码来源:ContactsListActivity.java

示例14: initRuntimePermissionRequest

import com.afollestad.assent.Assent; //导入方法依赖的package包/类
private void initRuntimePermissionRequest() {
    Assent.setActivity(this, this);
}
 
开发者ID:akexorcist,项目名称:Android-SleepingForLess,代码行数:4,代码来源:ImagePostPreviewActivity.java

示例15: onResume

import com.afollestad.assent.Assent; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Assent.setActivity(this, this);
}
 
开发者ID:berger89,项目名称:beacon-finder,代码行数:6,代码来源:MainActivity.java


注:本文中的com.afollestad.assent.Assent.setActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。