Merge pull request #12877 from nextcloud/showSnackAboveFAB

Show snackbar above FAB
This commit is contained in:
Alper Öztürk 2024-04-26 16:04:29 +02:00 committed by GitHub
commit 20cabd4aab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 1 deletions

View file

@ -17,7 +17,7 @@ concurrency:
jobs: jobs:
screenshot: screenshot:
runs-on: macOS-latest runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -48,6 +48,12 @@ jobs:
distribution: "temurin" distribution: "temurin"
java-version: 17 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 - name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true' if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -650,10 +650,22 @@ public final class DisplayUtils {
*/ */
public static Snackbar showSnackMessage(Activity activity, String message) { public static Snackbar showSnackMessage(Activity activity, String message) {
final Snackbar snackbar = Snackbar.make(activity.findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG); 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(); snackbar.show();
return snackbar; 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. * Show a temporary message in a {@link Snackbar} bound to the given view.
* *
@ -663,6 +675,10 @@ public final class DisplayUtils {
*/ */
public static Snackbar showSnackMessage(View view, @StringRes int messageResource) { public static Snackbar showSnackMessage(View view, @StringRes int messageResource) {
final Snackbar snackbar = Snackbar.make(view, messageResource, Snackbar.LENGTH_LONG); 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(); snackbar.show();
return snackbar; return snackbar;
} }