-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from solrudev/develop
0.7.4
- Loading branch information
Showing
18 changed files
with
282 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
ackpine-splits/src/main/kotlin/ru/solrudev/ackpine/helpers/CloseableHelpers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2024 Ilya Fomichev | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ru.solrudev.ackpine.helpers | ||
|
||
import java.io.Closeable | ||
|
||
@JvmSynthetic | ||
internal fun Closeable.closeWithException(cause: Throwable) { | ||
try { | ||
close() | ||
} catch (closeException: Throwable) { | ||
cause.addSuppressed(closeException) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
sample-java/src/main/java/ru/solrudev/ackpine/sample/install/HideFabOnScrollBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (C) 2024 Ilya Fomichev | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ru.solrudev.ackpine.sample.install; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior; | ||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; | ||
|
||
@SuppressWarnings("unused") | ||
public class HideFabOnScrollBehavior<V extends View> extends HideBottomViewOnScrollBehavior<V> { | ||
|
||
public HideFabOnScrollBehavior(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public HideFabOnScrollBehavior() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public boolean layoutDependsOn(@NonNull CoordinatorLayout parent, @NonNull V child, @NonNull View dependency) { | ||
return child instanceof ExtendedFloatingActionButton && dependency instanceof RecyclerView; | ||
} | ||
|
||
@Override | ||
public boolean onLayoutChild(@NonNull CoordinatorLayout parent, @NonNull V child, int layoutDirection) { | ||
var canScroll = false; | ||
final var childCount = parent.getChildCount(); | ||
for (var i = 0; i < childCount; i++) { | ||
final var dependency = parent.getChildAt(i); | ||
if (dependency instanceof RecyclerView) { | ||
canScroll = dependency.canScrollVertically(1) || dependency.canScrollVertically(-1); | ||
break; | ||
} | ||
} | ||
if (child instanceof ExtendedFloatingActionButton && !canScroll && isScrolledDown()) { | ||
slideUp(child); | ||
} | ||
return super.onLayoutChild(parent, child, layoutDirection); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.