Fix banner
This commit is contained in:
parent
ccde2d91ec
commit
a271a180b5
20 changed files with 0 additions and 1577 deletions
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.misc
|
||||
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
object DisposableManager {
|
||||
|
||||
private var compositeDisposable: CompositeDisposable? = null
|
||||
|
||||
fun add(disposable: Disposable) {
|
||||
getCompositeDisposable().add(disposable)
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
getCompositeDisposable().dispose()
|
||||
}
|
||||
|
||||
private fun getCompositeDisposable(): CompositeDisposable {
|
||||
if (compositeDisposable == null || compositeDisposable!!.isDisposed) {
|
||||
compositeDisposable = CompositeDisposable()
|
||||
}
|
||||
return compositeDisposable!!
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.misc
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class DisposingObserver<T> : Observer<T> {
|
||||
@CallSuper
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
DisposableManager.add(d)
|
||||
}
|
||||
|
||||
override fun onNext(next: T) {}
|
||||
|
||||
override fun onError(e: Throwable) {}
|
||||
|
||||
override fun onComplete() {}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.misc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/*Don't delete even if its not showing not using*/
|
||||
public class ScrollAwareFABBehavior extends CoordinatorLayout.Behavior<FloatingActionButton> {
|
||||
private static final String TAG = "ScrollingFABBehavior";
|
||||
Handler mHandler;
|
||||
|
||||
public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
|
||||
@NonNull FloatingActionButton child,
|
||||
@NonNull View target) {
|
||||
super.onStopNestedScroll(coordinatorLayout, child, target);
|
||||
|
||||
if (mHandler == null)
|
||||
mHandler = new Handler();
|
||||
|
||||
|
||||
mHandler.postDelayed(() -> {
|
||||
child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
|
||||
Log.d("FabAnim", "startHandler()");
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
|
||||
@NonNull FloatingActionButton child,
|
||||
@NonNull View target,
|
||||
int dxConsumed,
|
||||
int dyConsumed,
|
||||
int dxUnconsumed,
|
||||
int dyUnconsumed) {
|
||||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
|
||||
|
||||
//child -> Floating Action Button
|
||||
if (dyConsumed > 0) {
|
||||
Log.d("Scrolling", "Up");
|
||||
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
|
||||
int fab_bottomMargin = layoutParams.bottomMargin;
|
||||
child.animate().translationY(child.getHeight() + fab_bottomMargin).setInterpolator(new LinearInterpolator()).start();
|
||||
} else if (dyConsumed < 0) {
|
||||
Log.d("Scrolling", "down");
|
||||
child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
|
||||
@NonNull FloatingActionButton child,
|
||||
@NonNull View directTargetChild,
|
||||
@NonNull View target,
|
||||
int nestedScrollAxes) {
|
||||
if (mHandler != null) {
|
||||
mHandler.removeMessages(0);
|
||||
Log.d("Scrolling", "stopHandler()");
|
||||
}
|
||||
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.misc;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private int space;
|
||||
|
||||
public SpacesItemDecoration(int space) {
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view,
|
||||
RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.right = space;
|
||||
outRect.bottom = space;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue