net.gsantner.opoc.format.markdown.SimpleMarkdownParser Java Examples
The following examples show how to use
net.gsantner.opoc.format.markdown.SimpleMarkdownParser.
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: ContextUtils.java From memetastic with GNU General Public License v3.0 | 5 votes |
/** * Load a markdown file from a {@link RawRes}, prepend each line with {@code prepend} text * and convert markdown to html using {@link SimpleMarkdownParser} */ public String loadMarkdownForTextViewFromRaw(@RawRes int rawMdFile, String prepend) { try { return new SimpleMarkdownParser() .parse(_context.getResources().openRawResource(rawMdFile), prepend, SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW) .replaceColor("#000001", rcolor(getResId(ResType.COLOR, "accent"))) .removeMultiNewlines().replaceBulletCharacter("*").getHtml(); } catch (IOException e) { e.printStackTrace(); return ""; } }
Example #2
Source File: ContextUtils.java From openlauncher with Apache License 2.0 | 5 votes |
/** * Load a markdown file from a {@link RawRes}, prepend each line with {@code prepend} text * and convert markdown to html using {@link SimpleMarkdownParser} */ public String loadMarkdownForTextViewFromRaw(@RawRes int rawMdFile, String prepend) { try { return new SimpleMarkdownParser() .parse(_context.getResources().openRawResource(rawMdFile), prepend, SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW) .replaceColor("#000001", rcolor(getResId(ResType.COLOR, "accent"))) .removeMultiNewlines().replaceBulletCharacter("*").getHtml(); } catch (IOException e) { e.printStackTrace(); return ""; } }
Example #3
Source File: ContextUtils.java From Stringlate with MIT License | 5 votes |
/** * Load a markdown file from a {@link RawRes}, prepend each line with {@code prepend} text * and convert markdown to html using {@link SimpleMarkdownParser} */ public String loadMarkdownForTextViewFromRaw(@RawRes int rawMdFile, String prepend) { try { return new SimpleMarkdownParser() .parse(_context.getResources().openRawResource(rawMdFile), prepend, SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW) .replaceColor("#000001", rcolor(getResId(ResType.COLOR, "accent"))) .removeMultiNewlines().replaceBulletCharacter("*").getHtml(); } catch (IOException e) { e.printStackTrace(); return ""; } }
Example #4
Source File: ContextUtils.java From kimai-android with MIT License | 5 votes |
/** * Load a markdown file from a {@link RawRes}, prepend each line with {@code prepend} text * and convert markdown to html using {@link SimpleMarkdownParser} */ public String loadMarkdownForTextViewFromRaw(@RawRes int rawMdFile, String prepend) { try { return new SimpleMarkdownParser() .parse(_context.getResources().openRawResource(rawMdFile), prepend, SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW) .replaceColor("#000001", rcolor(getResId(ResType.COLOR, "accent"))) .removeMultiNewlines().replaceBulletCharacter("*").getHtml(); } catch (IOException e) { e.printStackTrace(); return ""; } }
Example #5
Source File: MainActivity.java From memetastic with GNU General Public License v3.0 | 4 votes |
@SuppressLint("ClickableViewAccessibility") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { _currentMainMode = savedInstanceState.getInt(BOTTOM_NAV_POSITION); } _appSettings = new AppSettings(this); _activityUtils = new ActivityUtils(this); _activityUtils.setAppLanguage(_appSettings.getLanguage()); if (_appSettings.isOverviewStatusBarHidden()) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } setContentView(R.layout.main__activity); // Bind UI app = (App) getApplication(); ButterKnife.bind(this); // Setup _toolbar setSupportActionBar(_toolbar); _tagKeys = getResources().getStringArray(R.array.meme_tags__keys); _tagValues = getResources().getStringArray(R.array.meme_tags__titles); if (MainActivity.LOCAL_ONLY_MODE) { for (int i = 0; i < _tagKeys.length; i++) { _tagKeys[i] = "other"; } _tagKeys = new String[]{_tagKeys[0]}; _tagValues = new String[]{_tagValues[0]}; } _recyclerMemeList.setHasFixedSize(true); _recyclerMemeList.setItemViewCacheSize(_appSettings.getGridColumnCountPortrait() * _appSettings.getGridColumnCountLandscape() * 2); _recyclerMemeList.setDrawingCacheEnabled(true); _recyclerMemeList.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW); _recyclerMemeList.addItemDecoration(new GridDecoration(1.7f)); if (_appSettings.getMemeListViewType() == MemeItemAdapter.VIEW_TYPE__ROWS_WITH_TITLE) { RecyclerView.LayoutManager recyclerLinearLayout = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); _recyclerMemeList.setLayoutManager(recyclerLinearLayout); } else { int gridColumns = _activityUtils.isInPortraitMode() ? _appSettings.getGridColumnCountPortrait() : _appSettings.getGridColumnCountLandscape(); RecyclerView.LayoutManager recyclerGridLayout = new GridLayoutManager(this, gridColumns); _recyclerMemeList.setLayoutManager(recyclerGridLayout); } for (String cat : _tagValues) { TabLayout.Tab tab = _tabLayout.newTab(); tab.setText(cat); _tabLayout.addTab(tab); } // Basically enable "other" only mode if (MainActivity.LOCAL_ONLY_MODE) { _tabLayout.setVisibility(View.GONE); } // END _viewPager.setOffscreenPageLimit(5); _viewPager.setAdapter(new MemePagerAdapter(getSupportFragmentManager(), _tagKeys.length, _tagValues)); _tabLayout.setupWithViewPager(_viewPager); selectTab(app.settings.getLastSelectedTab(), app.settings.getDefaultMainMode()); _infoBarProgressBar.getProgressDrawable().setColorFilter(ContextCompat.getColor(this, R.color.accent), PorterDuff.Mode.SRC_IN); // Show first start dialog / changelog try { if (_appSettings.isAppCurrentVersionFirstStart(true)) { SimpleMarkdownParser smp = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW); String html = ""; html += smp.parse(getString(R.string.copyright_license_text_official).replace("\n", " \n"), "").getHtml(); html += "<br/><br/><br/><big><big>" + getString(R.string.changelog) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.changelog), "", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW, SimpleMarkdownParser.FILTER_CHANGELOG); html += "<br/><br/><br/><big><big>" + getString(R.string.licenses) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.licenses_3rd_party), "").getHtml(); _activityUtils.showDialogWithHtmlTextView(R.string.licenses, html); } } catch (IOException e) { e.printStackTrace(); } new AssetUpdater.LoadAssetsThread(this).start(); if (PermissionChecker.doIfPermissionGranted(this)) { ContextUtils.checkForAssetUpdates(this); } _bottomNav.setOnNavigationItemSelectedListener(this); }