11<!doctype html>
2- < html lang =" en-us " >
2+ < html >
33 < head >
44 < META http-equiv ="Content-Type " content ="text/html; charset=UTF-8 ">
5- < meta charset ="utf -8 ">
5+ < meta charset ="UTF -8 ">
66 < title > socialview</ title >
77 < meta content ="width=device-width, initial-scale=1 " name ="viewport ">
88 < meta content ="#159957 " name ="theme-color ">
99 < link href ="styles/main.css " rel ="stylesheet ">
1010 < link href ="styles/dark.css " rel ="stylesheet ">
1111 < link href ="styles/normalize.css " rel ="stylesheet ">
12- < link href ="https://fonts.googleapis.com/css?family=Open+Sans:400,700 " rel ="stylesheet ">
1312 < link href ="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css " rel ="stylesheet ">
1413 < script src ="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js "> </ script > < script src ="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-groovy.min.js "> </ script > < script src ="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-java.min.js "> </ script >
1514 <!--Primary meta tags-->
@@ -23,33 +22,33 @@ <h2 class="project-tagline">Android TextView and EditText with hashtag, mention,
2322 </ section >
2423 < section class ="main-content ">
2524 < p >
26- < a href ="https://travis-ci. com/github/hendraanggrian /socialview/ "> < img alt ="Travis CI " src ="https://img.shields.io/travis/com/hendraanggrian /socialview "> </ a >
27- < a href ="https://codecov.io/gh/hendraanggrian /socialview/ "> < img alt ="Codecov " src ="https://img.shields.io/codecov/c/github/hendraanggrian /socialview "> </ a >
25+ < a href ="https://app.circleci. com/pipelines/ github/hanggrian /socialview/ "> < img alt ="CircleCI " src ="https://img.shields.io/circleci/build/gh/hanggrian /socialview "> </ a >
26+ < a href ="https://app. codecov.io/gh/hanggrian /socialview/ "> < img alt ="Codecov " src ="https://img.shields.io/codecov/c/gh/hanggrian /socialview "> </ a >
2827< a href ="https://search.maven.org/artifact/com.hendraanggrian.appcompat/socialview/ "> < img alt ="Maven Central " src ="https://img.shields.io/maven-central/v/com.hendraanggrian.appcompat/socialview "> </ a >
2928< a href ="https://s01.oss.sonatype.org/content/repositories/snapshots/com/hendraanggrian/appcompat/socialview/ "> < img alt ="Nexus Snapshot " src ="https://img.shields.io/nexus/s/com.hendraanggrian.appcompat/socialview?server=https%3A%2F%2Fs01.oss.sonatype.org "> </ a >
30- < a href ="https://developer.android.com/studio /releases/platforms/#4 .0 "> < img alt ="Android SDK " src ="https://img.shields.io/badge/sdk-14 %2B-informational "> </ a >
29+ < a href ="https://developer.android.com/tools /releases/platforms#5 .0 "> < img alt ="Android SDK " src ="https://img.shields.io/badge/android-21 %2B-34a853 "> </ a >
3130 </ p >
32-
31+
3332 < h1 > SocialView</ h1 >
34-
33+
3534 < p >
3635 < img alt ="Hashtag preview. " src ="https://github.com/hendraanggrian/socialview/raw/assets/preview_hashtag.png ">
3736< img alt ="Mention preview. " src ="https://github.com/hendraanggrian/socialview/raw/assets/preview_mention.png ">
3837 </ p >
39-
38+
4039 < p > TextView and EditText with hashtag, mention, and hyperlink support.</ p >
41-
40+
4241 < ul >
43-
42+
4443 < li > Pre-loaded with default views, but also installable to any custom view.</ li >
45-
44+
4645 < li > Display hashtag and mention suggestions as you type.</ li >
47-
46+
4847 </ ul >
49-
48+
5049 < h2 > Download</ h2 >
51-
52- < pre > < code class ="language-groovy "> repositories {
50+
51+ < pre > < code class ="language-gradle "> repositories {
5352 mavenCentral()
5453 google()
5554}
@@ -61,16 +60,16 @@ <h2>Download</h2>
6160 implementation "com.hendraanggrian.appcompat:socialview-autocomplete:$version"
6261}
6362</ code > </ pre >
64-
63+
6564 < h2 > Usage</ h2 >
66-
65+
6766 < h3 > Core</ h3 >
68-
67+
6968 < p >
7069 Core library contains < code > SocialTextView</ code > , < code > SocialEditText</ code > and helper class
7170applies these behavior into any < code > TextView</ code > .
7271 </ p >
73-
72+
7473 < pre > < code class ="language-xml "> <com.hendraanggrian.appcompat.socialview.widget.SocialTextView
7574 android:id="@+id/textView"
7675 android:layout_width="match_parent"
@@ -80,30 +79,32 @@ <h3>Core</h3>
8079 app:hashtagColor="@color/blue"
8180 app:mentionColor="@color/red"/>
8281</ code > </ pre >
83-
82+
8483 < p >
8584 See < a href ="https://github.com/HendraAnggrian/socialview/blob/master/socialview/res/values/attrs.xml "> attrs.xml</ a >
8685for full list of available attributes.
8786 </ p >
88-
87+
8988 < p > Modify its state and set listeners programmatically.</ p >
90-
89+
9190 < pre > < code class ="language-java "> textView.setMentionEnabled(false);
9291textView.setHashtagColor(Color.RED);
93- textView.setOnHashtagClickListener(new SocialView.OnClickListener() {
94- @Override
95- public void invoke(SocialView socialView, String s) {
96- // do something
97- }
98- });
92+ textView.setOnHashtagClickListener(
93+ new SocialView.OnClickListener() {
94+ @Override
95+ public void invoke(SocialView socialView, String s) {
96+ // do something
97+ }
98+ }
99+ );
99100</ code > </ pre >
100-
101+
101102 < h3 > Auto-complete</ h3 >
102-
103+
103104 < p >
104105 Extended library comes with < code > SocialAutoCompleteTextView</ code > .
105106 </ p >
106-
107+
107108 < pre > < code class ="language-xml "> <com.hendraanggrian.appcompat.socialview.widget.SocialAutoCompleteTextView
108109 android:id="@+id/textView"
109110 android:layout_width="match_parent"
@@ -112,79 +113,83 @@ <h3>Auto-complete</h3>
112113 app:socialFlags="hyperlink"
113114 app:hyperlinkColor="@color/green"/>
114115</ code > </ pre >
115-
116+
116117 < p >
117118 To display suggestions, it is required to < code > setHashtagAdapter()</ code >
118119and < code > setMentionAdapter()</ code > .
119120 </ p >
120-
121+
121122 < pre > < code class ="language-java "> ArrayAdapter<Hashtag> hashtagAdapter = new HashtagAdapter(getContext());
122- hashtagAdapter.add(new Hashtag("follow"));
123- hashtagAdapter.add(new Hashtag("followme", 1000));
124- hashtagAdapter.add(new Hashtag("followmeorillkillyou", 500));
123+ hashtagAdapter.add(new Hashtag("yolo"));
124+ hashtagAdapter.add(new Hashtag("swag", 500));
125125textView.setHashtagAdapter(hashtagAdapter);
126126
127127ArrayAdapter<Mention> mentionAdapter = new MentionAdapter(getContext());
128- mentionAdapter.add(new Mention("dirtyhobo"));
129- mentionAdapter.add(new Mention("hobo", "Regular Hobo", R.mipmap.ic_launcher));
130- mentionAdapter.add(new Mention("hendraanggrian", "Hendra Anggrian",
131- "https://avatars0.githubusercontent.com/u/11507430?v=3&s=460"));
128+ mentionAdapter.add(new Mention("man"));
129+ mentionAdapter.add(new Mention("woman", "Alice", R.drawable.ic_person));
130+ mentionAdapter.add(
131+ new Mention(
132+ "johndoe",
133+ "John Doe",
134+ "url://to.profile",
135+ )
136+ );
132137textView.setMentionAdapter(mentionAdapter);
133138</ code > </ pre >
134-
139+
135140 < p >
136141 To customize hashtag or mention adapter, create a custom adapter using
137142customized < code > SocialAdapter</ code > or write your own < code > ArrayAdapter</ code > .
138143 </ p >
139-
144+
140145 < blockquote >
141-
146+
142147 < p > Custom adapters are experimental, see sample for example.</ p >
143-
148+
144149 </ blockquote >
145-
150+
146151 < pre > < code class ="language-java "> public class Person {
147- public final String name;
152+ public final String name;
148153
149- public Person(String name) {
150- this.name = name;
151- }
154+ public Person(String name) {
155+ this.name = name;
156+ }
152157}
153158
154159// easier
155160public class PersonAdapter extends SocialAdapter<Person> {
156- public PersonAdapter(@NonNull Context context) {
157- super(context, R.layout.item_person, R.id.textview_person);
158- }
159-
160- @Override
161- public String convertToString(Person $receiver) {
162- return $receiver.name;
163- }
164-
165- @Override
166- public View getView(int position, View convertView, @NonNull ViewGroup parent) {
167- // ...
168- }
161+ public PersonAdapter(@NonNull Context context) {
162+ super(context, R.layout.item_person, R.id.textview_person);
163+ }
164+
165+ @Override
166+ public String convertToString(Person $receiver) {
167+ return $receiver.name;
168+ }
169+
170+ @Override
171+ public View getView(int position, View convertView, @NonNull ViewGroup parent) {
172+ // ...
173+ }
169174}
170175
171176// this works too
172177public class PersonAdapter extends ArrayAdapter<Person> {
173- // your own adapter layout, view holder, data binding
174- // and of course, filtering logic
178+ // your own adapter layout, view holder, data binding
179+ // and of course, filtering logic
175180}
176181</ code > </ pre >
177-
182+
178183 < p > Then, use the custom adapter.</ p >
179-
184+
180185 < pre > < code class ="language-java "> ArrayAdapter<Person> adapter = new PersonAdapter(getContext());
181186adapter.add(personA);
182187adapter.add(personB);
183188textView.setMentionAdapter(adapter);
184189</ code > </ pre >
185-
190+
186191 < footer class ="site-footer ">
187- < span class ="site-footer-owner "> < a href ="https://github.com/hendraanggrian /socialview/ "> socialview</ a > is maintained by < a href ="https://github.com/hendraanggrian / "> Hendra Anggrian</ a > </ span > < span class ="site-footer-credits "> Hosted on GitHub Pages — Theme by < a href ="https://github.com/jasonlong/cayman-theme/ "> jasonlong</ a > </ span >
192+ < span class ="site-footer-owner "> < a href ="https://github.com/hanggrian /socialview/ "> socialview</ a > is maintained by < a href ="https://github.com/hanggrian / "> Hendra Anggrian</ a > </ span > < span class ="site-footer-credits "> Hosted on GitHub Pages — Theme by < a href ="https://github.com/jasonlong/cayman-theme/ "> jasonlong</ a > </ span >
188193 </ footer >
189194 </ section >
190195 </ body >
0 commit comments