Search in sources :

Example 66 with ContextThemeWrapper

use of android.view.ContextThemeWrapper in project FirebaseUI-Android by firebase.

the class FragmentHelper method showLoadingDialog.

@Override
public void showLoadingDialog(String message) {
    dismissDialog();
    ContextThemeWrapper context = new ContextThemeWrapper(mFragment.getContext(), getFlowParams().themeId);
    mProgressDialog = ProgressDialog.show(context, "", message, true);
}
Also used : ContextThemeWrapper(android.view.ContextThemeWrapper)

Example 67 with ContextThemeWrapper

use of android.view.ContextThemeWrapper in project android-floating-action-button by futuresimple.

the class FloatingActionsMenu method createLabels.

private void createLabels() {
    Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);
    for (int i = 0; i < mButtonsCount; i++) {
        FloatingActionButton button = (FloatingActionButton) getChildAt(i);
        String title = button.getTitle();
        if (button == mAddButton || title == null || button.getTag(R.id.fab_label) != null)
            continue;
        TextView label = new TextView(context);
        label.setTextAppearance(getContext(), mLabelsStyle);
        label.setText(button.getTitle());
        addView(label);
        button.setTag(R.id.fab_label, label);
    }
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) TextView(android.widget.TextView)

Example 68 with ContextThemeWrapper

use of android.view.ContextThemeWrapper in project SmartAndroidSource by jaychou2012.

the class ActionBarImpl method getThemedContext.

public Context getThemedContext() {
    if (mThemedContext == null) {
        TypedValue outValue = new TypedValue();
        Resources.Theme currentTheme = mContext.getTheme();
        currentTheme.resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
        final int targetThemeRes = outValue.resourceId;
        if (targetThemeRes != 0) {
            // XXX && mContext.getThemeResId() !=
            // targetThemeRes) {
            mThemedContext = new ContextThemeWrapper(mContext, targetThemeRes);
        } else {
            mThemedContext = mContext;
        }
    }
    return mThemedContext;
}
Also used : ContextThemeWrapper(android.view.ContextThemeWrapper) Resources(android.content.res.Resources) TypedValue(android.util.TypedValue)

Example 69 with ContextThemeWrapper

use of android.view.ContextThemeWrapper in project k-9 by k9mail.

the class MessageViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Context context = new ContextThemeWrapper(inflater.getContext(), K9.getK9ThemeResourceId(K9.getK9MessageViewTheme()));
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    View view = layoutInflater.inflate(R.layout.message, container, false);
    mMessageView = (MessageTopView) view.findViewById(R.id.message_view);
    mMessageView.setAttachmentCallback(this);
    mMessageView.setMessageCryptoPresenter(messageCryptoPresenter);
    mMessageView.setOnToggleFlagClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            onToggleFlagged();
        }
    });
    mMessageView.setOnDownloadButtonClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mMessageView.disableDownloadButton();
            messageLoaderHelper.downloadCompleteMessage();
        }
    });
    mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());
    return view;
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) View(android.view.View) MessageCryptoMvpView(com.fsck.k9.ui.messageview.MessageCryptoPresenter.MessageCryptoMvpView)

Example 70 with ContextThemeWrapper

use of android.view.ContextThemeWrapper in project k-9 by k9mail.

the class MessageCompose method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (UpgradeDatabases.actionUpgradeDatabases(this, getIntent())) {
        finish();
        return;
    }
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    if (K9.getK9ComposerThemeSetting() != K9.Theme.USE_GLOBAL) {
        // theme the whole content according to the theme (except the action bar)
        ContextThemeWrapper themeContext = new ContextThemeWrapper(this, K9.getK9ThemeResourceId(K9.getK9ComposerTheme()));
        // this is the top level activity element, it has no root
        @SuppressLint("InflateParams") View v = LayoutInflater.from(themeContext).inflate(R.layout.message_compose, null);
        TypedValue outValue = new TypedValue();
        // background color needs to be forced
        themeContext.getTheme().resolveAttribute(R.attr.messageViewBackgroundColor, outValue, true);
        v.setBackgroundColor(outValue.data);
        setContentView(v);
    } else {
        setContentView(R.layout.message_compose);
    }
    initializeActionBar();
    // on api level 15, setContentView() shows the progress bar for some reason...
    setProgressBarIndeterminateVisibility(false);
    final Intent intent = getIntent();
    String messageReferenceString = intent.getStringExtra(EXTRA_MESSAGE_REFERENCE);
    relatedMessageReference = MessageReference.parse(messageReferenceString);
    final String accountUuid = (relatedMessageReference != null) ? relatedMessageReference.getAccountUuid() : intent.getStringExtra(EXTRA_ACCOUNT);
    account = Preferences.getPreferences(this).getAccount(accountUuid);
    if (account == null) {
        account = Preferences.getPreferences(this).getDefaultAccount();
    }
    if (account == null) {
        /*
             * There are no accounts set up. This should not have happened. Prompt the
             * user to set up an account as an acceptable bailout.
             */
        startActivity(new Intent(this, Accounts.class));
        changesMadeSinceLastSave = false;
        finish();
        return;
    }
    contacts = Contacts.getInstance(MessageCompose.this);
    chooseIdentityButton = (TextView) findViewById(R.id.identity);
    chooseIdentityButton.setOnClickListener(this);
    RecipientMvpView recipientMvpView = new RecipientMvpView(this);
    ComposePgpInlineDecider composePgpInlineDecider = new ComposePgpInlineDecider();
    recipientPresenter = new RecipientPresenter(getApplicationContext(), getLoaderManager(), recipientMvpView, account, composePgpInlineDecider, new ReplyToParser(), this);
    recipientPresenter.updateCryptoStatus();
    subjectView = (EditText) findViewById(R.id.subject);
    subjectView.getInputExtras(true).putBoolean("allowEmoji", true);
    EolConvertingEditText upperSignature = (EolConvertingEditText) findViewById(R.id.upper_signature);
    EolConvertingEditText lowerSignature = (EolConvertingEditText) findViewById(R.id.lower_signature);
    QuotedMessageMvpView quotedMessageMvpView = new QuotedMessageMvpView(this);
    quotedMessagePresenter = new QuotedMessagePresenter(this, quotedMessageMvpView, account);
    attachmentPresenter = new AttachmentPresenter(getApplicationContext(), attachmentMvpView, getLoaderManager(), this);
    messageContentView = (EolConvertingEditText) findViewById(R.id.message_content);
    messageContentView.getInputExtras(true).putBoolean("allowEmoji", true);
    attachmentsView = (LinearLayout) findViewById(R.id.attachments);
    TextWatcher draftNeedsChangingTextWatcher = new SimpleTextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            changesMadeSinceLastSave = true;
        }
    };
    TextWatcher signTextWatcher = new SimpleTextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            changesMadeSinceLastSave = true;
            signatureChanged = true;
        }
    };
    recipientMvpView.addTextChangedListener(draftNeedsChangingTextWatcher);
    quotedMessageMvpView.addTextChangedListener(draftNeedsChangingTextWatcher);
    subjectView.addTextChangedListener(draftNeedsChangingTextWatcher);
    messageContentView.addTextChangedListener(draftNeedsChangingTextWatcher);
    /*
         * We set this to invisible by default. Other methods will turn it back on if it's
         * needed.
         */
    quotedMessagePresenter.showOrHideQuotedText(QuotedTextMode.NONE);
    subjectView.setOnFocusChangeListener(this);
    messageContentView.setOnFocusChangeListener(this);
    if (savedInstanceState != null) {
        /*
             * This data gets used in onCreate, so grab it here instead of onRestoreInstanceState
             */
        relatedMessageProcessed = savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false);
    }
    if (initFromIntent(intent)) {
        action = Action.COMPOSE;
        changesMadeSinceLastSave = true;
    } else {
        String action = intent.getAction();
        if (ACTION_COMPOSE.equals(action)) {
            this.action = Action.COMPOSE;
        } else if (ACTION_REPLY.equals(action)) {
            this.action = Action.REPLY;
        } else if (ACTION_REPLY_ALL.equals(action)) {
            this.action = Action.REPLY_ALL;
        } else if (ACTION_FORWARD.equals(action)) {
            this.action = Action.FORWARD;
        } else if (ACTION_EDIT_DRAFT.equals(action)) {
            this.action = Action.EDIT_DRAFT;
        } else {
            // This shouldn't happen
            Timber.w("MessageCompose was started with an unsupported action");
            this.action = Action.COMPOSE;
        }
    }
    if (identity == null) {
        identity = account.getIdentity(0);
    }
    if (account.isSignatureBeforeQuotedText()) {
        signatureView = upperSignature;
        lowerSignature.setVisibility(View.GONE);
    } else {
        signatureView = lowerSignature;
        upperSignature.setVisibility(View.GONE);
    }
    updateSignature();
    signatureView.addTextChangedListener(signTextWatcher);
    if (!identity.getSignatureUse()) {
        signatureView.setVisibility(View.GONE);
    }
    requestReadReceipt = account.isMessageReadReceiptAlways();
    updateFrom();
    if (!relatedMessageProcessed) {
        if (action == Action.REPLY || action == Action.REPLY_ALL || action == Action.FORWARD || action == Action.EDIT_DRAFT) {
            messageLoaderHelper = new MessageLoaderHelper(this, getLoaderManager(), getFragmentManager(), messageLoaderCallbacks);
            internalMessageHandler.sendEmptyMessage(MSG_PROGRESS_ON);
            Parcelable cachedDecryptionResult = intent.getParcelableExtra(EXTRA_MESSAGE_DECRYPTION_RESULT);
            messageLoaderHelper.asyncStartOrResumeLoadingMessage(relatedMessageReference, cachedDecryptionResult);
        }
        if (action != Action.EDIT_DRAFT) {
            String alwaysBccString = account.getAlwaysBcc();
            if (!TextUtils.isEmpty(alwaysBccString)) {
                recipientPresenter.addBccAddresses(Address.parse(alwaysBccString));
            }
        }
    }
    if (action == Action.REPLY || action == Action.REPLY_ALL) {
        relatedMessageReference = relatedMessageReference.withModifiedFlag(Flag.ANSWERED);
    }
    if (action == Action.REPLY || action == Action.REPLY_ALL || action == Action.EDIT_DRAFT) {
        //change focus to message body.
        messageContentView.requestFocus();
    } else {
        // Explicitly set focus to "To:" input field (see issue 2998)
        recipientMvpView.requestFocusOnToField();
    }
    if (action == Action.FORWARD) {
        relatedMessageReference = relatedMessageReference.withModifiedFlag(Flag.FORWARDED);
    }
    updateMessageFormat();
    // Set font size of input controls
    int fontSize = K9.getFontSizes().getMessageComposeInput();
    recipientMvpView.setFontSizes(K9.getFontSizes(), fontSize);
    quotedMessageMvpView.setFontSizes(K9.getFontSizes(), fontSize);
    K9.getFontSizes().setViewTextSize(subjectView, fontSize);
    K9.getFontSizes().setViewTextSize(messageContentView, fontSize);
    K9.getFontSizes().setViewTextSize(signatureView, fontSize);
    updateMessageFormat();
    setTitle();
    currentMessageBuilder = (MessageBuilder) getLastNonConfigurationInstance();
    if (currentMessageBuilder != null) {
        setProgressBarIndeterminateVisibility(true);
        currentMessageBuilder.reattachCallback(this);
    }
}
Also used : ComposePgpInlineDecider(com.fsck.k9.message.ComposePgpInlineDecider) RecipientPresenter(com.fsck.k9.activity.compose.RecipientPresenter) EolConvertingEditText(com.fsck.k9.ui.EolConvertingEditText) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) Parcelable(android.os.Parcelable) QuotedMessageMvpView(com.fsck.k9.ui.compose.QuotedMessageMvpView) View(android.view.View) QuotedMessageMvpView(com.fsck.k9.ui.compose.QuotedMessageMvpView) TextView(android.widget.TextView) AttachmentMvpView(com.fsck.k9.activity.compose.AttachmentPresenter.AttachmentMvpView) RecipientMvpView(com.fsck.k9.activity.compose.RecipientMvpView) SuppressLint(android.annotation.SuppressLint) QuotedMessagePresenter(com.fsck.k9.ui.compose.QuotedMessagePresenter) ReplyToParser(com.fsck.k9.helper.ReplyToParser) SimpleTextWatcher(com.fsck.k9.helper.SimpleTextWatcher) ContextThemeWrapper(android.view.ContextThemeWrapper) SuppressLint(android.annotation.SuppressLint) RecipientMvpView(com.fsck.k9.activity.compose.RecipientMvpView) SimpleTextWatcher(com.fsck.k9.helper.SimpleTextWatcher) TextWatcher(android.text.TextWatcher) AttachmentPresenter(com.fsck.k9.activity.compose.AttachmentPresenter) TypedValue(android.util.TypedValue)

Aggregations

ContextThemeWrapper (android.view.ContextThemeWrapper)122 Context (android.content.Context)65 TypedValue (android.util.TypedValue)52 Resources (android.content.res.Resources)32 View (android.view.View)22 TextView (android.widget.TextView)17 TypedArray (android.content.res.TypedArray)16 AlertDialog (android.app.AlertDialog)15 DialogInterface (android.content.DialogInterface)13 OnClickListener (android.content.DialogInterface.OnClickListener)11 Drawable (android.graphics.drawable.Drawable)11 LayoutInflater (android.view.LayoutInflater)10 RecyclerView (android.support.v7.widget.RecyclerView)8 ImageView (android.widget.ImageView)8 MenuBuilder (com.actionbarsherlock.internal.view.menu.MenuBuilder)7 Point (android.graphics.Point)6 ViewStub (android.view.ViewStub)6 WindowManagerImpl (android.view.WindowManagerImpl)6 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5