Search in sources :

Example 1 with TextSwitcher

use of android.widget.TextSwitcher in project OverlayMenu by sephiroth74.

the class OverMenuLayout method initializeTextSwitcher.

private void initializeTextSwitcher(@NonNull final Context context) {
    selectedTextView = new TextSwitcher(getContext());
    selectedTextView.setFactory(this);
    selectedTextView.setAnimateFirstView(false);
    selectedTextView.setBackgroundResource(mSelectedTextBackground);
    if (mTextSwitcherInAnimation != 0) {
        selectedTextView.setInAnimation(context, mTextSwitcherInAnimation);
    }
    if (mTextSwitcherOutAnimation != 0) {
        selectedTextView.setOutAnimation(context, mTextSwitcherOutAnimation);
    }
    LayoutParams params = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    selectedTextView.setLayoutParams(params);
    selectedTextView.setLayerType(LAYER_TYPE_HARDWARE, null);
    addView(selectedTextView);
}
Also used : TextSwitcher(android.widget.TextSwitcher)

Example 2 with TextSwitcher

use of android.widget.TextSwitcher in project wire-android by wireapp.

the class BasePreferenceActivity method onCreate.

@SuppressLint("PrivateResource")
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    replaceFragmentStrategy = new PreferenceScreenStrategy.ReplaceFragment(this, R.anim.abc_fade_in, R.anim.abc_fade_out, R.anim.abc_fade_in, R.anim.abc_fade_out);
    toolbar = ViewUtils.getView(this, R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    assert ab != null;
    ab.setDisplayHomeAsUpEnabled(true);
    title = getTitle();
    titleSwitcher = new TextSwitcher(toolbar.getContext());
    titleSwitcher.setFactory(new ViewSwitcher.ViewFactory() {

        @Override
        public View makeView() {
            TextView tv = new AppCompatTextView(toolbar.getContext());
            TextViewCompat.setTextAppearance(tv, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
            return tv;
        }
    });
    titleSwitcher.setCurrentText(title);
    ab.setCustomView(titleSwitcher);
    ab.setDisplayShowCustomEnabled(true);
    ab.setDisplayShowTitleEnabled(false);
    titleSwitcher.setInAnimation(this, R.anim.abc_fade_in);
    titleSwitcher.setOutAnimation(this, R.anim.abc_fade_out);
}
Also used : PreferenceScreenStrategy(com.waz.zclient.pages.main.profile.preferences.PreferenceScreenStrategy) TextSwitcher(android.widget.TextSwitcher) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) TextView(android.widget.TextView) View(android.view.View) AppCompatTextView(android.support.v7.widget.AppCompatTextView) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) ViewSwitcher(android.widget.ViewSwitcher) SuppressLint(android.annotation.SuppressLint)

Aggregations

TextSwitcher (android.widget.TextSwitcher)2 SuppressLint (android.annotation.SuppressLint)1 ActionBar (android.support.v7.app.ActionBar)1 AppCompatTextView (android.support.v7.widget.AppCompatTextView)1 View (android.view.View)1 TextView (android.widget.TextView)1 ViewSwitcher (android.widget.ViewSwitcher)1 PreferenceScreenStrategy (com.waz.zclient.pages.main.profile.preferences.PreferenceScreenStrategy)1