use of com.google.android.material.snackbar.Snackbar in project android by owncloud.
the class OCFileListFragment method registerFabUploadListeners.
/**
* registers {@link android.view.View.OnClickListener} and {@link android.view.View.OnLongClickListener}
* on the Upload mini FAB for the linked action an {@link Snackbar} showing the underlying action.
*/
private void registerFabUploadListeners() {
getFabUpload().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final View uploadBottomSheet = getLayoutInflater().inflate(R.layout.upload_bottom_sheet_fragment, null);
final BottomSheetDialog dialog = new BottomSheetDialog(requireContext());
dialog.setContentView(uploadBottomSheet);
final BottomSheetFragmentItemView uploadFromFilesItemView = uploadBottomSheet.findViewById(R.id.upload_from_files_item_view);
BottomSheetFragmentItemView uploadFromCameraItemView = uploadBottomSheet.findViewById(R.id.upload_from_camera_item_view);
TextView uploadToTextView = uploadBottomSheet.findViewById(R.id.upload_to_text_view);
uploadFromFilesItemView.setOnTouchListener((v13, event) -> {
Intent action = new Intent(Intent.ACTION_GET_CONTENT);
action = action.setType(ALL_FILES_SAF_REGEX).addCategory(Intent.CATEGORY_OPENABLE);
action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
getActivity().startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)), FileDisplayActivity.REQUEST_CODE__SELECT_CONTENT_FROM_APPS);
dialog.hide();
return false;
});
uploadFromCameraItemView.setOnTouchListener((v12, event) -> {
((FileDisplayActivity) getActivity()).getFilesUploadHelper().uploadFromCamera(FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA);
dialog.hide();
return false;
});
uploadToTextView.setText(String.format(getResources().getString(R.string.upload_to), getResources().getString(R.string.app_name)));
final BottomSheetBehavior uploadBottomSheetBehavior = BottomSheetBehavior.from((View) uploadBottomSheet.getParent());
dialog.setOnShowListener(dialog1 -> uploadBottomSheetBehavior.setPeekHeight(uploadBottomSheet.getMeasuredHeight()));
dialog.show();
getFabMain().collapse();
recordMiniFabClick();
}
});
getFabUpload().setOnLongClickListener(v -> {
showSnackMessage(R.string.actionbar_upload);
return true;
});
}
use of com.google.android.material.snackbar.Snackbar in project android by owncloud.
the class OCFileListFragment method showSnackMessage.
/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar snackbar = Snackbar.make(requireActivity().findViewById(R.id.coordinator_layout), messageResource, Snackbar.LENGTH_LONG);
snackbar.show();
}
use of com.google.android.material.snackbar.Snackbar in project android by owncloud.
the class CreateFolderDialogFragment method showSnackMessage.
/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar snackbar = Snackbar.make(requireActivity().findViewById(R.id.coordinator_layout), messageResource, Snackbar.LENGTH_LONG);
snackbar.show();
}
use of com.google.android.material.snackbar.Snackbar in project android by owncloud.
the class RenameFileDialogFragment method showSnackMessage.
/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar snackbar = Snackbar.make(getActivity().findViewById(android.R.id.content), messageResource, Snackbar.LENGTH_LONG);
snackbar.show();
}
use of com.google.android.material.snackbar.Snackbar in project materialistic by hidroh.
the class BaseListActivity method onPostCreate.
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
if (!Preferences.isReleaseNotesSeen(this)) {
Snackbar snackbar = Snackbar.make(findViewById(R.id.content_frame), R.string.hint_update, Snackbar.LENGTH_INDEFINITE);
snackbar.setAction(R.string.title_activity_release, v -> {
snackbar.dismiss();
startActivity(new Intent(BaseListActivity.this, ReleaseNotesActivity.class));
}).setActionTextColor(ContextCompat.getColor(this, R.color.orange500)).addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
Preferences.setReleaseNotesSeen(BaseListActivity.this);
}
}).show();
}
}
Aggregations