- 您需要在 Google 控制台上启用 G+ API。
https://developers.google.com/+/mobile/android/getting-started#step_1_enable_the_google_api https://developers.google.com/+/mobile/android/getting-started#step_1_enable_the_google_api
- 您需要制作自定义导航抽屉:
http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
如何在android中创建自定义导航抽屉 https://stackoverflow.com/questions/21796209/how-to-create-a-custom-navigation-drawer-in-android
- 您需要初始化 GoogleApiClient
https://developer.android.com/google/auth/api-client.html https://developer.android.com/google/auth/api-client.html
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......
googleApiClient = new GoogleApiClient.Builder(getActivity())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addScope(Plus.SCOPE_PLUS_PROFILE)
.build();
}
@Override
public void onConnected(Bundle bundle) {
Plus.PeopleApi.loadVisible(googleApiClient, null).setResultCallback(this);
if (Plus.PeopleApi.getCurrentPerson(googleApiClient) != null) {
Person person = Plus.PeopleApi.getCurrentPerson(googleApiClient);
personNameView.setText(person.getDisplayName());
if (person.hasImage()) {
Person.Image image = person.getImage();
new AsyncTask<String, Void, Bitmap>() {
@Override
protected Bitmap doInBackground(String... params) {
try {
URL url = new URL(params[0]);
InputStream in = url.openStream();
return BitmapFactory.decodeStream(in);
} catch (Exception e) {
/* TODO log error */
}
return null;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
personImageView.setImageBitmap(bitmap);
}
}.execute(image.getUrl());
}
}
整个例子你可以在这里得到:http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/ http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/
对于封面照片,你可以做类似的事情
Person.Cover.CoverPhoto cover = person.getCover().getCoverPhoto();
cover.getUrl()
- 圆形图像
http://curious-blog.blogspot.com/2014/05/create-circle-bitmap-in-android.html http://curious-blog.blogspot.com/2014/05/create-circle-bitmap-in-android.html
如何制作带有圆角的ImageView? https://stackoverflow.com/questions/2459916/how-to-make-an-imageview-with-rounded-corners