Search in sources :

Example 1 with MainThread

use of android.support.annotation.MainThread in project Rutgers-Course-Tracker by tevjef.

the class RatingLayoutInflater method getProfessorLayout.

@MainThread
public ViewGroup getProfessorLayout() {
    ViewGroup root = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.section_info_rmp_rating, null);
    setOpenInBrowser(root);
    setName(root);
    setSubtitle(root);
    setOverall(root);
    setEasiness(root);
    setClarity(root);
    setHelpfulness(root);
    setAverageGrade(root);
    setRatingCount(root);
    tagView(root);
    return root;
}
Also used : ViewGroup(android.view.ViewGroup) MainThread(android.support.annotation.MainThread)

Example 2 with MainThread

use of android.support.annotation.MainThread in project FirebaseUI-Android by firebase.

the class AuthUiActivity method handleSignInResponse.

@MainThread
private void handleSignInResponse(int resultCode, Intent data) {
    IdpResponse response = IdpResponse.fromResultIntent(data);
    // Successfully signed in
    if (resultCode == ResultCodes.OK) {
        startActivity(SignedInActivity.createIntent(this, response));
        finish();
        return;
    } else {
        // Sign in failed
        if (response == null) {
            // User pressed back button
            showSnackbar(R.string.sign_in_cancelled);
            return;
        }
        if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
            showSnackbar(R.string.no_internet_connection);
            return;
        }
        if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
            showSnackbar(R.string.unknown_error);
            return;
        }
    }
    showSnackbar(R.string.unknown_sign_in_response);
}
Also used : IdpResponse(com.firebase.ui.auth.IdpResponse) MainThread(android.support.annotation.MainThread)

Example 3 with MainThread

use of android.support.annotation.MainThread in project mobile-center-sdk-android by Microsoft.

the class DefaultChannel method sendLogs.

/**
     * Send logs.
     *
     * @param groupState   The group state.
     * @param currentState The current state.
     * @param batch        The log batch.
     * @param batchId      The batch ID.
     */
@MainThread
private synchronized void sendLogs(final GroupState groupState, final int currentState, List<Log> batch, final String batchId) {
    if (checkStateDidNotChange(groupState, currentState)) {
        /* Send logs. */
        LogContainer logContainer = new LogContainer();
        logContainer.setLogs(batch);
        mIngestion.sendAsync(mAppSecret, mInstallId, logContainer, new ServiceCallback() {

            @Override
            public void onCallSucceeded(String payload) {
                handleSendingSuccess(groupState, currentState, batchId);
            }

            @Override
            public void onCallFailed(Exception e) {
                handleSendingFailure(groupState, currentState, batchId, e);
            }
        });
        /* Check for more pending logs. */
        checkPendingLogs(groupState.mName);
    }
}
Also used : ServiceCallback(com.microsoft.azure.mobile.http.ServiceCallback) LogContainer(com.microsoft.azure.mobile.ingestion.models.LogContainer) IOException(java.io.IOException) CancellationException(com.microsoft.azure.mobile.CancellationException) MainThread(android.support.annotation.MainThread)

Example 4 with MainThread

use of android.support.annotation.MainThread in project FirebaseUI-Android by firebase.

the class SignedInActivity method populateProfile.

@MainThread
private void populateProfile() {
    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if (user.getPhotoUrl() != null) {
        Glide.with(this).load(user.getPhotoUrl()).fitCenter().into(mUserProfilePicture);
    }
    mUserEmail.setText(TextUtils.isEmpty(user.getEmail()) ? "No email" : user.getEmail());
    mUserDisplayName.setText(TextUtils.isEmpty(user.getDisplayName()) ? "No display name" : user.getDisplayName());
    StringBuilder providerList = new StringBuilder(100);
    providerList.append("Providers used: ");
    if (user.getProviders() == null || user.getProviders().isEmpty()) {
        providerList.append("none");
    } else {
        Iterator<String> providerIter = user.getProviders().iterator();
        while (providerIter.hasNext()) {
            String provider = providerIter.next();
            if (GoogleAuthProvider.PROVIDER_ID.equals(provider)) {
                providerList.append("Google");
            } else if (FacebookAuthProvider.PROVIDER_ID.equals(provider)) {
                providerList.append("Facebook");
            } else if (EmailAuthProvider.PROVIDER_ID.equals(provider)) {
                providerList.append("Password");
            } else {
                providerList.append(provider);
            }
            if (providerIter.hasNext()) {
                providerList.append(", ");
            }
        }
    }
    mEnabledProviders.setText(providerList);
}
Also used : FirebaseUser(com.google.firebase.auth.FirebaseUser) MainThread(android.support.annotation.MainThread)

Example 5 with MainThread

use of android.support.annotation.MainThread in project mosby by sockeqwe.

the class MviBasePresenter method bindIntentActually.

@MainThread
private <I> Observable<I> bindIntentActually(@NonNull V view, @NonNull IntentRelayBinderPair<?> relayBinderPair) {
    if (view == null) {
        throw new NullPointerException("View is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
    }
    if (relayBinderPair == null) {
        throw new NullPointerException("IntentRelayBinderPair is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
    }
    PublishSubject<I> intentRelay = (PublishSubject<I>) relayBinderPair.intentRelaySubject;
    if (intentRelay == null) {
        throw new NullPointerException("IntentRelay from binderPair is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
    }
    ViewIntentBinder<V, I> intentBinder = (ViewIntentBinder<V, I>) relayBinderPair.intentBinder;
    if (intentBinder == null) {
        throw new NullPointerException(ViewIntentBinder.class.getSimpleName() + " is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
    }
    Observable<I> intent = intentBinder.bind(view);
    if (intent == null) {
        throw new NullPointerException("Intent Observable returned from Binder " + intentBinder + " is null");
    }
    if (intentDisposals == null) {
        intentDisposals = new CompositeDisposable();
    }
    intentDisposals.add(intent.subscribeWith(new DisposableIntentObserver<I>(intentRelay)));
    return intentRelay;
}
Also used : PublishSubject(io.reactivex.subjects.PublishSubject) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) MainThread(android.support.annotation.MainThread)

Aggregations

MainThread (android.support.annotation.MainThread)5 ViewGroup (android.view.ViewGroup)1 IdpResponse (com.firebase.ui.auth.IdpResponse)1 FirebaseUser (com.google.firebase.auth.FirebaseUser)1 CancellationException (com.microsoft.azure.mobile.CancellationException)1 ServiceCallback (com.microsoft.azure.mobile.http.ServiceCallback)1 LogContainer (com.microsoft.azure.mobile.ingestion.models.LogContainer)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 PublishSubject (io.reactivex.subjects.PublishSubject)1 IOException (java.io.IOException)1