本文整理汇总了Java中pl.tajchert.nammu.Nammu类的典型用法代码示例。如果您正苦于以下问题:Java Nammu类的具体用法?Java Nammu怎么用?Java Nammu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nammu类属于pl.tajchert.nammu包,在下文中一共展示了Nammu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
});
}
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:17,代码来源:PhotoHelper.java
示例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();
}
}
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:27,代码来源:KwalaApplication.java
示例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();
}
}
开发者ID:BackPackerDz,项目名称:PotRoom,代码行数:19,代码来源:NameActivity.java
示例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);
}
}
开发者ID:BackPackerDz,项目名称:PotRoom,代码行数:27,代码来源:NameActivity.java
示例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() { }
});
}
}
}
开发者ID:ChillingVan,项目名称:AndroidInstantVideo,代码行数:21,代码来源:MainActivity.java
示例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();
}
}
}
开发者ID:ayz4sci,项目名称:permissionHelper,代码行数:18,代码来源:PermissionHelper.java
示例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();
}
开发者ID:adrielcafe,项目名称:NMSAlphabetAndroidApp,代码行数:22,代码来源:App.java
示例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);
}
}
}
}
开发者ID:goodev,项目名称:materialup,代码行数:26,代码来源:PhotoActivity.java
示例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);
}
}
开发者ID:goodev,项目名称:droidddle,代码行数:20,代码来源:CreateActivity.java
示例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);
}
}
}
开发者ID:goodev,项目名称:droidddle,代码行数:25,代码来源:CreateActivity.java
示例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);
}
开发者ID:KlubJagiellonski,项目名称:pola-android,代码行数:20,代码来源:VideoCaptureFragment.java
示例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());
}
开发者ID:KlubJagiellonski,项目名称:pola-android,代码行数:20,代码来源:CreateReportActivity.java
示例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();
}
});
}
开发者ID:tajchert,项目名称:Nammu,代码行数:22,代码来源:MyFragment.java
示例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);
}
}
}
开发者ID:tajchert,项目名称:Nammu,代码行数:26,代码来源:MyFragment.java
示例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();
}
});
}
开发者ID:tajchert,项目名称:Nammu,代码行数:20,代码来源:MainActivity.java
示例16: clickButtChangeSettings
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@OnClick(R.id.buttonSpecialChangeSettings) public void clickButtChangeSettings() {
if (Nammu.checkSpecialPermission(Manifest.permission.WRITE_SETTINGS)) {
Toast.makeText(this, "Access granted", Toast.LENGTH_SHORT).show();
} else {
Nammu.askForSpecialPermission(this, Manifest.permission.WRITE_SETTINGS,
new PermissionCallback() {
@Override public void permissionGranted() {
Toast.makeText(MainActivity.this, "Access granted", Toast.LENGTH_SHORT).show();
}
@Override public void permissionRefused() {
Log.d(TAG, "permissionRefused: ");
Toast.makeText(MainActivity.this, "Access refused", Toast.LENGTH_SHORT).show();
}
});
}
}
开发者ID:tajchert,项目名称:Nammu,代码行数:18,代码来源:MainActivity.java
示例17: clickButtContacts
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
@OnClick(R.id.buttonContacts) public void clickButtContacts() {
//Lets see if we can access Contacts
if (Nammu.checkPermission(Manifest.permission.READ_CONTACTS)) {
//We have a permission, easy peasy
boolean hasAccess = Tools.accessContacts(this);
Toast.makeText(this, "Access granted = " + hasAccess, Toast.LENGTH_SHORT).show();
} else {
//We do not own this permission
if (Nammu.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_CONTACTS)) {
//User already refused to give us this permission or removed it
//Now he/she can mark "never ask again" (sic!)
Snackbar.make(mLayout, "Here we explain user why we need to know his/her contacts.",
Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override public void onClick(View view) {
Nammu.askForPermission(MainActivity.this, Manifest.permission.READ_CONTACTS,
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.READ_CONTACTS, permissionContactsCallback);
}
}
}
开发者ID:tajchert,项目名称:Nammu,代码行数:27,代码来源:MainActivity.java
示例18: 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(this);
Toast.makeText(this, "Access granted fine= " + hasAccess, Toast.LENGTH_SHORT).show();
} else {
if (Nammu.shouldShowRequestPermissionRationale(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(mLayout, "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(MainActivity.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(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION,
permissionLocationCallback);
}
}
}
开发者ID:tajchert,项目名称:Nammu,代码行数:26,代码来源:MainActivity.java
示例19: setLocationEnabled
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
public static void setLocationEnabled(final Activity activity, final GoogleMap map) {
if (activity == null || map == null) {
return;
}
if (!setLocationIfPossible(activity, map)) {
Nammu.askForPermission(activity, LOCATION_PERMISSION, new PermissionCallback() {
@Override
public void permissionGranted() {
setLocationEnabled(activity, map);
}
@Override
public void permissionRefused() {
// Can't do anything here
}
});
}
}
开发者ID:cdeange,项目名称:uwaterloo-api,代码行数:20,代码来源:MapUtils.java
示例20: loadHero
import pl.tajchert.nammu.Nammu; //导入依赖的package包/类
public final void loadHero(final HeroFileInfo heroPath) {
Nammu.askForPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionCallback() {
@Override
public void permissionGranted() {
if (getHero() != null && preferences.getBoolean(DsaTabPreferenceActivity.KEY_AUTO_SAVE, true)) {
HeroSaveTask heroSaveTask = new HeroSaveTask(DsaTabActivity.this, getHero(),HeroExchange.getInstance());
heroSaveTask.execute();
}
setToolbarRefreshing(true);
Bundle args = new Bundle();
args.putSerializable(KEY_HERO_PATH, heroPath);
getLoaderManager().restartLoader(LOADER_HERO, args, new HeroLoaderCallback(DsaTabActivity.this));
}
@Override
public void permissionRefused() {
ViewUtils.snackbar(DsaTabActivity.this, "Keine Berechtigung um Helden auf SD-Karte zu speichern.");
}
});
}
开发者ID:gandulf,项目名称:DsaTab,代码行数:24,代码来源:DsaTabActivity.java
注:本文中的pl.tajchert.nammu.Nammu类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论