Sweet-Mother-of-Json


Source link: https://github.com/jianastrero/Sweet-Mother-of-Json

Sweet-Mother-of-Json

The Sweetest way into connecting to your server

##Installation Add the JitPack repository to your build file then add it in your root build.gradle at the end of repositories:

allprojects {

  repositories {

...

maven {
 url 'https://jitpack.io' 
}

  
}
 
}
 

Add the dependency

dependencies {

  compile 'com.github.jianastrero:Sweet-Mother-of-Json:v2.1' 
}
 

##Usage - Youtube (v1.0) or Instruction v2.1 ####The 1st difference of v1.0 to v2.1 is the name of classes #####SweetConfig -> SweetJsonConfig; Sweet -> SweetJson; ####The 2nd is, the mid sdk is lowered till api 3 ###Youtube

###Instructions Call SweetJsonConfig.setDomain atleast once (recomended to be on the first activity) in your application

SweetJsonConfig.setDomain("192.168.43.33/sweet");
 //when using a local server. this may be mydomain.com 

Extend SweetJson and declare public fields equivalent to post data names. Then call super for the constructor, set the route and set the subclass instance always to this

public class Connect extends SweetJson {

  public String postValue; //this is the value which in php will be taken from $_POST["postValue"]

public Connect(String postValue) {

super();
 //always call super

 setRoute("sweet.php");
 //set the route

setSubclassInstance(this);
  //never changers

 this.postValue=postValue;
  
}
 
}
 

####the code above correspond to this php file:


 echo 'postValue = '.$_POST["postValue"]; 

Lastly, create an instance of your subclass then call submit. if wanted an OnConnectionListener can be set to the instance to listen onBeforeConnectionStart and onAfterConnectionStopped. onAfterConnectionStopped has parameters of result, jsonobject and json array, in which result will always have a value, jsonobject can be null if the result is not a jsonobject else not. and so as with the jsonarray.

Connect connect=new Connect("Sweet Mother Of Json");
 connect.setOnConnectionListener(new Sweet.OnConnectionListener() {

  @Override
  public void onBeforeConnectionStart() {

textView.setText("Connecting to server...");

  
}

@Override
  public void onAfterConnectionStopped(String result, JSONObject jsonObject, JSONArray jsonArray) {

textView.setText(""+result);

  
}
 
}
);
 connect.submit();
 

##Thats it! Now you can easily connect to your server with a short and elegant code :)

Resources

Nibo is a collection of useful widgets and drop in UIs for interacting with Google Places API.

Just another custom Android Toast.

A fully "functional" and easy to use android utility library.

CosmoCalendar is a fully customizable calendar with a wide variety of features and displaying modes.

Simple Android library for permissions request.

Why NoPermission:

  • Not a framework. It's just one class
  • Never ask again feature
  • Automatic check whether the permission is granted or not (don't need to check api version)
  • Fragments support

How to use

A Reactive Bus library.

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