Discrollview


Source link: https://github.com/flavienlaurent/discrollview

Discrollview

Regularly, I am pleasantly surprised by websites using a pattern I called the discrollver pattern. I'm sure you already know what I'm talking about but if not, http://vimeo.com/player is a good example. When you scroll, widgets appear from nowhere by fade, translation or scale.

With DiscrollView, I wanted to import this pattern on Android. This is an 0.0.1 alpha version because you have to do all the transformation work (fade, translation, scale etc) yourself base on a ratio value. I'm going to add some transformation presets (translation from left to right + fade in for example) to make the library more ready to use for lazy developers.

( on youtube)

Try out the sample APK here

Or browse the source code of the sample application for a complete example of use.

Including in your project

Just add the library to your application as a library project.

Compatibilty

API 14+

Usage

Using the library is simple, just look at the source code of the provided sample here

build.gradle

compile 'com.github.flavienlaurent.discrollview:library:0.0.2@aar' 

The main layout

You must use the DiscrollViewContent view.

<com.flavienlaurent.discrollview.lib.DiscrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:discrollve="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

<com.flavienlaurent.discrollview.lib.DiscrollViewContent

android:layout_width="match_parent"

android:layout_height="match_parent">

 <!-- here you put discrollvable views -->

</com.flavienlaurent.discrollview.lib.DiscrollViewContent>  </com.flavienlaurent.discrollview.lib.DiscrollView>

Discrollvable views

You can apply some transformation on discroll:

  • alpha
  • scale
  • translation (fromLeft, fromBottom, fromRight, fromTop) fromLeft+fromRight and fromBottom+fromTop are forbidden couples.
  • bgcolor
discrollve:discrollve_alpha="true" discrollve:discrollve_translation="fromLeft|fromBottom" discrollve:discrollve_scaleX="true" discrollve:discrollve_scaleY="true" discrollve:discrollve_fromBgColor="#88EE66" discrollve:discrollve_toBgColor="#000000" discrollve:discrollve_threshold="0.3"

The threshold attribute is used to trigger the discrollve at a specified ratio. For example, if threshold=0.3, the discrollve starts when the ratio >= 0.3.

A simple example

<com.flavienlaurent.discrollview.lib.DiscrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:discrollve="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

<com.flavienlaurent.discrollview.lib.DiscrollViewContent

android:layout_width="match_parent"

android:layout_height="match_parent">

 <TextView

 android:layout_width="match_parent"

 android:layout_height="600dp"

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

 android:textColor="@android:color/black"

 android:padding="25dp"

 android:textSize="72sp"

 android:gravity="center"

 android:fontFamily="serif"

 android:text="Do you love cheese?" />

 <View

 android:layout_width="match_parent"

 android:layout_height="200dp"

 android:background="#007788"

 discrollve:discrollve_alpha="true"

 discrollve:discrollve_threshold="0.3" />

 <ImageView

 android:layout_width="200dp"

 android:layout_height="120dp"

 discrollve:discrollve_alpha="true"

 discrollve:discrollve_translation="fromLeft|fromBottom"

 android:src="@drawable/cheese1" />

 <View

 android:layout_width="match_parent"

 android:layout_height="200dp"

 discrollve:discrollve_fromColor="#88EE66"

 discrollve:discrollve_toColor="#000000" />

 <ImageView

 android:layout_width="220dp"

 android:layout_height="110dp"

 android:layout_gravity="right"

 android:src="@drawable/cheese2"

 discrollve:discrollve_translation="fromRight" />

 <TextView

 android:layout_width="match_parent"

 android:layout_height="wrap_content"

 android:padding="20dp"

 android:fontFamily="serif"

 android:gravity="center"

 android:text="When the cheese comes out everybody's happy pecorino red leicester"

 android:textSize="18sp"

 discrollve:discrollve_alpha="true"

 discrollve:discrollve_translation="fromBottom" />

 <ImageView

 android:layout_width="wrap_content"

 android:layout_height="wrap_content"

 android:layout_margin="20dp"

 android:layout_gravity="center"

 android:src="@drawable/ilovecheese_heart"

 discrollve:discrollve_scaleX="true"

 discrollve:discrollve_scaleY="true"  />

</com.flavienlaurent.discrollview.lib.DiscrollViewContent> </com.flavienlaurent.discrollview.lib.DiscrollView>

License

Copyright 2013 Flavien Laurent  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. 

Resources

Android Library to show a beautiful Alert View.

Search currency information by country name, code, ISO3 code and currency code.

Iris is an android speech to text app.

TL;DR: Moshi version of Jackson's @JsonIgnore. For when you can't use @Transient.

In Moshi, You can use transient keyword (in Kotlin: @Transient annotation) for ignore serialization.
But sometimes it's conflict to other features. e.g. ebean-querybean.

moshi-kotlin-ignore is library for ignore parameter serialization / deserialization. You can use this library to resolve above issues.

This demo aims shows practical way of clean architecture, MVP in android with Kotlin.

An example app to download pdf from url and saved into your internal storage.

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