本文整理汇总了Java中com.google.android.gms.common.api.CommonStatusCodes.SUCCESS属性的典型用法代码示例。如果您正苦于以下问题:Java CommonStatusCodes.SUCCESS属性的具体用法?Java CommonStatusCodes.SUCCESS怎么用?Java CommonStatusCodes.SUCCESS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.gms.common.api.CommonStatusCodes
的用法示例。
在下文中一共展示了CommonStatusCodes.SUCCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PROFILE_REQUEST && resultCode == CommonStatusCodes.SUCCESS) {
preferences.setIdAuth("");
preferences.setUserData("");
preferences.setUserDni("");
preferences.setEmail("");
preferences.setIsLogged(false);
setDataToHeader(preferences);
if (!(getSupportFragmentManager().findFragmentById(R.id.containerHome) instanceof MapFragment)) {
navigationView.getMenu().getItem(0).setChecked(true);
setTitleToolbar(getString(R.string.map_stations));
getSupportFragmentManager().popBackStack("", FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
} else if (requestCode == 140) {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.containerHome);
if (fragment != null && fragment instanceof MapFragment) {
fragment.onActivityResult(requestCode, resultCode, data);
}
} else if (resultCode == Activity.RESULT_OK && requestCode == LoginActivity.LOGIN_RESULT) {
navigationView.getMenu().getItem(itemSelected).setChecked(true);
preferences.setIsLogged(true);
setDataToHeader(preferences);
}
}
示例2: onActivityResult
/**
* Called when an activity you launched exits, giving you the requestCode
* you started it with, the resultCode it returned, and any additional
* data from it. The <var>resultCode</var> will be
* {@link #RESULT_CANCELED} if the activity explicitly returned that,
* didn't return any result, or crashed during its operation.
* <p/>
* <p>You will receive this call immediately before onResume() when your
* activity is re-starting.
* <p/>
*
* @param requestCode The integer request code originally supplied to
* startActivityForResult(), allowing you to identify who this
* result came from.
* @param resultCode The integer result code returned by the child activity
* through its setResult().
* @param data An Intent, which can return result data to the caller
* (various data can be attached to Intent "extras").
* @see #startActivityForResult
* @see #createPendingResult
* @see #setResult(int)
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == RC_OCR_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
String text = data.getStringExtra(OcrCaptureActivity.TextBlockObject);
statusMessage.setText(R.string.ocr_success);
textValue.setText(text);
Log.d(TAG, "Text read: " + text);
} else {
statusMessage.setText(R.string.ocr_failure);
Log.d(TAG, "No Text captured, intent data is null");
}
} else {
statusMessage.setText(String.format(getString(R.string.ocr_error),
CommonStatusCodes.getStatusCodeString(resultCode)));
}
}
else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例3: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == BARCODE_READER_REQUEST_CODE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
QRURLParser parser = QRURLParser.getInstance();
String extracted_address = parser.extractAddressFromQrString(barcode.displayValue);
if (extracted_address == null) {
Toast.makeText(this, R.string.toast_qr_code_no_address, Toast.LENGTH_SHORT).show();
return;
}
Point[] p = barcode.cornerPoints;
toAddressText.setText(extracted_address);
}
} else {
Log.e("SEND", String.format(getString(R.string.barcode_error_format),
CommonStatusCodes.getStatusCodeString(resultCode)));
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例4: onActivityResult
/**
* Called when an activity you launched exits, giving you the requestCode
* you started it with, the resultCode it returned, and any additional
* data from it. The <var>resultCode</var> will be
* {@link #RESULT_CANCELED} if the activity explicitly returned that,
* didn't return any result, or crashed during its operation.
* <p/>
* <p>You will receive this call immediately before onResume() when your
* activity is re-starting.
* <p/>
*
* @param requestCode The integer request code originally supplied to
* startActivityForResult(), allowing you to identify who this
* result came from.
* @param resultCode The integer result code returned by the child activity
* through its setResult().
* @param data An Intent, which can return result data to the caller
* (various data can be attached to Intent "extras").
* @see #startActivityForResult
* @see #createPendingResult
* @see #setResult(int)
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == RC_OCR_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
String text = data.getStringExtra(OcrCaptureActivity.TextBlockObject);
statusMessage.setText(R.string.ocr_success);
textValue.setText(text);
Log.d(TAG, "Text read: " + text);
} else {
statusMessage.setText(R.string.ocr_failure);
Log.d(TAG, "No Text captured, intent data is null");
}
} else {
statusMessage.setText(String.format(getString(R.string.ocr_error),
CommonStatusCodes.getStatusCodeString(resultCode)));
}
displayStatus();
}
else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例5: onActivityResult
/**
* Called when an activity you launched exits, giving you the requestCode
* you started it with, the resultCode it returned, and any additional
* data from it. The <var>resultCode</var> will be
* {@link #RESULT_CANCELED} if the activity explicitly returned that,
* didn't return any result, or crashed during its operation.
* <p/>
* <p>You will receive this call immediately before onResume() when your
* activity is re-starting.
* <p/>
*
* @param requestCode The integer request code originally supplied to
* startActivityForResult(), allowing you to identify who this
* result came from.
* @param resultCode The integer result code returned by the child activity
* through its setResult().
* @param data An Intent, which can return result data to the caller
* (various data can be attached to Intent "extras").
* @see #startActivityForResult
* @see #createPendingResult
* @see #setResult(int)
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RC_BARCODE_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
statusMessage.setText(R.string.barcode_success);
barcodeValue.setText(barcode.displayValue);
Log.d(TAG, "Barcode read: " + barcode.displayValue);
} else {
statusMessage.setText(R.string.barcode_failure);
Log.d(TAG, "No barcode captured, intent data is null");
}
} else {
statusMessage.setText(String.format(getString(R.string.barcode_error),
CommonStatusCodes.getStatusCodeString(resultCode)));
}
}
else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例6: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, "onActivityResult");
if (requestCode == RC_BARCODE_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
Log.d(TAG, "Barcode read: " + barcode.displayValue);
mPresenter.newEvent(barcode);
} else {
Log.d(TAG, "No barcode captured, intent data is null");
}
} else {
Log.d(TAG, "onActivityResult is not a success");
}
}
else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例7: getCurrentUsersGooglePlusIds
private List<String> getCurrentUsersGooglePlusIds() {
ArrayList<String> friendGooglePlusIds = new ArrayList<>();
ConnectionResult connectionResult = googleApiClient
.blockingConnect(Constants.CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS);
if (connectionResult.isSuccess()) {
People.LoadPeopleResult peopleData = Plus.PeopleApi.loadVisible(googleApiClient, null).await();
if (peopleData.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
PersonBuffer personBuffer = peopleData.getPersonBuffer();
try {
int count = personBuffer.getCount();
for (int i = 0; i < count; i++) {
friendGooglePlusIds.add(personBuffer.get(i).getId());
}
} finally {
personBuffer.close();
}
} else {
Timber.w("Error requesting visible circles: %s", peopleData.getStatus());
}
}
if (googleApiClient.isConnected()) {
googleApiClient.disconnect();
}
return friendGooglePlusIds;
}
示例8: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == BARCODE_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
statusMessage.setText("Success!");
barcodeValue.setText(barcode.displayValue);
Log.d("BARCODER", "Barcode read: " + barcode.displayValue);
} else {
statusMessage.setText("Fail");
Log.d("BARCODER", "No barcode has been captured");
}
} else {
statusMessage.setText("Error");
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例9: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_SCAN_ICCID) {
if (resultCode == CommonStatusCodes.SUCCESS && data != null) {
Barcode barcode = data.getParcelableExtra(BarcodeScannerActivity.EXTRA_BARCODE);
log.d("Barcode read: " + barcode.displayValue);
this.onBarcodeScanningFinished(barcode.displayValue);
} else {
Toaster.s(this, "No barcode scanned.");
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例10: onCreateDialog
@Override
protected Dialog onCreateDialog(int id) {
if (id != DIALOG_GET_GOOGLE_PLAY_SERVICES) {
return super.onCreateDialog(id);
}
int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (available == CommonStatusCodes.SUCCESS) {
return null;
}
if (GooglePlayServicesUtil.isUserRecoverableError(available)) {
return GooglePlayServicesUtil.getErrorDialog(
available, this, REQUEST_CODE_GET_GOOGLE_PLAY_SERVICES, this);
}
return new AlertDialog.Builder(this)
.setMessage(R.string.plus_generic_error)
.setCancelable(true)
.setOnCancelListener(this)
.create();
}
示例11: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_moments_activity);
PlusOptions options = PlusOptions.builder().addActivityTypes(MomentUtil.ACTIONS).build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API, options)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.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 != CommonStatusCodes.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例12: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.multi_moment_activity);
PlusOptions options = PlusOptions.builder().addActivityTypes(MomentUtil.ACTIONS).build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API, options)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.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 != CommonStatusCodes.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例13: onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.person_list_activity);
PlusOptions options = PlusOptions.builder().addActivityTypes(MomentUtil.ACTIONS).build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API, options)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.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 != CommonStatusCodes.SUCCESS) {
showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
}
}
示例14: getLocationSettingsResultCallback
@NonNull
private ResultCallback<Result> getLocationSettingsResultCallback() {
return new ResultCallback<Result>() {
@Override
public void onResult(@NonNull Result result) {
Status status = result.getStatus();
if (status.getStatusCode() == CommonStatusCodes.SUCCESS) {
Log.i(TAG, "All location settings are satisfied.");
Runnable requestUpdatesTask = new OnPermissionsTask();
if (isConnected()) requestUpdatesTask.run();
else {
mOnConnectedUpdateCallback = requestUpdatesTask;
Log.d(TAG, "Google API is not connected. "
+ "Updates delayed until Google API is connected again.");
}
} else if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
Log.i(TAG, "Location settings are not satisfied. "
+ "Showing the user a dialog to upgrade location settings.");
try {
setRequestingPermissions(true);
// Show the dialog by calling startResolutionForResult(),
// and check the result in the onActivityResult() of mContext
status.startResolutionForResult(mContext, REQUEST_CHECK_SETTINGS);
} catch (IntentSender.SendIntentException e) {
Log.wtf(TAG, "PendingIntent unable to execute request", e);
}
} else if (status.getStatusCode()
== LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
if (checkNetwork()) {
Log.w(TAG, "Location settings can't be changed to meet the requirements");
setHasPermissions(false);
mOnPermissionsChangedListeners.run();
setRequestingPermissions(false);
}
}
}
};
}
示例15: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == RC_OCR_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
String text = data.getStringExtra(OcrCaptureActivity.TextBlockObject);
text = trimQuantity(text);
quantityEditText.setText(text);
}
} else {
Toast.makeText(getActivity(), "Error", Toast.LENGTH_SHORT).show();
}
}
}