src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java
changeset 1044 197a85a35cba
parent 1043 7d6f2526244a
child 1045 e5a970600066
equal deleted inserted replaced
1043:7d6f2526244a 1044:197a85a35cba
     1 /*
       
     2     BEEM is a videoconference application on the Android Platform.
       
     3 
       
     4     Copyright (C) 2009 by Frederic-Charles Barthelery,
       
     5                           Jean-Manuel Da Silva,
       
     6                           Nikita Kozlov,
       
     7                           Philippe Lago,
       
     8                           Jean Baptiste Vergely,
       
     9                           Vincent Veronis.
       
    10 
       
    11     This file is part of BEEM.
       
    12 
       
    13     BEEM is free software: you can redistribute it and/or modify
       
    14     it under the terms of the GNU General Public License as published by
       
    15     the Free Software Foundation, either version 3 of the License, or
       
    16     (at your option) any later version.
       
    17 
       
    18     BEEM is distributed in the hope that it will be useful,
       
    19     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    20     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    21     GNU General Public License for more details.
       
    22 
       
    23     You should have received a copy of the GNU General Public License
       
    24     along with BEEM.  If not, see <http://www.gnu.org/licenses/>.
       
    25 
       
    26     Please send bug reports with examples or suggestions to
       
    27     contact@beem-project.com or http://dev.beem-project.com/
       
    28 
       
    29     Epitech, hereby disclaims all copyright interest in the program "Beem"
       
    30     written by Frederic-Charles Barthelery,
       
    31                Jean-Manuel Da Silva,
       
    32                Nikita Kozlov,
       
    33                Philippe Lago,
       
    34                Jean Baptiste Vergely,
       
    35                Vincent Veronis.
       
    36 
       
    37     Nicolas Sadirac, November 26, 2009
       
    38     President of Epitech.
       
    39 
       
    40     Flavien Astraud, November 26, 2009
       
    41     Head of the EIP Laboratory.
       
    42 
       
    43 */
       
    44 package com.beem.project.beem.smack.avatar;
       
    45 
       
    46 import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
       
    47 import org.jivesoftware.smack.Connection;
       
    48 // API level 8
       
    49 //import android.net.http.AndroidHttpClient;
       
    50 //import org.apache.http.client.HttpClient;
       
    51 
       
    52 /**
       
    53  * A factory for AvatarRetriever.
       
    54  */
       
    55 public final class AvatarRetrieverFactory {
       
    56 
       
    57     /**
       
    58      * Private constructor.
       
    59      */
       
    60     private AvatarRetrieverFactory() {
       
    61     }
       
    62 
       
    63     /**
       
    64      * Get a AvatarRetriever to retrieve this avatar.
       
    65      *
       
    66      * @param con the connection
       
    67      * @param from the user which own the avatar
       
    68      * @param info the metadata information of the avatar to retrieve
       
    69      * @return an AvatarRetriever null if none can retrieve this avatar
       
    70      */
       
    71     public static AvatarRetriever getRetriever(Connection con, String from, Info info) {
       
    72 	String url = info.getUrl();
       
    73 	if (url != null) {
       
    74 	    // return new HttpAvatarRetriever(url);
       
    75 	    // HttpClient client = AndroidHttpClient.newInstance("Beem");
       
    76 	    return new HttpClientAvatarRetriever(url);
       
    77 	}
       
    78 	return new XmppAvatarRetriever(con, from, info.getId());
       
    79     }
       
    80 }