general post-release cleanup

removed lots of unused strings/resources/drawables
extracted all translatable strings
added new logo
This commit is contained in:
Giovanni Harting
2015-09-16 13:40:04 +02:00
parent 608a9c48d1
commit 42ff424622
58 changed files with 342 additions and 478 deletions

View File

@@ -43,7 +43,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
@@ -78,7 +77,7 @@ public class LedDHelper {
}
};
public LedDHelper(LedDDaemon ledDDaemon, Context appl) throws IOException {
public LedDHelper(LedDDaemon ledDDaemon, Context appl) {
this.context = appl;
this.dRequests = new LinkedBlockingQueue<>();
this.ledDDaemon = ledDDaemon;
@@ -91,16 +90,18 @@ public class LedDHelper {
* Add controller to ledd daemon
*
* @param c controller object
* @throws JSONException no valid json
* @throws IOException socket error
*/
public void addController(final Controller c, final AddControllerCallback callback) throws JSONException, IOException {
public void addController(final Controller c, final AddControllerCallback callback) {
JSONObject jnson = new JSONObject();
jnson.put("action", ACTION_ADDCONTROLLER);
jnson.put("channels", c.getChannels());
jnson.put("i2c_dev", c.getI2c_device());
jnson.put("address", c.getAddress());
try {
jnson.put("action", ACTION_ADDCONTROLLER);
jnson.put("channels", c.getChannels());
jnson.put("i2c_dev", c.getI2c_device());
jnson.put("address", c.getAddress());
} catch (JSONException e) {
e.printStackTrace();
}
addRequestToQueue(jnson, new AnswerTask() {
@Override
@@ -126,14 +127,15 @@ public class LedDHelper {
/**
* Get stripes known to daemon
*
* @throws JSONException no valid json
* @throws IOException socket error
*/
public void getStripes(final StripesCallback callback) throws JSONException, IOException {
public void getStripes(final StripesCallback callback) {
JSONObject jnson = new JSONObject();
jnson.put("action", ACTION_GETALLSTRIPES);
try {
jnson.put("action", ACTION_GETALLSTRIPES);
} catch (JSONException e) {
e.printStackTrace();
}
addRequestToQueue(jnson, new AnswerTask() {
@Override
@@ -220,14 +222,16 @@ public class LedDHelper {
* Get color using the stripeid
*
* @param ledStripe Stripe
* @throws JSONException no valid json
* @throws IOException socket error
*/
public void getColor(final LedStripe ledStripe, final RecieveColorCallback callback) throws JSONException, IOException {
public void getColor(final LedStripe ledStripe, final RecieveColorCallback callback) {
JSONObject jnson = new JSONObject();
jnson.put("action", ACTION_GETCOLOR);
jnson.put("sid", ledStripe.getId());
try {
jnson.put("action", ACTION_GETCOLOR);
jnson.put("sid", ledStripe.getId());
} catch (JSONException e) {
e.printStackTrace();
}
addRequestToQueue(jnson, new AnswerTask() {
@Override
@@ -258,15 +262,19 @@ public class LedDHelper {
* @param c controller
* @param channel channel number
* @param value value (1= on, 0 = off)
* @throws JSONException
*/
public void testChannel(Controller c, int channel, int value) throws JSONException {
public void testChannel(Controller c, int channel, int value) {
JSONObject jnson = new JSONObject();
jnson.put("action", ACTION_TESTCHANNEL);
jnson.put("cid", c.getId());
jnson.put("channel", channel);
jnson.put("value", value);
try {
jnson.put("action", ACTION_TESTCHANNEL);
jnson.put("cid", c.getId());
jnson.put("channel", channel);
jnson.put("value", value);
} catch (JSONException e) {
e.printStackTrace();
}
addRequestToQueue(jnson, new AnswerTask() {
@Override
@@ -283,14 +291,15 @@ public class LedDHelper {
/**
* Get information about an ledd daemon
*
* @throws JSONException no valid json
* @throws IOException socket error
*/
public void discover(final DiscoverCallback callback) throws JSONException, IOException {
public void discover(final DiscoverCallback callback) {
JSONObject jnson = new JSONObject();
jnson.put("action", ACTION_DISCOVER);
try {
jnson.put("action", ACTION_DISCOVER);
} catch (JSONException e) {
e.printStackTrace();
}
addRequestToQueue(jnson, new AnswerTask() {
@Override
@@ -313,26 +322,29 @@ public class LedDHelper {
/**
* Get information about an ledd daemon
*
* @throws JSONException no valid json
* @throws IOException socket error
*/
public void addStripe(final LedStripe ledStripe, final AddStripeCallback callback) throws JSONException, IOException {
public void addStripe(final LedStripe ledStripe, final AddStripeCallback callback) {
JSONObject jnson = new JSONObject();
jnson.put("action", ACTION_ADDSTRIPES);
JSONObject stripe = new JSONObject();
try {
jnson.put("action", ACTION_ADDSTRIPES);
stripe.put("name", ledStripe.getName());
stripe.put("rgb", ledStripe.isRGB());
JSONObject stripe = new JSONObject();
JSONObject mapping = new JSONObject();
mapping.put("r", ledStripe.getChannelRed());
mapping.put("g", ledStripe.getChannelGreen());
mapping.put("b", ledStripe.getChannelBlue());
stripe.put("map", mapping);
stripe.put("cid", ledStripe.getController().getId());
jnson.put("stripe", stripe);
stripe.put("name", ledStripe.getName());
stripe.put("rgb", ledStripe.isRGB());
JSONObject mapping = new JSONObject();
mapping.put("r", ledStripe.getChannelRed());
mapping.put("g", ledStripe.getChannelGreen());
mapping.put("b", ledStripe.getChannelBlue());
stripe.put("map", mapping);
stripe.put("cid", ledStripe.getController().getId());
jnson.put("stripe", stripe);
} catch (JSONException e) {
e.printStackTrace();
}
addRequestToQueue(jnson, new AnswerTask() {
@Override
@@ -355,7 +367,7 @@ public class LedDHelper {
}
private void addRequestToQueue(JSONObject json, AnswerTask task) {
dRequests.add(new LedDRequest(json, task));
if (json != null && json.length() > 0) dRequests.add(new LedDRequest(json, task));
}
public void teardown() {
@@ -389,8 +401,6 @@ public class LedDHelper {
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
break;
} catch (JSONException e) {
e.printStackTrace();
}
}
}