mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Created an api package
This commit is contained in:
parent
ab905a5316
commit
b7a07ab2ed
@ -15,6 +15,8 @@ import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.communiquons.android.comunic.client.api.*;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.communiquons.android.comunic.client;
|
||||
package org.communiquons.android.comunic.client.api;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
|
@ -1,4 +1,6 @@
|
||||
package org.communiquons.android.comunic.client;
|
||||
package org.communiquons.android.comunic.client.api;
|
||||
|
||||
import org.communiquons.android.comunic.client.api.APIPostData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -8,7 +10,7 @@ import java.util.ArrayList;
|
||||
* Created by pierre on 10/31/17.
|
||||
*/
|
||||
|
||||
class APIRequestParameters {
|
||||
public class APIRequestParameters {
|
||||
|
||||
/**
|
||||
* Parameters of the request
|
||||
@ -25,7 +27,7 @@ class APIRequestParameters {
|
||||
*
|
||||
* @param uri The request URI on the server
|
||||
*/
|
||||
APIRequestParameters(String uri){
|
||||
public APIRequestParameters(String uri){
|
||||
//Save request URI
|
||||
request_uri = uri;
|
||||
|
||||
@ -39,7 +41,7 @@ class APIRequestParameters {
|
||||
* @param name The name of the new key
|
||||
* @param value The value of the new key
|
||||
*/
|
||||
void addParameter(String name, String value){
|
||||
public void addParameter(String name, String value){
|
||||
parameters.add(new APIPostData(name, value));
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package org.communiquons.android.comunic.client;
|
||||
package org.communiquons.android.comunic.client.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import org.communiquons.android.comunic.client.BuildConfig;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
@ -23,7 +24,7 @@ import java.net.URL;
|
||||
*
|
||||
* Created by pierre on 10/31/17.
|
||||
*/
|
||||
abstract class APIRequestTask extends AsyncTask<APIRequestParameters, Void, APIResponse> {
|
||||
public abstract class APIRequestTask extends AsyncTask<APIRequestParameters, Void, APIResponse> {
|
||||
|
||||
/**
|
||||
* Background task
|
||||
@ -127,7 +128,7 @@ abstract class APIRequestTask extends AsyncTask<APIRequestParameters, Void, APIR
|
||||
* @param context The context used to perform the test
|
||||
* @return True if a network connection is available
|
||||
*/
|
||||
static boolean isAPIavailable(Context context){
|
||||
public static boolean isAPIavailable(Context context){
|
||||
ConnectivityManager connMgr = (ConnectivityManager)
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.communiquons.android.comunic.client;
|
||||
package org.communiquons.android.comunic.client.api;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@ -9,7 +9,7 @@ import org.json.JSONObject;
|
||||
* Created by pierre on 10/31/17.
|
||||
*/
|
||||
|
||||
class APIResponse {
|
||||
public class APIResponse {
|
||||
|
||||
/**
|
||||
* Reponse code
|
Loading…
Reference in New Issue
Block a user