Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show snackbar above FAB #12877

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/screenShotTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

jobs:
screenshot:
runs-on: macOS-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -48,6 +48,12 @@ jobs:
distribution: "temurin"
java-version: 17

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions app/src/main/java/com/owncloud/android/utils/DisplayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,22 @@ public static Snackbar showSnackMessage(Activity activity, @StringRes int messag
*/
public static Snackbar showSnackMessage(Activity activity, String message) {
final Snackbar snackbar = Snackbar.make(activity.findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG);
var fab = findFABView(activity);
if (fab != null && fab.getVisibility() == View.VISIBLE) {
snackbar.setAnchorView(fab);
}
snackbar.show();
return snackbar;
}

private static View findFABView(Activity activity) {
return activity.findViewById(R.id.fab_main);
}

private static View findFABView(View view) {
return view.findViewById(R.id.fab_main);
}

/**
* Show a temporary message in a {@link Snackbar} bound to the given view.
*
Expand All @@ -663,6 +675,10 @@ public static Snackbar showSnackMessage(Activity activity, String message) {
*/
public static Snackbar showSnackMessage(View view, @StringRes int messageResource) {
final Snackbar snackbar = Snackbar.make(view, messageResource, Snackbar.LENGTH_LONG);
var fab = findFABView(view.getRootView());
if (fab != null && fab.getVisibility() == View.VISIBLE) {
snackbar.setAnchorView(fab);
}
snackbar.show();
return snackbar;
}
Expand Down
Loading