Search in sources :

Example 1 with CenterSpan

use of com.bluejamesbond.text.style.CenterSpan in project TextJustify-Android by bluejamesbond.

the class ImageSpanTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ArticleBuilder ab = new ArticleBuilder().append(testName, false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD), new LeftSpan()).append("<font color=0xFFC801>Justin Worland</font><font color=0x888888> @justinworland  Oct. 25, 2014</font>", false, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD)).append("<font color=0x888888>Updated: Oct. 25, 2014 2:34 PM</font>".toUpperCase(), true, new RelativeSizeSpan(0.6f), new StyleSpan(Typeface.BOLD)).append("State health department staff will be on the ground at state airports", true, new RelativeSizeSpan(1.2f), new StyleSpan(Typeface.BOLD), new StyleSpan(Typeface.ITALIC));
    for (int i = 0; i < 1; i++) ab.append("Healthcare workers returning to New York or New Jersey after treating Ebola patients in West Africa will be placed under a mandatory quarantine, officials announced Friday, one day after a Doctors Without Borders doctor was diagnosed with the virus in New York City. Illinois announced a similar policy Saturday, meaning it will be enforced in states with three of the five airports through which passengers traveling from the Ebola-stricken West African countries must enter the United States.", true, new RelativeSizeSpan(1f), new JustifiedSpan()).append("N.J. Gov. Chris Christie and N.Y. Gov. Andrew Cuomo made the announcement as part of a broader procedural plan to help protect the densely packed, highly populated area from any further spread of the disease.", true, new RelativeSizeSpan(0.8f), new JustifiedSpan(), new MyQuoteSpan(0xFFFFC801)).append("“Since taking office, I have erred on the side of caution when it comes to the safety and protection of New Yorkers, and the current situation regarding Ebola will be no different,” Gov. Cuomo said. “The steps New York and New Jersey are taking today will strengthen our safeguards to protect our residents against this disease and help ensure those that may be infected by Ebola are treated with the highest precautions.”", true, new RelativeSizeSpan(1f), new CenterSpan(), new ImageSpan(getResources().getDrawable(R.drawable.ic_launcher), ImageSpan.ALIGN_BASELINE));
    addDocumentView(ab, DocumentView.FORMATTED_TEXT);
}
Also used : JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) LeftSpan(com.bluejamesbond.text.style.LeftSpan) StyleSpan(android.text.style.StyleSpan) MyQuoteSpan(com.bluejamesbond.text.sample.helper.MyQuoteSpan) ArticleBuilder(com.bluejamesbond.text.util.ArticleBuilder) RelativeSizeSpan(android.text.style.RelativeSizeSpan) CenterSpan(com.bluejamesbond.text.style.CenterSpan) ImageSpan(android.text.style.ImageSpan)

Example 2 with CenterSpan

use of com.bluejamesbond.text.style.CenterSpan in project TextJustify-Android by bluejamesbond.

the class LongFormattedTextTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ArticleBuilder ab = new ArticleBuilder().append(testName, false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD), new LeftSpan()).append("<font color=0xFFC801>Justin Worland</font><font color=0x888888> @justinworland  Oct. 25, 2014</font>", false, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD)).append("<font color=0x888888>Updated: Oct. 25, 2014 2:34 PM</font>".toUpperCase(), true, new RelativeSizeSpan(0.6f), new StyleSpan(Typeface.BOLD)).append("State health department staff will be on the ground at state airports", true, new RelativeSizeSpan(1.2f), new StyleSpan(Typeface.BOLD), new StyleSpan(Typeface.ITALIC));
    for (int i = 0; i < 15; i++) ab.append("Healthcare workers returning to New York or New Jersey after treating Ebola patients in West Africa will be placed under a mandatory quarantine, officials announced Friday, one day after a Doctors Without Borders doctor was diagnosed with the virus in New York City. Illinois announced a similar policy Saturday, meaning it will be enforced in states with three of the five airports through which passengers traveling from the Ebola-stricken West African countries must enter the United States.", true, new RelativeSizeSpan(1f), new JustifiedSpan()).append("N.J. Gov. Chris Christie and N.Y. Gov. Andrew Cuomo made the announcement as part of a broader procedural plan to help protect the densely packed, highly populated area from any further spread of the disease.", true, new RelativeSizeSpan(0.8f), new JustifiedSpan(), new MyQuoteSpan(0xFFFFC801)).append("“Since taking office, I have erred on the side of caution when it comes to the safety and protection of New Yorkers, and the current situation regarding Ebola will be no different,” Gov. Cuomo said. “The steps New York and New Jersey are taking today will strengthen our safeguards to protect our residents against this disease and help ensure those that may be infected by Ebola are treated with the highest precautions.”", true, new RelativeSizeSpan(1f), new CenterSpan()).append("New York and New Jersey state health department staff will be present on the ground at John F. Kennedy International Airport in New York and Newark Liberty Airport in New Jersey. In addition to implementing the mandatory quarantine of health care workers and others who had direct contact with Ebola patients, health department officials in each state will determine whether others should travelers should be hospitalized or quarantined.", true, new RelativeSizeSpan(1f), new JustifiedSpan()).append("“The announcements mark a dramatic escalation in measures designed to prevent the spread of Ebola in the United States. Previously, only individuals with symptoms of Ebola would be quarantined upon entry to the U.S. under a federal rule from the Centers for Diseases Control and the Department of Homeland Security.”", true, new RelativeSizeSpan(1f), new RightSpan());
    addDocumentView(ab, DocumentView.FORMATTED_TEXT);
}
Also used : JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) LeftSpan(com.bluejamesbond.text.style.LeftSpan) StyleSpan(android.text.style.StyleSpan) MyQuoteSpan(com.bluejamesbond.text.sample.helper.MyQuoteSpan) ArticleBuilder(com.bluejamesbond.text.util.ArticleBuilder) RelativeSizeSpan(android.text.style.RelativeSizeSpan) CenterSpan(com.bluejamesbond.text.style.CenterSpan) RightSpan(com.bluejamesbond.text.style.RightSpan)

Example 3 with CenterSpan

use of com.bluejamesbond.text.style.CenterSpan in project TextJustify-Android by bluejamesbond.

the class ShortFormattedTextTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ArticleBuilder ab = new ArticleBuilder().append(testName, false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD), new LeftSpan()).append("<font color=0xFFC801>Justin Worland</font><font color=0x888888> @justinworland  Oct. 25, 2014</font>", false, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD)).append("<font color=0x888888>Updated: Oct. 25, 2014 2:34 PM</font>".toUpperCase(), true, new RelativeSizeSpan(0.6f), new StyleSpan(Typeface.BOLD)).append("State health department staff will be on the ground at state airports", true, new RelativeSizeSpan(1.2f), new StyleSpan(Typeface.BOLD), new StyleSpan(Typeface.ITALIC));
    for (int i = 0; i < 1; i++) ab.append("Healthcare workers returning to New York or New Jersey after treating Ebola patients in West Africa will be placed under a mandatory quarantine, officials announced Friday, one day after a Doctors Without Borders doctor was diagnosed with the virus in New York City. Illinois announced a similar policy Saturday, meaning it will be enforced in states with three of the five airports through which passengers traveling from the Ebola-stricken West African countries must enter the United States.", true, new RelativeSizeSpan(1f), new JustifiedSpan()).append("N.J. Gov. Chris Christie and N.Y. Gov. Andrew Cuomo made the announcement as part of a broader procedural plan to help protect the densely packed, highly populated area from any further spread of the disease.", true, new RelativeSizeSpan(0.8f), new JustifiedSpan(), new MyQuoteSpan(0xFFFFC801)).append("“Since taking office, I have erred on the side of caution when it comes to the safety and protection of New Yorkers, and the current situation regarding Ebola will be no different,” Gov. Cuomo said. “The steps New York and New Jersey are taking today will strengthen our safeguards to protect our residents against this disease and help ensure those that may be infected by Ebola are treated with the highest precautions.”", true, new RelativeSizeSpan(1f), new CenterSpan());
    addDocumentView(ab, DocumentView.FORMATTED_TEXT);
}
Also used : JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) LeftSpan(com.bluejamesbond.text.style.LeftSpan) StyleSpan(android.text.style.StyleSpan) MyQuoteSpan(com.bluejamesbond.text.sample.helper.MyQuoteSpan) ArticleBuilder(com.bluejamesbond.text.util.ArticleBuilder) RelativeSizeSpan(android.text.style.RelativeSizeSpan) CenterSpan(com.bluejamesbond.text.style.CenterSpan)

Aggregations

RelativeSizeSpan (android.text.style.RelativeSizeSpan)3 StyleSpan (android.text.style.StyleSpan)3 MyQuoteSpan (com.bluejamesbond.text.sample.helper.MyQuoteSpan)3 CenterSpan (com.bluejamesbond.text.style.CenterSpan)3 JustifiedSpan (com.bluejamesbond.text.style.JustifiedSpan)3 LeftSpan (com.bluejamesbond.text.style.LeftSpan)3 ArticleBuilder (com.bluejamesbond.text.util.ArticleBuilder)3 ImageSpan (android.text.style.ImageSpan)1 RightSpan (com.bluejamesbond.text.style.RightSpan)1