FoldingCell


Source link: https://github.com/Ramotion/folding-cell-android

FoldingCell for Android

Check this library on other platforms:

Looking for developers for your project?
This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.


Requirements

?

  • Android 4.0 IceCreamSandwich (API lvl 14) or greater
  • Your favorite IDE

Installation

? Just download the package from here and add it to your project classpath, or just use the maven repo:

Gradle:

'com.ramotion.foldingcell:folding-cell:1.2.1'

SBT:

libraryDependencies += "com.ramotion.foldingcell" % "folding-cell" % "1.2.1"

Maven:

<dependency>  <groupId>com.ramotion.foldingcell</groupId>  <artifactId>folding-cell</artifactId>  <version>1.2.1</version> </dependency>

?

Basic usage

?

  1. Add com.ramotion.foldingcell.FoldingCell to your layout ?
... <com.ramotion.foldingcell.FoldingCell
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/folding_cell"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"> ? </com.ramotion.foldingcell.FoldingCell> ...

? 2. Add exactly two child elements to your cell. The first child ( content view) always represents the unfolded state layout and the second child ( title view) represents folded state layout. Of course, those layouts can contain any number of child elements and they can be any complexity, but to work correctly, there are some limitations: content view height must be at least 2x times greater than title view height, and the height of each of those layouts must be set to android:layout_height="wrap_content". If you want to set exact height in dp , you can set height for child elements in your own layout inside content view or title view. Also, you need to hide your content view layout using android:visibility="gone". ?

... <com.ramotion.foldingcell.FoldingCell
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/folding_cell"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"> ?

<FrameLayout

 android:id="@+id/cell_content_view"

 android:layout_width="match_parent"

 android:layout_height="wrap_content"

 android:background="@android:color/holo_green_dark"

 android:visibility="gone">

 <TextView

  android:layout_width="match_parent"

  android:layout_height="250dp" />

</FrameLayout> ?

<FrameLayout

 android:id="@+id/cell_title_view"

 android:layout_width="match_parent"

 android:layout_height="wrap_content">

 <TextView

  android:layout_width="match_parent"

  android:layout_height="100dp"

  android:background="@android:color/holo_blue_dark" />

</FrameLayout> ? </com.ramotion.foldingcell.FoldingCell> ...

? 3. Almost done! Two steps remain! For correct animation, you need to set up two properties on the root element(s) of your Folding Cell: ?

android:clipChildren="false" android:clipToPadding="false"

? 4. Final step! Add onClickListener to your Folding Cell in MainActivity.java to toggle animation: ?

@Override protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);
 ?
  // get our folding cell
  final FoldingCell fc = (FoldingCell) findViewById(R.id.folding_cell);
 ?
  // attach click listener to folding cell
  fc.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

 fc.toggle(false);

}

  
}
);
 
}

? 5. Extra step - customizing cell settings. For now, there are three main parameters - animation time, back side color and additional flips count. If first two do not cause questions, the third requires an some explanation. It is count of flips to be executed after first(main) flip. Default value is 0(auto choose). Also there is a fourth, additional parameter - camera height, it controls level(depth) of 3d effect. There are two ways to change cell settings: From xml layout file with res-auto namespace xmlns:folding-cell="http://schemas.android.com/apk/res-auto":

folding-cell:animationDuration="1000" folding-cell:backSideColor="@color/bgBackSideColor" folding-cell:additionalFlipsCount="2" folding-cell:cameraHeight="30"

Or from code:

// get our folding cell final FoldingCell fc = (FoldingCell) findViewById(R.id.folding_cell);
 // set custom parameters fc.initialize(1000, Color.DKGRAY, 2);
 // or with camera height parameter fc.initialize(30, 1000, Color.DKGRAY, 2);

? You can find this and other, more complex, examples in this repository ?

Licence

? Folding cell is released under the MIT license. See LICENSE for details.


Get the Showroom App for Android to give it a try

Try our UI components in our mobild app. Contact us if interested.



Resources

Bounce Scroller is a library for Android platform that provides iOS-like bounce scroller effect and can also be used as pull-to-refresh.

Features:

  • Support all ViewGroups and almost all Views (except self-scrollable TextView).
  • Bounce-effect can be added to header and footer.
  • No need to specify custom wrappers.

Couchbase-Lite-Android is a lightweight embedded NoSQL database engine for Android with the built-in ability to sync to Couchbase Server on the backend.

It is the Android port of Couchbase Lite iOS.

Android Widget to show circular counters.

Grocery Sync for Couchbase Lite Android.

An example app that uses the Couchbase Lite Android mobile database framework.

Easy Rating Dialog provides a simple way to display an alert dialog for rating app.

Default conditions to show:

  • User opened the app more than 5 times
  • User opened the app after 7 days of first opening.

Helper library about Showing and stopping a progress in the ActionBar.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes