WIP: Log vertical FAB translation

parent 90b29938
Pipeline #3658 passed with stage
in 8 minutes and 12 seconds
package org.briarproject.briar.android.view;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.util.AttributeSet;
import android.view.View;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import java.util.logging.Logger;
import io.github.kobakei.materialfabspeeddial.FabSpeedDial;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Logger.getLogger;
@NotNullByDefault
public class FabSpeedDialBehavior
extends CoordinatorLayout.Behavior<FabSpeedDial> {
private static final Logger LOG =
getLogger(FabSpeedDialBehavior.class.getName());
public FabSpeedDialBehavior() {
super();
}
public FabSpeedDialBehavior(Context context, AttributeSet attrs) {
super();
}
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FabSpeedDial child,
View dependency) {
return dependency instanceof Snackbar.SnackbarLayout;
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent,
FabSpeedDial child, View dependency) {
float diff = dependency.getTranslationY() - dependency.getHeight();
if (LOG.isLoggable(WARNING)) LOG.warning("translationY: " + diff);
child.setTranslationY(diff);
return false;
}
}
\ No newline at end of file
......@@ -22,6 +22,6 @@
app:fab_miniFabTextBackground="@color/briar_accent"
app:fab_miniFabTextColor="@android:color/white"
app:layout_anchorGravity="bottom|right|end"
app:layout_behavior="io.github.kobakei.materialfabspeeddial.FabSpeedDial$Behavior"/>
app:layout_behavior="org.briarproject.briar.android.view.FabSpeedDialBehavior"/>
</android.support.design.widget.CoordinatorLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment