本文整理汇总了Java中pl.tajchert.nammu.Nammu类的典型用法代码示例。如果您正苦于以下问题:Java Nammu类的具体用法?Java Nammu怎么用?Java Nammu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nammu类属于pl.tajchert.nammu包,在下文中一共展示了Nammu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showChooserDialog
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
public static void showChooserDialog(final BaseActivity activity, final Callback callback) {
PhotoHelper.callback = callback;
Nammu.askForPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {
@Override
public void permissionGranted() {
Intent intent = CropImage.getPickImageChooserIntent(activity);
activity.startActivityForResult(intent, CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE);
}
@Override
public void permissionRefused() {
callOnFailure(Failure.PERMISSION_DENIED);
}
});
}
示例2: onCreate
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
application = this;
Nammu.init(this);
/*
* Configure Realm
*/
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(realmConfiguration);
try {
DataStore.getInstance();
} catch (RealmError e) {
Log.e(TAG, "Error configuring realm, deleting and trying again.", e);
Realm.deleteRealm(realmConfiguration);
DataStore.getInstance();
}
}
示例3: onCreate
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_name);
ButterKnife.bind(this);
Nammu.init(this);
profileImage.setImageURI(session.getUrlAvatar());
editUsername.setText(session.getUsername());
boolean isModification = getIntent().getBooleanExtra(KEY_MODIFICATION, false);
if (!isModification && !TextUtils.isEmpty(session.getUsername())) {
navigateListRoomsActivity();
}
}
示例4: selectImage
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@DebugLog
@OnClick(R.id.backdrop)
void selectImage() {
int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
Nammu.askForPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {
@DebugLog
@Override
public void permissionGranted() {
EasyImage.openGallery(NameActivity.this, 0);
//Nothing, this sample saves to Public gallery so it needs permission
}
@DebugLog
@Override
public void permissionRefused() {
// finish();
}
});
}
else {
EasyImage.openGallery(NameActivity.this, 0);
}
}
示例5: askPermission
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
private void askPermission(String permissionName) {
if (!Nammu.checkPermission(permissionName)) {
if (Nammu.shouldShowRequestPermissionRationale(this, permissionName)) {
Toast.makeText(this, R.string.permission_tips, Toast.LENGTH_SHORT).show();
Nammu.askForPermission(MainActivity.this, permissionName, new PermissionCallback() {
@Override
public void permissionGranted() { }
@Override
public void permissionRefused() { }
});
} else {
Nammu.askForPermission(MainActivity.this, permissionName, new PermissionCallback() {
@Override
public void permissionGranted() { }
@Override
public void permissionRefused() { }
});
}
}
}
示例6: onActivityResult
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE && permissionCallback != null && activity != null) {
ArrayList<String> rejectedPermissions = new ArrayList<>();
for(String neededPermission: neededPermissions){
if (!Nammu.checkPermission(neededPermission)){
rejectedPermissions.add(neededPermission);
}
}
permissionDialog.dismiss();
if(!rejectedPermissions.isEmpty()){
permissionCallback.permissionRefused();
}else{
permissionCallback.permissionGranted();
}
}
}
示例7: onCreate
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
CustomActivityOnCrash.install(this);
EventBus.getDefault().register(this);
EasyImage.configuration(this)
.saveInRootPicturesDirectory()
.setImagesFolderName(getString(R.string.app_name));
Nammu.init(this);
Paper.init(this);
Typekit.getInstance()
.addNormal(Typekit.createFromAsset(this, "fonts/LatoLatin-Regular.ttf"))
.addBold(Typekit.createFromAsset(this, "fonts/LatoLatin-Bold.ttf"))
.addItalic(Typekit.createFromAsset(this, "fonts/LatoLatin-Italic.ttf"))
.addBoldItalic(Typekit.createFromAsset(this, "fonts/LatoLatin-BoldItalic.ttf"))
.addCustom1(Typekit.createFromAsset(this, "fonts/Geomanist-Regular.otf"))
.addCustom2(Typekit.createFromAsset(this, "fonts/Handlee-Regular.ttf"));
initFabric();
initParse();
}
示例8: onClick
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.back) {
supportFinishAfterTransition();
} else if (v.getId() == R.id.save) {
if (!mCanSave) {
UI.showToast(this, R.string.image_is_loading);
return;
}
if (Nammu.checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
save();
} else {
if (Nammu.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
//User already refused to give us this permission or removed it
//Now he/she can mark "never ask again" (sic!)
showTips();
} else {
//First time asking for permission
// or phone doesn't offer permission
// or user marked "never ask again"
Nammu.askForPermission(this, Manifest.permission.READ_CONTACTS, permissionLocationCallback);
}
}
}
}
示例9: onMyCreate
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
protected void onMyCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_create);
ButterKnife.inject(this);
Nammu.init(getApplicationContext());
mType = getIntent().getIntExtra(UiUtils.ARG_TYPE, UiUtils.TYPE_SHOT);
if (mType == UiUtils.TYPE_BUCKET) {
mBucket = getIntent().getParcelableExtra(UiUtils.ARG_BUCKET);
} else {
mShot = getIntent().getParcelableExtra(UiUtils.ARG_SHOT);
}
if (savedInstanceState == null) {
mFragment = getFrament();
getSupportFragmentManager().beginTransaction().replace(R.id.container, mFragment).commit();
} else {
mFragment = (SaveCheckFragment) getSupportFragmentManager().findFragmentById(R.id.container);
}
}
示例10: onResume
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (!Nammu.checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
//We do not own this permission
if (Nammu.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
//User already refused to give us this permission or removed it
//Now he/she can mark "never ask again" (sic!)
Snackbar.make(findViewById(R.id.image_view_tips), "Need storage permission to read pictures.",
Snackbar.LENGTH_INDEFINITE)
.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) {
Nammu.askForPermission(CreateActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE, permissionContactsCallback);
}
}).show();
} else {
//First time asking for permission
// or phone doesn't offer permission
// or user marked "never ask again"
Nammu.askForPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, permissionContactsCallback);
}
}
}
示例11: onViewCreated
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
Bundle args = getArguments();
if(args == null) {
throw new IllegalArgumentException("Please pass SearchResult as fragment argument");
}
final SearchResult searchResult = Parcels.unwrap(args.getParcelable(SEARCH_RESULT));
cameraCompat = CameraCompat.create(searchResult.maxPicSize());
cameraCompat.open();
videoCaptureSurfaceView.getHolder().addCallback(this);
timer.setText(searchResult.askForPicsProduct());
Nammu.askForPermission(getActivity(), new String[]{
android.Manifest.permission.CAMERA,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
android.Manifest.permission.READ_EXTERNAL_STORAGE
} , permissionCameraCallback);
}
示例12: onCreate
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_report);
ButterKnife.bind(this);
sessionId = SessionId.create(this);
if (getIntent() != null) {
productId = getIntent().getStringExtra("productId");
code = getIntent().getStringExtra("code");
}
setImageView(bitmaps);
Nammu.init(this);
if(logger == null) {
logger = new EventLogger(this);
}
logger.logLevelStart("report", code, sessionId.get());
}
示例13: onResume
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
Nammu.permissionCompare(new PermissionListener() {
@Override
public void permissionsChanged(String permissionRevoke) {
//Toast is not needed as always either permissionsGranted() or permissionsRemoved() will be called
//Toast.makeText(MainActivity.this, "Access revoked = " + permissionRevoke, Toast.LENGTH_SHORT).show();
}
@Override
public void permissionsGranted(String permissionGranted) {
Toast.makeText(getContext(), "Access granted = " + permissionGranted, Toast.LENGTH_SHORT).show();
}
@Override
public void permissionsRemoved(String permissionRemoved) {
Toast.makeText(getContext(), "Access removed = " + permissionRemoved, Toast.LENGTH_SHORT).show();
}
});
}
示例14: clickButtLocation
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@OnClick(R.id.buttonLocation)
public void clickButtLocation() {
if(Nammu.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
boolean hasAccess = Tools.accessLocation(getContext());
Toast.makeText(getContext(), "Access granted fine= " + hasAccess, Toast.LENGTH_SHORT).show();
} else {
if (Nammu.shouldShowRequestPermissionRationale(MyFragment.this, Manifest.permission.ACCESS_FINE_LOCATION)) {
//User already refused to give us this permission or removed it
//Now he/she can mark "never ask again" (sic!)
Snackbar.make(getView(), "Here we explain user why we need to know his/her location.",
Snackbar.LENGTH_INDEFINITE)
.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) {
Nammu.askForPermission(MyFragment.this, Manifest.permission.ACCESS_FINE_LOCATION, permissionLocationCallback);
}
}).show();
} else {
//First time asking for permission
// or phone doesn't offer permission
// or user marked "never ask again"
Nammu.askForPermission(MyFragment.this, Manifest.permission.ACCESS_FINE_LOCATION, permissionLocationCallback);
}
}
}
示例15: onResume
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@Override protected void onResume() {
super.onResume();
Nammu.permissionCompare(new PermissionListener() {
@Override public void permissionsChanged(String permissionRevoke) {
//Toast is not needed as always either permissionsGranted() or permissionsRemoved() will be called
//Toast.makeText(MainActivity.this, "Access revoked = " + permissionRevoke, Toast.LENGTH_SHORT).show();
}
@Override public void permissionsGranted(String permissionGranted) {
Toast.makeText(MainActivity.this, "Access granted = " + permissionGranted,
Toast.LENGTH_SHORT).show();
}
@Override public void permissionsRemoved(String permissionRemoved) {
Toast.makeText(MainActivity.this, "Access removed = " + permissionRemoved,
Toast.LENGTH_SHORT).show();
}
});
}