Coder Social home page Coder Social logo

simplepanorama's Introduction

SimplePanorama

SimplePanorama is android panorama view library that uses modified version of panoramagl-android library. You can find modified version here.

Download

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.lespinsideg:SimplePanorama:0.3.1'
}

Usage

Setting layout xml

You can add SphericalView in your layout xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.lespinside.simplepanorama.view.SphericalView
        android:id="@+id/spherical_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:enableZoom="false"/>
</LinearLayout>

Call lifecycle methods in activity

And you should call onResume, onPause, onDestroy method in each lifecycle method.

public class MainActivity extends AppCompatActivity {

    private SphericalView sphericalView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        sphericalView = (SphericalView) findViewById(R.id.spherical_view);
        sphericalView.setPanorama(PLUtils.getBitmap(this, R.raw.sunset_at_pier), false);
    }

    @Override
    protected void onResume() {
        super.onResume();
        sphericalView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        sphericalView.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        sphericalView.onDestroy();
    }
}

Attributes list

  • enableZoom - enable zooming in/out with two fingers touch.
  • enableReset - enable resetting zoom factor with three fingers touch.
  • enableAccelerometer - enable accelerometer sensor to move panorama camera.
  • enableInertia - enable inertia of panorama camera movement.
  • yaw - set default yaw of panorama camera.
  • pitch - set default pitch of panorama camera.
  • zoomFactor - set default zoom factor of panorama camera.
  • rotationSensibility - set default rotation sensibility of panorama camera.

Sample activity

You can find a sample activity here

Supports

  • supports spherical view
  • only supports power of 2 image sizes : 2048 x 1024 , 1024 * 512 , 512 * 256 ...

License

Copyright 2016 kyuhyen hwang

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.

simplepanorama's People

Contributors

lespinsideg 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.