本文整理匯總了Java中com.google.android.gms.plus.PlusClient類的典型用法代碼示例。如果您正苦於以下問題:Java PlusClient類的具體用法?Java PlusClient怎麽用?Java PlusClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PlusClient類屬於com.google.android.gms.plus包,在下文中一共展示了PlusClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: revokeAccess
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
/**
* Revoke Google+ authorization completely.
*/
public void revokeAccess() {
if (mPlusClient.isConnected()) {
// Clear the default account as in the Sign Out.
mPlusClient.clearDefaultAccount();
// Revoke access to this entire application. This will call back to
// onAccessRevoked when it is complete, as it needs to reach the Google
// authentication servers to revoke all tokens.
mPlusClient.revokeAccessAndDisconnect(new PlusClient.OnAccessRevokedListener() {
public void onAccessRevoked(ConnectionResult result) {
updateConnectButtonState();
onPlusClientRevokeAccess();
}
});
}
}
示例2: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String chosenAccountName = AccountUtils.getActiveAccountName(getActivity());
mPlusClient = new PlusClient.Builder(getActivity(), this, this)
.clearScopes()
.setAccountName(chosenAccountName)
.build();
final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
mSessionUri = intent.getData();
if (mSessionUri == null) {
return;
}
mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);
mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);
LoaderManager manager = getLoaderManager();
manager.restartLoader(0, null, this);
setHasOptionsMenu(true);
}
示例3: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
/**
* Creates a {@link PlusClient} and kicks-off the connection flow.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Retain instance to avoid reconnecting on rotate. This means that onDestroy and onCreate
// will not be called on configuration changes.
setRetainInstance(true);
mHandler = new PlusClientFragmentHandler();
// Create the PlusClient.
PlusClient.Builder plusClientBuilder =
new PlusClient.Builder(getActivity().getApplicationContext(), this, this);
String[] visibleActivities = getArguments().getStringArray(ARG_VISIBLE_ACTIVITIES);
if (visibleActivities != null && visibleActivities.length > 0) {
plusClientBuilder.setVisibleActivities(visibleActivities);
}
mPlusClient = plusClientBuilder.build();
if (savedInstanceState == null) {
mRequestCode = INVALID_REQUEST_CODE;
} else {
mRequestCode = savedInstanceState.getInt(STATE_REQUEST_CODE, INVALID_REQUEST_CODE);
}
}
示例4: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_in_activity);
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions(MomentUtil.ACTIONS)
.build();
mSignInStatus = (TextView) findViewById(R.id.sign_in_status);
mSignInButton = (SignInButton) findViewById(R.id.sign_in_button);
mSignInButton.setOnClickListener(this);
mSignOutButton = findViewById(R.id.sign_out_button);
mSignOutButton.setOnClickListener(this);
mRevokeAccessButton = findViewById(R.id.revoke_access_button);
mRevokeAccessButton.setOnClickListener(this);
}
示例5: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
plusClient = new PlusClient.Builder(this, this, this);
plusClient.setScopes(Scopes.PLUS_LOGIN);
plusClient.setVisibleActivities(
"http://schemas.google.com/AddActivity",
"http://schemas.google.com/BuyActivity");
client = plusClient.build();
findViewById(R.id.button_sign_in).setOnClickListener(this);
dialog = new ProgressDialog(this);
getIntent().getAction();
}
示例6: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mLogout = getIntent().getBooleanExtra("logout", false);
mPlusClient = new PlusClient.Builder(
this, // Context
this, // ConnectionCallbacks
this) // OnConnectionFailedListener
.build();
mProgress = (ProgressBar)findViewById(R.id.progressBar);
mBtnSignIn = (SignInButton)findViewById(R.id.sign_in_button);
mBtnSignIn.setOnClickListener(this);
connectGPlus();
}
示例7: onSignedIn
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
public void onSignedIn(PlusClient plusClient) {
mSignInStatus.setText(getString(R.string.signed_in_status));
// We can now obtain the signed-in user's profile information.
Person currentPerson = plusClient.getCurrentPerson();
if (currentPerson != null) {
String greeting = getString(R.string.greeting_status, currentPerson.getDisplayName());
mSignInStatus.setText(greeting);
// Add the user name in the Preferences
AppPrefs.setUserAccountName(SignInActivity.this, currentPerson.getDisplayName());
Intent reservationsIntent = new Intent(SignInActivity.this, NavDrawerMainActivity.class);
startActivity(reservationsIntent);
finish();
} else {
resetAccountState();
}
}
示例8: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.person_list_activity);
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions(MomentUtil.ACTIONS)
.build();
mListItems = new ArrayList<String>();
mListAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mListItems);
mPersonListView = (ListView) findViewById(R.id.person_list);
mResolvingError = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (available != ConnectionResult.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例9: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_moments_activity);
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions(MomentUtil.ACTIONS)
.build();
mListItems = new ArrayList<Moment>();
mMomentListAdapter = new MomentListAdapter(this, android.R.layout.simple_list_item_1,
mListItems);
mMomentListView = (ListView) findViewById(R.id.moment_list);
mMomentListView.setOnItemClickListener(this);
mResolvingError = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (available != ConnectionResult.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例10: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.share_activity);
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions(MomentUtil.ACTIONS)
.build();
Button sendButton = (Button) findViewById(R.id.send_interactive_button);
sendButton.setOnClickListener(this);
mEditSendText = (EditText) findViewById(R.id.share_prefill_edit);
mSharing = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_SHARING, false);
int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (available != ConnectionResult.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例11: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.multi_moment_activity);
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions(MomentUtil.ACTIONS)
.build();
mListAdapter = new ArrayAdapter<String>(
this, android.R.layout.simple_list_item_1, MomentUtil.MOMENT_LIST);
mMomentListView = (ListView) findViewById(R.id.moment_list);
mMomentListView.setOnItemClickListener(this);
mResolvingError = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (available != ConnectionResult.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例12: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPlusClient = new PlusClient.Builder(this, this, this)
.setVisibleActivities("http://schemas.google.com/AddActivity",
"http://schemas.google.com/BuyActivity").build();
mConnectionProgressDialog = new ProgressDialog(this);
mConnectionProgressDialog.setMessage("Signin in...");
setContentView(R.layout.activity_main);
findViewById(R.id.sign_in_button).setOnClickListener(this);
deepShare = (Button) findViewById(R.id.deeplink);
deepShare.setOnClickListener(this);
shareButton = (Button) findViewById(R.id.simpleshare_button);
shareButton.setOnClickListener(this);
}
示例13: onActivityCreated
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
getSherlockActivity().getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
mPlusClient = new PlusClient.Builder(this.getActivity().getApplicationContext(), this, this)
.setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")
.setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_PROFILE).build();
mConnectionProgressDialog = new ProgressDialog(this.getActivity());
mConnectionProgressDialog.setTitle("Login");
// mConnectionProgressDialog.setCancelable(false);
mConnectionProgressDialog.setMessage(getSherlockActivity().getString(R.string.google_login_));
}
示例14: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String chosenAccountName = AccountUtils.getChosenAccountName(getActivity());
mPlusClient = new PlusClient.Builder(getActivity(), this, this)
.clearScopes()
.setAccountName(chosenAccountName)
.build();
final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
mSessionUri = intent.getData();
if (mSessionUri == null) {
return;
}
mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);
mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);
LoaderManager manager = getLoaderManager();
manager.restartLoader(0, null, this);
setHasOptionsMenu(true);
}
示例15: onCreate
import com.google.android.gms.plus.PlusClient; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize the PlusClient connection.
// Scopes indicate the information about the user your application will be able to access.
mPlusClient =
new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN,
Scopes.PLUS_PROFILE).build();
}