Search in sources :

Example 1 with IdRes

use of androidx.annotation.IdRes in project FirebaseUI-Android by firebase.

the class AuthMethodPickerActivity method populateIdpListCustomLayout.

private void populateIdpListCustomLayout(List<IdpConfig> providerConfigs) {
    Map<String, Integer> providerButtonIds = customLayout.getProvidersButton();
    for (IdpConfig idpConfig : providerConfigs) {
        final String providerId = providerOrEmailLinkProvider(idpConfig.getProviderId());
        Integer buttonResId = providerButtonIds.get(providerId);
        if (buttonResId == null) {
            throw new IllegalStateException("No button found for auth provider: " + idpConfig.getProviderId());
        }
        @IdRes int buttonId = buttonResId;
        View loginButton = findViewById(buttonId);
        handleSignInOperation(idpConfig, loginButton);
    }
    // hide custom layout buttons that don't have their identity provider set
    for (String providerBtnId : providerButtonIds.keySet()) {
        if (providerBtnId == null) {
            continue;
        }
        boolean hasProvider = false;
        for (IdpConfig idpConfig : providerConfigs) {
            String providerId = providerOrEmailLinkProvider(idpConfig.getProviderId());
            if (providerBtnId.equals(providerId)) {
                hasProvider = true;
                break;
            }
        }
        if (!hasProvider) {
            Integer resId = providerButtonIds.get(providerBtnId);
            if (resId == null) {
                continue;
            }
            @IdRes int buttonId = resId;
            findViewById(buttonId).setVisibility(View.GONE);
        }
    }
}
Also used : IdpConfig(com.firebase.ui.auth.AuthUI.IdpConfig) IdRes(androidx.annotation.IdRes) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 2 with IdRes

use of androidx.annotation.IdRes in project Conversations by siacs.

the class ConversationsActivity method onBackendConnected.

@Override
void onBackendConnected() {
    if (performRedirectIfNecessary(true)) {
        return;
    }
    xmppConnectionService.getNotificationService().setIsInForeground(true);
    Intent intent = pendingViewIntent.pop();
    if (intent != null) {
        if (processViewIntent(intent)) {
            if (binding.secondaryFragment != null) {
                notifyFragmentOfBackendConnected(R.id.main_fragment);
            }
            invalidateActionBarTitle();
            return;
        }
    }
    for (@IdRes int id : FRAGMENT_ID_NOTIFICATION_ORDER) {
        notifyFragmentOfBackendConnected(id);
    }
    ActivityResult activityResult = postponedActivityResult.pop();
    if (activityResult != null) {
        handleActivityResult(activityResult);
    }
    invalidateActionBarTitle();
    if (binding.secondaryFragment != null && ConversationFragment.getConversation(this) == null) {
        Conversation conversation = ConversationsOverviewFragment.getSuggestion(this);
        if (conversation != null) {
            openConversation(conversation, null);
        }
    }
    showDialogsIfMainIsOverview();
}
Also used : IdRes(androidx.annotation.IdRes) Intent(android.content.Intent) Conversation(eu.siacs.conversations.entities.Conversation) ActivityResult(eu.siacs.conversations.ui.util.ActivityResult) SuppressLint(android.annotation.SuppressLint)

Example 3 with IdRes

use of androidx.annotation.IdRes in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BatteryTip method updatePreference.

public void updatePreference(Preference preference) {
    final Context context = preference.getContext();
    preference.setTitle(getTitle(context));
    preference.setSummary(getSummary(context));
    preference.setIcon(getIconId());
    @IdRes int iconTintColorId = getIconTintColorId();
    if (iconTintColorId != View.NO_ID) {
        preference.getIcon().setTint(context.getColor(iconTintColorId));
    }
}
Also used : Context(android.content.Context) IdRes(androidx.annotation.IdRes)

Aggregations

IdRes (androidx.annotation.IdRes)3 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 Intent (android.content.Intent)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 IdpConfig (com.firebase.ui.auth.AuthUI.IdpConfig)1 Conversation (eu.siacs.conversations.entities.Conversation)1 ActivityResult (eu.siacs.conversations.ui.util.ActivityResult)1