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