Android Open Source - favouritetv Session Events






From Project

Back to project page favouritetv.

License

The source code is released under:

Copyright (c) 2011 Andr? Prata<andreprata@ua.pt> Eriksson Monteiro<eriksson.monteiro@ua.pt> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associat...

If you think the Android project favouritetv 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 Facebook, Inc.// w  w  w.ja  v a2 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.
 */

package pt.ua.code.favouritetv.facebook;

import java.util.LinkedList;

public class SessionEvents {

    private static LinkedList<AuthListener> mAuthListeners = 
        new LinkedList<AuthListener>();
    private static LinkedList<LogoutListener> mLogoutListeners = 
        new LinkedList<LogoutListener>();

    /**
     * Associate the given listener with this Facebook object. The listener's
     * callback interface will be invoked when authentication events occur.
     * 
     * @param listener
     *            The callback object for notifying the application when auth
     *            events happen.
     */
    public static void addAuthListener(AuthListener listener) {
        mAuthListeners.add(listener);
    }

    /**
     * Remove the given listener from the list of those that will be notified
     * when authentication events occur.
     * 
     * @param listener
     *            The callback object for notifying the application when auth
     *            events happen.
     */
    public static void removeAuthListener(AuthListener listener) {
        mAuthListeners.remove(listener);
    }

    /**
     * Associate the given listener with this Facebook object. The listener's
     * callback interface will be invoked when logout occurs.
     * 
     * @param listener
     *            The callback object for notifying the application when log out
     *            starts and finishes.
     */
    public static void addLogoutListener(LogoutListener listener) {
        mLogoutListeners.add(listener);
    }

    /**
     * Remove the given listener from the list of those that will be notified
     * when logout occurs.
     * 
     * @param listener
     *            The callback object for notifying the application when log out
     *            starts and finishes.
     */
    public static void removeLogoutListener(LogoutListener listener) {
        mLogoutListeners.remove(listener);
    }
    
    public static void onLoginSuccess() {
        for (AuthListener listener : mAuthListeners) {
            listener.onAuthSucceed();
        }
    }
    
    public static void onLoginError(String error) {
        for (AuthListener listener : mAuthListeners) {
            listener.onAuthFail(error);
        }
    }
    
    public static void onLogoutBegin() {
        for (LogoutListener l : mLogoutListeners) {
            l.onLogoutBegin();
        }
    }
    
    public static void onLogoutFinish() {
        for (LogoutListener l : mLogoutListeners) {
            l.onLogoutFinish();
        }   
    }
    
    /**
     * Callback interface for authorization events.
     *
     */
    public static interface AuthListener {

        /**
         * Called when a auth flow completes successfully and a valid OAuth 
         * Token was received.
         * 
         * Executed by the thread that initiated the authentication.
         * 
         * API requests can now be made.
         */
        public void onAuthSucceed();

        /**
         * Called when a login completes unsuccessfully with an error. 
         *  
         * Executed by the thread that initiated the authentication.
         */
        public void onAuthFail(String error);
    }
    
    /**
     * Callback interface for logout events.
     *
     */ 
    public static interface LogoutListener {
        /**
         * Called when logout begins, before session is invalidated.  
         * Last chance to make an API call.  
         * 
         * Executed by the thread that initiated the logout.
         */
        public void onLogoutBegin();

        /**
         * Called when the session information has been cleared.
         * UI should be updated to reflect logged-out state.
         * 
         * Executed by the thread that initiated the logout.
         */
        public void onLogoutFinish();
    }
    
}




Java Source Code List

com.facebook.android.AsyncFacebookRunner.java
com.facebook.android.DialogError.java
com.facebook.android.FacebookError.java
com.facebook.android.Facebook.java
com.facebook.android.FbDialog.java
com.facebook.android.Util.java
pt.ua.code.favouritetv.FavouriteTV.java
pt.ua.code.favouritetv.Map.java
pt.ua.code.favouritetv.Programs.java
pt.ua.code.favouritetv.SelectChannels.java
pt.ua.code.favouritetv.calendar.CalendarManager.java
pt.ua.code.favouritetv.content.Channels.java
pt.ua.code.favouritetv.content.FavouriteTvProvider.java
pt.ua.code.favouritetv.content.Home.java
pt.ua.code.favouritetv.content.SQLiteFavouriteTvHelper.java
pt.ua.code.favouritetv.facebook.BaseDialogListener.java
pt.ua.code.favouritetv.facebook.BaseRequestListener.java
pt.ua.code.favouritetv.facebook.LoginButton.java
pt.ua.code.favouritetv.facebook.SessionEvents.java
pt.ua.code.favouritetv.facebook.SessionStore.java
pt.ua.code.favouritetv.gui.AsyncImageLoader.java
pt.ua.code.favouritetv.gui.FViewFlipper.java
pt.ua.code.favouritetv.gui.ImagemETextoListAdapter.java
pt.ua.code.favouritetv.gui.MyMap.java
pt.ua.code.favouritetv.gui.Rotate3dAnimation.java
pt.ua.code.favouritetv.gui.ViewCache.java
pt.ua.code.favouritetv.service.ContextAlertBinder.java
pt.ua.code.favouritetv.service.ContextAlerter.java
pt.ua.code.favouritetv.service.ContextStartup.java
pt.ua.code.favouritetv.service.NotificationAlarm.java
pt.ua.code.ws.Channel.java
pt.ua.code.ws.MeoParser.java
pt.ua.code.ws.MeoWsClient.java
pt.ua.code.ws.Program.java