本文整理汇总了Java中android.support.design.widget.BaseTransientBottomBar.BaseCallback方法的典型用法代码示例。如果您正苦于以下问题:Java BaseTransientBottomBar.BaseCallback方法的具体用法?Java BaseTransientBottomBar.BaseCallback怎么用?Java BaseTransientBottomBar.BaseCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.BaseTransientBottomBar
的用法示例。
在下文中一共展示了BaseTransientBottomBar.BaseCallback方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
if(getArguments().containsKey(REMINDER_TO_DISPLAY)) {
mReminder = (OneTimeReminder) getArguments().getSerializable(REMINDER_TO_DISPLAY);
} else {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
getActivity().finish();
}
};
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.fragment_location_based_reminder_detail_snackbar_error_no_reminder, SnackbarUtil.SnackbarDuration.LONG, callback);
}
}
示例2: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
if(getArguments().containsKey(REMINDER_TO_DISPLAY)) {
mReminder = (LocationBasedReminder) getArguments().getSerializable(REMINDER_TO_DISPLAY);
} else {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
getActivity().finish();
}
};
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.fragment_location_based_reminder_detail_snackbar_error_no_reminder, SnackbarUtil.SnackbarDuration.LONG, callback);
}
}
示例3: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
if(getArguments().containsKey(REMINDER_TO_DISPLAY)) {
mReminder = (RepeatingReminder) getArguments().getSerializable(REMINDER_TO_DISPLAY);
} else {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
getActivity().finish();
}
};
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.fragment_location_based_reminder_detail_snackbar_error_no_reminder, SnackbarUtil.SnackbarDuration.LONG, callback);
}
}
示例4: onReceiveAddressResult
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
@Override
public void onReceiveAddressResult(int resultCode, Bundle resultData) {
String alias = resultData.getString(FetchAddressIntentService.RESULT_ALIAS_KEY);
String address = resultData.getString(FetchAddressIntentService.RESULT_ADDRESS_KEY);
if (resultCode == FetchAddressIntentService.SUCCESS_RESULT) {
setAliasAndAddress(alias, address);
} else {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
setAliasAndAddress("", "");
}
};
SnackbarUtil.showSnackbar(mMapContainer, SnackbarUtil.SnackbarType.ERROR, R.string.activity_place_snackbar_error_fetching_address, SnackbarUtil.SnackbarDuration.SHORT, callback);
}
}
示例5: saveThumbnailAsImageFile
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
private void saveThumbnailAsImageFile(Bitmap thumbnail) {
File imageFile = new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename());
try {
ImageUtil.saveBitmapAsJpeg(imageFile, thumbnail, IMAGE_COMPRESSION_PERCENTAGE);
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.activity_edit_image_attachment_snackbar_error_image_deleted_from_device, SnackbarUtil.SnackbarDuration.LONG, null);
}catch (IOException e) {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
setResult(RESULT_CANCELED);
finish();
}
};
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.error_unexpected, SnackbarUtil.SnackbarDuration.LONG, callback);
}
}
示例6: onRequestPermissionsResult
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case REQUEST_TAKE_PICTURE_PERMISSION:
for (int result : grantResults) {
if(result != PackageManager.PERMISSION_GRANTED) {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
handleImageCapture();
}
};
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.NOTICE, R.string.activity_edit_image_attachment_snackbar_error_no_permissions, SnackbarUtil.SnackbarDuration.SHORT, callback);
return;
}
}
//Permissions granted
dispatchTakePictureIntent();
break;
}
}
示例7: showSnackbar
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
public static void showSnackbar(View container, @NonNull SnackbarType snackbarType,
@StringRes int textStringRes, @Nullable SnackbarDuration duration,
@Nullable BaseTransientBottomBar.BaseCallback<Snackbar> callback) {
duration = (duration == null ? SnackbarDuration.LONG : duration);
Snackbar snackbar = Snackbar.make(container, textStringRes, duration.getDuration());
snackbar.getView().setBackgroundResource(snackbarType.getColorRes());
TextView snackbarText = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
snackbarText.setCompoundDrawablesWithIntrinsicBounds(0, 0,snackbarType.getIconRes(), 0);
snackbarText.setGravity(Gravity.CENTER);
if(callback != null)
snackbar.addCallback(callback);
snackbar.show();
}
示例8: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_image_attachment);
mContainer = (RelativeLayout) findViewById(R.id.activity_edit_image_attachment_container);
mImage = (ImageView) findViewById(R.id.activity_edit_image_attachment_image);
mCrop = (FloatingActionButton) findViewById(R.id.activity_edit_image_attachment_crop);
mRotate = (FloatingActionButton) findViewById(R.id.activity_edit_image_attachment_rotate);
mCamera = (FloatingActionButton) findViewById(R.id.activity_edit_image_attachment_camera);
mOk = (Button) findViewById(R.id.activity_edit_image_attachment_ok);
mCancel = (Button) findViewById(R.id.activity_edit_image_attachment_cancel);
//If screen was rotated, for example
if (savedInstanceState != null) {
//Load values from savedInstanceState
mImageAttachment = (ImageAttachment) savedInstanceState.getSerializable(IMAGE_ATTACHMENT_EXTRA);
mHolderPosition = savedInstanceState.getInt(HOLDER_POSITION_EXTRA);
mEditingExistingImageAttachment = savedInstanceState.getBoolean(EDITING_ATTACHMENT_EXTRA);
//Get jpeg from SD Card
mImageBackup = ImageUtil.getBitmap(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()));
if(mImageBackup == null) { //If jpeg was deleted from device, use thumbnail
mImageBackup = ImageUtil.getBitmap(mImageAttachment.getThumbnail());
saveThumbnailAsImageFile(mImageBackup);
}
mImage.setImageBitmap(mImageBackup);
showTapTargetSequence();
} else {
//Coming from another activity: Check if intent has required extras
if(getIntent().hasExtra(HOLDER_POSITION_EXTRA) && getIntent().hasExtra(IMAGE_ATTACHMENT_EXTRA)) {
mHolderPosition = getIntent().getIntExtra(HOLDER_POSITION_EXTRA, -1);
mImageAttachment = (ImageAttachment) getIntent().getSerializableExtra(IMAGE_ATTACHMENT_EXTRA);
if (mImageAttachment.getImageFilename() != null && !mImageAttachment.getImageFilename().isEmpty()) {
mImageBackup = ImageUtil.getBitmap(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()));
if(mImageBackup == null) { //IF image was deleted from device
mImageBackup = ImageUtil.getBitmap(mImageAttachment.getThumbnail());
saveThumbnailAsImageFile(mImageBackup);
}
mEditingExistingImageAttachment = true;
mImage.setImageBitmap(mImageBackup);
showTapTargetSequence();
} else {
mImageAttachment = new ImageAttachment();
mImageAttachment.setImageFilename(UUID.randomUUID().toString() + IMAGE_FILE_EXTENSION);
handleShowCameraGalleryDialog();
}
} else {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
setResult(RESULT_CANCELED);
finish();
}
};
Log.e(TAG, "Missing HOLDER_POSITION_EXTRA and/or IMAGE_ATTACHMENT_EXTRA parameters in EditImageAttachmentActivity.");
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.error_unexpected, SnackbarUtil.SnackbarDuration.LONG, callback);
finish();
}
// mImageAttachment = new ImageAttachment(new byte[0], "09ce7135-86d6-4d93-bcc5-1fbff5651d0f.jpg");
// mImageBackup = ImageUtil.getBitmap(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()));
// mEditingExistingImageAttachment = true;
// mImage.setImageBitmap(mImageBackup);
}
mRotation = 0;
mCrop.setOnClickListener(this);
mRotate.setOnClickListener(this);
mCamera.setOnClickListener(this);
mOk.setOnClickListener(this);
mCancel.setOnClickListener(this);
}
示例9: handleTaskSave
import android.support.design.widget.BaseTransientBottomBar; //导入方法依赖的package包/类
private void handleTaskSave() {
AttachmentUtil.cleanInvalidAttachments(mTask.getAttachments());
try {
RemindyDAO dao = new RemindyDAO(this);
if (!editingTask) {
//Insert the task
dao.insertTask(mTask);
//Update geofences
if(mTask.getReminderType().equals(ReminderType.LOCATION_BASED))
GeofenceUtil.updateGeofences(getApplicationContext(), mGoogleApiClient);
//Update alarms
if(mTask.getReminderType().equals(ReminderType.ONE_TIME) || mTask.getReminderType().equals(ReminderType.REPEATING)) {
//Remove task from triggeredTasks list
SharedPreferenceUtil.removeIdFromTriggeredTasks(getApplicationContext(), mTask.getId());
//Update alarms
AlarmManagerUtil.updateAlarms(getApplicationContext());
}
}
//If editing, Caller activity TaskDetailActivity will save the task.
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
Intent returnIntent = new Intent();
returnIntent.putExtra(HomeActivity.NEW_TASK_RETURN_REMINDER_TYPE, mTask.getReminderType());
returnIntent.putExtra(TaskActivity.TASK_TO_EDIT, mTask);
setResult(RESULT_OK, returnIntent); //Task was created, set result to OK
finish();
}
};
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.SUCCESS, R.string.activity_task_snackbar_save_successful, SnackbarUtil.SnackbarDuration.SHORT, callback);
} catch (CouldNotInsertDataException e) {
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.activity_task_snackbar_error_saving, SnackbarUtil.SnackbarDuration.SHORT, null);
}
}