Paralloid


Source link: https://github.com/chrisjenx/Paralloid

Paralloid - DEPRECATED

DEPRECATED - Use the project for more of guide and ideas how to apply parallax techniques. I will not support this library anymore.

Paralloid - (Pah-rah-loid) The Android Parallax library

Compatible back to API 7

An example application, Paralloid Library Example, can be downloaded from the Play Store.

ParallaxScrollView is dead..

I originally wrote ParallaxScrollView a while back as proof of concept, people took surprisingly well to it; but from the get-go it was a fundamentally flawed.

Tightly-coupled and inflexible, made it difficult to maintain and confusing for people to use.

Features

Currently limited but will expand when requests.

  • Parallax another view when the parent scrolls.
  • Parallax multiple backgrounds.
  • Transformers, Parallax in different ways and directions

Supports:

  • ListView
  • ScrollView
  • HorizontalScrollView

Modular

Paralloid is designed to be modular and very loosely coupled (to an extent).

Two high level modules exist

  • paralloid - which is the library which everything extends from.
  • paralloidviews - which extends the library with a couple of pre-extended ScrollableViews.
  • paralloidexamples - which is of course the examples App.

Generally use paralloidviews as it contains everything you need to get going.

Getting Started

Dependency

Currently I only support Gradle

Locally:

Temporary steps from @therealkris.

  • First, I cloned the library into myproject/libs/paralloid.
  • In my settings.gradle, I added include ':libs:paralloid:paralloid', ':libs:paralloid:paralloidviews'.
  • In my build.gradle, I added compile project(':libs:paralloid:paralloid'), project(':libs:paralloid:paralloidviews').
  • In libs/paralloid/paralloid, I removed the uploadArchives { } block.
  • In libs/paralloid/paralloidviews, I removed the uploadArchives { } block AND changed the dependency to read: compile project(':libs:paralloid:paralloid') instead of compile project(':paralloid')

Or Repository (coming soon):

dependencies {

  compile 'uk.co.chrisjenx.paralloid:paralloid:0.1.+' 
}
 

Layout

ScrollView

This is an example, please refer to the paralloidexample App for full code.

<FrameLayout ..> <FrameLayout
android:id="@+id/top_content"

 android:layout_width="match_parent"

 android:layout_height="192dp"/>  <uk.co.chrisjenx.paralloid.views.ParallaxScrollView

android:id="@+id/scroll_view"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:fillViewport="true">

<LinearLayout

android:id="@+id/scroll_content"

 android:layout_width="match_parent"

 android:layout_height="wrap_content"

 android:orientation="vertical"

 android:paddingTop="192dp"/>  </uk.co.chrisjenx.paralloid.views.ParallaxScrollView> </FrameLayout> 

Fragment

Inside your onViewCreated() or onCreateView().

//... FrameLayout topContent = (FrameLayout) rootView.findViewById(R.id.top_content);
 ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
 if (scrollView instanceof Parallaxor) {

((Parallaxor) scrollView).parallaxViewBy(topContent, 0.5f);
 
}
 // TODO: add content to top/scroll content 

Thats it!

Have a look at the Parallaxor interface for applicable Parallax methods.

Custom Views

I tried to keep this as simple as possible, you can nearly copy and paste this.

  • Extend the Scrollable view (or the one you allready have).
  • Implement the Parallaxor interface.
  • Job done! See below for an example

Example implementation:

public class MyScrollView extends ScrollView implements Parallaxor {

//...
ParallaxViewController mParallaxViewController;
 // Call init() in constructors
private void init() {

  mParallaxViewController = ParallaxViewController.wrap(this);

}

 @Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {

  super.onScrollChanged(l, t, oldl, oldt);

  mParallaxViewController.onScrollChanged(this, l, t, oldl, oldt);

}

 // region Implementation of Parallaxor
 @Override
public void parallaxViewBy(View view, float multiplier) {

  mParallaxViewController.parallaxViewBy(view, multiplier);

}

 @Override
public void parallaxViewBy(View view, Transformer transformer, float multiplier) {

  mParallaxViewController.parallaxViewBy(view, transformer, multiplier);

}

 @Override
public void parallaxViewBackgroundBy(View view, Drawable drawable, float multiplier) {

  mParallaxViewController.parallaxViewBackgroundBy(view, drawable, multiplier);

}

 // endregion 
}
 

Resources

DesignOverlay is an android app which displays a design image with grid lines to facilitate the tedious layout process. The grid is especially useful to align to baseline grids as described in Android Design Guidelines.

Coordinator is a Java library that is used to coordinate various asynchronous actions. Usually we found cases that you need to check if other thread is completed to execute an action, coordinator solves this problem without using flags.

Prime is an Android image loading library.

Simple, pretty and powerful logger for Android.

Load custom fonts easily just via layout parameters or styles. Uses static Typeface objects, load once - memory efficient. No more textView.setTypeface() calls!

Extends StatedFragment and save state in onSaveState(Bundle outState) and restore state in onRestoreState(Bundle savedInstanceState).

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