• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Assent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.afollestad.assent.Assent的典型用法代码示例。如果您正苦于以下问题:Java Assent类的具体用法?Java Assent怎么用?Java Assent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Assent类属于com.afollestad.assent包,在下文中一共展示了Assent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onClickFab

import com.afollestad.assent.Assent; //导入依赖的package包/类
@OnClick(R.id.fab)
public void onClickFab() {
  if (!Assent.isPermissionGranted(Assent.WRITE_EXTERNAL_STORAGE)) {
    Assent.requestPermissions(
        results -> {
          if (results.allPermissionsGranted()) {
            request.send().subscribe();
          } else {
            Snackbar.make(rootView, R.string.permission_denied, Snackbar.LENGTH_LONG).show();
          }
        },
        69,
        Assent.WRITE_EXTERNAL_STORAGE);
    return;
  }
  request.send().subscribe();
}
 
开发者ID:afollestad,项目名称:arctic-icon-request,代码行数:18,代码来源:MainActivity.java


示例2: grantExternalStoragePermission

import com.afollestad.assent.Assent; //导入依赖的package包/类
public void grantExternalStoragePermission() {
    if (!Assent.isPermissionGranted(Assent.WRITE_EXTERNAL_STORAGE)) {
        Assent.requestPermissions(new AssentCallback() {
            @Override
            public void onPermissionResult(PermissionResultSet result) {
                if (result.isGranted(Assent.WRITE_EXTERNAL_STORAGE)) {
                    startDownload();
                } else {
                    Snackbar.make(ivPreview, R.string.please_accept_write_external_storage_permission, Snackbar.LENGTH_LONG).show();
                }
            }
        }, 5, Assent.WRITE_EXTERNAL_STORAGE);
    } else {
        startDownload();
    }
}
 
开发者ID:akexorcist,项目名称:Android-SleepingForLess,代码行数:17,代码来源:ImagePostPreviewActivity.java


示例3: grantExternalStoragePermission

import com.afollestad.assent.Assent; //导入依赖的package包/类
private void grantExternalStoragePermission() {
    if (!Assent.isPermissionGranted(Assent.WRITE_EXTERNAL_STORAGE)) {
        Assent.requestPermissions(new AssentCallback() {
            @Override
            public void onPermissionResult(PermissionResultSet result) {
                if (result.isGranted(Assent.WRITE_EXTERNAL_STORAGE)) {
                    startDownload();
                } else {
                    Snackbar.make(ivPreview, R.string.please_accept_write_external_storage_permission, Snackbar.LENGTH_LONG).show();
                }
            }
        }, 5, Assent.WRITE_EXTERNAL_STORAGE);
    } else {
        startDownload();
    }
}
 
开发者ID:akexorcist,项目名称:Android-SleepingForLess,代码行数:17,代码来源:OfflineImagePostPreviewActivity.java


示例4: 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


示例5: 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


示例6: onCheckedChanged

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
@SuppressWarnings("all")
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView.getId() == R.id.cb_voice_commands) {
        if (isChecked) {
            if (!Assent.isPermissionGranted(Assent.RECORD_AUDIO)) {
                Assent.requestPermissions(result -> {
                    // Permission granted or denied
                    if (!result.allPermissionsGranted()) {
                        Toast.makeText(SetupActivity.this, noPermissionForVoice, Toast.LENGTH_SHORT).show();
                        cbVoiceCommands.setChecked(false);
                    }
                }, 2, Assent.RECORD_AUDIO);
            }
        }
    } else {
        if (isChecked) {
            etSubreddit.setVisibility(View.GONE);
            tvRedditTitle.setVisibility(View.GONE);
        } else {
            etSubreddit.setVisibility(View.VISIBLE);
            tvRedditTitle.setVisibility(View.VISIBLE);
        }
    }
}
 
开发者ID:NielsMasdorp,项目名称:Speculum-Android,代码行数:26,代码来源:SetupActivity.java


示例7: 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


示例8: onResume

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    Assent.setFragment(this, this);
    mMapView.onResume();

    if (isPlacesEnabled()) {
        if (getView().getMeasuredHeight() == 0)
            getView().post(new Runnable() {
                @Override
                public void run() {
                    prepareLayout(true);
                }
            });
        else
            prepareLayout(true);
    }

    askPermissions();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:21,代码来源:SendPositionAbstractFragment.java


示例9: askPermissions

import com.afollestad.assent.Assent; //导入依赖的package包/类
private void askPermissions() {
    if (!Assent.isPermissionGranted(Assent.ACCESS_COARSE_LOCATION) ||
        !Assent.isPermissionGranted(Assent.ACCESS_FINE_LOCATION)) {

        if (!mPermissionAsked) {
            Assent.requestPermissions(this, REQUEST_PERMISSIONS,
                Assent.ACCESS_COARSE_LOCATION,
                Assent.ACCESS_FINE_LOCATION);
            mPermissionAsked = true;
        }
    }
    else {
        if (mMap != null)
            mMap.setMyLocationEnabled(true);
        requestLocation();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:18,代码来源:SendPositionAbstractFragment.java


示例10: onMapReady

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
public void onMapReady(final AnyMap anyMap) {
    super.onMapReady(anyMap);

    if (SystemUtils.isPermissionGranted(getContext(), Assent.ACCESS_FINE_LOCATION)) {
        @SuppressLint("MissingPermission")
        Location lastLocation = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        // Note that this can be NULL if last location isn't already known.
        if (lastLocation != null) {
            // Print current location if not null
            Log.d(TAG, "last location: " + lastLocation.toString());
            LatLng latLng = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
            mMyLocation.setLatitude(lastLocation.getLatitude());
            mMyLocation.setLongitude(lastLocation.getLongitude());
            if (mMap != null)
                mMap.animateCamera(CameraUpdateFactory.getInstance().newLatLngZoom(latLng, 16));
        }
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:20,代码来源:SendPositionOsmFragment.java


示例11: onResume

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    Assent.setFragment(this, this);

    if (Authenticator.getDefaultAccount(getActivity()) == null) {
        NumberValidation.start(getActivity());
        getActivity().finish();
        return;
    }

    // hold message center
    MessageCenterService.hold(getActivity(), true);

    ComposeMessage activity = getParentActivity();
    if (activity == null || !activity.hasLostFocus() || activity.hasWindowFocus()) {
        onFocus();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:20,代码来源:AbstractComposeFragment.java


示例12: startRecording

import com.afollestad.assent.Assent; //导入依赖的package包/类
void startRecording() {
    // ask parent to stop all sounds
    if (mListener != null)
        mListener.stopAllSounds();

    if (!Assent.isPermissionGranted(Assent.READ_EXTERNAL_STORAGE) ||
        !Assent.isPermissionGranted(Assent.WRITE_EXTERNAL_STORAGE) ||
        !Assent.isPermissionGranted(Assent.RECORD_AUDIO)) {

        Assent.requestPermissions(this, REQUEST_PERMISSIONS,
            Assent.READ_EXTERNAL_STORAGE,
            Assent.WRITE_EXTERNAL_STORAGE,
            Assent.RECORD_AUDIO);
    }
    else {
        doStartRecording();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:19,代码来源:ComposerBar.java


示例13: 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


示例14: askPermissions

import com.afollestad.assent.Assent; //导入依赖的package包/类
private void askPermissions() {
    if (mPermissionsAsked)
        return;

    if (!Assent.isPermissionGranted(Assent.READ_CONTACTS) ||
        !Assent.isPermissionGranted(Assent.WRITE_CONTACTS)) {
        Assent.requestPermissions(new AssentCallback() {
            @Override
            public void onPermissionResult(PermissionResultSet result) {
                // we can go by write contacts denied, but not read contacts
                if (!result.isGranted(Assent.READ_CONTACTS)) {
                    // just notify the user for now, we'll ask again later
                    error(R.string.err_validation_contacts_denied);
                }
            }
        }, REQUEST_PERMISSIONS, Assent.READ_CONTACTS, Assent.WRITE_CONTACTS);
        mPermissionsAsked = true;
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:20,代码来源:NumberValidation.java


示例15: 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


示例16: onCreate

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mTimeTxt = findViewById(R.id.time);
    mTimeTxt.setText(DateUtils.formatElapsedTime(0));
    mHintTxt = findViewById(R.id.hint);
    mImageButton = findViewById(R.id.image_audio);
    mProgressBar = findViewById(R.id.circularSeekBar);
    mProgressBar.setMax(MAX_PROGRESS);
    mProgressBar.setVisibility(View.INVISIBLE);
    getButton(Dialog.BUTTON_POSITIVE).setVisibility(View.GONE);

    if (!Assent.isPermissionGranted(Assent.READ_EXTERNAL_STORAGE) ||
        !Assent.isPermissionGranted(Assent.WRITE_EXTERNAL_STORAGE) ||
        !Assent.isPermissionGranted(Assent.RECORD_AUDIO)) {

        Assent.requestPermissions(this, REQUEST_PERMISSIONS,
            Assent.READ_EXTERNAL_STORAGE,
            Assent.WRITE_EXTERNAL_STORAGE,
            Assent.RECORD_AUDIO);
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:23,代码来源:AudioDialog.java


示例17: requestLocationPermission

import com.afollestad.assent.Assent; //导入依赖的package包/类
private void requestLocationPermission() {
    Assent.requestPermissions(new AssentCallback() {
        @Override
        public void onPermissionResult(PermissionResultSet permissionResultSet) {
            // Intentionally left blank
        }
    }, PERMISSION_COARSE_LOCATION, Assent.ACCESS_COARSE_LOCATION);
}
 
开发者ID:berger89,项目名称:beacon-finder,代码行数:9,代码来源:MainActivity.java


示例18: onRequestPermissionsResult

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String[] permissions,
                                       @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    Assent.handleResult(permissions, grantResults);
}
 
开发者ID:berger89,项目名称:beacon-finder,代码行数:8,代码来源:MainActivity.java


示例19: onCreate

import com.afollestad.assent.Assent; //导入依赖的package包/类
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //Bluetooth check
        verifyBluetooth();

        beaconManager = BeaconManager.getInstanceForApplication(getActivity());
        //BEACON PARSER
//        beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout(BeaconParser.ALTBEACON_LAYOUT));
        // Detect the main identifier (UID) frame:
        beaconManager.getBeaconParsers().add(new BeaconParser().
                setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
        // Detect the telemetry (TLM) frame:
        beaconManager.getBeaconParsers().add(new BeaconParser().
                setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
        // Detect the URL frame:
        beaconManager.getBeaconParsers().add(new BeaconParser().
                setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT));
        // Detect parser for iBeacons;
        beaconManager.getBeaconParsers().add(new BeaconParser().
                setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

//        beaconManager.debug = true;
        beaconHashMap = new HashMap<String, BeaconUtil>();
        if (!Assent.isPermissionGranted(Assent.ACCESS_COARSE_LOCATION)) {
            requestLocationPermission();
        }


    }
 
开发者ID:berger89,项目名称:beacon-finder,代码行数:32,代码来源:MonitorFragment.java


示例20: requestLocationPermission

import com.afollestad.assent.Assent; //导入依赖的package包/类
private void requestLocationPermission() {
    requestPermission(new String[]{Assent.ACCESS_COARSE_LOCATION, Assent.ACCESS_FINE_LOCATION}, new AssentCallback() {
        @Override
        public void onPermissionResult(PermissionResultSet permissionResultSet) {
            if (!permissionResultSet.allPermissionsGranted()) {
                finish();
                Toast.makeText(MainActivity.this, "You must grant location permission.", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
 
开发者ID:akexorcist,项目名称:Droid2JoyStick,代码行数:12,代码来源:MainActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XBasicForLoopExpression类代码示例发布时间:2022-05-22
下一篇:
Java DisallowSnapshotResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap