com.spreada.utils.chinese.ZHConverter Java Examples
The following examples show how to use
com.spreada.utils.chinese.ZHConverter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KuaiDi100Helper.java From ExpressHelper with GNU General Public License v3.0 | 6 votes |
public static ArrayList<CompanyInfo.Company> searchCompany(String keyword) { keyword = ZHConverter.convert(keyword, ZHConverter.SIMPLIFIED); ArrayList<CompanyInfo.Company> src = new ArrayList<>(); if (keyword != null && keyword.trim().length() > 0) { for (int i = 0; i < CompanyInfo.info.size(); i++) { if (!CompanyInfo.names [i].contains(keyword) && !CompanyInfo.pinyin [i].contains(keyword)) { continue; } src.add(CompanyInfo.info.get(i)); } } else { return CompanyInfo.info; } return src; }
Example #2
Source File: ChapterContentAdapter.java From MissZzzReader with Apache License 2.0 | 5 votes |
private String getLanguageContext(String content) { if (mSetting.getLanguage() == Language.traditional && mSetting.getFont() == Font.默认字体) { return ZHConverter.convert(content, ZHConverter.TRADITIONAL); } return content; }
Example #3
Source File: ReadContentAdapter.java From MissZzzReader with Apache License 2.0 | 5 votes |
private String getLanguageContext(String content) { if (mSetting.getLanguage() == Language.traditional && mSetting.getFont() == Font.默认字体) { return ZHConverter.convert(content, ZHConverter.TRADITIONAL); } return content; }
Example #4
Source File: ChapterContentAdapter.java From MissZzzReader with Apache License 2.0 | 4 votes |
/** * 加载章节内容 * * @param chapter * @param viewHolder */ private void getChapterContent(final Chapter chapter, final ViewHolder viewHolder) { if (viewHolder != null) { viewHolder.tvErrorTips.setVisibility(View.GONE); } Chapter cacheChapter = mChapterService.findChapterByBookIdAndTitle(chapter.getBookId(), chapter.getTitle()); if (cacheChapter != null && !StringHelper.isEmpty(cacheChapter.getContent())) { chapter.setContent(cacheChapter.getContent()); chapter.setId(cacheChapter.getId()); if (viewHolder != null) { if (mSetting.getLanguage() == Language.traditional) { viewHolder.tvContent.setText(ZHConverter.convert(chapter.getTitle(), ZHConverter.TRADITIONAL)); } else { viewHolder.tvContent.setText(chapter.getContent()); } viewHolder.tvErrorTips.setVisibility(View.GONE); } } else { CommonApi.getChapterContent(chapter.getUrl(), new ResultCallback() { @Override public void onFinish(final Object o, int code) { chapter.setContent((String) o); mChapterService.saveOrUpdateChapter(chapter); if (viewHolder != null) { mHandler.post(new Runnable() { @Override public void run() { viewHolder.tvContent.setText(getLanguageContext((String) o)); viewHolder.tvErrorTips.setVisibility(View.GONE); } }); } } @Override public void onError(Exception e) { if (viewHolder != null) { mHandler.sendMessage(mHandler.obtainMessage(1, viewHolder)); } } }); } }
Example #5
Source File: ReadContentAdapter.java From MissZzzReader with Apache License 2.0 | 4 votes |
/** * 加载章节内容 * * @param chapter * @param viewHolder */ private void getChapterContent(final Chapter chapter, final ViewHolder viewHolder) { if (viewHolder != null) { viewHolder.tvErrorTips.setVisibility(View.GONE); } Chapter cacheChapter = mChapterService.findChapterByBookIdAndTitle(chapter.getBookId(), chapter.getTitle()); if (cacheChapter != null && !StringHelper.isEmpty(cacheChapter.getContent())) { chapter.setContent(cacheChapter.getContent()); chapter.setId(cacheChapter.getId()); if (viewHolder != null) { if (mSetting.getLanguage() == Language.traditional) { viewHolder.tvContent.setText(ZHConverter.convert(chapter.getTitle(), ZHConverter.TRADITIONAL)); } else { viewHolder.tvContent.setText(chapter.getContent()); } viewHolder.tvErrorTips.setVisibility(View.GONE); } } else { CommonApi.getChapterContent(chapter.getUrl(), new ResultCallback() { @Override public void onFinish(final Object o, int code) { chapter.setContent((String) o); mChapterService.saveOrUpdateChapter(chapter); if (viewHolder != null) { mHandler.post(new Runnable() { @Override public void run() { viewHolder.tvContent.setText(getLanguageContext((String) o)); viewHolder.tvErrorTips.setVisibility(View.GONE); } }); } } @Override public void onError(Exception e) { if (viewHolder != null) { mHandler.sendMessage(mHandler.obtainMessage(1, viewHolder)); } } }); } }