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;
}
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);
}
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);
}
}
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);
}
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;
}
Aggregations