improved documentation
This commit is contained in:
parent
6a13d506b6
commit
a0f05e4a2f
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"address": "192.168.2.203",
|
"address": "192.168.1.100",
|
||||||
"port" : 8080,
|
"port" : 8080,
|
||||||
"favorites" : [ ]
|
"favorites" : [ ]
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ package com.example.aped;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -293,8 +292,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* paul
|
* Method to set the config.xml to a default.
|
||||||
* @param xmlFile
|
* @param xmlFile the config.xml file
|
||||||
*/
|
*/
|
||||||
private void setDefaultXML(final File xmlFile) {
|
private void setDefaultXML(final File xmlFile) {
|
||||||
try {
|
try {
|
||||||
@ -307,23 +306,23 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
fileOutputStream.write(buffer);
|
fileOutputStream.write(buffer);
|
||||||
fileOutputStream.close();
|
fileOutputStream.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("MainActivity", "error while transferring the "
|
Log.e("MainActivity", "error while transferring"
|
||||||
+ "default.xml into the config.xml: " + e.getMessage());
|
+ "a default config: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* paul
|
* Method to set the config.json to a default.
|
||||||
* @param xmlFile
|
* @param jsonFile the config.json file
|
||||||
*/
|
*/
|
||||||
private void setDefaultConfig(final File xmlFile) {
|
private void setDefaultConfig(final File jsonFile) {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = getAssets().open(
|
InputStream inputStream = getAssets().open(
|
||||||
"defaultConfig.json");
|
"defaultConfig.json");
|
||||||
byte[] buffer = new byte[inputStream.available()];
|
byte[] buffer = new byte[inputStream.available()];
|
||||||
inputStream.read(buffer);
|
inputStream.read(buffer);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(xmlFile);
|
FileOutputStream fileOutputStream = new FileOutputStream(jsonFile);
|
||||||
fileOutputStream.write(buffer);
|
fileOutputStream.write(buffer);
|
||||||
fileOutputStream.close();
|
fileOutputStream.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -163,9 +163,9 @@ public class Communicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* paul
|
* Method for handling various {@link VolleyError}.
|
||||||
* @param error
|
* @param error the {@link VolleyError}
|
||||||
* @param method
|
* @param method the name of the method where the error occurred
|
||||||
*/
|
*/
|
||||||
private void handleError(final VolleyError error, final String method) {
|
private void handleError(final VolleyError error, final String method) {
|
||||||
if (error instanceof ServerError) {
|
if (error instanceof ServerError) {
|
||||||
@ -181,6 +181,10 @@ public class Communicator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for making a custom toast message for serious {@link VolleyError}.
|
||||||
|
* @param message the message to be displayed in the toast
|
||||||
|
*/
|
||||||
private void makeToast(final String message) {
|
private void makeToast(final String message) {
|
||||||
Toast toast = new Toast(mainActivity);
|
Toast toast = new Toast(mainActivity);
|
||||||
View toastView = mainActivity.getLayoutInflater().inflate(R.layout.
|
View toastView = mainActivity.getLayoutInflater().inflate(R.layout.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user