-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
106 changed files
with
898 additions
and
3,674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,191 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en-us"> | ||
<head> | ||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<meta charset="utf-8"> | ||
<title>socialview</title> | ||
<meta content="width=device-width, initial-scale=1" name="viewport"> | ||
<meta content="#159957" name="theme-color"> | ||
<link href="styles/main.css" rel="stylesheet"> | ||
<link href="styles/dark.css" rel="stylesheet"> | ||
<link href="styles/normalize.css" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet"> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet"> | ||
<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> | ||
<!--Primary meta tags--> | ||
<meta content="socialview" name="title"> | ||
<meta content="Android TextView and EditText with hashtag, mention, and hyperlink support" name="description"> | ||
</head> | ||
<body> | ||
<section class="page-header"> | ||
<h1 class="project-name">socialview</h1> | ||
<h2 class="project-tagline">Android TextView and EditText with hashtag, mention, and hyperlink support</h2> | ||
</section> | ||
<section class="main-content"> | ||
<p> | ||
<a href="https://travis-ci.com/github/hendraanggrian/socialview/"><img alt="Travis CI" src="https://img.shields.io/travis/com/hendraanggrian/socialview"></a> | ||
<a href="https://codecov.io/gh/hendraanggrian/socialview/"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/hendraanggrian/socialview"></a> | ||
<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> | ||
<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> | ||
<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> | ||
</p> | ||
|
||
<h1>SocialView</h1> | ||
|
||
<p> | ||
<img alt="Hashtag preview." src="https://github.com/hendraanggrian/socialview/raw/assets/preview_hashtag.png"> | ||
<img alt="Mention preview." src="https://github.com/hendraanggrian/socialview/raw/assets/preview_mention.png"> | ||
</p> | ||
|
||
<p>TextView and EditText with hashtag, mention, and hyperlink support.</p> | ||
|
||
<ul> | ||
|
||
<li>Pre-loaded with default views, but also installable to any custom view.</li> | ||
|
||
<li>Display hashtag and mention suggestions as you type.</li> | ||
|
||
</ul> | ||
|
||
<h2>Download</h2> | ||
|
||
<pre><code class="language-gradle">repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
// base widgets | ||
implementation "com.hendraanggrian.appcompat:socialview:$version" | ||
|
||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>SocialView Javadoc</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="https://github.com/hendraanggrian/socialview">GitHub</a><br/> | ||
<br/> | ||
<p>Welcome to SocialView Javadoc!</p> | ||
<h3>Libraries</h3> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<p><a href="socialview-core/index.html">socialview-core</a></p> | ||
</td> | ||
<td> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<p><a href="socialview-commons/index.html">socialview-commons</a></p> | ||
</td> | ||
<td> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</BODY> | ||
</HTML> | ||
// auto-complete widgets | ||
implementation "com.hendraanggrian.appcompat:socialview-autocomplete:$version" | ||
} | ||
</code></pre> | ||
|
||
<h2>Usage</h2> | ||
|
||
<h3>Core</h3> | ||
|
||
<p> | ||
Core library contains <code>SocialTextView</code>, <code>SocialEditText</code> and helper class | ||
applies these behavior into any <code>TextView</code>. | ||
</p> | ||
|
||
<pre><code class="language-xml"><com.hendraanggrian.appcompat.socialview.widget.SocialTextView | ||
android:id="@+id/textView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="#hashtag and @mention." | ||
app:socialFlags="hashtag|mention" | ||
app:hashtagColor="@color/blue" | ||
app:mentionColor="@color/red"/> | ||
</code></pre> | ||
|
||
<p> | ||
See <a href="https://github.com/HendraAnggrian/socialview/blob/master/socialview/res/values/attrs.xml">attrs.xml</a> | ||
for full list of available attributes. | ||
</p> | ||
|
||
<p>Modify its state and set listeners programmatically.</p> | ||
|
||
<pre><code class="language-java">textView.setMentionEnabled(false); | ||
textView.setHashtagColor(Color.RED); | ||
textView.setOnHashtagClickListener(new SocialView.OnClickListener() { | ||
@Override | ||
public void invoke(SocialView socialView, String s) { | ||
// do something | ||
} | ||
}); | ||
</code></pre> | ||
|
||
<h3>Auto-complete</h3> | ||
|
||
<p> | ||
Extended library comes with <code>SocialAutoCompleteTextView</code>. | ||
</p> | ||
|
||
<pre><code class="language-xml"><com.hendraanggrian.appcompat.socialview.widget.SocialAutoCompleteTextView | ||
android:id="@+id/textView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="What's on your mind?" | ||
app:socialFlags="hyperlink" | ||
app:hyperlinkColor="@color/green"/> | ||
</code></pre> | ||
|
||
<p> | ||
To display suggestions, it is required to <code>setHashtagAdapter()</code> | ||
and <code>setMentionAdapter()</code>. | ||
</p> | ||
|
||
<pre><code class="language-java">ArrayAdapter<Hashtag> hashtagAdapter = new HashtagAdapter(getContext()); | ||
hashtagAdapter.add(new Hashtag("follow")); | ||
hashtagAdapter.add(new Hashtag("followme", 1000)); | ||
hashtagAdapter.add(new Hashtag("followmeorillkillyou", 500)); | ||
textView.setHashtagAdapter(hashtagAdapter); | ||
|
||
ArrayAdapter<Mention> mentionAdapter = new MentionAdapter(getContext()); | ||
mentionAdapter.add(new Mention("dirtyhobo")); | ||
mentionAdapter.add(new Mention("hobo", "Regular Hobo", R.mipmap.ic_launcher)); | ||
mentionAdapter.add(new Mention("hendraanggrian", "Hendra Anggrian", | ||
"https://avatars0.githubusercontent.com/u/11507430?v=3&s=460")); | ||
textView.setMentionAdapter(mentionAdapter); | ||
</code></pre> | ||
|
||
<p> | ||
To customize hashtag or mention adapter, create a custom adapter using | ||
customized <code>SocialAdapter</code> or write your own <code>ArrayAdapter</code>. | ||
</p> | ||
|
||
<blockquote> | ||
|
||
<p>Custom adapters are experimental, see sample for example.</p> | ||
|
||
</blockquote> | ||
|
||
<pre><code class="language-java">public class Person { | ||
public final String name; | ||
|
||
public Person(String name) { | ||
this.name = name; | ||
} | ||
} | ||
|
||
// easier | ||
public class PersonAdapter extends SocialAdapter<Person> { | ||
public PersonAdapter(@NonNull Context context) { | ||
super(context, R.layout.item_person, R.id.textview_person); | ||
} | ||
|
||
@Override | ||
public String convertToString(Person $receiver) { | ||
return $receiver.name; | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, @NonNull ViewGroup parent) { | ||
// ... | ||
} | ||
} | ||
|
||
// this works too | ||
public class PersonAdapter extends ArrayAdapter<Person> { | ||
// your own adapter layout, view holder, data binding | ||
// and of course, filtering logic | ||
} | ||
</code></pre> | ||
|
||
<p>Then, use the custom adapter.</p> | ||
|
||
<pre><code class="language-java">ArrayAdapter<Person> adapter = new PersonAdapter(getContext()); | ||
adapter.add(personA); | ||
adapter.add(personB); | ||
textView.setMentionAdapter(adapter); | ||
</code></pre> | ||
|
||
<footer class="site-footer"> | ||
<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> | ||
</footer> | ||
</section> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
socialview-commons/com.hendraanggrian.appcompat.socialview/-hashtag/-init-.html
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
socialview-commons/com.hendraanggrian.appcompat.socialview/-hashtag/count.html
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
socialview-commons/com.hendraanggrian.appcompat.socialview/-hashtag/equals.html
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
socialview-commons/com.hendraanggrian.appcompat.socialview/-hashtag/hash-code.html
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
socialview-commons/com.hendraanggrian.appcompat.socialview/-hashtag/hashtag.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.