本文整理匯總了Java中com.google.android.gms.plus.PlusClient.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java PlusClient.Builder方法的具體用法?Java PlusClient.Builder怎麽用?Java PlusClient.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.plus.PlusClient
的用法示例。
在下文中一共展示了PlusClient.Builder方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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();
}
示例3: newInstance
import com.google.android.gms.plus.PlusClient; //導入方法依賴的package包/類
public static GooglePlusFragment newInstance(String user_name,
PlusClient plusClient, PlusClient.Builder builder) {
GooglePlusFragment fragment = new GooglePlusFragment();
Bundle bundle = new Bundle();
bundle.putString("username", user_name);
fragment.setArguments(bundle);
fragment.client = plusClient;
fragment.plusClientBuilder = builder;
return fragment;
}
示例4: addPlusFragment
import com.google.android.gms.plus.PlusClient; //導入方法依賴的package包/類
private void addPlusFragment(String user, PlusClient client,PlusClient.Builder builder) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.add(R.id.fragment_container,
GooglePlusFragment.newInstance(user, client,builder));
transaction.commit();
}
示例5: 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);
String[] scopes = getArguments().getStringArray(ARG_SCOPES);
plusClientBuilder.setScopes(scopes);
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);
}
// Attempt to connect.
mPlusClient.connect();
mIsConnecting = true;
}
示例6: onListItemClick
import com.google.android.gms.plus.PlusClient; //導入方法依賴的package包/類
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
if (position == mAccountListAdapter.getCount() - 1) {
Intent addAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
addAccountIntent.putExtra(Settings.EXTRA_AUTHORITIES,
new String[]{ScheduleContract.CONTENT_AUTHORITY});
startActivity(addAccountIntent);
return;
}
AccountActivity activity = (AccountActivity) getActivity();
ConnectivityManager cm = (ConnectivityManager)
activity.getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork == null || !activeNetwork.isConnected()) {
Toast.makeText(activity, R.string.no_connection_cant_login,
Toast.LENGTH_SHORT).show();
return;
}
activity.mCancelAuth = false;
activity.mChosenAccount = mAccountListAdapter.getItem(position);
activity.getSupportFragmentManager().beginTransaction()
.replace(R.id.root_container, new AuthProgressFragment(), "loading")
.addToBackStack("choose_account")
.commit();
PlusClient.Builder builder = new PlusClient.Builder(activity, activity, activity);
activity.mPlusClient = builder
.setScopes(AccountUtils.AUTH_SCOPES)
.setAccountName(activity.mChosenAccount.name).build();
activity.mPlusClient.connect();
}
示例7: onCreate
import com.google.android.gms.plus.PlusClient; //導入方法依賴的package包/類
@Override
public void onCreate() {
application = (GameApplication) getApplication();
builder = new PlusClient.Builder(getApplicationContext(), this, this);
builder.setScopes(Scopes.PLUS_LOGIN, GriddlerScopes.USERINFO_EMAIL);
builder.setAccountName(application.getSelectedAccountName());
plus = builder.build();
}
開發者ID:GoogleCloudPlatform,項目名稱:solutions-griddler-sample-android-client,代碼行數:10,代碼來源:GooglePlusService.java