This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void onCreate(Bundle saved){ | |
| super.onCreate(saved); | |
| // Init the swipe back | |
| SwipeBack.attach(this, Position.LEFT) | |
| .setContentView(R.layout.activity_simple) | |
| .setSwipeBackView(R.layout.swipeback_default); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Whitelist wlist = Whitelist.basic(); | |
| Log.d(TAG, Jsoup.clean(rs, wlist)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Whitelist wlist=new Whitelist(); | |
| wlist.addTags("table","tbody","tr","td"); | |
| wlist.addTags("img").addAttributes("img","src"); | |
| Log.d(TAG, Jsoup.clean(rs, wlist)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String html = "<html><head><title>First parse</title></head>" | |
| + "<body><p> | |
| Parsed HTML into a doc.</p> | |
| </body></html>"; | |
| Document doc = Jsoup.parse(html); | |
| Elements title = doc.select("title"); //First parse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String html = "<div> | |
| An <a href='http://example.com/'><b>example</b></a> link.</div> | |
| "; | |
| Document doc = Jsoup.parse(html); | |
| Element link = doc.select("div > a").text(); //example | |
| Element link = doc.select("div > a").html(); //<b>example</b> | |
| Element link = doc.select("div > a").get(0).text(); //get first link | |
| Element link = doc.select("div").text(); //example link. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OkHttpClient client = new OkHttpClient(); | |
| String url = "http://www.google.com"; | |
| Request request = new Request.Builder() | |
| .url(url) | |
| .build(); | |
| Response response = client.newCall(request).execute(); | |
| //Response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OkHttpClient client = new OkHttpClient(); | |
| String url = "http://www.google.com"; | |
| Request request = new Request.Builder() | |
| .url(url) | |
| .build(); | |
| Call call = client.newCall(request); | |
| call.enqueue(new Callback() { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:orientation="vertical"> | |
| <android.support.design.widget.TabLayout | |
| android:id="@+id/tabs" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| toolbar = (Toolbar) findViewById(R.id.tool_bar); | |
| setSupportActionBar(toolbar); | |
| pager = (ViewPager) findViewById(R.id.pager); | |
| pager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ViewPagerAdapter extends FragmentPagerAdapter { | |
| private final String[] tabTitles = { "Tab1", "Tab2", "Tab3" }; | |
| public ViewPagerAdapter(FragmentManager fm) { | |
| super(fm); | |
| } | |
| @Override | |
| public CharSequence getPageTitle(int position) { |