Search in sources :

Example 26 with RelativeSizeSpan

use of android.text.style.RelativeSizeSpan in project TextJustify-Android by bluejamesbond.

the class ClickableSpanTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final DocumentView documentView = addDocumentView(new ArticleBuilder().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 JustifiedSpan(), new ClickableSpan() {

        @Override
        public void onClick(View widget) {
            Toast.makeText(ClickableSpanTest.this, "Clicked", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void updateDrawState(TextPaint ds) {
            ds.setColor(Color.parseColor("#ff05c5cf"));
            ds.setUnderlineText(true);
        }
    }).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 JustifiedSpan()), DocumentView.FORMATTED_TEXT);
    documentView.getDocumentLayoutParams().setHyphenator(SqueezeHyphenator.getInstance());
    documentView.getDocumentLayoutParams().setHyphenated(true);
}
Also used : JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) MyQuoteSpan(com.bluejamesbond.text.sample.helper.MyQuoteSpan) ArticleBuilder(com.bluejamesbond.text.util.ArticleBuilder) RelativeSizeSpan(android.text.style.RelativeSizeSpan) DocumentView(com.bluejamesbond.text.DocumentView) ClickableSpan(android.text.style.ClickableSpan) DocumentView(com.bluejamesbond.text.DocumentView) View(android.view.View) TextPaint(android.text.TextPaint)

Example 27 with RelativeSizeSpan

use of android.text.style.RelativeSizeSpan in project TextJustify-Android by bluejamesbond.

the class LeadingMarginSpan2Test method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ArticleBuilder amb = new ArticleBuilder();
    amb.append(testName, false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD), new LeftSpan());
    amb.append("<font color=0xFFC801>@levifan</font><font color=0x888888> Oct 9. 28, 2014</font>", true, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD));
    amb.append("现代计算机中内存空间都是按照byte划分的,从理论上讲似乎对任何类型的变量的访问可以从任何地址开始,<font color=0xFFC801>现代计算机中内存空间都是按照byte划分的,从理论上讲似乎对任何类型的变量的访问可以从任何地址开始</font>," + "但实际情况是在访问特定变量的时候经一定的规则在空间上排列,而不是顺序的一个接一个的排放,这就是对齐。现代计算机中内存空间都是按照byte划分的,从理论上讲似乎对任何类型的变量的访问可以从任何地址开始,但实际情况是在访问特定变量的时候" + "经一定的规则在空间上排列,而不是顺序的一个接一个的排放,这就是对齐。", false, new RelativeSizeSpan(1f), new JustifiedSpan(), new MyLeadingMarginSpan2(2, 100));
    addDocumentView(amb, DocumentView.FORMATTED_TEXT);
}
Also used : JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) LeftSpan(com.bluejamesbond.text.style.LeftSpan) StyleSpan(android.text.style.StyleSpan) ArticleBuilder(com.bluejamesbond.text.util.ArticleBuilder) RelativeSizeSpan(android.text.style.RelativeSizeSpan) MyLeadingMarginSpan2(com.bluejamesbond.text.sample.helper.MyLeadingMarginSpan2)

Example 28 with RelativeSizeSpan

use of android.text.style.RelativeSizeSpan in project TextJustify-Android by bluejamesbond.

the class MixedRTLTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addDocumentView(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), new DirectionSpan(Direction.RIGHT_TO_LEFT)).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)).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(), new DirectionSpan(Direction.RIGHT_TO_LEFT)).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(1f), new RightSpan(), new DirectionSpan(Direction.RIGHT_TO_LEFT)).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 JustifiedSpan(), new StyleSpan(Typeface.ITALIC)).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(), new StyleSpan(Typeface.ITALIC)).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.”", false, new RelativeSizeSpan(1f), new JustifiedSpan()), DocumentView.FORMATTED_TEXT);
}
Also used : DirectionSpan(com.bluejamesbond.text.style.DirectionSpan) JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) LeftSpan(com.bluejamesbond.text.style.LeftSpan) StyleSpan(android.text.style.StyleSpan) ArticleBuilder(com.bluejamesbond.text.util.ArticleBuilder) RelativeSizeSpan(android.text.style.RelativeSizeSpan) RightSpan(com.bluejamesbond.text.style.RightSpan)

Example 29 with RelativeSizeSpan

use of android.text.style.RelativeSizeSpan in project TextJustify-Android by bluejamesbond.

the class QuoteSpanTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addDocumentView(new ArticleBuilder().append(testName, false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD), new LeftSpan()).append("<font color=0xFFC801>Jon Brodkin</font><font color=0x888888> Oct. 28, 2014</font>", true, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD)).append("But now we have more numbers on the performance declines, thanks to a new report from the Measurement Lab Consortium (M-Lab). M-Lab hosts measuring equipment at Internet exchange points to analyze connections between network operators and has more than five years' worth of measurements. A report released today examines connections between consumer Internet service providers (\"Access ISPs\" in M-Lab parlance) and backbone operators (\"Transit ISPs\"), including the ones that sent traffic from Netflix to ISPs while the money fights were still going on.", true, new RelativeSizeSpan(0.8f), new JustifiedSpan(), new MyQuoteSpan(0xFFFFC801, 2, 50), new StyleSpan(Typeface.ITALIC), new ForegroundColorSpan(0xFF555555)).append("Using Measurement Lab (M-Lab) data, and constraining our research to the United States, we observed sustained performance degradation experienced by customers of Access ISPs AT&T, Comcast, CenturyLink, Time Warner Cable, and Verizon when their traffic passed over interconnections with Transit ISPs Cogent Communications (Cogent), Level 3 Communications (Level 3), and XO Communications (XO),\" researchers wrote. \"In a large number of cases we observed similar patterns of performance degradation whenever and wherever specific pairs of Access/Transit ISPs interconnected. From this we conclude that ISP interconnection has a substantial impact on consumer internet performance—sometimes a severely negative impact—and that business relationships between ISPs, and not major technical problems, are at the root of the problems we observed.", true, new RelativeSizeSpan(1f), new JustifiedSpan()).append("Using Measurement Lab (M-Lab) data, and constraining our research to the United States, we observed sustained performance degradation experienced by customers of Access ISPs AT&T, Comcast, CenturyLink, Time Warner Cable, and Verizon when their traffic passed over interconnections with Transit ISPs Cogent Communications (Cogent), Level 3 Communications (Level 3), and XO Communications (XO),\" researchers wrote. \"In a large number of cases we observed similar patterns of performance degradation whenever and wherever specific pairs of Access/Transit ISPs interconnected. From this we conclude that ISP interconnection has a substantial impact on consumer internet performance—sometimes a severely negative impact—and that business relationships between ISPs, and not major technical problems, are at the root of the problems we observed.", false, new RelativeSizeSpan(0.8f), new RightSpan(), new MyQuoteSpan(0xFFFFC801, 2, 50), new StyleSpan(Typeface.ITALIC), new ForegroundColorSpan(0xFF555555)), DocumentView.FORMATTED_TEXT);
}
Also used : JustifiedSpan(com.bluejamesbond.text.style.JustifiedSpan) ForegroundColorSpan(android.text.style.ForegroundColorSpan) 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) RightSpan(com.bluejamesbond.text.style.RightSpan)

Example 30 with RelativeSizeSpan

use of android.text.style.RelativeSizeSpan 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)63 StyleSpan (android.text.style.StyleSpan)32 ForegroundColorSpan (android.text.style.ForegroundColorSpan)21 SpannableString (android.text.SpannableString)18 SpannableStringBuilder (android.text.SpannableStringBuilder)17 CharacterStyle (android.text.style.CharacterStyle)16 AbsoluteSizeSpan (android.text.style.AbsoluteSizeSpan)10 SuperscriptSpan (android.text.style.SuperscriptSpan)10 TypefaceSpan (android.text.style.TypefaceSpan)10 JustifiedSpan (com.bluejamesbond.text.style.JustifiedSpan)9 ArticleBuilder (com.bluejamesbond.text.util.ArticleBuilder)9 SubscriptSpan (android.text.style.SubscriptSpan)8 ImageSpan (android.text.style.ImageSpan)7 StrikethroughSpan (android.text.style.StrikethroughSpan)7 UnderlineSpan (android.text.style.UnderlineSpan)7 LeftSpan (com.bluejamesbond.text.style.LeftSpan)7 SimpleDateFormat (java.text.SimpleDateFormat)7 Context (android.content.Context)6 BackgroundColorSpan (android.text.style.BackgroundColorSpan)6 MyQuoteSpan (com.bluejamesbond.text.sample.helper.MyQuoteSpan)6