Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Typeface
Search
Keishin Yokomaku
September 24, 2014
Technology
1.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Typeface
Android library for easy use of typeface.
Keishin Yokomaku
September 24, 2014
Transcript
17 slides
Typeface @KeithYokoma - Drivemode, Inc. potatotips #9
About myself • KeithYokoma • Keishin Yokomaku • Drivemode, Inc.
• GitHub: https://github.com/KeithYokoma • e-Book: http://amzn.to/1mZNydv
Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface
Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface
http://bit.ly/1rjOdtN
Typeface • Cool • Nice • Beautiful • Android provides
Roboto by default
Typeface • If you would like to change the typeface…
TextView#setTypeface(Typeface) Paint#setTypeface(Typeface) Button#setTypeface(Typeface) EditText#setTypeface(Typeface)
Typeface • Read Typeface from your assets Typeface.createFromAsset(AssetManager, String)
Typeface • Read Typeface from your assets ! • Caution!
Typeface.createFromAsset(AssetManager, String) Typeface.createFromAsset leaks asset stream! http://bit.ly/1rVOkir
Typeface • Workaround: cache private final Hashtable<String, Typeface> mCache =
new Hashtable<String, Typeface>();! private final Application mApplication;! ! public synchronized Typeface get(String name) {! ! Typeface typeface = mCache.get(name);! ! if(typeface == null) {! ! ! try {! ! ! ! typeface = Typeface.createFromAsset(mApplication.getAssets(), name);! ! ! } catch (Exception exp) {! ! ! ! return null;! ! ! }! ! ! mCache.put(name, typeface);! ! }! ! return typeface;! }
Typeface • If you would like to change the typeface
for ActionBar title Dialog button texts Dialog message text ActionBar tab text All text views in the view group blah blah blah…
Typeface • Got it, we introduce you our library! TypefaceHelper
- http://bit.ly/1AxfqLz
Typeface • First, initialize the object in your Application. public
class SampleApp extends Application {! ! @Override! ! public void onCreate() {! ! ! super.onCreate();! ! ! TypefaceHelper.initialize(this);! ! }! ! ! @Override! ! public void onTerminate() {! ! ! TypefaceHelper.destroy();! ! ! super.onTerminate();! ! }! }
Typeface • Set your Typeface. public class SampleActivity extends Activity
{! ! ! TextView mTextView;! ! ! @Override! ! public void onCreate(Bundle icicle) {! ! ! // …! ! ! TypefaceHelper helper = TypefaceHelper.getInstance();! ! ! helper.setTypeface(this, “MyFont.ttf”);! ! ! helper.setTypeface(mTextView, “Another.ttf”);! ! }! }
Typeface • That's it. Just do it!
Typeface • You can set your Typeface to… • All
views that is a child of TextView. • All TextViews that is belong to ViewGroup. • Activity, Fragment, Dialog. • Canvas(thanks to Nohana team!)
Typeface • Works in progress 1. OptionsMenu 2. Preferences 3.
Set typeface by annotation
Typeface @KeithYokoma - Drivemode, Inc. potatotips #9
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
Base64 in Android
keithyokoma
0
76
One screen, many BottomSheets
keithyokoma
0
500
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
780
Build apps for Cars
keithyokoma
0
620
Save the state
keithyokoma
0
660
Either in Kotlin
keithyokoma
0
670
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5.7k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5.4k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
600
Other Decks in Technology
See All in Technology
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
380
Well, that’s weird…
csswizardry
1
130
変更差分を読むために環境を整備しよう
pipepasta
1
480
Context parameters で作る!はじめての型クラス
kworkdev
PRO
1
160
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
120
AWS Blocksで AIエージェント作れるの知ってます?
kmiya84377
1
130
AIで実装が加速したのに、 なぜ私は仕事の大半で人と話し続けていたのか?
say_no_w
0
200
エンタープライズ事業未経験のデータ屋、 AI時代にN回撃沈する.pdf
ryoskdara_
0
170
クラウドでも使えるNetApp -現場目線での設計とクラウドバックアップの活用
ryutakondo
1
190
エンタープライズIAMについて - ID・権限をどう統制するか
oidfj
1
250
Platform Engineering をベースとした Agentic Software Factory の実践
110y
1
430
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
3
790
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
From π to Pie charts
rasagy
1
450
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
610
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Music & Morning Musume
bryan
48
7.5k
Facilitating Awesome Meetings
lara
57
7.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k