本文整理汇总了Java中org.sufficientlysecure.htmltextview.HtmlTextView.setHtml方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlTextView.setHtml方法的具体用法?Java HtmlTextView.setHtml怎么用?Java HtmlTextView.setHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sufficientlysecure.htmltextview.HtmlTextView
的用法示例。
在下文中一共展示了HtmlTextView.setHtml方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: onCreateDialog
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setTitle(R.string.dialog_startup_title)
.setNegativeButton(R.string.dialog_startup_negative_button, null)
.setPositiveButton(R.string.dialog_startup_positive_button, onPositiveButtonClickListener);
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
View viewRoot = inflater.inflate(R.layout.dialog_startup, null);
HtmlTextView htmlTextView = (HtmlTextView) viewRoot.findViewById(R.id.html_text);
String htmlContent =
"<p>"+getString(R.string.html_text_purpose)+"</p>"+
"<p>"+getString(R.string.html_text_free)+"</p>"+
"<p>"+getString(R.string.html_text_donation)+"</p>";
htmlTextView.setHtml(htmlContent);
builder.setView(viewRoot);
return builder.create();
}
示例6: onCreate
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
setContentView(R.layout.activity_about);
HtmlTextView htmlTextView = (HtmlTextView) findViewById(R.id.html_text);
htmlTextView.setHtml(R.raw.privacypolicy);
}
示例7: onCreate
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
setContentView(R.layout.activity_about);
HtmlTextView htmlTextView = (HtmlTextView) findViewById(R.id.html_text);
htmlTextView.setHtml(R.raw.about);
}
示例8: onCreateDialog
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String content = "";
boolean isHtml = false;
if (getArguments() != null) {
content = getArguments().getString(ARG_CONTENT);
isHtml = getArguments().getBoolean(ARG_HTML);
}
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_html, null);
HtmlTextView htmltv = (HtmlTextView) view.findViewById(R.id.html_view);
if (isHtml) {
htmltv.setHtml(content);
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
htmltv.setTextAppearance(R.style.TextAppearance_AppCompat_Small);
} else {
htmltv.setTextAppearance(getContext(), R.style.TextAppearance_AppCompat_Small);
}
htmltv.setText(content);
}
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(view);
return builder.create();
}
示例9: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_faq, container, false);
HtmlTextView faqText = (HtmlTextView) view.findViewById(R.id.faqText);
try {
String html = new Markdown4jProcessor().process(
getActivity().getResources().openRawResource(R.raw.faq));
faqText.setHtml(html, new HtmlResImageGetter(faqText));
} catch (IOException e) {
Log.e("UniPatcher", "IOException", e);
}
return view;
}
示例10: onCreateView
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
rootLayout = (RelativeLayout) inflater.inflate(R.layout.fragment_about, container, false);
icon = (ImageView) rootLayout.findViewById(R.id.appIcon);
try {
icon.setImageDrawable(getActivity().getPackageManager().getApplicationIcon("com.chris.randomrestaurantgenerator"));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
appVersion = (TextView) rootLayout.findViewById(R.id.appVersion);
appVersion.setText(String.format("Version: %s", BuildConfig.VERSION_NAME));
githubLink = (TextView) rootLayout.findViewById(R.id.githubLink);
githubLink.setMovementMethod(LinkMovementMethod.getInstance());
String htmlLink = "<a href='https://github.com/christarazi/random-restaurant-generator'> Source code</a>";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
githubLink.setText(Html.fromHtml(htmlLink, Html.FROM_HTML_MODE_LEGACY));
}
else {
githubLink.setText(Html.fromHtml(htmlLink));
}
htmlAbout = (HtmlTextView) rootLayout.findViewById(R.id.htmlAbout);
htmlAbout.setHtml(R.raw.about, new Html.ImageGetter() {
@Override
public Drawable getDrawable(String s) {
return null;
}
});
return rootLayout;
}
示例11: newPush
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
/**
* 有新消息推送
*
* @param post
*/
@Override
public void newPush(final RecentPost post) {
AccountApp.isPushed = true;
// 显示重要消息的对话框
AlertDialog.Builder builder = AccountApp.getAlertDialogBuilder(this);
View dialogView = LayoutInflater.from(this)
.inflate(R.layout.dialog_push, null);
builder.setView(dialogView);
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
Button btnOK = (Button) dialogView.findViewById(R.id.btnOK);
TextView tvTitle = (TextView) dialogView.findViewById(R.id.tvTitle);
TextView tvDate = (TextView) dialogView.findViewById(R.id.tvDate);
HtmlTextView tvContent = (HtmlTextView) dialogView.findViewById(R.id.tvContent);
tvTitle.setText(post.getTitle());
tvDate.setText("发布日期:" + post.getDate());
tvContent.setHtml(post.getContent());
btnOK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AccountApp.pushID = post.getId();
AccountApp.getInstance().editor.putInt(Constants.PUSH_ID, AccountApp.pushID).apply();
dialog.dismiss();
}
});
dialog.show();
}
示例12: onCreate
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
HtmlTextView textView = (HtmlTextView) findViewById(R.id.html_text);
//text.setRemoveFromHtmlSpace(false); // default is true
textView.setClickableTableSpan(new ClickableTableSpanImpl());
DrawTableLinkSpan drawTableLinkSpan = new DrawTableLinkSpan();
drawTableLinkSpan.setTableLinkText("[tap for table]");
textView.setDrawTableLinkSpan(drawTableLinkSpan);
textView.setHtml(R.raw.example, new HtmlResImageGetter(textView));
}
示例13: displayHtml
import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
/**
* This method will be used by data binding when we use app:html in XML.
* BindingAdapters only need to be declared once and usable in the whole app.
* Its better to put all BindingAdapters in a single Java file.
*
* @param view The {@link HtmlTextView}
* @param html The value from {@link NewsItem#getHtml()}
*/
@BindingAdapter({"html"})
public static void displayHtml(HtmlTextView view, @Nullable String html) {
view.setHtml(html, new HtmlResImageGetter(view));
}