An imageView can auto scroll with device rotating.

Overview

PanoramaImageView

An imageView can auto scroll with device rotating.

ScreenShots

Include PanoramaImageView to Your Project

With gradle:

dependencies {
   compile 'com.gjiazhe:PanoramaImageView:1.0'
}

Use PanoramaImageView in Layout File Just Like ImageView

<com.gjiazhe.panoramaimageview.PanoramaImageView
    android:id="@+id/panorama_image_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/img"
    app:piv_enablePanoramaMode="true"
    app:piv_show_scrollbar="true"
    app:piv_invertScrollDirection="false" />

Description of Attributes

Attributes Format Default Description
piv_enablePanoramaMode boolean true Enable panorama effect or not.
piv_show_scrollbar boolean true Show scrollbar or not.
piv_invertScrollDirection boolean false Invert the scroll direction or not.

All the attributes can also be set in java code:

panoramaImageView.setEnablePanoramaMode(true);
panoramaImageView.setEnableScrollbar(true);
panoramaImageView.setInvertScrollDirection(false);

Register the GyroscopeObserver

In Activity or Fragment using PanoramaImageView, you should register the GyroscopeObserver in onResume() and remember to unregister it in onPause().

public class MyActivity extends AppCompatActivity {
  
    private GyroscopeObserver gyroscopeObserver;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Initialize GyroscopeObserver.
        gyroscopeObserver = new GyroscopeObserver();
        // Set the maximum radian the device should rotate to show image's bounds.
        // It should be set between 0 and π/2.
        // The default value is π/9.
      	gyroscopeObserver.setMaxRotateRadian(Math.PI/9);

        PanoramaImageView panoramaImageView = (PanoramaImageView) findViewById(R.id.panorama_image_view);
        // Set GyroscopeObserver for PanoramaImageView.
        panoramaImageView.setGyroscopeObserver(gyroscopeObserver);
    }

    @Override
    protected void onResume() {
        super.onResume();
        // Register GyroscopeObserver.
        gyroscopeObserver.register(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        // Unregister GyroscopeObserver.
        gyroscopeObserver.unregister();
    }
}

Set OnPanoramaScrollListener to observe scroll state

If you want to get callback when the image scrolls, set an OnPanoramaScrollListener for PanoramaImageView.

panoramaImageView.setOnPanoramaScrollListener(new PanoramaImageView.OnPanoramaScrollListener() {
    @Override
    public void onScrolled(PanoramaImageView view, float offsetProgress) {
        // Do something here.
        // The offsetProgress range from -1 to 1, indicating the image scrolls
        // from left(top) to right(bottom).
    }
});

License

MIT License

Copyright (c) 2016 郭佳哲

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • Only showing images set with android:src attribute

    Only showing images set with android:src attribute

    I'm trying to have all of my viewholders in a recyclerview use the same gyroscopeobserver instance. I set the observer in the onCreateViewHolder method. I load an image into the imageview in the viewholder with picasso. My images don't show up, it's just black. Images are loading fine with a standard imageview. If i set a static image using the android:src attribute, everything is working fine.

    opened by tpfaff 3
  • Classes won't work

    Classes won't work

    Two of the classes won't work. The PanoramaImageView and GyroscopeObserver. They can't resolve the ImageView in public class [classname] extends ImageView and they both have an error that says

    'addPanoramaImageView(com.gjiazhe.panoramaimageview.PanoramaImageView)' is not public in 'com.gjiazhe.panoramaimageview.GyroscopeObserver'. Cannot be accessed from outside package

    opened by TassiloHeinrich 1
  • Attribute application:label conflicted~

    Attribute application:label conflicted~

    Compiling with following errors: Error:Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed : Attribute application@label value=(@string/app_label) from AndroidManifest.xml:18:13-46 is also present at [com.gjiazhe:PanoramaImageView:1.0] AndroidManifest.xml:13:9-41 value=(@string/app_name). Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:14:5-30:19 to override.

    opened by microstudent 1
  • create BuildTest.yml + Cherry picked support for Accelerometer Sensor

    create BuildTest.yml + Cherry picked support for Accelerometer Sensor

    build, test and export your APK, test reports cherry picked a commit from => https://github.com/codernavi18/PanoramaImageView.git | commit id => 9c255a82430106cf1cfd20228b4dad603d50050a for support for Accelerometer Sensor

    opened by Micoder-dev 0
  • Orientation Problem

    Orientation Problem

    When using this image, it starts vertical orientation, instead of horizontal orientation http://www.panophoto.eu/Images/Uploads/Med/42f5eda5-7031-4a2e-9c84-7114126c46c0.jpg It's possible to set it manually?

    I tested it with the demo app, and it's working fine. I used in my app in a listview, and on every onMeasure, I get the heightMeasureSpec= 0, that's why it's entering the VERTICAL part of the if (PanoramaImageViewer.java). What could be the problem?

    opened by arnoldcoder 0
  • PanoramaImageView How to use with Glide?

    PanoramaImageView How to use with Glide?

    Hi,

    I'm using Glide for load images and my image not work well how can fix this issue.

    Now only work when I add an image with android:src on xml file.

    opened by BurakDurmus 5
  • PanoramaImageView on view pager

    PanoramaImageView on view pager

    I'm using panoramaImageview as item of pages on view pager, but scrolling when the image is not centered shows a gap between this image and the next, so you can see the layout behind it. Had you faced this issue? Any ideas to solve this?

    opened by prcGit 0
Owner
郭佳哲
郭佳哲
A circular ImageView for Android

CircleImageView A fast circular ImageView perfect for profile images. This is based on RoundedImageView from Vince Mi which itself is based on techniq

Henning Dodenhof 14.4k Jan 5, 2023
Custom shaped android imageview components

Shape Image View Provides a set of custom shaped android imageview components, and a framework to define more shapes. Implements both shader and bitma

Siyamed SINIR 2.6k Jan 8, 2023
Android ImageView that handles animated GIF images

GifImageView Android ImageView that handles Animated GIF images Usage In your build.gradle file: dependencies { compile 'com.felipecsl:gifimageview:

Felipe Lima 1.1k Dec 27, 2022
Android ImageView that supports different radii on each corner.

SelectableRoundedImageView Note that this project is no longer maintained. Android ImageView that supports different radii on each corner. It also sup

Joonho Kim 1.1k Nov 25, 2022
A fast ImageView that supports rounded corners, ovals, and circles.

RoundedImageView A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy. I

Vince Mi 6.4k Jan 8, 2023
An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Scrolling Image View An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Q42 1.8k Dec 27, 2022
a solution that can help developers display pictures in any shape.

android-anyshape With the solution, pictures can be displayed in any shape on Android platform. Effect The left is the UI using normal ImageViews, and

Lankton 190 Dec 22, 2022
🍂 Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

?? Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

Jaewoong Eum 1.4k Jan 2, 2023
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
Android auto scroll viewpager or viewpager in viewpager

Android Auto Scroll ViewPager ViewPager which can auto scrolling, cycling, decelerating. ViewPager which can be slided normal in parent ViewPager. Att

Trinea 1.7k Dec 10, 2022
Slider-Gallery-Zoom: image slider for android supporting indicator and auto scroll with clicking on image

image slider supporting indicator and auto scroll with clicking on image to open full screen image slider swipe and pinch zoom gestures like gallery,just pass your images and the position of the current image.

Mahmoud Elian 3 May 28, 2022
Visual back-port of the rotating drawer-to-arrow drawable from Android L

DrawerArrowDrawable A simple drawable backport of the new drawer-indicator/back-arrow rotating drawable from the upcoming Android L. License Copyright

Chris Renke 827 Nov 25, 2022
Android widget for cropping and rotating an image.

Cropper The Cropper is an image cropping tool. It provides a way to set an image in XML and programmatically, and displays a resizable crop window on

Edmodo 2.9k Nov 14, 2022
Android widget for cropping and rotating an image.

Cropper The Cropper is an image cropping tool. It provides a way to set an image in XML and programmatically, and displays a resizable crop window on

Edmodo 2.9k Nov 14, 2022
Visual back-port of the rotating drawer-to-arrow drawable from Android L

DrawerArrowDrawable A simple drawable backport of the new drawer-indicator/back-arrow rotating drawable from the upcoming Android L. License Copyright

Chris Renke 827 Nov 25, 2022
Menu with items on a rotating circle

Circle Menu This is a simple implementation of a circle menu for Android applications. Deprecated ConstraintLayout 1.1.0 is now supporting circular po

Csaba Szugyiczki 296 Nov 10, 2022
Android ImageView you pan by tilting your device.

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

Justas Medeišis 265 Nov 11, 2022
An Android GridView that can be configured to scroll horizontally or vertically

TwoWayGridView An Android GridView that can be configured to scroll horizontally or vertically. I should have posted this over a year and a half ago,

Jess Anders 656 Jan 9, 2023
DMIV aims to provide a flexible and customizable instrument for automated images moving on display. It provides scroll, gyroscope or time based moving. But you can create your own evaluator.

DexMovingImageView DMIV aims to provide a flexible and customizable instrument for automated images moving on display. It provides scroll, gyroscope o

Diego Grancini 310 Feb 7, 2022