本文整理汇总了Java中org.sufficientlysecure.htmltextview.HtmlTextView类的典型用法代码示例。如果您正苦于以下问题:Java HtmlTextView类的具体用法?Java HtmlTextView怎么用?Java HtmlTextView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HtmlTextView类属于org.sufficientlysecure.htmltextview包,在下文中一共展示了HtmlTextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public void initialize(ViewHolder holder, int position) {
CourseDetailModel model = list.get(position);
holder.title.setText(model.title);
if (TextUtils.isEmpty(model.summary)) {
holder.summary.setVisibility(HtmlTextView.GONE);
} else {
holder.summary.setVisibility(HtmlTextView.VISIBLE);
holder.summary.setHtml(model.summary, new HtmlHttpImageGetter(holder.summary));
}
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(holder.itemView.getContext());
holder.content.setLayoutManager(layoutManager);
holder.content.setItemAnimator(new DefaultItemAnimator());
holder.content.setAdapter(new CourseDetailInnerRecyclerViewAdapter(model.courseDetailInnerModels()));
}
示例2: onPostExecute
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
protected void onPostExecute(Drawable result) {
if (result == null) {
Log.w(HtmlTextView.TAG, "Drawable result is null! (source: " + source + ")");
return;
}
final UrlDrawable urlDrawable = drawableReference.get();
if (urlDrawable == null) {
return;
}
// set the correct bound according to the result from HTTP call
urlDrawable.setBounds(0, 0, (int) (result.getIntrinsicWidth() * scale), (int) (result.getIntrinsicHeight() * scale));
// change the reference of the current drawable to the result from the HTTP call
urlDrawable.drawable = result;
final MyHtmlHttpImageGetter imageGetter = imageGetterReference.get();
if (imageGetter == null) {
return;
}
// redraw the image by invalidating the container
imageGetter.container.invalidate();
// re-set text to fix images overlapping text
imageGetter.container.setText(imageGetter.container.getText());
}
示例3: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_station_trivia, container, false);
IntentFilter filter = new IntentFilter();
filter.addAction(StationActivity.ACTION_MAIN_SERVICE_BOUND);
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext());
bm.registerReceiver(mBroadcastReceiver, filter);
triviaView = (HtmlTextView) view.findViewById(R.id.trivia_view);
triviaView.setHtml(getString(R.string.status_loading));
update();
return view;
}
示例4: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setUpActivity(getString(R.string.frag_help_title), R.id.nav_help, false, false);
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_help, container, false);
htmltv = (HtmlTextView) view.findViewById(R.id.html_view);
if (getArguments() != null && getArguments().containsKey(ARG_PAGE)) {
setHtmlFromHelpFile(getArguments().getString(ARG_PAGE));
} else {
setHtmlFromHelpFile("index");
}
return view;
}
示例5: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home_stats, container, false);
Context context = view.getContext();
lineStatsLayout = (TableLayout) view.findViewById(R.id.line_stats_layout);
progressBar = (ProgressBar) view.findViewById(R.id.loading_indicator);
lastDisturbanceView = (HtmlTextView) view.findViewById(R.id.last_disturbance_view);
progressBar.setVisibility(View.VISIBLE);
updateInformationView = (TextView) view.findViewById(R.id.update_information);
IntentFilter filter = new IntentFilter();
filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
filter.addAction(StatsCache.ACTION_STATS_UPDATE_STARTED);
filter.addAction(StatsCache.ACTION_STATS_UPDATE_SUCCESS);
filter.addAction(StatsCache.ACTION_STATS_UPDATE_FAILED);
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
bm.registerReceiver(mBroadcastReceiver, filter);
redraw(context);
return view;
}
示例6: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_changelog, container, false);
HtmlTextView changelogText = (HtmlTextView) view.findViewById(R.id.changelogText);
try {
String html = new Markdown4jProcessor().process(
getActivity().getResources().openRawResource(R.raw.changelog));
changelogText.setHtml(html, new HtmlResImageGetter(changelogText));
} catch (IOException e) {
Log.e("UniPatcher", "IOException", e);
}
return view;
}
示例7: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_about, container, false);
TextView versionText = (TextView) view.findViewById(R.id.versionText);
versionText.setText(getString(R.string.help_activity_about_tab_version, Utils.getAppVersion(getActivity())));
HtmlTextView aboutText = (HtmlTextView) view.findViewById(R.id.aboutText);
try {
String html = new Markdown4jProcessor().process(
getActivity().getResources().openRawResource(R.raw.about));
aboutText.setHtml(html, new HtmlResImageGetter(aboutText));
} catch (IOException e) {
Log.e("UniPatcher", "IOException", e);
}
return view;
}
示例8: createHtmlInfoDialog
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
private static AlertDialog createHtmlInfoDialog(Context context, int titleId, Integer messageId, String message, boolean largeText, boolean textIsSelectable) {
if (messageId == null && message == null)
throw new IllegalArgumentException("MessageId or message values is required");
AlertDialog.Builder builder = new AlertDialog.Builder(context);
LayoutInflater inflater = LayoutInflater.from(context);
View dialogLayout = inflater.inflate(R.layout.html_information_dialog, null);
builder.setView(dialogLayout);
builder.setPositiveButton(R.string.dialog_ok, null);
builder.setTitle(titleId);
HtmlTextView messageView = (HtmlTextView) dialogLayout.findViewById(R.id.html_info_dialog_textview);
messageView.setTextAppearance(context, (largeText ? android.R.style.TextAppearance_Medium : android.R.style.TextAppearance_Small));
if (messageId != null) {
messageView.setHtml(messageId, new HtmlResImageGetter(messageView));
} else {
messageView.setHtml(message, new HtmlResImageGetter(messageView));
}
// don't move above settings content because it won't work
messageView.setTextIsSelectable(textIsSelectable);
AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
return dialog;
}
示例9: FeaturedRegionCard
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
public FeaturedRegionCard(View itemView) {
super(itemView);
header = (RelativeLayout) itemView.findViewById(R.id.card_world_featured_header_container);
regionName = (TextView) itemView.findViewById(R.id.card_world_featured_region_name);
nationCount = (TextView) itemView.findViewById(R.id.card_world_featured_nation_count);
flag = (ImageView) itemView.findViewById(R.id.card_world_featured_flag);
waDelegate = (TextView) itemView.findViewById(R.id.card_world_featured_wa);
founder = (TextView) itemView.findViewById(R.id.card_world_featured_founder);
factbookHolder = (LinearLayout) itemView.findViewById(R.id.card_world_featured_factbook_holder);
factbook = (HtmlTextView) itemView.findViewById(R.id.card_world_featured_factbook);
tags = (TextView) itemView.findViewById(R.id.card_world_featured_tags);
visitButton = (LinearLayout) itemView.findViewById(R.id.card_world_featured_region_button_holder);
visitText = (TextView) itemView.findViewById(R.id.card_world_featured_region_button_name);
}
示例10: setStyledTextView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
/**
* Helper used for setting and styling an HTML string into a TextView.
* @param c App context
* @param t Target TextView
* @param holder Content
*/
public static void setStyledTextView(Context c, TextView t, String holder) {
if (t instanceof HtmlTextView) {
try {
((HtmlTextView)t).setHtml(holder);
}
catch(Exception e) {
logError(e.toString());
logError(holder);
t.setText(c.getString(R.string.bbcode_parse_error));
t.setTypeface(t.getTypeface(), Typeface.ITALIC);
}
}
else {
t.setText(fromHtml(holder));
}
styleLinkifiedTextView(c, t);
}
示例11: styleLinkifiedTextView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
/**
* Stylify text view to primary colour and no underline
* @param c App context
* @param t TextView
*/
public static void styleLinkifiedTextView(Context c, TextView t) {
// Get individual spans and replace them with clickable ones.
Spannable s = new SpannableString(t.getText());
URLSpan[] spans = s.getSpans(0, s.length(), URLSpan.class);
for (URLSpan span: spans) {
int start = s.getSpanStart(span);
int end = s.getSpanEnd(span);
s.removeSpan(span);
span = new URLSpanNoUnderline(c, span.getURL());
s.setSpan(span, start, end, 0);
}
t.setText(s);
// Need to set this to allow for clickable TextView links.
if (!(t instanceof HtmlTextView)) {
t.setMovementMethod(LinkMovementMethod.getInstance());
t.setLongClickable(false);
}
}
示例12: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_dialog_html, container, false);
// Restore saved state
if (savedInstanceState != null) {
raw = savedInstanceState.getString(KEY_RAW);
title = savedInstanceState.getString(KEY_TITLE);
}
content = (HtmlTextView) view.findViewById(R.id.dialog_html_content);
SparkleHelper.setStyledTextView(getContext(), content, raw, fm);
getDialog().setTitle(title);
return view;
}
示例13: init
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
public void init(IssueResultHeadlinesContainer headlines) {
headlinesTitle.setText(context.getString(R.string.issue_trending));
LayoutInflater inflater = LayoutInflater.from(context);
headlinesHolder.removeAllViews();
int index = 0;
for (String h : headlines.headlines) {
View headlineTextHolder = inflater.inflate(R.layout.view_world_breaking_news_entry, null);
HtmlTextView newsContent = (HtmlTextView) headlineTextHolder.findViewById(R.id.card_world_breaking_news_content);
h = h.trim();
setIssueResultsFormatting(newsContent, mNation, h);
if (++index >= headlines.headlines.size()) {
headlineTextHolder.findViewById(R.id.view_divider).setVisibility(View.GONE);
}
headlinesHolder.addView(headlineTextHolder);
}
}
示例14: NationOverviewCard
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
public NationOverviewCard(View view) {
super(view);
govType = (HtmlTextView) view.findViewById(R.id.nation_gov_type);
region = (TextView) view.findViewById(R.id.nation_region);
influence = (TextView) view.findViewById(R.id.nation_influence);
population = (TextView) view.findViewById(R.id.nation_population);
motto = (TextView) view.findViewById(R.id.nation_motto);
time = (TextView) view.findViewById(R.id.nation_time);
waMember = (RelativeLayout) view.findViewById(R.id.nation_wa_member);
waSection = (LinearLayout) view.findViewById(R.id.card_overview_section_wa);
isWaMember = (TextView) view.findViewById(R.id.nation_wa_status);
divider = view.findViewById(R.id.view_divider);
endorsementsHolder = (RelativeLayout) view.findViewById(R.id.nation_wa_endorsements);
endorsementsCount = (TextView) view.findViewById(R.id.nation_wa_num_endorsements);
gaVoteHolder = (RelativeLayout) view.findViewById(R.id.nation_wa_ga_vote);
gaVote = (TextView) view.findViewById(R.id.card_overview_wa_vote_ga);
scVoteHolder = (RelativeLayout) view.findViewById(R.id.nation_wa_sc_vote);
scVote = (TextView) view.findViewById(R.id.card_overview_wa_vote_sc);
}
示例15: init
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入依赖的package包/类
public void init(Context context, List<Event> newsItems) {
inflater = LayoutInflater.from(context);
newsHolder.removeAllViews();
int index = 0;
for (Event e : newsItems) {
View newsItemView = inflater.inflate(R.layout.view_world_breaking_news_entry, null);
HtmlTextView newsContent = (HtmlTextView) newsItemView.findViewById(R.id.card_world_breaking_news_content);
SparkleHelper.setHappeningsFormatting(context, newsContent, e.content);
if (++index >= newsItems.size()) {
newsItemView.findViewById(R.id.view_divider).setVisibility(View.GONE);
}
newsHolder.addView(newsItemView);
}
}