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


Java CommonStatusCodes类代码示例

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


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

示例1: onActivityResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:27,代码来源:HomeActivity.java

示例2: handleSignInResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
protected void handleSignInResult(GoogleSignInResult result) {
    Schedulers.newThread()
            .scheduleDirect(() -> {
                if (result.isSuccess()) {
                    if (result.getSignInAccount() != null && result.getSignInAccount().getAccount() != null) {
                        Account account = result.getSignInAccount().getAccount();
                        try {
                            String token = GoogleAuthUtil.getToken(activity, account, "oauth2:" + SCOPE_PICASA);
                            emitter.onSuccess(new GoogleSignIn.SignInAccount(token, result.getSignInAccount()));
                        } catch (IOException | GoogleAuthException e) {
                            emitter.onError(new SignInException("SignIn", e));
                        }
                    } else {
                        emitter.onError(new SignInException("SignIn", "getSignInAccount is null!", 0));
                    }

                } else {
                    if (result.getStatus().getStatusCode() == CommonStatusCodes.SIGN_IN_REQUIRED) {
                        emitter.onError(new SignInRequiredException());
                    } else {
                        emitter.onError(new SignInException("SignIn", result.getStatus().getStatusMessage(), result.getStatus().getStatusCode()));
                    }
                }
            });
}
 
开发者ID:yosriz,项目名称:RxGooglePhotos,代码行数:26,代码来源:GoogleSignInOnSubscribeBase.java

示例3: onTap

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
/**
 * onTap is called to capture the first TextBlock under the tap location and return it to
 * the Initializing Activity.
 *
 * @param rawX - the raw position of the tap
 * @param rawY - the raw position of the tap.
 * @return true if the activity is ending.
 */
private boolean onTap(float rawX, float rawY) {
    OcrGraphic graphic = mGraphicOverlay.getGraphicAtLocation(rawX, rawY);
    TextBlock text = null;
    if (graphic != null) {
        text = graphic.getTextBlock();
        if (text != null && text.getValue() != null) {
            Intent data = new Intent();
            data.putExtra(TextBlockObject, text.getValue());
            setResult(CommonStatusCodes.SUCCESS, data);
            finish();
        }
        else {
            Log.d(TAG, "text data is null");
        }
    }
    else {
        Log.d(TAG,"no text detected");
    }
    return text != null;
}
 
开发者ID:DevipriyaSarkar,项目名称:OCR-Reader,代码行数:29,代码来源:OcrCaptureActivity.java

示例4: onActivityResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:DevipriyaSarkar,项目名称:OCR-Reader,代码行数:45,代码来源:MainActivity.java

示例5: onActivityResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:25,代码来源:SendActivity.java

示例6: resolveResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
private void resolveResult(Status status) {
    if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
        try {
            //status.startResolutionForResult(mActivity, RC_READ);
            startIntentSenderForResult(status.getResolution().getIntentSender(), RC_READ, null, 0, 0, 0, null);
        } catch (IntentSender.SendIntentException e) {
            e.printStackTrace();
            mCredentialsApiClient.disconnect();
            mAccountSubject.onError(new Throwable(e.toString()));
        }
    }
    else {
        // The user must create an account or sign in manually.
        mCredentialsApiClient.disconnect();
        mAccountSubject.onError(new Throwable(getString(R.string.status_canceled_request_credential)));
    }
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:18,代码来源:RxSmartLockPasswordsFragment.java

示例7: signOut

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
/**
 * Facebook sign out
 */
public void signOut(PublishSubject<RxStatus> statusSubject) {
    LoginManager.getInstance().logOut();
    // delete current user
    deleteCurrentUser();
    statusSubject.onNext(new RxStatus(
            CommonStatusCodes.SUCCESS,
            getString(R.string.status_success_log_out_message)
    ));
    statusSubject.onCompleted();
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:14,代码来源:RxFacebookAuthFragment.java

示例8: handleUnsuccessfulNearbyResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
private void handleUnsuccessfulNearbyResult(Status status) {
    Log.v(TAG, "Processing error, status = " + status);
    if (mResolvingError) {
        // Already attempting to resolve an error.
        return;
    } else if (status.hasResolution()) {
        try {
            mResolvingError = true;
            status.startResolutionForResult(getActivity(),
                    REQUEST_RESOLVE_ERROR);
        } catch (IntentSender.SendIntentException e) {
            mResolvingError = false;
            Log.v(TAG, "Failed to resolve error status.", e);
        }
    } else {
        if (status.getStatusCode() == CommonStatusCodes.NETWORK_ERROR) {
            Toast.makeText(getActivity(),
                    "No connectivity, cannot proceed. Fix in 'Settings' and try again.",
                    Toast.LENGTH_LONG).show();
        } else {
            // To keep things simple, pop a toast for all other error messages.
            Toast.makeText(getActivity(), "Unsuccessful: " +
                    status.getStatusMessage(), Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Beacon-for-Eddystone,代码行数:27,代码来源:BeaconsFragment.java

示例9: onActivityResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
/**
 * 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);


 }
}
 
开发者ID:thegenuinegourav,项目名称:Questor,代码行数:48,代码来源:MainActivity.java

示例10: onFailure

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
@Override
public void onFailure(@NonNull Exception e) {
    // An error occurred while communicating with the service.
    mResult = null;

    if (e instanceof ApiException) {
        // An error with the Google Play Services API contains some additional details.
        ApiException apiException = (ApiException) e;
        Log.d(TAG, "Error: " +
                CommonStatusCodes.getStatusCodeString(apiException.getStatusCode()) + ": " +
                apiException.getStatusMessage());
    } else {
        // A different, unknown type of error occurred.
        Log.d(TAG, "ERROR! " + e.getMessage());
    }

}
 
开发者ID:googlesamples,项目名称:android-play-safetynet,代码行数:18,代码来源:SafetyNetSampleFragment.java

示例11: handleUnsuccessfulNearbyResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
@VisibleForTesting
protected void handleUnsuccessfulNearbyResult(Status status) {
    Log.v(TAG, "Processing error, status = " + status);

    if (resolvingError) {
        // Already attempting to resolve an error.
        return;
    } else if (status.hasResolution()) {
        try {
            resolvingError = true;
            status.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
        } catch (Exception e) {
            resolvingError = false;
            Log.v(TAG, "Failed to resolve error status.", e);
        }
    } else {
        if (status.getStatusCode() == CommonStatusCodes.NETWORK_ERROR) {
            Toast.makeText(this,
                    "No connectivity, cannot proceed. Fix in 'Settings' and try again.",
                    Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(this, "Unsuccessful: " + status.getStatusMessage(),
                    Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:sourceallies,项目名称:zonebeacon,代码行数:27,代码来源:TransferActivity.java

示例12: onTap

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
/**
 * onTap is called to capture the oldest barcode currently detected and
 * return it to the caller.
 *
 * @param rawX - the raw position of the tap
 * @param rawY - the raw position of the tap.
 * @return true if the activity is ending.
 */
private boolean onTap(float rawX, float rawY) {

    //TODO: use the tap position to select the barcode.
    BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
    Barcode barcode = null;
    if (graphic != null) {
        barcode = graphic.getBarcode();
        if (barcode != null) {
            Intent data = new Intent();
            data.putExtra(BarcodeObject, barcode);
            setResult(CommonStatusCodes.SUCCESS, data);
            finish();
        }
        else {
            Log.d(TAG, "barcode data is null");
        }
    }
    else {
        Log.d(TAG,"no barcode detected");
    }
    return barcode != null;
}
 
开发者ID:ashishsurana,项目名称:qrcode-reader,代码行数:31,代码来源:BarcodeCaptureActivity.java

示例13: onActivityResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:ashishsurana,项目名称:qrcode-reader,代码行数:45,代码来源:MainActivity.java

示例14: onActivityResult

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:compte14031879,项目名称:udacity-capstone,代码行数:21,代码来源:EventsFragment.java

示例15: onConnected

import com.google.android.gms.common.api.CommonStatusCodes; //导入依赖的package包/类
@Override
public void onConnected(@Nullable Bundle bundle) {
    googleApi.requestCredentials(new ResultCallback<CredentialRequestResult>() {
        @Override
        public void onResult(@NonNull CredentialRequestResult result) {
            if (result.getStatus().isSuccess()) {
                onCredentialRetrieved(result.getCredential());
            } else if (result.getStatus().getStatusCode() != CommonStatusCodes.SIGN_IN_REQUIRED && result.getStatus().hasResolution()) {
                try {
                    result.getStatus().startResolutionForResult(LoginActivity.this, GoogleApiAdapter.RETRIEVE_CREDENTIALS);
                } catch (IntentSender.SendIntentException e) {
                    Snackbar.make(vLoginForm, R.string.error_smartlock_failed, Snackbar.LENGTH_LONG);
                }
            }
        }
    });
}
 
开发者ID:Sefford,项目名称:BeAuthentic,代码行数:18,代码来源:LoginActivity.java


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