Giter Club home page Giter Club logo

imageswitcher's Introduction

ImageSwitcher

An Android library allowing for easy, configuration-less, touch view switching.

Usage

The functionality can be added to both Views and ViewGroups, but the touch makes most sense on a Transparent ViewGroup.

Example
Activity / Fragment - Setup
ViewGroup touchViewGroup = [Get the Transparent ViewGroup]

DraweeView imageA = [Get ImageA];
DraweeView imageB = [Get ImageB];
DraweeView imageC = [Get ImageC];

ArrayList<Uri> imageUri = [Get Image URIs]

// 1. Create the (convenience class) containing the switching functions.
ImageSwitcher imageSwitcher = new ImageSwitcher(imageUri, imageA, imageB, imageC);

// 2. Create Touch listener.
SwitchListener switchListener = new SwitchListener(context, imageSwitcher.viewTracker, imageSwitcher);

// 3. Add the Touch listener .
touchViewGroup.setOnTouchListener(switchListener);
Layout
<FrameLayout
  android:id="@+id/transparent_touch_area"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  
  <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/media_image_A"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:visibility="gone"/>

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/media_image_B"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"/>

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/media_image_C"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:visibility="gone"/>
  
</FrameLayout>

Change Log

Version 0.3
  • Added Boolean parameters to Switcher functions to indicate whether function called because of user action or because of some system action.
Version 0.2
  • Made some internal SwitchListener functions public for easier access and functionality.
  • Updated from Fresco 0.7 to 0.8.

imageswitcher's People

Contributors

mithrandir21 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.