Skip to content

Instantly share code, notes, and snippets.

View strombringer's full-sized avatar

Matthias Schippling strombringer

  • Munich, Germany
  • 11:31 (UTC +02:00)
View GitHub Profile
@strombringer
strombringer / ZoomPanLayout.java
Created March 15, 2018 12:37
Custom ZoomPanLayout for https://github.com/moagrius/TileView/ that allows restricting the scroll bounds with an arbitrary rectangle
public class ZoomPanLayout extends ViewGroup implements
GestureDetector.OnGestureListener,
GestureDetector.OnDoubleTapListener,
ScaleGestureDetector.OnScaleGestureListener,
TouchUpGestureDetector.OnTouchUpListener {
private boolean isFinderActive(){
// return true if FinderView is available and visible
}
@strombringer
strombringer / CustomDialogFragment.java
Created October 4, 2017 10:06
Android: DialogFragment embedded or as Dialog
public class CustomDialogFragment extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (isInLayout())
return super.onCreateDialog(savedInstanceState);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setView(R.layout.my_custom_layout)
@strombringer
strombringer / RecyclerViewBottomPaddingLayout.xml
Last active July 25, 2023 00:32
Adding bottom padding to RecyclerView or ListView so the last item is not obscured by a FAB (Android)
<android.support.v7.widget.RecyclerView
...
android:clipToPadding="false"
android:paddingBottom="72dp"
/>
<!--
Button size = 56dp
Margin = 16dp // on tablets 24dp
--------------------------
@strombringer
strombringer / ContextMenuRecyclerViewAdapter.cs
Last active January 23, 2019 20:45
Using a ContextMenu with MvxRecyclerView (Xamarin, MvvmCross, Android)
public class ContextMenuRecyclerViewAdapter : MvxRecyclerAdapter
{
private readonly Action<int> _contextPositionSetter;
public ContextMenuRecyclerViewAdapter(IMvxAndroidBindingContext bindingContext, Action<int> contextPositionSetter) : base(bindingContext)
{
_contextPositionSetter = contextPositionSetter;
}
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)