Comments (16)
@samsoft00 Your code seems correct. The latest version of the build has not been pushed to maven yet. You are still using a rather beta edition. There is in fact a bug with the library. It has been fixed. I will push it in momentarily. Thank you for spotting it and I apologize for the problem
from textjustify-android.
Use version 2.0.3. Please look at the samples before you use it. There are some modifications done in order to address previous bugs. Let me know if issues persist.
from textjustify-android.
Use version 2.0.4. Let me know if you still have any issues.
from textjustify-android.
No Crashing again but no text display -> DocumentView documentView = new DocumentView(getActivity(), R.id.instruction);
Please help, I'm using fragment layout..
from textjustify-android.
Provide some code
—
Sent from Mailbox
On Thu, Jan 15, 2015 at 2:53 AM, Oyewole S. Abayomi
[email protected] wrote:
No Crashing again but no text display -> DocumentView documentView = new DocumentView(getActivity(), R.id.instruction);
Please help, I'm using fragment layout..
Reply to this email directly or view it on GitHub:
#53 (comment)
from textjustify-android.
Here is my code
public class StartRegistrationFragment extends Fragment {
private static final String ARG_KEY = "key";
private PageFragmentCallbacks mCallbacks;
private String mKey;
private StartRegistrationActivity mPage;
DocumentView mDocumentView;
ArticleBuilder a;
public static StartRegistrationFragment create(String key) {
Bundle args = new Bundle();
args.putString(ARG_KEY, key);
StartRegistrationFragment fragment = new StartRegistrationFragment();
fragment.setArguments(args);
return fragment;
}
public StartRegistrationFragment(){}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
mKey = args.getString(ARG_KEY);
mPage = (StartRegistrationActivity) mCallbacks.onGetPage(mKey);
a = new ArticleBuilder();
a.append("WHO: Ebola Cases",
false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD))
.append("<font color=0xFFC801>Sam Frizell</font><font color=0x888888> @Sam_Frizell Oct. 25, 2014</font>",
false, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD))
.append("In New York and New Jersey, governors Andrew Cuomo and Chris Christie have implemented controversial quarantines on all healthcare workers returning from West Africa after a doctor returning from Guinea contracted the disease and was diagnosed in New York.",
true, new RelativeSizeSpan(1f), new JustifiedSpan());
DocumentView documentView = new DocumentView(getActivity(), R.id.instruction); // Support spanned text
documentView.setText(a); // Set to `true` to enable justification
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_start_registration, container, false);
((TextView) rootView.findViewById(android.R.id.title)).setText(mPage.getTitle());
//mDocumentView = (DocumentView) rootView.findViewById(R.id.instruction);
return rootView;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (!(activity instanceof PageFragmentCallbacks)) {
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
}
mCallbacks = (PageFragmentCallbacks) activity;
}
@Override
public void onDetach() {
super.onDetach();
mCallbacks = null;
}
}
from textjustify-android.
This is my view
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:document="http://schemas.android.com/apk/res-auto"
style="@style/WizardPageContainer"
android:orientation="vertical">
<TextView style="@style/WizardPageTitle" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/review_icon"
android:layout_gravity="center"
android:padding="10dp"/>
<LinearLayout
android:id="@+id/discription_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:padding="10dp">
<com.bluejamesbond.text.DocumentView
android:id="@+id/instruction"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
from textjustify-android.
Your did not add DocumentView to a parent layout
from textjustify-android.
@bluejamesbond DocumentView to a parent layout? where and how?
from textjustify-android.
findViewById(R.id.desriptionWrapper).addView(documentView)
from textjustify-android.
@bluejamesbond i'm sorry, this is getting confused...
This is reference to my layout==>
DocumentView mDocumentView = (DocumentView) rootView.findViewById(R.id.instruction);
Where i'm going to reference it here ==>
DocumentView documentView = new DocumentView(getActivity(), R.id.instruction);
documentView.setText(articleBuilder);
can you help me with sample code!
Thanks!
from textjustify-android.
https://gist.github.com/bluejamesbond/32d73923b9f67dc07639
from textjustify-android.
Thanks, it work now but i move the code to onResume()
@Override
public void onResume() {
super.onResume();
a = new ArticleBuilder();
a.append("WHO: Ebola Cases",
false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD))
.append("<font color=0xFFC801>Sam Frizell</font><font color=0x888888> @Sam_Frizell Oct. 25, 2014</font>",
false, new RelativeSizeSpan(0.8f), new StyleSpan(Typeface.BOLD))
.append("In New York and New Jersey, governors Andrew Cuomo and Chris Christie have implemented controversial quarantines on all healthcare workers returning from West Africa after a doctor returning from Guinea contracted the disease and was diagnosed in New York.",
true, new RelativeSizeSpan(1f), new JustifiedSpan());
DocumentView documentView = new DocumentView(getActivity(), DocumentView.FORMATTED_TEXT); // Support spanned text
documentView.setText(a); // Set to `true` to enable justification
(mLayout).addView(documentView);
}
Thanks
from textjustify-android.
@samsoft00 I don't believe you are supposed to put it in onResume as per Android contract.
from textjustify-android.
@bluejamesbond it crashed when i put it onCreate, remember this is fragment. Also, question. how do i reset the textSize!
from textjustify-android.
I think dere's alot to amend, i later discovered that the article is not fully loaded, only first append contents.. Check code
a = new ArticleBuilder();
a.append("BluSlate Study Studio",
false, new RelativeSizeSpan(2f), new StyleSpan(Typeface.BOLD))
.append("The Blue Slate Study Studio is our flagship education solution where the art of teaching, the joy of learning and the proactive anticipation of exams – all co-exist in harmony to produce a positive and gratifying learning experience. The Study Studio application is made of multiple Study Booths. A Study Booth caters exclusively for a course as follows: Course No., Course Name, Course Material, Slide Presentations, Practice Exams, Course Notes and Course Information.",
true, new RelativeSizeSpan(1f), new JustifiedSpan())
.append("<font color=0xFFC801>Course No. Tab:</font> (the first tab) lists the course identifier – e.g. CSC 101.",
true, new RelativeSizeSpan(1f), new JustifiedSpan())
.append("<font color=0xFFC801>Course Name Tab:</font> (the second tab) lists the full name of the course.",
true, new RelativeSizeSpan(1f), new LeftSpan())
.append("<font color=0xFFC801>Course Material Tab: </font> opens up an e-book containing lecture materials content.",
true, new RelativeSizeSpan(1f), new LeftSpan())
.append("<font color=0xFFC801>Slide Presentation Tab: </font> opens into a Power point Slide presentation prepared by lecturer.",
true, new RelativeSizeSpan(1f), new LeftSpan())
.append("<font color=0xFFC801>Practice Exam Tab: </font> opens up to CBC’s Practezer App with content made up of previous sessions exams, answers and correct model solutions. The students can practice in an ad-hoc manner (random questions, untimed) or actually sit for a previous exam (timed). For each question, the student can click a button to see the correct answer, and click another button to get a detailed model solution.",
true, new RelativeSizeSpan(1f), new LeftSpan())
.append("<font color=0xFFC801>Course Notes Tab: </font> opens up a Word document where the student can keep personal notes on the course..",
true, new RelativeSizeSpan(1f), new LeftSpan())
.append("<font color=0xFFC801>Course Info Tab: </font> opens up to general information on the course such as course content, prerequisites, lecturers, as well as the schedule of lectures and labs for the course.",
true, new RelativeSizeSpan(1f), new LeftSpan())
.append("PLEASE NOTE THAT YOU WILL NEED INTERNET ACCESS FOR <font color=0xFFC801>REGISTRATION</font> FOR YOUR FIRST LOGIN",
true, new RelativeSizeSpan(1f), new LeftSpan());
DocumentView documentView = new DocumentView(getActivity(), DocumentView.FORMATTED_TEXT); // Support spanned text
documentView.setText(a);
(mLayout).addView(documentView);
from textjustify-android.
Related Issues (20)
- How to set RTL for Arabic Text
- Extra space in AlertDialog
- max line limit HOT 1
- com.bluejamesbond.text.StringDocumentLayout$PlainDocumentException: Cannot fit word(s) into one line. Font size too large? HOT 2
- is Html text Support ?
- bug java.lang.IllegalArgumentException:
- How to change the text size? HOT 3
- java.lang.IndexOutOfBoundsException HOT 2
- Crash on Android 7.X
- DocumentViews in LinearLayout and EventListeners
- Background Color does not change with Spannables, please help.
- DocumentView has a problem with ExpandableListView
- RTL supprot for documentView_textFormat="plain"
- Broken on API 21 when change portrait to landscape positions
- Hyphenate license
- Image Span test does not work
- Report crash .onMeasure
- How to use android:ellipsize="end" attributes????
- bug: java.lang.IllegalArgumentException: width and height must be > 0
- onClick in Clickablespan is not work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textjustify-android.