WordPressHelper


Source link: https://github.com/rebus007/WordPressHelper

WordPressHelper

This library is created for get post and information from a blog or a website created with WordPress

Import

At the moment the library is in my personal maven repo

repositories {

  maven {

url 'http://dl.bintray.com/raphaelbussa/maven'
  
}
 
}
dependencies {

  compile 'rebus:wordpress-helper:1.0.10' 
}

How to use

How to parse a generic WordPress feed

import rebus.wordpress.helper.FeedItem; import rebus.wordpress.helper.FeedParser;  private FeedParser feedParser;  feedParser = new FeedParser("feed rss");
 //set rss url like http://www.smartphone-italia.com/feed feedParser.showLoading(true, getString(R.string.loading), this);
 //set loading dialog, need boolean value, string to show and context feedParser.execute();
 //start parsing! feedParser.onFinish(new FeedParser.OnComplete() {

  @Override
  public void onFinish(ArrayList<FeedItem> feedItems) {

//return arraylist with all info for each item

//do here something when parsing is finished
  
}

@Override
  public void onError() {

//this method is call on parsing error
  
}
 
}
);

You can also use StarDataBase class for save article in a database

import rebus.wordpress.helper.StarDataBase; import rebus.wordpress.helper.FeedItem;  private StarDataBase starDataBase; private FeedItem feedItem;  starDataBase = new StarDataBase(this);
 int numStar = getStarCount();
 //return number of item in the database boolean isPresent = starDataBase.isStar(feedItem);
 //check if the item is in the database, returns true if there is starDataBase.addStar(feedItem);
 //add item starDataBase.deleteStar(feedItem);
 //delete item starDataBase.deleteAll();
 //delate all item form database ArrayList<FeedItem> feedItems = starDataBase.getStar();
 //get arraylist with all item

Get comments from an article

import rebus.wordpress.helper.CommentItem; import rebus.wordpress.helper.CommentParser;  private CommentParser commentParser;  commentParser = new CommentParser("comments feed rss");
 //you can get this value from precedent parsing using feedParser.getCommentRss();
 commentParser.execute();
 //start parsing! commentParser.onFinish(new CommentParser.OnComplete() {

  @Override
  public void onFinish(ArrayList<CommentItem> commentItems) {

//return arraylist with all info for each comment

//do here something when parsing is finished
  
}

@Override
  public void onError() {

//this method is call on parsing error
  
}
 
}
);

If the blog use default WordPress comment system you can use PostComment class for add a comment

import rebus.wordpress.helper.PostComment;  PostComment postComment = new PostComment(

"id post", //you can get this value from precedent parsing using feedParser.getId();


"http://www.smartphone-italia.com", //base url of blog

"name user", //name of the commenter required

"email user", //email of the commenter required

"web site user", //web site of the commenter not required, you can pass an empty string

"body of comment", //body of comment required

"0");
 //if is a new comment you must pass a string with value "0", if is an answer you must pass the id of the comment  to which you want to respond, you can get this value from precedent parsing commentItem.getId();
 postComment.showLoading(true, getString(R.string.loading), this);
 //set loading dialog, need boolean value, string to show and context postComment.execute();
 //send comment! postComment.onFinish(new PostComment.OnComplete() {

  @Override
  public void onFinish() {

//this method is call on sending comment successful
  
}

@Override
  public void onError() {

//this method is call on sending comment error
  
}
 
}
);

You can also get post from a specific author using AuthorParser

import rebus.wordpress.helper.AuthorParser; import rebus.wordpress.helper.FeedItem;  private AuthorParser authorParser;  authorParser = new AuthorParser("http://www.smartphone-italia.com", "rebus");
 //set url of blog and author nickname authorParser.showLoading(true, getString(R.string.loading), this);
 //set loading dialog, need boolean value, string to show and context authorParser.execute();
 //start parsing! authorParser.onFinish(new AuthorParser.OnComplete() {

  @Override
  public void onFinish(ArrayList<FeedItem> feedItems) {

//return arraylist with all info for each item

//do here something when parsing is finished
  
}

@Override
  public void onError() {

//this method is call on parsing error
  
}
 
}
);

And in the end you can search in the blog

import rebus.wordpress.helper.SearchParser; import rebus.wordpress.helper.FeedItem;  private SearchParser searchParser;  searchParser = new SearchParser("http://www.smartphone-italia.com", "search something");
 //set url of blog and search query searchParser.showLoading(true, getString(R.string.loading), this);
 //set loading dialog, need boolean value, string to show and context searchParser.execute();
 //start parsing! searchParser.onFinish(new SearchParser.OnComplete() {

  @Override
  public void onFinish(ArrayList<FeedItem> feedItems) {

//return arraylist with all info for each item

//do here something when parsing is finished
  
}

@Override
  public void onError() {

//this method is call on parsing error
  
}
 
}
);

Remember if you use loading dialog

@Override protected void onPause() {

  super.onPause();

  feedParser.onPauseLoading();
 
}

Changelog

  • 1.0.8 fix category/tag bug
  • 1.0.7 fix bintray maven upload
  • 1.0.6 bug fix
  • 1.0.5 bug fix
  • 1.0.4 bug fix
  • 1.0.3 bug fix
  • 1.0.2 bug fix
  • 1.0.1 bug fix
  • 1.0.0 add StarDatabase
  • 0.0.1 first alpha

App using WordPress Helper

If you use this lib [contact me](mailto: [email protected]?subject=WordPress Helper) and I will add it to the list below:

###Developed By Raphaël Bussa - [email protected]

License

The MIT License (MIT)  Copyright (c) 2015 Raphael Bussa <[email protected]>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

Resources

RxJava extension for Firebase Cloud Messaging which acts as an architectural approach to easily satisfy the requirements of an android app when dealing with push notifications.

Android library listening available WiFi Access Points and related information with RxJava Observables.

ViewPager replacement with dynamic height support and smooth animations for the few edge cases where a standard ViewPager doesn't fulfill your needs.

An Android Keyboard visibility listener.

A pretty pull down view.

Easy info about Android device.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes