Search in sources :

Example 1 with TypefaceSpan

use of com.mixiaoxiao.android.view.TypefaceSpan in project 9GAG by Mixiaoxiao.

the class MxxBrowserActivity method setActionBarTitle.

private void setActionBarTitle(String title) {
    SpannableString spannableString = new SpannableString(title);
    String font = "LockScreen_Clock.ttf";
    spannableString.setSpan(new TypefaceSpan(font, Typeface.createFromAsset(getAssets(), font)), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    getActionBar().setTitle(spannableString);
}
Also used : SpannableString(android.text.SpannableString) SpannableString(android.text.SpannableString) TypefaceSpan(com.mixiaoxiao.android.view.TypefaceSpan)

Example 2 with TypefaceSpan

use of com.mixiaoxiao.android.view.TypefaceSpan in project 9GAG by Mixiaoxiao.

the class MxxTextUtil method getTypefaceSpannableString.

public static SpannableString getTypefaceSpannableString(Context context, String string, String fontName) {
    SpannableString spannableString = new SpannableString(string);
    spannableString.setSpan(new TypefaceSpan(fontName, Typeface.createFromAsset(context.getAssets(), fontName), false), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    return spannableString;
}
Also used : SpannableString(android.text.SpannableString) TypefaceSpan(com.mixiaoxiao.android.view.TypefaceSpan)

Example 3 with TypefaceSpan

use of com.mixiaoxiao.android.view.TypefaceSpan in project 9GAG by Mixiaoxiao.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MxxSystemBarTintUtil.setSystemBarTintColor(this);
    SpannableString spannableString = new SpannableString("9GAG");
    String font = "LockScreen_Clock.ttf";
    spannableString.setSpan(new TypefaceSpan(font, Typeface.createFromAsset(getAssets(), font)), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    getActionBar().setTitle(spannableString);
    getActionBar().setDisplayShowHomeEnabled(false);
    setContentView(R.layout.activity_main);
    mViewPager = (ViewPager) findViewById(R.id.main_viewpager);
    //		scaleImageView = (MxxScaleImageView) findViewById(R.id.main_mxxScaleImageView1);
    mViewPager.setOffscreenPageLimit(3);
    mTabStrip = (MxxPagerSlidingTabStrip) findViewById(R.id.main_tab);
    ArrayList<Fragment> fragments = new ArrayList<Fragment>();
    fragments.add(new GagFragmentHot());
    fragments.add(new GagFragmentTrending());
    fragments.add(new GagFragmentFresh());
    mViewPager.setAdapter(new GagAdapter2(getSupportFragmentManager(), fragments, new String[] { "hot", "trending", "fresh" }));
    mTabStrip.setViewPager(mViewPager);
    initTint();
    mTabStrip.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int arg0) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
            // TODO Auto-generated method stub
            if (((ViewGroup) tabLayout).getChildAt(0).getTranslationY() != 0) {
                ((ViewGroup) tabLayout).getChildAt(0).setTranslationY(0);
            }
        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
        // TODO Auto-generated method stub
        }
    });
    mImageFragment = (ImageFragment) getSupportFragmentManager().findFragmentById(R.id.main_image_fragment);
    mTabStrip.post(new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
            getSupportFragmentManager().beginTransaction().hide(mImageFragment).commit();
        }
    });
}
Also used : GagFragmentTrending(com.mixiaoxiao.ninegag.fragment.GagFragmentTrending) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) SpannableString(android.text.SpannableString) ImageFragment(com.mixiaoxiao.ninegag.fragment.ImageFragment) Fragment(android.support.v4.app.Fragment) GagFragment(com.mixiaoxiao.ninegag.fragment.GagFragment) ViewPager(android.support.v4.view.ViewPager) SpannableString(android.text.SpannableString) GagFragmentFresh(com.mixiaoxiao.ninegag.fragment.GagFragmentFresh) GagFragmentHot(com.mixiaoxiao.ninegag.fragment.GagFragmentHot) TypefaceSpan(com.mixiaoxiao.android.view.TypefaceSpan)

Example 4 with TypefaceSpan

use of com.mixiaoxiao.android.view.TypefaceSpan in project 9GAG by Mixiaoxiao.

the class MxxTextUtil method getTypefaceSpannableString.

public static SpannableString getTypefaceSpannableString(Context context, String string, boolean isBold) {
    SpannableString spannableString = new SpannableString(string);
    //"LockScreen_Clock.ttf";
    String font = Roboto_Light;
    spannableString.setSpan(new TypefaceSpan(font, Typeface.createFromAsset(context.getAssets(), font), isBold), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    return spannableString;
}
Also used : SpannableString(android.text.SpannableString) SpannableString(android.text.SpannableString) TypefaceSpan(com.mixiaoxiao.android.view.TypefaceSpan)

Aggregations

SpannableString (android.text.SpannableString)4 TypefaceSpan (com.mixiaoxiao.android.view.TypefaceSpan)4 Fragment (android.support.v4.app.Fragment)1 ViewPager (android.support.v4.view.ViewPager)1 ViewGroup (android.view.ViewGroup)1 GagFragment (com.mixiaoxiao.ninegag.fragment.GagFragment)1 GagFragmentFresh (com.mixiaoxiao.ninegag.fragment.GagFragmentFresh)1 GagFragmentHot (com.mixiaoxiao.ninegag.fragment.GagFragmentHot)1 GagFragmentTrending (com.mixiaoxiao.ninegag.fragment.GagFragmentTrending)1 ImageFragment (com.mixiaoxiao.ninegag.fragment.ImageFragment)1 ArrayList (java.util.ArrayList)1