Android ImageView you pan by tilting your device.

Overview

WindowView

Window as in windowsill.

Tilting to pan images.

An Android ImageView that can be panned around by tilting your device, as if you were looking through a window.

Usage

Add it to your project using Gradle:

compile 'com.jmedeisis:windowview:0.2.0'

Use in place of an ImageView. Example XML layout file:

<com.jmedeisis.windowview.WindowView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/my_image" />

Please refer to the included sample application project for a complete example.

Configuration

You will typically want to configure the following attributes for the WindowView class:

  • wwv_max_pitch - maximum angle (in degrees) from origin for vertical device tilts. Default - 30°

  • wwv_max_roll - maximum angle (in degrees) from origin for horizontal device tilts. Default - 30°

  • wwv_vertical_origin - (in degrees) when device pitch equals this value, the image is centered vertically. Default - 0°

  • wwv_horizontal_origin - (in degrees) when device roll equals this value, the image is centered horizontally. Default - 0°

You may also want to configure more advanced attributes:

  • wwv_orientation_mode - Absolute or Relative (default). Specifies whether device tilt should be tracked with respect to Absolute world coordinates (i.e. pitch, roll w.r.t. ground plane) or with respect to the device orientation when WindowView is created, which WindowView refers to as the 'orientation origin'. If using the latter, i.e. Relative, you may use WindowView#resetOrientationOrigin(boolean) to set the orientation origin to that of the device when the method is called.

  • wwv_translate_mode - Constant or Proportional (default). Specifies how much the image is translated in response to device tilt. If Proportional, the image moves within the full range defined by max_pitch / max_roll, with the extremities of the image visible when device pitch / roll is at those angles. If Constant, the image moves a constant amount per unit of tilt which is defined by max_constant_translation, achieved when pitch / roll are at max_pitch / max_roll.

  • wwv_max_constant_translation - see above. Default - 150dp

  • wwv_sensor_sampling_period - the desired rate of sensor events. In microseconds or one of fast, normal (default) or slow. If using microsecond values, higher values result in slower sensor updates. Directly related to the rate at which WindowView updates in response to device tilt.

  • wwv_tilt_sensor_mode - Manual or Automatic (default). Specifies whether WindowView is responsible for when tilt motion tracking starts and stops. If Automatic, WindowView works out of the box and requires no extra configuration. If Manual, you must explicitly start and stop tilt motion tracking. You have two options:

    • Use WindowView#startTiltTracking() and WindowView#stopTiltTracking(), e.g. in your Activity's onResume() and onPause(), respectively.

    • Use WindowView#attachTiltTracking(TiltSensor) and WindowView#detachTiltTracking(TiltSensor). This approach is recommended when using multiple WindowViews in a single logical layout. The externally managed TiltSensor should be started and stopped using TiltSensor#startTracking(int) and TiltSensor#stopTracking() as appropriate.

Example configuration:

<com.jmedeisis.windowview.WindowView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/my_image"
    app:wwv_tilt_sensor_mode="Manual"
    app:wwv_orientation_mode="Relative"
    app:wwv_translate_mode="Constant"
    app:wwv_max_constant_translation="100dp"
    app:wwv_sensor_sampling_period="fast"
    app:wwv_max_pitch="15"
    app:wwv_max_roll="15"
    app:wwv_vertical_origin="0"
    app:wwv_horizontal_origin="0" />

Limitations

  • Only supports the CENTER_CROP scale type.
  • Works for API levels 9+.

Development

Pull requests are welcome and encouraged for bugfixes and features such as:

  • adaptive smoothing filters tuned for different sensor accuracy and rates
  • bi-directional image panning

License

WindowView is licensed under the terms of the MIT License.

You might also like...
Name UI states, navigate between them, remember where you've been.

Deprecated Flow had a good run and served us well, but new use is strongly discouraged. The app suite at Square that drove its creation is in the proc

Highly customizable SlidingLayer as you have seen in Wunderlist

6Wunderkinder SlidingLayer for Android This repository hosts a library that provides an easy way to include an autonomous layer/view that slides from

Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data.
Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data.

Android-ProgressFragment Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the init

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. 💳 EasyFlipView Built with ❤︎ by Wajahat Karim and

Highly customizable SlidingLayer as you have seen in Wunderlist

6Wunderkinder SlidingLayer for Android This repository hosts a library that provides an easy way to include an autonomous layer/view that slides from

A view to show bling bling stars when you touch it.
A view to show bling bling stars when you touch it.

AndroidGlitterView A view to show bling bling stars when you touch it. Demo Dependency compile('com.liangfeizc:glitterview:1.0.0@aar') Attributes name

A lovely snail,You can use it as a seekbar or progressbar.

SnailBar A lovely ,you can use it as a seekbar or progressbar. Helixbar design by Davlikanoff.This is his words: Hi Guys! This 18 seconds long animati

A View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.
A View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.

FreeDrawView A View that let you draw freely on it. You can customize paint width, alpha and color. Can be useful for notes app, signatures or hands-f

Allows you to launch various /hidden/ options of the Oculus Quest (2)

vrLauncher Allows you to launch various /hidden/ options of the Oculus Quest (2) Using it Sideload the apk onto your Oculus Quest (2) Choose the optio

Comments
  • Not works with Picasso library

    Not works with Picasso library

    Hi! Is it possible to make this works with Picasso library? Currently when I trying to do like this:

        Picasso.with(this)
                .load(R.drawable.splash)
                .fit()
                .centerCrop()
                .into(ivSplash);
    

    I got NullPointerException: E/AndroidRuntime(10358): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.drawable.Drawable.getIntrinsicWidth()' on a null object reference E/AndroidRuntime(10358): at com.jmedeisis.windowview.WindowView.onSizeChanged(WindowView.java:283) E/AndroidRuntime(10358): at android.view.View.sizeChange(View.java:15793) E/AndroidRuntime(10358): at android.view.View.setFrame(View.java:15758) E/AndroidRuntime(10358): at android.widget.ImageView.setFrame(ImageView.java:1019) E/AndroidRuntime(10358): at android.view.View.layout(View.java:15674) E/AndroidRuntime(10358): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579) E/AndroidRuntime(10358): at android.widget.FrameLayout.onLayout(FrameLayout.java:514) E/AndroidRuntime(10358): at android.view.View.layout(View.java:15678) E/AndroidRuntime(10358): at android.view.ViewGroup.layout(ViewGroup.java:5039) E/AndroidRuntime(10358): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579) E/AndroidRuntime(10358): at android.widget.FrameLayout.onLayout(FrameLayout.java:514) E/AndroidRuntime(10358): at android.view.View.layout(View.java:15678) E/AndroidRuntime(10358): at android.view.ViewGroup.layout(ViewGroup.java:5039) E/AndroidRuntime(10358): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703) E/AndroidRuntime(10358): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557) E/AndroidRuntime(10358): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466) E/AndroidRuntime(10358): at android.view.View.layout(View.java:15678) E/AndroidRuntime(10358): at android.view.ViewGroup.layout(ViewGroup.java:5039) E/AndroidRuntime(10358): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579) E/AndroidRuntime(10358): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)

    opened by GAV-516 1
  • Can I use it with a Video ?

    Can I use it with a Video ?

    Hi, great library.

    My question is if I can use it with a TextureView or VideoView ?

    I want to display a video centered full-screen and if there is no more space allow seeing the rest of it by tilting it like in this library.

    opened by eshkoliGilad 0
Releases(0.2.0)
  • 0.2.0(Jun 18, 2016)

  • v0.1.1(Oct 9, 2015)

  • v0.1.0(Sep 27, 2015)

    First numbered release.

    • Supported sensor combinations:
      • ROTATION_VECTOR
      • MAGNETIC_FIELD + GRAVITY
      • MAGNETIC_FIELD + ACCELEROMETER
    • Supports all screen orientations.
    • Configurable attributes:
      • max_pitch / max_roll
      • vertical_origin / horizontal_origin
      • sensor_sampling_period
      • orientation_mode
      • translate_mode
      • max_constant_translation
    • Supports CENTER_CROP scale type.
    • Android API level 9+.
    • Initial public release on JCenter.
    Source code(tar.gz)
    Source code(zip)
    sample-0_1_0-release.apk(1.56 MB)
Owner
Justas Medeišis
Justas Medeišis
A custom view, in which device contact list is displayed

Getting Started This repository contains a custom view, in which device contact list is displayed Implementation Go to Settings.gradle, inside reposit

Ankit Kumar 2 May 7, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.4k Dec 31, 2022
StandOut lets you easily create floating windows in your Android app.

Coming Soon Meanwhile, checkout the demo video at http://www.youtube.com/watch?v=S3vHjxonOeg Join the conversation at http://forum.xda-developers.com/

Mark Wei 1.2k Dec 12, 2022
A simple library to let you sign (or draw lines) smoothly with your finger into a view and save it.

FingerSignView Introduction FingerSignView is a simple library that lets you finger, or draw lines, smoothly with your finger into a View and save it

Agnaldo Pereira 25 Nov 20, 2022
🪄 It's a library that helps you customize your notification bar

NotificationBarCustom ?? It's a library that helps you customize your notification bar Demo Contrast(white) Contrast(black) Transparent Setup Add it i

박상선 8 Sep 7, 2022
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Android library which allows you to swipe down from an activity to close it.

Android Sliding Activity Library Easily create activities that can slide vertically on the screen and fit well into the Material Design age. Features

Jake Klinker 1.3k Nov 25, 2022