Android Open Source - AndroIUT Zoom State






From Project

Back to project page AndroIUT.

License

The source code is released under:

GNU General Public License

If you think the Android project AndroIUT listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2010 Sony Ericsson Mobile Communications AB
 * /* www. jav  a 2 s . c  o m*/
 *  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.
 */
/**
 * Licence Modifications : Change package name
 */
package com.iutdijon.androiut2.util.zoom;

import java.util.Observable;

/**
 * A ZoomState holds zoom and pan values and allows the user to read and listen
 * to changes. Clients that modify ZoomState should call notifyObservers()
 */
public class ZoomState extends Observable {
    /**
     * Zoom level A value of 1.0 means the content fits the view.
     */
    private double mZoom;

    /**
     * Pan position x-coordinate X-coordinate of zoom window center position,
     * relative to the width of the content.
     */
    private double mPanX;

    /**
     * Pan position y-coordinate Y-coordinate of zoom window center position,
     * relative to the height of the content.
     */
    private double mPanY;

    // Public methods

    /**
     * Get current x-pan
     * 
     * @return current x-pan
     */
    public double getPanX() {
        return mPanX;
    }

    /**
     * Get current y-pan
     * 
     * @return Current y-pan
     */
    public double getPanY() {
        return mPanY;
    }

    /**
     * Get current zoom value
     * 
     * @return Current zoom value
     */
    public double getZoom() {
        return mZoom;
    }

    /**
     * Help function for calculating current zoom value in x-dimension
     * 
     * @param aspectQuotient (Aspect ratio content) / (Aspect ratio view)
     * @return Current zoom value in x-dimension
     */
    public double getZoomX(float aspectQuotient) {
        return Math.min(mZoom, mZoom * aspectQuotient);
    }

    /**
     * Help function for calculating current zoom value in y-dimension
     * 
     * @param aspectQuotient (Aspect ratio content) / (Aspect ratio view)
     * @return Current zoom value in y-dimension
     */
    public double getZoomY(float aspectQuotient) {
        return Math.min(mZoom, mZoom / aspectQuotient);
    }

    /**
     * Set pan-x
     * 
     * @param d Pan-x value to set
     */
    public void setPanX(double d) {
        if (d != mPanX) {
            mPanX = d;
            setChanged();
        }
    }

    /**
     * Set pan-y
     * 
     * @param d Pan-y value to set
     */
    public void setPanY(double d) {
        if (d != mPanY) {
            mPanY = d;
            setChanged();
        }
    }

    /**
     * Set zoom
     * 
     * @param d Zoom value to set
     */
    public void setZoom(double d) {
        if (d != mZoom) {
            mZoom = d;
            setChanged();
        }
    }

}




Java Source Code List

.ADEResourcesDataTree.java
com.iutdijon.androiut2.ade.activities.ADEActivity.java
com.iutdijon.androiut2.ade.activities.ADEListResourcesChooser.java
com.iutdijon.androiut2.ade.activities.OnImageDownloadedCallback.java
com.iutdijon.androiut2.ade.service.ADEICalendarDownloader.java
com.iutdijon.androiut2.ftp.activities.FTPActivity.java
com.iutdijon.androiut2.ftp.adapters.FTPFileListAdapter.java
com.iutdijon.androiut2.ftp.data.FTPCommandResult.java
com.iutdijon.androiut2.ftp.data.FTPCommandWrapper.java
com.iutdijon.androiut2.ftp.data.FTPCommand.java
com.iutdijon.androiut2.ftp.services.FTPDownloadMonitor.java
com.iutdijon.androiut2.ftp.services.FTPServiceCall.java
com.iutdijon.androiut2.ftp.services.ProgressDownload.java
com.iutdijon.androiut2.global.AndroIUTApplication.java
com.iutdijon.androiut2.iut.activities.HomeActivity.java
com.iutdijon.androiut2.iut.activities.LoginActivity.java
com.iutdijon.androiut2.iut.data.Credential.java
com.iutdijon.androiut2.iut.data.UserFactory.java
com.iutdijon.androiut2.iut.data.account.StudentAccount.java
com.iutdijon.androiut2.iut.data.account.TeacherAccount.java
com.iutdijon.androiut2.iut.data.account.UserAccount.java
com.iutdijon.androiut2.iut.services.IUTLoginServiceCall.java
com.iutdijon.androiut2.mail.activities.MailActivity.java
com.iutdijon.androiut2.mail.activities.MailReaderActivity.java
com.iutdijon.androiut2.mail.adapters.MailDisplayAdapter.java
com.iutdijon.androiut2.mail.adapters.MailsListAdapter.java
com.iutdijon.androiut2.mail.services.EmailUtils.java
com.iutdijon.androiut2.mail.services.MailReader.java
com.iutdijon.androiut2.mail.services.MailService.java
com.iutdijon.androiut2.schooling.activities.SchoolingActivity.java
com.iutdijon.androiut2.schooling.activities.SchoolingTabActivity.java
com.iutdijon.androiut2.schooling.adapters.SectionedAdapter.java
com.iutdijon.androiut2.schooling.data.Absence.java
com.iutdijon.androiut2.schooling.data.Mark.java
com.iutdijon.androiut2.schooling.data.SchoolingData.java
com.iutdijon.androiut2.schooling.service.SchoolingDataServiceCall.java
com.iutdijon.androiut2.util.AndroIUTLogger.java
com.iutdijon.androiut2.util.IOUtils.java
com.iutdijon.androiut2.util.PreferencesManager.java
com.iutdijon.androiut2.util.UIUtil.java
com.iutdijon.androiut2.util.adapters.AbsencesAdapter.java
com.iutdijon.androiut2.util.adapters.BitmapAdapter.java
com.iutdijon.androiut2.util.adapters.CalendarAdapter.java
com.iutdijon.androiut2.util.adapters.IAdapter.java
com.iutdijon.androiut2.util.adapters.MarksAdapter.java
com.iutdijon.androiut2.util.adapters.UserAdapter.java
com.iutdijon.androiut2.util.adapters.XmlAdapter.java
com.iutdijon.androiut2.util.bridge.BridgeFinder.java
com.iutdijon.androiut2.util.loaders.AndroIUTHTTPConnection.java
com.iutdijon.androiut2.util.loaders.AsyncServiceCall.java
com.iutdijon.androiut2.util.loaders.BitmapDownloaderTask.java
com.iutdijon.androiut2.util.loaders.GetAsyncServiceCall.java
com.iutdijon.androiut2.util.loaders.ImageDownloader.java
com.iutdijon.androiut2.util.loaders.PostAsyncServiceCall.java
com.iutdijon.androiut2.util.observers.Observable.java
com.iutdijon.androiut2.util.observers.Observer.java
com.iutdijon.androiut2.util.security.SecureCenter.java
com.iutdijon.androiut2.util.view.ImageZoomView.java
com.iutdijon.androiut2.util.zoom.AspectQuotient.java
com.iutdijon.androiut2.util.zoom.DynamicZoomControl.java
com.iutdijon.androiut2.util.zoom.LongPressZoomListener.java
com.iutdijon.androiut2.util.zoom.PinchZoomListener.java
com.iutdijon.androiut2.util.zoom.SimpleZoomListener.java
com.iutdijon.androiut2.util.zoom.ZoomState.java
com.iutdijon.androiut2.util.zoom.util.Dynamics.java
com.iutdijon.androiut2.util.zoom.util.SpringDynamics.java