com.norbsoft.typefacehelper.TypefaceHelper Java Examples

The following examples show how to use com.norbsoft.typefacehelper.TypefaceHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FragmentNavigationDemoApplication.java    From FragmentNavigationPatternDemo with Apache License 2.0 6 votes vote down vote up
private void initLibs() {

        // Initialize dagger
        DaggerManager.getInstance().buildComponentAndInject(this);

        //@formatter:off
        // Initialize typeface helper
        TypefaceCollection typeface = new TypefaceCollection.Builder()
                .set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"))
                .set(Typeface.BOLD, Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"))
                .create();
        TypefaceHelper.init(typeface);
        //@formatter:on

        if (BuildConfig.DEBUG) {
            // Facebook Stetho
            Stetho.initializeWithDefaults(this);
        }
    }
 
Example #2
Source File: OverlayTopMenuView.java    From Qiitanium with MIT License 6 votes vote down vote up
@Override
protected void onViewCreated(View view) {
  layout = view.findViewById(R.id.overlay_top_menu);
  layoutToggle = view.findViewById(R.id.overlay_top_menu_toggle_btn);
  layoutToggle.setSelected(ViewUtils.isVisible(layout));

  homeBtn = view.findViewById(R.id.overlay_top_menu_logged_in_home_btn);
  homeLabel = view.findViewById(R.id.overlay_top_menu_logged_in_name_text);
  refreshBtn = view.findViewById(R.id.overlay_top_menu_refresh_btn);
  refreshLabel = view.findViewById(R.id.overlay_top_menu_refresh_text);
  settingBtn = view.findViewById(R.id.overlay_top_menu_settings_btn);
  settingLabel = view.findViewById(R.id.overlay_top_menu_settings_text);

  TypefaceHelper.typeface(homeLabel);
  TypefaceHelper.typeface(refreshLabel);
  TypefaceHelper.typeface(settingLabel);

  layoutToggle.setOnClickListener(this);
  homeBtn.setOnClickListener(this);
  refreshBtn.setOnClickListener(this);
  settingBtn.setOnClickListener(this);

}
 
Example #3
Source File: OverlayArticleMenuView.java    From Qiitanium with MIT License 6 votes vote down vote up
@Override
protected void onViewCreated(View view) {
  layout = view.findViewById(R.id.overlay_article_menu);
  layoutToggle = view.findViewById(R.id.overlay_article_menu_toggle_btn);
  layoutToggle.setSelected(ViewUtils.isVisible(layout));

  homeBtn = view.findViewById(R.id.overlay_article_menu_logged_in_home_btn);
  homeLabel = view.findViewById(R.id.overlay_article_menu_logged_in_name_text);
  stockBtn = view.findViewById(R.id.overlay_article_menu_stock_btn);
  shareBtn = view.findViewById(R.id.overlay_article_menu_share_btn);
  openBrowserBtn = view.findViewById(R.id.overlay_article_menu_open_browser_btn);
  commentBtn = view.findViewById(R.id.overlay_article_menu_comment_btn);

  TypefaceHelper.typeface(homeLabel);

  layoutToggle.setOnClickListener(this);
  homeBtn.setOnClickListener(this);
  stockBtn.setOnClickListener(this);
  shareBtn.setOnClickListener(this);
  openBrowserBtn.setOnClickListener(this);
  commentBtn.setOnClickListener(this);

}
 
Example #4
Source File: ArticleListItemView.java    From Qiitanium with MIT License 6 votes vote down vote up
@Override
protected void onViewCreated(final View view) {
  titleText = RxView.findById(view, R.id.list_item_article_title);
  bodyText = RxView.findById(view, R.id.list_item_article_body);
  createdAtText = RxView.findById(view, R.id.list_item_article_timeago);
  authorNameText = RxView.findById(view, R.id.list_item_article_author_text);
  authorThumbnailImage = RxView.findById(view, R.id.list_item_article_author_image);
  bookmarkIcon = RxView.findById(view, R.id.list_item_article_bookmark_icon);
  tagText = RxView.findById(view, R.id.list_item_article_tag);

  // Apply custom font
  TypefaceHelper.typeface(createdAtText.get());
  TypefaceHelper.typeface(tagText.get());

  setOnClickListener(this);
}
 
Example #5
Source File: BaseActivity.java    From FragmentNavigationPatternDemo with Apache License 2.0 5 votes vote down vote up
@Override
public void setContentView(int layoutResID) {
    // We set a toolbar layout as the default and inflate into the content layout
    super.setContentView(R.layout.toolbar_layout);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mContentLayout = (FrameLayout) findViewById(R.id.content);

    // use the new toolbar
    setSupportActionBar(mToolbar);

    // Get an inflater
    getLayoutInflater().inflate(layoutResID, mContentLayout);
    ButterKnife.bind(this);
    TypefaceHelper.typeface(this);
}
 
Example #6
Source File: AppLifecycleCallbacks.java    From Qiitanium with MIT License 5 votes vote down vote up
protected void setupTypeFace() {
  TypefaceHelper.init(new TypefaceCollection.Builder()
      .set(Typeface.NORMAL, createTypefaceFromAsset(R.string.font_ubuntu_regular))
      .set(Typeface.BOLD, createTypefaceFromAsset(R.string.font_ubuntu_bold))
      .set(Typeface.ITALIC, createTypefaceFromAsset(R.string.font_ubuntu_regular_italic))
      .set(Typeface.BOLD_ITALIC,
          createTypefaceFromAsset(R.string.font_ubuntu_bold_italic))
      .create());
}
 
Example #7
Source File: ArticleAboutFragment.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
public void onDataSetChanged(RxReadOnlyList.Event event) {
  LayoutInflater inflater = LayoutInflater.from(getContext());

  for (int i = 0, size = tagList.size(); i < size; i++) {
    TagListItemView itemView = Objects.cast(
        inflater.inflate(R.layout.list_item_tag, listView, false));
    itemView.bindTo(tagList.get(i));
    listView.addHeaderView(itemView);
  }

  View commentHeader = inflater.inflate(R.layout.list_item_comment_header, listView, false);
  TypefaceHelper.typeface(commentHeader);
  listView.addHeaderView(commentHeader, null, false);
}
 
Example #8
Source File: TagListItemView.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected void onViewCreated(final View view) {
  nameText = RxView.findById(view, R.id.list_item_tag_name);

  // Apply custom font
  TypefaceHelper.typeface(nameText.get());

  setOnClickListener(this);
}
 
Example #9
Source File: CommentListItemView.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected void onViewCreated(final View view) {
  commentText = RxView.findById(view, R.id.list_item_comment_text);
  authorThumbImage = RxView.findById(view, R.id.list_item_comment_author_image);
  commentedAtText = RxView.findById(view, R.id.list_item_comment_timeago);

  TypefaceHelper.typeface(commentedAtText.get());
}
 
Example #10
Source File: TagActivity.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
  setContentView(R.layout.activity_tag);

  View header = findViewById(R.id.header);
  View headerImage = findViewById(R.id.header_image);

  headerHelper = new ParallaxHeaderHelper.Builder(header, headerImage)
      .setMinHeight(getDimensionPixelSize(R.dimen.header_min_height))
      .setElevation(getDimensionPixelSize(R.dimen.header_elevation))
      .create();

  TextView title = ViewUtils.findById(this, R.id.title);
  title.setText(getTagName());

  TextView back = ViewUtils.findById(this, R.id.back);
  back.setOnClickListener(onBackListener);

  TypefaceHelper.typeface(title);
  TypefaceHelper.typeface(back);

  if (savedInstanceState == null) {
    setFragment(R.id.content, ArticleListFragment.newInstance(getTagId()));
  }
}
 
Example #11
Source File: SettingsActivity.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
  setContentView(R.layout.activity_settings);

  View header = findViewById(R.id.header);
  View headerImage = findViewById(R.id.header_image);

  headerHelper = new ParallaxHeaderHelper.Builder(header, headerImage)
      .setMinHeight(getDimensionPixelSize(R.dimen.header_min_height))
      .setElevation(getDimensionPixelSize(R.dimen.header_elevation))
      .create();

  TextView title = ViewUtils.findById(this, R.id.title);
  title.setText(R.string.app_name);

  TextView back = ViewUtils.findById(this, R.id.back);
  back.setText(R.string.back_to_prev);
  back.setOnClickListener(onBackListener);

  TypefaceHelper.typeface(title);
  TypefaceHelper.typeface(back);

  if (savedInstanceState == null) {
    setFragment(R.id.content, SettingsFragment.newInstance());
  }
}
 
Example #12
Source File: ComingSoonFragment.java    From Qiitanium with MIT License 4 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  TypefaceHelper.typeface(ViewUtils.findById(view, R.id.coming_soon_title));
}
 
Example #13
Source File: TopActivity.java    From Qiitanium with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_top);

  FragmentManager fm = getFragmentManager();

  View header = findViewById(R.id.header);
  View headerImage = findViewById(R.id.header_image);

  headerHelper = new ParallaxHeaderHelper.Builder(header, headerImage)
      .setMinHeight(getDimensionPixelSize(R.dimen.header_min_height))
      .setElevation(getDimensionPixelSize(R.dimen.header_elevation))
      .create();

  SlidingUpPanelLayout slidingUpPanel = ViewUtils.findById(this, R.id.panel);
  panelHelper = new SlidingUpPanelHelper(slidingUpPanel);

  TextView title = ViewUtils.findById(this, R.id.title);
  title.setText(R.string.label_articles);

  viewPagerAdapter = new FragmentPagerItemAdapter(fm, FragmentPagerItems.with(this)
      .add(R.string.tab_new, ArticleListFragment.class)
      .add(R.string.tab_following, ComingSoonScrollableFragment.class)
      .create());

  viewPager = ViewUtils.findById(this, R.id.article_top_viewpager);
  viewPager.setAdapter(viewPagerAdapter);
  SmartTabLayout viewPagerTab = ViewUtils.findById(this, R.id.viewpagertab);
  viewPagerTab.setCustomTabView(R.layout.view_tab, R.id.view_tab_text);
  viewPagerTab.setViewPager(viewPager);
  viewPagerTab.setOnPageChangeListener(onPageChangeListener);

  TextView tagTitle = ViewUtils.findById(this, R.id.tag_top_title);
  ViewPager tagViewPager = ViewUtils.findById(this, R.id.tag_top_viewpager);
  tagViewPager.setAdapter(new FragmentPagerItemAdapter(fm, FragmentPagerItems.with(this)
      .add(R.string.tab_popular, TagListFragment.class)
      .add(R.string.tab_following, ComingSoonFragment.class)
      .create()));

  SmartTabLayout tagViewPagerTab = ViewUtils.findById(this, R.id.tag_top_viewpagertab);
  tagViewPagerTab.setViewPager(tagViewPager);

  topMenu = ViewUtils.findById(this, R.id.overlay_top);
  topMenu.bindTo(this);

  TypefaceHelper.typeface(title);
  TypefaceHelper.typeface(tagTitle);
  TypefaceHelper.typeface(viewPagerTab);
  TypefaceHelper.typeface(tagViewPagerTab);

}
 
Example #14
Source File: ArticleActivity.java    From Qiitanium with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
  setContentView(R.layout.activity_article);

  viewModel = ArticleDetailViewModel.create(this);
  viewModel.loadArticle(getArticleId());

  articleMenu = ViewUtils.findById(this, R.id.overlay_article);
  articleMenu.bindTo(viewModel);

  View header = findViewById(R.id.header);
  View headerImage = findViewById(R.id.header_image);

  headerHelper = new ParallaxHeaderHelper.Builder(header, headerImage)
      .setMinHeight(getDimensionPixelSize(R.dimen.header_min_height))
      .setElevation(getDimensionPixelSize(R.dimen.header_elevation))
      .create();

  SlidingUpPanelLayout slidingUpPanel = ViewUtils.findById(this, R.id.panel);
  panelHelper = new SlidingUpPanelHelper(slidingUpPanel);

  subject = ViewUtils.findById(this, R.id.header_article_subject);

  title = RxView.findById(this, R.id.header_article_title);
  timeAgo = RxView.findById(this, R.id.header_article_timeago);

  back = ViewUtils.findById(this, R.id.back);
  back.setOnClickListener(onBackListener);
  back.setAlpha(0f);

  findViewById(R.id.back_icon).setOnClickListener(onBackListener);

  TypefaceHelper.typeface(timeAgo.get());
  TypefaceHelper.typeface(back);
  TypefaceHelper.typeface(findViewById(R.id.article_about_title));

  if (savedInstanceState == null) {
    setFragment(R.id.content, ArticleFragment.newInstance());
    setFragment(R.id.article_about_content, ArticleAboutFragment.newInstance(getArticleId()));
  }
}
 
Example #15
Source File: MyApplication.java    From android-typeface-helper with Apache License 2.0 4 votes vote down vote up
@Override public void onCreate() {
	super.onCreate();

	// Load helper with default custom typeface (single custom typeface)
	TypefaceHelper.init(new TypefaceCollection.Builder()
			.set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-R.ttf"))
			.set(Typeface.BOLD, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-B.ttf"))
			.set(Typeface.ITALIC, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-RI.ttf"))
			.set(Typeface.BOLD_ITALIC, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-BI.ttf"))
			.create());

	// Multiple custom typefaces support
	mJuiceTypeface = new TypefaceCollection.Builder()
			.set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(), "fonts/Juice/JUICE_Regular.ttf"))
			.set(Typeface.BOLD, Typeface.createFromAsset(getAssets(), "fonts/Juice/JUICE_Bold.ttf"))
			.set(Typeface.ITALIC, Typeface.createFromAsset(getAssets(), "fonts/Juice/JUICE_Italic.ttf"))
			.set(Typeface.BOLD_ITALIC, Typeface.createFromAsset(getAssets(), "fonts/Juice/JUICE_Bold_Italic.ttf"))
			.create();

	// Multiple custom typefaces support
	mArchRivalTypeface = new TypefaceCollection.Builder()
			.set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(), "fonts/arch_rival/SF_Arch_Rival.ttf"))
			.set(Typeface.BOLD, Typeface.createFromAsset(getAssets(), "fonts/arch_rival/SF_Arch_Rival_Bold.ttf"))
			.set(Typeface.ITALIC, Typeface.createFromAsset(getAssets(), "fonts/arch_rival/SF_Arch_Rival_Italic.ttf"))
			.set(Typeface.BOLD_ITALIC, Typeface.createFromAsset(getAssets(), "fonts/arch_rival/SF_Arch_Rival_Bold_Italic.ttf"))
			.create();

	// Multiple custom typefaces support
	mActionManTypeface = new TypefaceCollection.Builder()
			.set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(), "fonts/Action-Man/Action_Man.ttf"))
			.set(Typeface.BOLD, Typeface.createFromAsset(getAssets(), "fonts/Action-Man/Action_Man_Bold.ttf"))
			.set(Typeface.ITALIC, Typeface.createFromAsset(getAssets(), "fonts/Action-Man/Action_Man_Italic.ttf"))
			.set(Typeface.BOLD_ITALIC, Typeface.createFromAsset(getAssets(), "fonts/Action-Man/Action_Man_Bold_Italic.ttf"))
			.create();

	// Multiple custom typefaces support
	mUbuntuTypeface = new TypefaceCollection.Builder()
			.set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-R.ttf"))
			.set(Typeface.BOLD, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-B.ttf"))
			.set(Typeface.ITALIC, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-RI.ttf"))
			.set(Typeface.BOLD_ITALIC, Typeface.createFromAsset(getAssets(), "fonts/ubuntu/Ubuntu-BI.ttf"))
			.create();

	// Multiple custom typefaces support
	mSystemDefaultTypeface = TypefaceCollection.createSystemDefault();
}
 
Example #16
Source File: BaseFragment.java    From FragmentNavigationPatternDemo with Apache License 2.0 3 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    TypefaceHelper.typeface(view);

    initActionBar(true, getString(R.string.app_name));


}