當前位置: 首頁>>代碼示例>>Java>>正文


Java ResultReceiver類代碼示例

本文整理匯總了Java中android.os.ResultReceiver的典型用法代碼示例。如果您正苦於以下問題:Java ResultReceiver類的具體用法?Java ResultReceiver怎麽用?Java ResultReceiver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResultReceiver類屬於android.os包,在下文中一共展示了ResultReceiver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onHandleIntent

import android.os.ResultReceiver; //導入依賴的package包/類
@Override
protected void onHandleIntent(Intent intent) {
    if (intent == null) {
        return;
    }
    final String action = intent.getAction();
    if (ACTION_UPDATE_ICON.equals(action)) {
        ResultReceiver receiver = intent.getParcelableExtra(Intent.EXTRA_RESULT_RECEIVER);
        handleUpdateIcon(receiver);
    } else if (ACTION_REPLY.equals(action)) {
        CharSequence content = intent.getCharSequenceExtra(EXTRA_CONTENT);
        Chat chat = intent.getParcelableExtra(EXTRA_CHAT);
        handleReply(content, chat);
    } else if (ACTION_DOWNLOAD_QRCODE.equals(action)) {
        handleDownloadQrCode();
    } else if (ACTION_RESTART_WEBQQ.equals(action)) {
        handleRestart();
    }
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:20,代碼來源:FFMIntentService.java

示例2: startRecording

import android.os.ResultReceiver; //導入依賴的package包/類
private void startRecording() {
    if (!mHandlingEvent) {
        mHandlingEvent = true;
        ResultReceiver receiver = new ResultReceiver(new Handler()) {
            @Override
            protected void onReceiveResult(int resultCode, Bundle resultData) {
                setRecording(true);
                handleStartRecordingResult(resultCode, resultData);
                mHandlingEvent = false;
            }
        };
        if (mFrontRadioButton.isChecked()) {
            CameraService.startToStartRecording(this, Camera.CameraInfo.CAMERA_FACING_FRONT, receiver);
        } else if (mBackRadioButton.isChecked()) {
            CameraService.startToStartRecording(this, Camera.CameraInfo.CAMERA_FACING_FRONT, receiver);
        } else {
            throw new IllegalStateException("Must choose a camera for recording");
        }
    }
}
 
開發者ID:imjaspreet,項目名稱:Camera-Background-Servce,代碼行數:21,代碼來源:MainActivity.java

示例3: sendCommand

import android.os.ResultReceiver; //導入依賴的package包/類
public void sendCommand(String command, Bundle params, ResultReceiver cb) {
    try {
        this.mBinder.sendCommand(command, params, new ResultReceiverWrapper(cb));
    } catch (RemoteException e) {
        Log.e(MediaControllerCompat.TAG, "Dead object in sendCommand. " + e);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:8,代碼來源:MediaControllerCompat.java

示例4: onHandleIntent

import android.os.ResultReceiver; //導入依賴的package包/類
@Override
protected void onHandleIntent(final Intent intent) {


    int phase = intent.getIntExtra(INTENT_REQUESTED_PHASE, 0) & 0x03;
    resultReceiver = (ResultReceiver) intent.getParcelableExtra(INTENT_RESULT_RECEIVER);
    delayForInitDeviceFirmware = intent.getLongExtra(EXTRA_WAIT_FOR_INIT_DEVICE_FIRMWARE, 0);

    int rc = 0;

    logi("DFUBaseService onHandleIntent phase = " + phase);
    mServicePhase = 0;

    if ((phase & FLASHING_WITH_PAIR_CODE) != 0) {
        mServicePhase = FLASHING_WITH_PAIR_CODE;

        rc = flashingWithPairCode(intent);
    }

    if (resultReceiver != null) {
        rc <<= 8;
        resultReceiver.send(rc | phase, null);
    }
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:25,代碼來源:DfuBaseService.java

示例5: AutoCompleteTextViewReflector

import android.os.ResultReceiver; //導入依賴的package包/類
AutoCompleteTextViewReflector() {
    try {
        this.doBeforeTextChanged = AutoCompleteTextView.class.getDeclaredMethod("doBeforeTextChanged", new Class[0]);
        this.doBeforeTextChanged.setAccessible(true);
    } catch (NoSuchMethodException e) {
    }
    try {
        this.doAfterTextChanged = AutoCompleteTextView.class.getDeclaredMethod("doAfterTextChanged", new Class[0]);
        this.doAfterTextChanged.setAccessible(true);
    } catch (NoSuchMethodException e2) {
    }
    try {
        this.ensureImeVisible = AutoCompleteTextView.class.getMethod("ensureImeVisible", new Class[]{Boolean.TYPE});
        this.ensureImeVisible.setAccessible(true);
    } catch (NoSuchMethodException e3) {
    }
    try {
        this.showSoftInputUnchecked = InputMethodManager.class.getMethod("showSoftInputUnchecked", new Class[]{Integer.TYPE, ResultReceiver.class});
        this.showSoftInputUnchecked.setAccessible(true);
    } catch (NoSuchMethodException e4) {
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:23,代碼來源:SearchView.java

示例6: onStartCommand

import android.os.ResultReceiver; //導入依賴的package包/類
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null && intent.getAction() != null) {
        if (intent.getAction().equals(ACTION_RECORDING_START)) {
            if (intent.hasExtra(EXTRA_SAMPLING_RATE)) {
                mSamplingRate = intent.getIntExtra(EXTRA_SAMPLING_RATE, DEFAULT_SAMPLING_RATE);
            }
            startRecording();
            return START_STICKY;
        } else if (intent.getAction().equals(ACTION_RECORDING_STOP)) {
            stopRecording();
            return START_STICKY;
        } else if (intent.getAction().equals(ACTION_RECORDING_GET_STATUS)) {
            ResultReceiver receiver = intent.getParcelableExtra("receiver");
            Bundle data = new Bundle();
            data.putInt(EXTRA_RECORDING_STATUS, mRecordingStatus);
            receiver.send(0, data);
            return START_STICKY;
        }
    }

    stopSelf();
    return START_NOT_STICKY;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:25,代碼來源:RecordingService.java

示例7: maybeProcessStartIntent

import android.os.ResultReceiver; //導入依賴的package包/類
private void maybeProcessStartIntent() {
    if (mStartIntent == null || mTorchStatus == TORCH_STATUS_UNKNOWN) return;

    if (ACTION_TOGGLE_TORCH.equals(mStartIntent.getAction())) {
        if (DEBUG) Log.d(TAG, "maybeProcessStartIntent: ACTION_TOGGLE_TORCH");
        toggleTorch();
    } else if (ACTION_TORCH_GET_STATUS.equals(mStartIntent.getAction())) {
        if (DEBUG) Log.d(TAG, "maybeProcessStartIntent: " +
                "ACTION_TORCH_GET_STATUS: mTorchStatus=" + mTorchStatus);
        ResultReceiver receiver = mStartIntent.getParcelableExtra("receiver");
        Bundle data = new Bundle();
        data.putInt(EXTRA_TORCH_STATUS, mTorchStatus);
        receiver.send(0, data);
    }
    mStartIntent = null;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:17,代碼來源:TorchService.java

示例8: sendNfcState

import android.os.ResultReceiver; //導入依賴的package包/類
private static void sendNfcState(ResultReceiver receiver) {
    if (mContext == null || receiver == null) return;
    int nfcState = NFC_STATE_UNKNOWN;
    try {
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
        if (adapter != null) {
            nfcState = (Integer) XposedHelpers.callMethod(adapter, "getAdapterState");
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    } finally {
        Bundle b = new Bundle();
        b.putInt("nfcState", nfcState);
        receiver.send(0, b);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:17,代碼來源:ConnectivityServiceWrapper.java

示例9: cu

import android.os.ResultReceiver; //導入依賴的package包/類
cu() {
    try {
        this.f1479a = AutoCompleteTextView.class.getDeclaredMethod("doBeforeTextChanged", new Class[0]);
        this.f1479a.setAccessible(true);
    } catch (NoSuchMethodException e) {
    }
    try {
        this.f1480b = AutoCompleteTextView.class.getDeclaredMethod("doAfterTextChanged", new Class[0]);
        this.f1480b.setAccessible(true);
    } catch (NoSuchMethodException e2) {
    }
    try {
        this.f1481c = AutoCompleteTextView.class.getMethod("ensureImeVisible", new Class[]{Boolean.TYPE});
        this.f1481c.setAccessible(true);
    } catch (NoSuchMethodException e3) {
    }
    try {
        this.f1482d = InputMethodManager.class.getMethod("showSoftInputUnchecked", new Class[]{Integer.TYPE, ResultReceiver.class});
        this.f1482d.setAccessible(true);
    } catch (NoSuchMethodException e4) {
    }
}
 
開發者ID:Qwaz,項目名稱:solved-hacking-problem,代碼行數:23,代碼來源:cu.java

示例10: closeKeyboard

import android.os.ResultReceiver; //導入依賴的package包/類
/**
 * Returns Observable that will receive true if the keyboard is closed
 */
public static Single<Boolean> closeKeyboard(Activity activity) {
    View view = activity.getCurrentFocus();
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(
                Context.INPUT_METHOD_SERVICE);

        return Single.create(s -> {
            imm.hideSoftInputFromWindow(view.getWindowToken(), 0, new ResultReceiver(null) {
                @Override
                protected void onReceiveResult(int resultCode, Bundle resultData) {
                    s.onSuccess(resultCode == InputMethodManager.RESULT_HIDDEN);
                    super.onReceiveResult(resultCode, resultData);
                }
            });
        });
    } else {
        return Single.just(false);
    }
}
 
開發者ID:google,項目名稱:science-journal,代碼行數:23,代碼來源:KeyboardUtil.java

示例11: getVideoQualityInfo

import android.os.ResultReceiver; //導入依賴的package包/類
/**
 * Retrieve all video {@link Format} and current selected index from current media playback.
 * <p>
 * Later you could use {@link MediaControllerCompatHelper#setVideoQualityIndex(Activity, int)}
 * or {@link MediaControllerCompatHelper#setVideoQualityIndex(MediaControllerCompat, int)} to
 * change new index.
 */
public static void getVideoQualityInfo(@NonNull MediaControllerCompat controller,
                                       @NonNull final VideoQualityInfoCallback callback) {
    controller.sendCommand(StraasMediaCore.COMMAND_GET_VIDEO_FORMATS, null,
            new ResultReceiver(new Handler()) {
                @Override
                protected void onReceiveResult(int resultCode, Bundle resultData) {
                    resultData.setClassLoader(Format.class.getClassLoader());
                    if (resultData.containsKey(StraasMediaCore.KEY_CURRENT_VIDEO_FORMAT_INDEX)) {
                        ArrayList<Format> formats = resultData.getParcelableArrayList(StraasMediaCore.KEY_ALL_VIDEO_FORMATS);
                        int selectedIndex = resultData.getInt(StraasMediaCore.KEY_CURRENT_VIDEO_FORMAT_INDEX);
                        callback.onGetVideoQualityInfo(new VideoQualityInfo(formats, selectedIndex));
                    }
                }
            });
}
 
開發者ID:StraaS,項目名稱:StraaS-android-sdk-sample,代碼行數:23,代碼來源:MediaControllerCompatHelper.java

示例12: onStop

import android.os.ResultReceiver; //導入依賴的package包/類
@Override
public void onStop() {
    super.onStop();

    if (!mDisableFlg) {
        Intent i = new Intent();
        i.setAction(DConnectObservationService.ACTION_START);
        i.setClass(getActivity(), ObserverReceiver.class);
        i.putExtra(DConnectObservationService.PARAM_RESULT_RECEIVER, new ResultReceiver(new Handler()) {
            @Override
            protected void onReceiveResult(int resultCode, Bundle resultData) {
            }
        });
        getActivity().sendBroadcast(i);
    }
    getActivity().finish();
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:18,代碼來源:WarningDialogFragment.java

示例13: checkLocationServiceEnabled

import android.os.ResultReceiver; //導入依賴的package包/類
/**
 * WiFiスキャンを行うには位置情報のパーミッション許可が必要なので、確認を行う.
 */
private void checkLocationServiceEnabled() {
    // WiFi scan in SDK 23 requires location service to be enabled.
    final LocationManager manager = getContext().getSystemService(LocationManager.class);
    if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        IntentHandlerActivity.startActivityForResult(getContext(),
                new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS),
                new ResultReceiver(new Handler(Looper.getMainLooper())) {
                    @Override
                    protected void onReceiveResult(int resultCode, final Bundle resultData) {
                        super.onReceiveResult(resultCode, resultData);

                        if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                            checkLocationPermission();
                        } else {
                            showErrorDialog(getString(R.string.sonycamera_request_permission_error));
                        }
                    }
                });
    } else {
        checkLocationPermission();
    }
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:26,代碼來源:SonyCameraConnectingFragment.java

示例14: LoginCodeController

import android.os.ResultReceiver; //導入依賴的package包/類
LoginCodeController(ResultReceiver resultReceiver,
                    StateButton stateButton, InvertedStateButton resendButton,
                    InvertedStateButton callMeButton, SpacedEditText loginEditText,
                    SessionManager<DigitsSession> sessionManager, DigitsClient client,
                    String requestId, long userId, String phoneNumber, ErrorCodes errors,
                    ActivityClassManager activityClassManager,
                    DigitsEventCollector digitsEventCollector, Boolean emailCollection,
                    TextView timerText, DigitsEventDetailsBuilder details) {
    super(resultReceiver, stateButton, loginEditText, client, errors, activityClassManager,
            sessionManager, digitsEventCollector, details);
    this.requestId = requestId;
    this.userId = userId;
    this.phoneNumber = phoneNumber;
    this.emailCollection = emailCollection;
    this.resendButton = resendButton;
    this.callMeButton = callMeButton;
    this.countDownTimer = createCountDownTimer(
            DigitsConstants.RESEND_TIMER_DURATION_MILLIS, timerText, resendButton,
            callMeButton);
    this.timerText = timerText;
    this.loginEditText = loginEditText;
}
 
開發者ID:crashlytics,項目名稱:digits-android,代碼行數:23,代碼來源:LoginCodeController.java

示例15: startDataDownloading

import android.os.ResultReceiver; //導入依賴的package包/類
private void startDataDownloading(ResultReceiver receiver, String userid) throws IOException {
    // First check for config being downloaded
    DbController db = DbController.getInstance(getApplicationContext());
    if (db.getClaimTypes(false).size() < 1) {
        if(!startConfigDownloading(null, userid)){
            receiver.send(STATUS_ERROR, Bundle.EMPTY);
            return;
        }
    }

    displayNotification("MAST", getResources().getString(R.string.DownloadingData),
            getResources().getString(R.string.Downloading));
    if(downloadProperties(userid)){
        updateNotification("MAST", getResources().getString(R.string.DataDownloadSuccessful),
                getResources().getString(R.string.DownloadFinished));
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
    } else {
        updateNotification("MAST", getResources().getString(R.string.DataDownloadFailed),
                getResources().getString(R.string.DownloadError));
        receiver.send(STATUS_ERROR, Bundle.EMPTY);
    }
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:23,代碼來源:DownloadService.java


注:本文中的android.os.ResultReceiver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。