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


Java CommonStatusCodes.SUCCESS属性代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:26,代码来源:HomeActivity.java

示例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);
    }
}
 
开发者ID:DevipriyaSarkar,项目名称:OCR-Reader,代码行数:44,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:24,代码来源:SendActivity.java

示例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);


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

示例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);
    }
}
 
开发者ID:ashishsurana,项目名称:qrcode-reader,代码行数:44,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:compte14031879,项目名称:udacity-capstone,代码行数:20,代码来源:EventsFragment.java

示例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;
}
 
开发者ID:AndrewJack,项目名称:moment-for-android-wear,代码行数:25,代码来源:RxFriendApi.java

示例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);
    }
}
 
开发者ID:jorgecoca,项目名称:SuperBarcodeScanner,代码行数:20,代码来源:BarcodeScannerOptionsActivity.java

示例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);
    }
}
 
开发者ID:particle-iot,项目名称:photon-tinker-android,代码行数:17,代码来源:ElectronSetupFragment.java

示例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();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:20,代码来源:ListVisiblePeopleActivity.java

示例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);
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:25,代码来源:ListMomentsActivity.java

示例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);
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:24,代码来源:MomentActivity.java

示例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);
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:25,代码来源:ListConnectedPeopleActivity.java

示例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);
                }
            }
        }
    };
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:38,代码来源:LocationAdapter.java

示例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();
        }
    }
}
 
开发者ID:volkansahin45,项目名称:Moneycim,代码行数:14,代码来源:AddAndEditSpendingFragment.java


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