-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
AwesomeTextViewExample.java
71 lines (55 loc) · 2.72 KB
/
AwesomeTextViewExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.fractalwrench.androidbootstrap.sample;
import android.os.Bundle;
import com.beardedhen.androidbootstrap.AwesomeTextView;
import com.beardedhen.androidbootstrap.BootstrapText;
import com.beardedhen.androidbootstrap.font.MaterialIcons;
import butterknife.BindView;
import butterknife.OnClick;
import static com.beardedhen.androidbootstrap.font.FontAwesome.FA_ANCHOR;
import static com.beardedhen.androidbootstrap.font.FontAwesome.FA_ANDROID;
import static com.beardedhen.androidbootstrap.font.FontAwesome.FA_APPLE;
import static com.beardedhen.androidbootstrap.font.FontAwesome.FA_HEART;
import static com.beardedhen.androidbootstrap.font.FontAwesome.FA_TWITTER;
import static com.beardedhen.androidbootstrap.font.Typicon.TY_CODE;
public class AwesomeTextViewExample extends BaseActivity {
@Override protected int getContentLayoutId() {
return R.layout.example_awesome_text_view;
}
@BindView(R.id.example_fa_text_change) AwesomeTextView exampleChange;
@BindView(R.id.example_fa_text_flash) AwesomeTextView exampleFlash;
@BindView(R.id.example_fa_text_rotate) AwesomeTextView exampleRotate;
@BindView(R.id.example_fa_text_multi_change) AwesomeTextView exampleMultiChange;
@BindView(R.id.example_fa_text_builder) AwesomeTextView exampleBuilder;
@BindView(R.id.example_mix_and_match) AwesomeTextView mixAndMatch;
private boolean android = true;
private boolean wikipedia = true;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupFontAwesomeText();
}
private void setupFontAwesomeText() {
exampleFlash.startFlashing(true, AwesomeTextView.AnimationSpeed.FAST);
exampleRotate.startRotate(true, AwesomeTextView.AnimationSpeed.SLOW);
BootstrapText text = new BootstrapText.Builder(this)
.addText("I ")
.addFontAwesomeIcon(FA_HEART)
.addText(" going on ")
.addFontAwesomeIcon(FA_TWITTER)
.build();
exampleBuilder.setBootstrapText(text);
mixAndMatch.setBootstrapText(new BootstrapText.Builder(this)
.addFontAwesomeIcon(FA_ANCHOR)
.addTypicon(TY_CODE)
.addMaterialIcon(MaterialIcons.MD_PHOTO)
.build());
}
@OnClick(R.id.example_fa_text_change) void onChangeClicked() {
android = !android;
exampleChange.setFontAwesomeIcon(android ? FA_ANDROID : FA_APPLE);
}
@OnClick(R.id.example_fa_text_multi_change) void onMultiChangeClicked() {
wikipedia = !wikipedia;
String text = wikipedia ? "{fa_image} is in the {fa_cloud}" : "{fa_bank} are on {fa_globe}";
exampleMultiChange.setMarkdownText(text);
}
}