Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/naxam/draggablepanel-android-binding

Xamarin Android Binding Library for Pedrovgs DraggablePanel
https://github.com/naxam/draggablepanel-android-binding

android bindings draggable-panel draggablepanel draggableview xamarin xamarin-android-binding

Last synced: 2 days ago
JSON representation

Xamarin Android Binding Library for Pedrovgs DraggablePanel

Awesome Lists containing this project

README

        

Draggable Panel - Xamarin Android Binding Library
===============

Draggable Panel is an Android library created to build a draggable user interface similar to the new YouTube draggable video component based on Fragments or Views.

This Android library offers you two main classes to use and create your own awesome user interfaces. If you want to use it with fragments add ``DraggablePanel`` to your layout. If you want to use it with views use ``DraggableView`` and put your views inside.

This new component has been created using some concepts described on [Flavien Laurent Blog][1] and [Denevell Blog][2].

To create this library I've used an Android component called [ViewDragHelper][3] and [ViewDragHelper.Calback][4]. This component doesn't have too much documentation and that's the reason why I've added some javadoc to my code in order to clarify the component usage.

This library works on Android 4.X or higher versions but not in lower versions because the scale effect is not going to work properly when the user try to drag the view. The clickable zone on a scaled view in Android 2.X is bigger than the real scaled zone.

Screenshots
-----------

![Demo Screenshot 1][5]
![Demo Screenshot 2][6]
![Demo Screenshot 4][7]
![Demo Screenshot 3][8]

Usage
-----

To use Draggable Panel library and get your new awesome UI working you can use two different Android widgets:

* 1. Add ``DraggablePanel`` widget to your layout. Configure the view customization elements using styleable attributes or programatically and configure your fragments to work as top or bottom fragment inside the ``DraggablePanel`` widget.

```xml

```

```java
private void initializeDraggablePanel() throws Resources.NotFoundException {
draggablePanel.setFragmentManager(getSupportFragmentManager());
draggablePanel.setTopFragment(placeFragment);
draggablePanel.setBottomFragment(mapFragment);
draggablePanel.initializeView();
}
```

* 2. Add ``DraggableView`` widget to your layout. Configure the view to use two children views as the draggable view and the second view. Configure the customization elements using styleable attributes or programatically.

```xml

```

**If you are going to use ``DraggablePanel`` or ``DraggableView`` combined with a ``DrawerLayout`` review [Famous Places Sample Activity](https://github.com/pedrovgs/DraggablePanel/blob/develop/sample/src/main/java/com/github/pedrovgs/sample/activity/PlacesSampleActivity.java)

Import DraggablePanel dependency
--------------------------------

```xml
Install-Package Naxam.DraggablePanel.Droid
```

Customization
-------------

You can customize some of the view effects programatically or using xml styleable attributes. The elements to customize are:

* Draggable view / fragment height.
* Draggable view X scale factor.
* Draggable view Y scale factor.
* Draggable view margin right applied when the view is minimized.
* Draggable view margin bottom applied when the view is minimized.
* Enable or disable the horizontal alpha effect applied while the view is being horizontally dragged.
* Enable or disable touch on minimized/maximized view to minimize/maximize.

```xml

```

```java
draggablePanel.setTopFragment(placeFragment);
draggablePanel.setBottomFragment(mapFragment);
draggablePanel.setXScaleFactor(xScaleFactor);
draggablePanel.setYScaleFactor(yScaleFactor);
draggablePanel.setTopViewHeight(topViewHeight);
draggablePanel.setTopFragmentMarginRight(topViewMarginRight);
draggablePanel.setTopFragmentMarginBottom(topViewMargnBottom);
draggablePanel.setClickToMaximizeEnabled(enableClickToMaximize);
draggablePanel.setClickToMinimizeEnabled(enableClickToMinimize);
```

Similar customizable attributes are available programatically or using styleable attributes in ``DraggableView``.

Do you want to resize the top view instead of scale it? Add ``dragable_view:top_view_resize`` attribute to your DraggableView:

```xml

```

Do you want to contribute? TODO
-------------------------------

* Support landscape mode when DraggableView is using ResizeTransformer.

Origin library Developed By
------------

* Pedro Vicente Gómez Sánchez -


Follow me on Twitter


Add me to Linkedin

*Does your app use DraggablePanel? If you want to be featured on this list tell me on [Twitter][10]

Libraries used on the sample project
------------------------------------

* [Renderers][11]
* [Dagger][12]
* [Butterknife][13]
* [NineOldAndroids][14]
* [Picasso][15]
* [ActionBarSherlock][16]
* [YouTube Player][17]

Origin Library License
-------

Copyright 2014 Pedro Vicente Gómez Sánchez

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.

[1]: http://flavienlaurent.com/blog/2013/08/28/each-navigation-drawer-hides-a-viewdraghelper/
[2]: http://blog.denevell.org/android-viewdraghelper-example-tutorial.html
[3]: http://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.html
[4]: http://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.Callback.html
[5]: https://github.com/pedrovgs/DraggablePanel/raw/develop/art/screenshot1.gif
[6]: https://github.com/pedrovgs/DraggablePanel/raw/develop/art/screenshot2.gif
[7]: https://github.com/pedrovgs/DraggablePanel/raw/develop/art/screenshot3.gif
[8]: https://github.com/pedrovgs/DraggablePanel/raw/develop/art/screenshot4.gif
[10]: https://twitter.com/pedro_g_s
[11]: https://github.com/pedrovgs/Renderers
[12]: https://github.com/square/dagger
[13]: https://github.com/JakeWharton/butterknife
[14]: https://github.com/JakeWharton/NineOldAndroids/
[15]: https://github.com/square/picasso
[16]: http://actionbarsherlock.com/
[17]: https://developers.google.com/youtube/android/player/