当前位置: 首页>>代码示例>>Java>>正文


Java Profile类代码示例

本文整理汇总了Java中com.facebook.Profile的典型用法代码示例。如果您正苦于以下问题:Java Profile类的具体用法?Java Profile怎么用?Java Profile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Profile类属于com.facebook包,在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSuccess

import com.facebook.Profile; //导入依赖的package包/类
@Override
        public void onSuccess(com.facebook.login.LoginResult loginResult) {
            Profile facebookProfile = Profile.getCurrentProfile();
            if (facebookProfile == null) {
                String errorMsg = InfoFromFacebookActivity.this.getResources().getString(R.string.facebook_error);
                errorMsg = errorMsg + ".";
                Snackbar.make(textViewFacebookName, errorMsg, Snackbar.LENGTH_LONG).show();
                textViewFacebookName.setText(errorMsg);
            } else {
                facebookProfilePhoto.setProfileId(facebookProfile.getId());
                textViewFacebookName.setText(facebookProfile.getName());

                buttonAck.setEnabled(true);
                buttonSwitch.setVisibility(Button.VISIBLE);
            }

            // TODO: Do not store access token - it is a security issue storing this
            // TODO and appears to be of no benefit.
//                AccessToken token = loginResult.getAccessToken();
//                DataHolder data = DataHolder.getInstance(InfoFromFacebookActivity.this.getApplicationContext());
//                data.setFacebookToken(token.getToken());
//                data.persist();
        }
 
开发者ID:nelladragon,项目名称:scab,代码行数:24,代码来源:InfoFromFacebookActivity.java

示例2: initFBSdk

import com.facebook.Profile; //导入依赖的package包/类
private void initFBSdk() {
    if (!FacebookSdk.isInitialized()) {
        FacebookSdk.setApplicationId(ApiObjects.facebook.get("app_id"));
        FacebookSdk.sdkInitialize(getActivity().getApplicationContext());
    }
    callbackManager = CallbackManager.Factory.create();

    profileTracker = new ProfileTracker() {
        @Override
        protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
            if (eventHandler != null) {
                if (currentProfile != null)
                    eventHandler.onFacebookLoggedIn();
            }
        }
    };
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:18,代码来源:FacebookShield.java

示例3: onCreate

import com.facebook.Profile; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getActivity().getApplicationContext());

    callbackManager = CallbackManager.Factory.create();

    accessTokenTracker = new AccessTokenTracker() {
        @Override
        protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {

        }
    };

    profileTracker = new ProfileTracker() {
        @Override
        protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
            //Toast.makeText(getActivity(), "newProfile", Toast.LENGTH_SHORT).show();
            //displayMessage(currentProfile);

        }
    };

    accessTokenTracker.startTracking();
    profileTracker.startTracking();
}
 
开发者ID:jtran064,项目名称:PlatePicks-Android,代码行数:27,代码来源:LoginFragment.java

示例4: setFacebookRule

import com.facebook.Profile; //导入依赖的package包/类
private void setFacebookRule() {
    callbackManager = CallbackManager.Factory.create();
    LoginManager.getInstance().registerCallback(callbackManager,
            new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                    EventBus.getDefault().post(MessageEvent.UPDATE_FACEBOOK_PROFILE);
                }

                @Override
                public void onCancel() {
                    Log.d("Teste", "deu errp");
                }

                @Override
                public void onError(FacebookException exception) {
                    Log.d("ErrorF", exception.toString());
                }
            }
    );

    Profile profile = Profile.getCurrentProfile();

    if (profile != null) {
        this.sidebar.showHideLogoff(true);
    } else {
        this.sidebar.showHideLogoff(false);
    }

}
 
开发者ID:voudeonibus,项目名称:vdb-android,代码行数:31,代码来源:BaseActivity.java

示例5: getImageStringFile

import com.facebook.Profile; //导入依赖的package包/类
private String getImageStringFile() {
    try {
        URL image = new URL(Profile.getCurrentProfile()
                .getProfilePictureUri(140, 140).toString());

        Resources res = getResources();
        Bitmap src = BitmapFactory.decodeStream(image.openConnection().getInputStream());

        ByteArrayOutputStream bYtE = new ByteArrayOutputStream();
        src.compress(Bitmap.CompressFormat.PNG, 100, bYtE);
        src.recycle();
        byte[] byteArray = bYtE.toByteArray();
        return Base64.encodeToString(byteArray, Base64.DEFAULT);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:BlunchDev,项目名称:blunch_android,代码行数:19,代码来源:LogInActivity.java

示例6: addTemplateTasks

import com.facebook.Profile; //导入依赖的package包/类
private void addTemplateTasks() {
    for (String task : NewEventActivity.TEMPLATE_TASKS[fromTemplateNumber]) {
        JSONObject json = new JSONObject();
        String eventId = String.valueOf(newEventId);
        try {
            json.put("name", task);
            json.put("cost", 0);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        ServerHandler.executePost(eventId, ServerHandler.EVENT_TASKS, Profile.getCurrentProfile().getId(), "", json, j -> {
            if (j != null)
                SplitAppLogger.writeLog(1, "Post new Task on event Creation (RESULT): " + j.toString());
        });
    }
}
 
开发者ID:Xero-Hige,项目名称:SplitApp,代码行数:18,代码来源:NewEventDetailsActivity.java

示例7: updateUserData

import com.facebook.Profile; //导入依赖的package包/类
private void updateUserData(String email) {
    Profile profile = Profile.getCurrentProfile();
    mName.setText(profile.getName());

    int photoDimention = getResources().getDimensionPixelSize(R.dimen.avatar_dimention);
    Picasso.with(this)
            .load(profile.getProfilePictureUri(photoDimention, photoDimention))
            .transform(PicassoTransformations.getRoundedTransformation())
            .error(R.drawable.ic_signup)
            .placeholder(R.drawable.ic_signup)
            .into(mPhotoProfile);

    if (!TextUtils.isEmpty(email)) {
        mEmail.setText(email);
    }
}
 
开发者ID:Hotmart-Org,项目名称:zum-android,代码行数:17,代码来源:SignUpActivity.java

示例8: startProfileTracking

import com.facebook.Profile; //导入依赖的package包/类
/**
 * Start tracking profile.
 */
public void startProfileTracking() {
    //Track profile
    profileTracker = new ProfileTracker() {
        @Override
        protected void onCurrentProfileChanged(
                Profile oldProfile,
                Profile currentProfile) {

            // App code comes here.
            if (currentProfile != null && Config.IS_DEBUG_MODE)
                Log.d(TAG, currentProfile.getName());

        }
    };
}
 
开发者ID:kgeriiie,项目名称:android-fagyi,代码行数:19,代码来源:FacebookHandler.java

示例9: onCreate

import com.facebook.Profile; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getActivity().getApplicationContext());
    mCallbackManager = CallbackManager.Factory.create();

    profileTracker = new ProfileTracker() {
        @Override
        protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
            final Profile profile = currentProfile;
            if (profile != null) {
                final Thread thread = new Thread() {
                    public void run() {
                        createUserFromFacebook(profile);
                        openListsOverview();
                    }
                };
                thread.start();
            }
        }
    };

    printKeyHash(getActivity());
}
 
开发者ID:andretf,项目名称:batatas-android,代码行数:25,代码来源:MainFragment.java

示例10: updateUI

import com.facebook.Profile; //导入依赖的package包/类
private void updateUI()  {
    boolean loggedIn = AccessToken.getCurrentAccessToken() != null;
    Profile profile = Profile.getCurrentProfile();

    if (loggedIn && (profile != null)) {
        profilePicture.setProfileId(profile.getId());
        userName.setText(profile.getName());
        name = profile.getName();
        id = profile.getId();





       // postLinkButton.setEnabled(true);
      //  postPictureButton.setEnabled(true);
    } else {
        profilePicture.setProfileId(null);
        userName.setText(null);
       // postLinkButton.setEnabled(false);
      //  postPictureButton.setEnabled(false);
    }
}
 
开发者ID:CE-KMITL-OOAD-2015,项目名称:make-me-smile,代码行数:24,代码来源:Login.java

示例11: ObtenerDatosFacebook

import com.facebook.Profile; //导入依赖的package包/类
/**
 * Metodo para obtener el nombre de usuario y la fotografia de Facebook
 */
private void ObtenerDatosFacebook() {
    //Para obtener datos del perfil tenemos que hacer un GraphRequest
    GraphRequest request = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
        @Override
        public void onCompleted(final JSONObject object, GraphResponse response) {
        //Obtenemos los datos del perfil
        Profile perfil = Profile.getCurrentProfile();
        //Lo mostramos en pantalla y lo guardamos
        foto.setProfileId(perfil.getId());
            nombre.setText(object.optString("name"));
        }
    });
    //Añadimos los parametros que hemos requerido y ejecutamos la peticion
    Bundle parameters = new Bundle();
    parameters.putString("fields", "name");
    request.setParameters(parameters);
    request.executeAsync();
}
 
开发者ID:pedroag,项目名称:TFG,代码行数:22,代码来源:PantallaPerfil.java

示例12: setFacebookAvatar

import com.facebook.Profile; //导入依赖的package包/类
private void setFacebookAvatar() {
	Profile fbProfile = Profile.getCurrentProfile();
	String profileImageUri = fbProfile.getProfilePictureUri(250, 250).toString();

	GetSocial.User.setAvatarUrl(profileImageUri, new CompletionCallback() {
		@Override
		public void onSuccess() {
			_activityListener.invalidateUi();
		}

		@Override
		public void onFailure(GetSocialException e) {
			// failed to set avatar url
		}
	});
}
 
开发者ID:getsocial-im,项目名称:getsocial-android-sdk,代码行数:17,代码来源:BaseFragment.java

示例13: finishLogin

import com.facebook.Profile; //导入依赖的package包/类
private void finishLogin(
        AccessToken newToken,
        LoginClient.Request origRequest,
        FacebookException exception,
        boolean isCanceled,
        FacebookCallback<LoginResult>  callback) {
    if (newToken != null) {
        AccessToken.setCurrentAccessToken(newToken);
        Profile.fetchProfileForCurrentAccessToken();
    }

    if (callback != null) {
        LoginResult loginResult = newToken != null
                ? computeLoginResult(origRequest, newToken)
                : null;
        // If there are no granted permissions, the operation is treated as cancel.
        if (isCanceled
                || (loginResult != null
                       && loginResult.getRecentlyGrantedPermissions().size() == 0)) {
            callback.onCancel();
        } else if (exception != null) {
            callback.onError(exception);
        } else if (newToken != null) {
            callback.onSuccess(loginResult);
        }
    }
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:28,代码来源:LoginManager.java

示例14: successLogin

import com.facebook.Profile; //导入依赖的package包/类
private void successLogin() {
	loggedIn = true;

	accessToken = AccessToken.getCurrentAccessToken();
	profile = Profile.getCurrentProfile();

	if (profile != null) { Utils.d("Name: " + profile.getName()); }

	Utils.callScriptFunc("login", "true");
	fetchUserInformationAndLogin();
}
 
开发者ID:FrogSquare,项目名称:GDFacebook,代码行数:12,代码来源:FacebookSDK.java

示例15: dump

import com.facebook.Profile; //导入依赖的package包/类
public String dump() {
    StringBuffer buf = new StringBuffer();

    buf.append("FacebookSDK is initialized: " + FacebookSdk.isInitialized() + "\n");
    buf.append("FacebookSDK app id: " + FacebookSdk.getApplicationId() + "\n");
    buf.append("FacebookSDK app name: " + FacebookSdk.getApplicationName() + "\n");
    buf.append("FacebookSDK app signature: " + FacebookSdk.getApplicationSignature(this) + "\n");
    buf.append("FacebookSDK client token: " + FacebookSdk.getClientToken() + "\n");
    buf.append("FacebookSDK facebook domain: " + FacebookSdk.getFacebookDomain() + "\n");
    buf.append("FacebookSDK version: " + FacebookSdk.getSdkVersion() + "\n");
    buf.append("FacebookSDK debug enabled: " + FacebookSdk.isDebugEnabled() + "\n");

    Profile profile = Profile.getCurrentProfile();
    if (profile == null) {
        buf.append("Profile is null\n");
    } else {
        buf.append("Profile: First Name: " + profile.getFirstName() + "\n");
        buf.append("Profile: Last Name: " + profile.getLastName() + "\n");
        buf.append("Profile: Name: " + profile.getName() + "\n");
        buf.append("Profile: Id: " + profile.getId() + "\n");
        buf.append("Profile: LinkURI: " + profile.getLinkUri() + "\n");
        buf.append("Profile: Pic URI: " + profile.getProfilePictureUri(100, 100) + "\n");
    }

    AccessToken currentToken = AccessToken.getCurrentAccessToken();
    if (currentToken == null) {
        buf.append("Current Access Token is null\n");
    } else {
        buf.append("CurToken: tok: " + currentToken.getToken() + "\n");
        buf.append("CurToken: appid: " + currentToken.getApplicationId() + "\n");
        buf.append("CurToken: expires: " + currentToken.getExpires().toString() + "\n");
    }
    return buf.toString();
}
 
开发者ID:nelladragon,项目名称:scab,代码行数:35,代码来源:InfoFromFacebookActivity.java


注:本文中的com.facebook.Profile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。