2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 06:05:12 +00:00

Reduced logging. Renamed variables in camelcase.

This commit is contained in:
Albert Vaca
2016-09-29 13:21:13 +02:00
parent 0f655cf4eb
commit 74dc1bcd63

View File

@@ -27,7 +27,6 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
@@ -99,7 +98,6 @@ public class CustomDevicesActivity extends ActionBarActivity {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
ipAddressList.remove(position);
Log.i(LOG_ID, "Removed item pos: " + position + " id: " + id);
saveList();
break;
case DialogInterface.BUTTON_NEGATIVE:
@@ -107,6 +105,7 @@ public class CustomDevicesActivity extends ActionBarActivity {
}
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(CustomDevicesActivity.this);
builder.setMessage("Delete " + ipAddressList.get(position) + " ?");
builder.setPositiveButton("Yes", confirmationListener);
@@ -160,37 +159,32 @@ public class CustomDevicesActivity extends ActionBarActivity {
}
public static String serializeIpList(ArrayList<String> iplist) {
public static String serializeIpList(ArrayList<String> ipList) {
String serialized = "";
for (String ipaddr : iplist) {
serialized += IP_DELIM+ipaddr;
for (String ipAddress : ipList) {
serialized += IP_DELIM+ipAddress;
}
// remove first delimiter
serialized = serialized.substring(IP_DELIM.length());
Log.d(LOG_ID, serialized);
return serialized;
}
public static ArrayList<String> deserializeIpList(String serialized) {
ArrayList<String> iplist = new ArrayList<>();
Log.d(LOG_ID, serialized);
for (String ipaddr : serialized.split(IP_DELIM)) {
iplist.add(ipaddr);
Log.d(LOG_ID, ipaddr);
ArrayList<String> ipList = new ArrayList<>();
for (String ipAddress : serialized.split(IP_DELIM)) {
ipList.add(ipAddress);
}
return iplist;
return ipList;
}
private void initializeDeviceList(Context context){
String deviceListPrefs = PreferenceManager.getDefaultSharedPreferences(context).getString(
KEY_CUSTOM_DEVLIST_PREFERENCE, "");
if(deviceListPrefs.isEmpty()){
Log.i(LOG_ID, "Initialising empty custom device list");
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(
KEY_CUSTOM_DEVLIST_PREFERENCE,
deviceListPrefs).commit();
} else {
Log.i(LOG_ID, "Populating device list");
ipAddressList = deserializeIpList(deviceListPrefs);
}
}