Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ee78ba9b53 | ||
![]() |
60f805f15c | ||
![]() |
6c321aaa90 | ||
![]() |
34776fc225 | ||
![]() |
9fa55d2994 | ||
![]() |
42ff424622 | ||
![]() |
608a9c48d1 | ||
![]() |
1e7e400d49 |
@@ -20,6 +20,10 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -40,8 +44,8 @@ android {
|
|||||||
applicationId "com.idlegandalf.ledd"
|
applicationId "com.idlegandalf.ledd"
|
||||||
minSdkVersion 17
|
minSdkVersion 17
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1
|
versionCode 2
|
||||||
versionName "1.0"
|
versionName "1.0.1"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -56,11 +60,12 @@ dependencies {
|
|||||||
compile 'com.android.support:appcompat-v7:23.0.1'
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
||||||
compile 'com.android.support:support-v4:23.0.1'
|
compile 'com.android.support:support-v4:23.0.1'
|
||||||
compile 'com.squareup.okhttp:okhttp:2.5.0'
|
compile 'com.squareup.okhttp:okhttp:2.5.0'
|
||||||
compile 'com.google.code.gson:gson:2.3.1'
|
compile 'com.google.code.gson:gson:2.4'
|
||||||
compile 'com.jakewharton:butterknife:7.0.1'
|
compile 'com.jakewharton:butterknife:7.0.1'
|
||||||
compile 'com.koushikdutta.async:androidasync:2.1.6'
|
compile 'com.koushikdutta.async:androidasync:2.1.6'
|
||||||
compile 'com.android.support:design:23.0.1'
|
compile 'com.android.support:design:23.0.1'
|
||||||
compile 'com.larswerkman:HoloColorPicker:1.5'
|
compile 'com.larswerkman:HoloColorPicker:1.5@aar'
|
||||||
compile 'com.google.guava:guava:19.0-rc1'
|
compile 'com.google.guava:guava:19.0-rc2'
|
||||||
|
compile 'com.thetransactioncompany:jsonrpc2-base:1.38'
|
||||||
provided 'org.projectlombok:lombok:1.16.6'
|
provided 'org.projectlombok:lombok:1.16.6'
|
||||||
}
|
}
|
||||||
|
BIN
app/libs/holo-color-picker_ledd_version.aar
Normal file
@@ -24,12 +24,13 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".ColorApplication"
|
android:name=".ColorApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:fullBackupContent="false"
|
android:fullBackupContent="false"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
|
@@ -27,6 +27,7 @@ import android.graphics.Color;
|
|||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
@@ -39,6 +40,7 @@ import android.view.Menu;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.SubMenu;
|
import android.view.SubMenu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Switch;
|
||||||
|
|
||||||
import com.idlegandalf.ledd.callbacks.RecieveColorCallback;
|
import com.idlegandalf.ledd.callbacks.RecieveColorCallback;
|
||||||
import com.idlegandalf.ledd.callbacks.StripesCallback;
|
import com.idlegandalf.ledd.callbacks.StripesCallback;
|
||||||
@@ -48,15 +50,14 @@ import com.idlegandalf.ledd.components.LedStripe;
|
|||||||
import com.idlegandalf.ledd.fragments.AddStripeDialog;
|
import com.idlegandalf.ledd.fragments.AddStripeDialog;
|
||||||
import com.idlegandalf.ledd.helper.LedDHelper;
|
import com.idlegandalf.ledd.helper.LedDHelper;
|
||||||
import com.larswerkman.holocolorpicker.ColorPicker;
|
import com.larswerkman.holocolorpicker.ColorPicker;
|
||||||
import com.larswerkman.holocolorpicker.SVBar;
|
import com.larswerkman.holocolorpicker.SaturationBar;
|
||||||
|
import com.larswerkman.holocolorpicker.ValueBar;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.Bind;
|
import butterknife.Bind;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnCheckedChanged;
|
||||||
|
|
||||||
public class ColorActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
public class ColorActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
@@ -68,13 +69,22 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
NavigationView navigationView;
|
NavigationView navigationView;
|
||||||
@Bind(R.id.picker)
|
@Bind(R.id.picker)
|
||||||
ColorPicker colorPicker;
|
ColorPicker colorPicker;
|
||||||
@Bind(R.id.svbar)
|
@Bind(R.id.saturationbar)
|
||||||
SVBar svBar;
|
SaturationBar saturationBar;
|
||||||
|
@Bind(R.id.valuebar)
|
||||||
|
ValueBar valueBar;
|
||||||
|
@Bind(R.id.switch_onoff)
|
||||||
|
Switch aSwitch;
|
||||||
private ActionBarDrawerToggle mDrawerToggle;
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
private refreshDaemonsListener daemonsListener;
|
private refreshDaemonsListener daemonsListener;
|
||||||
private List<LedStripe> ledStripes;
|
private List<LedStripe> ledStripes;
|
||||||
private LedStripe mCurrentStripe;
|
private LedStripe mCurrentStripe;
|
||||||
private LedDHelper mCurrentHelper;
|
private LedDHelper mCurrentHelper;
|
||||||
|
private boolean fromOnCreate = true;
|
||||||
|
private double rate = 5.0;
|
||||||
|
private double per = 100.0;
|
||||||
|
private double allowance = rate;
|
||||||
|
private long last_check = System.currentTimeMillis();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -85,21 +95,24 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
// check for connectivity
|
// check for connectivity
|
||||||
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
|
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
|
||||||
if (networkInfo == null || !networkInfo.isConnected()) {
|
if (networkInfo == null || !networkInfo.isConnected() || networkInfo.getType() != ConnectivityManager.TYPE_WIFI) {
|
||||||
// TODO: Display error (snackbar)
|
Snackbar.make(mDrawerLayout, R.string.snackbar_no_wlan, Snackbar.LENGTH_INDEFINITE).setAction("RETRY", new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
refreshStripes();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
colorPicker.addSVBar(svBar);
|
colorPicker.addSaturationBar(saturationBar);
|
||||||
|
colorPicker.addValueBar(valueBar);
|
||||||
colorPicker.setShowOldCenterColor(false);
|
colorPicker.setShowOldCenterColor(false);
|
||||||
|
|
||||||
colorPicker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
|
colorPicker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onColorChanged(int i) {
|
public void onColorChanged(int i) {
|
||||||
if (mCurrentStripe != null && mCurrentHelper != null) {
|
if (mCurrentStripe != null && mCurrentHelper != null && isRateAcceptable() && aSwitch.isChecked()) {
|
||||||
float[] hsv = new float[3];
|
setStripeFromColor(i);
|
||||||
Color.colorToHSV(i, hsv);
|
|
||||||
mCurrentStripe.setColor(new HSV(hsv[0], hsv[1], hsv[2]));
|
|
||||||
mCurrentHelper.setColor(mCurrentStripe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -168,6 +181,21 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnCheckedChanged(R.id.switch_onoff)
|
||||||
|
public void onOffToggle(boolean checked) {
|
||||||
|
if (mCurrentStripe != null && mCurrentHelper != null) {
|
||||||
|
if (!checked) {
|
||||||
|
HSV nHSV = mCurrentStripe.getColor();
|
||||||
|
nHSV.setValue(0.0);
|
||||||
|
mCurrentStripe.setColor(nHSV);
|
||||||
|
mCurrentHelper.setColor(mCurrentStripe);
|
||||||
|
//colorPicker.setColor(Color.HSVToColor(new float[]{(float) nHSV.getHue(), (float) nHSV.getSaturation(), (float) nHSV.getValue()}));
|
||||||
|
} else {
|
||||||
|
setStripeFromColor(colorPicker.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||||
@@ -187,6 +215,8 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
ColorApplication.getInstance().teardown();
|
ColorApplication.getInstance().teardown();
|
||||||
unregisterReceiver(daemonsListener);
|
unregisterReceiver(daemonsListener);
|
||||||
|
|
||||||
|
if (mCurrentStripe != null) PreferenceManager.getDefaultSharedPreferences(this).edit().putInt("lastStripe", mCurrentStripe.getId()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -198,12 +228,12 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
ColorApplication.getInstance().onResume();
|
if (!fromOnCreate) {
|
||||||
registerReceiver(daemonsListener, new IntentFilter(ColorApplication.INTENT_ACTION_REFRESH));
|
ColorApplication.getInstance().onResume();
|
||||||
try {
|
registerReceiver(daemonsListener, new IntentFilter(ColorApplication.INTENT_ACTION_REFRESH));
|
||||||
refreshStripes();
|
refreshStripes();
|
||||||
} catch (IOException e) {
|
} else {
|
||||||
e.printStackTrace();
|
fromOnCreate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,42 +251,7 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
|
|
||||||
for (LedStripe stripe : ledStripes) {
|
for (LedStripe stripe : ledStripes) {
|
||||||
if (stripe.getName().equals(menuItem.getTitle())) {
|
if (stripe.getName().equals(menuItem.getTitle())) {
|
||||||
mCurrentStripe = stripe;
|
selectStripe(stripe);
|
||||||
try {
|
|
||||||
mCurrentHelper = ColorApplication.getInstance().getHelperForDaemon(stripe.getLedDDaemon());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
mDrawerLayout.closeDrawer(Gravity.LEFT);
|
|
||||||
toolbar.setTitle(stripe.getName());
|
|
||||||
try {
|
|
||||||
mCurrentHelper.getColor(mCurrentStripe, new RecieveColorCallback() {
|
|
||||||
@Override
|
|
||||||
public void onColorRecieved(LedStripe stripe) {
|
|
||||||
final HSV cColor = stripe.getColor();
|
|
||||||
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
colorPicker.setColor(Color.HSVToColor(new float[]{(float) cColor.getHue(), (float) cColor.getSaturation(),
|
|
||||||
(float) cColor.getValue()}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRecievFailed(String msg) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed(String message) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,7 +259,7 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshStripes() throws IOException {
|
public void refreshStripes() {
|
||||||
reCreateNavigationView(); // need to recreate the navigationview since we can't remove a once added submenu
|
reCreateNavigationView(); // need to recreate the navigationview since we can't remove a once added submenu
|
||||||
|
|
||||||
final Menu nvMenu = navigationView.getMenu();
|
final Menu nvMenu = navigationView.getMenu();
|
||||||
@@ -276,43 +271,50 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
LedDHelper helper = ColorApplication.getInstance().getHelperForDaemon(dDaemon);
|
LedDHelper helper = ColorApplication.getInstance().getHelperForDaemon(dDaemon);
|
||||||
|
|
||||||
if (helper != null) {
|
if (helper != null) {
|
||||||
try {
|
final int finalI = i;
|
||||||
final int finalI = i;
|
helper.getStripes(new StripesCallback() {
|
||||||
helper.getStripes(new StripesCallback() {
|
@Override
|
||||||
@Override
|
public void onSuccess(final List<LedStripe> stripes) {
|
||||||
public void onSuccess(final List<LedStripe> stripes) {
|
runOnUiThread(new Runnable() {
|
||||||
runOnUiThread(new Runnable() {
|
@Override
|
||||||
@Override
|
public void run() {
|
||||||
public void run() {
|
SubMenu nDaemonMenu = nvMenu.addSubMenu(Menu.NONE, Menu.NONE, finalI, dDaemon.toString());
|
||||||
SubMenu nDaemonMenu = nvMenu.addSubMenu(Menu.NONE, Menu.NONE, finalI, dDaemon.toString());
|
nDaemonMenu.setGroupCheckable(stripeGroup, true, true);
|
||||||
nDaemonMenu.setGroupCheckable(stripeGroup, true, true);
|
|
||||||
|
|
||||||
ledStripes = stripes;
|
int lastStripeId = -1;
|
||||||
Snackbar.make(findViewById(android.R.id.content), "LED stripes reloaded", Snackbar.LENGTH_LONG).show();
|
if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).contains("lastStripe")) {
|
||||||
|
lastStripeId = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getInt("lastStripe", -1);
|
||||||
|
}
|
||||||
|
|
||||||
for (LedStripe stripe : ledStripes) {
|
ledStripes = stripes;
|
||||||
MenuItem sItem = nDaemonMenu.add(stripeGroup, View.generateViewId(), stripe.getId(), stripe.getName());
|
for (LedStripe stripe : ledStripes) {
|
||||||
sItem.setIcon(R.drawable.ic_wb_iridescent_black_48dp);
|
MenuItem sItem = nDaemonMenu.add(stripeGroup, View.generateViewId(), stripe.getId(), stripe.getName());
|
||||||
|
sItem.setIcon(R.drawable.ic_wb_iridescent_black_48dp);
|
||||||
|
|
||||||
|
if (lastStripeId != -1 && stripe.getId() == lastStripeId) {
|
||||||
|
selectStripe(stripe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
Snackbar.make(findViewById(android.R.id.content), R.string.snackbar_stripes_reloaded, Snackbar.LENGTH_LONG).show();
|
||||||
public void onGetFailed(String message) {
|
}
|
||||||
Snackbar.make(findViewById(android.R.id.content), "Coudn't get stripes from daemon: " + message, Snackbar.LENGTH_LONG)
|
});
|
||||||
.show();
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public void onGetFailed(int code, String message) {
|
||||||
|
Snackbar.make(findViewById(android.R.id.content), getString(R.string.snackbar_no_connection_stripes) + message, Snackbar
|
||||||
|
.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(String message) {
|
||||||
|
Snackbar.make(findViewById(android.R.id.content), getString(R.string.snackbar_connection_failed) + message, Snackbar
|
||||||
|
.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed(String message) {
|
|
||||||
Snackbar.make(findViewById(android.R.id.content), "Coudn't connect to daemon: " + message, Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@@ -338,16 +340,73 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void selectStripe(LedStripe stripe) {
|
||||||
|
mCurrentStripe = stripe;
|
||||||
|
mCurrentHelper = ColorApplication.getInstance().getHelperForDaemon(stripe.getLedDDaemon());
|
||||||
|
|
||||||
|
mDrawerLayout.closeDrawer(Gravity.LEFT);
|
||||||
|
toolbar.setTitle(stripe.getName());
|
||||||
|
mCurrentHelper.getColor(mCurrentStripe, new RecieveColorCallback() {
|
||||||
|
@Override
|
||||||
|
public void onColorRecieved(LedStripe stripe) {
|
||||||
|
final HSV cColor = stripe.getColor();
|
||||||
|
final int color = Color.HSVToColor(new float[]{(float) cColor.getHue(), (float) cColor.getSaturation(), (float) cColor.getValue()});
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
colorPicker.setColor(color);
|
||||||
|
if (cColor.getValue() == 0.0) {
|
||||||
|
aSwitch.setChecked(false);
|
||||||
|
} else {
|
||||||
|
aSwitch.setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecievFailed(int code, String msg) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(String message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isRateAcceptable() {
|
||||||
|
long current = System.currentTimeMillis();
|
||||||
|
long time_passed = current - last_check;
|
||||||
|
last_check = current;
|
||||||
|
allowance += time_passed * (rate / per);
|
||||||
|
if (allowance > rate) {
|
||||||
|
allowance = rate; // throttle
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allowance < 1.0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
allowance -= 1.0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setStripeFromColor(int color) {
|
||||||
|
float[] hsv = new float[3];
|
||||||
|
Color.colorToHSV(color, hsv);
|
||||||
|
mCurrentStripe.setColor(new HSV(hsv[0], hsv[1], hsv[2]));
|
||||||
|
mCurrentHelper.setColor(mCurrentStripe);
|
||||||
|
}
|
||||||
|
|
||||||
protected class refreshDaemonsListener extends BroadcastReceiver {
|
protected class refreshDaemonsListener extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (intent.getAction().equals(ColorApplication.INTENT_ACTION_REFRESH)) {
|
if (intent.getAction().equals(ColorApplication.INTENT_ACTION_REFRESH)) {
|
||||||
try {
|
refreshStripes();
|
||||||
refreshStripes();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,9 +29,6 @@ import com.idlegandalf.ledd.callbacks.DiscoverCallback;
|
|||||||
import com.idlegandalf.ledd.components.LedDDaemon;
|
import com.idlegandalf.ledd.components.LedDDaemon;
|
||||||
import com.idlegandalf.ledd.helper.LedDHelper;
|
import com.idlegandalf.ledd.helper.LedDHelper;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -56,28 +53,22 @@ public class ColorApplication extends Application {
|
|||||||
this.onResume();
|
this.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LedDHelper getHelperForDaemon(final LedDDaemon ledDDaemon) throws IOException {
|
public LedDHelper getHelperForDaemon(final LedDDaemon ledDDaemon) {
|
||||||
if (ledDHelpers.containsKey(ledDDaemon) && ledDHelpers.get(ledDDaemon) != null) {
|
if (ledDHelpers.containsKey(ledDDaemon) && ledDHelpers.get(ledDDaemon) != null) {
|
||||||
return ledDHelpers.get(ledDDaemon);
|
return ledDHelpers.get(ledDDaemon);
|
||||||
} else {
|
} else {
|
||||||
final LedDHelper dHelper = new LedDHelper(ledDDaemon, getApplicationContext());
|
final LedDHelper dHelper = new LedDHelper(ledDDaemon, getApplicationContext());
|
||||||
try {
|
dHelper.discover(new DiscoverCallback() {
|
||||||
dHelper.discover(new DiscoverCallback() {
|
@Override
|
||||||
@Override
|
public void onConnectionFailed(String message) {
|
||||||
public void onConnectionFailed(String message) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDiscoverSuccessfully(String version) {
|
|
||||||
ledDHelpers.put(ledDDaemon, dHelper);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDiscoverSuccessfully(String version) {
|
||||||
|
ledDHelpers.put(ledDDaemon, dHelper);
|
||||||
|
}
|
||||||
|
});
|
||||||
return dHelper;
|
return dHelper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,37 +94,31 @@ public class ColorApplication extends Application {
|
|||||||
TypeToken<Set<LedDDaemon>>() {
|
TypeToken<Set<LedDDaemon>>() {
|
||||||
}.getType());
|
}.getType());
|
||||||
|
|
||||||
|
Log.i(ColorApplication.TAG, "Loaded " + ledDDaemons.size() + " Daemons from preferences");
|
||||||
|
|
||||||
for (final LedDDaemon ledDDaemon : ledDDaemons) {
|
for (final LedDDaemon ledDDaemon : ledDDaemons) {
|
||||||
try {
|
final LedDHelper helper = new LedDHelper(ledDDaemon, getApplicationContext());
|
||||||
final LedDHelper helper = new LedDHelper(ledDDaemon, getApplicationContext());
|
|
||||||
|
|
||||||
helper.discover(new DiscoverCallback() {
|
helper.discover(new DiscoverCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onDiscoverSuccessfully(String version) {
|
public void onDiscoverSuccessfully(String version) {
|
||||||
//ledDDaemon.setActive(true);
|
//ledDDaemon.setActive(true);
|
||||||
ledDHelpers.put(ledDDaemon, helper);
|
ledDHelpers.put(ledDDaemon, helper);
|
||||||
|
|
||||||
Intent i = new Intent(INTENT_ACTION_REFRESH);
|
Intent i = new Intent(INTENT_ACTION_REFRESH);
|
||||||
sendBroadcast(i);
|
sendBroadcast(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
//ledDDaemon.setActive(false);
|
//ledDDaemon.setActive(false);
|
||||||
ledDHelpers.put(ledDDaemon, helper);
|
ledDHelpers.put(ledDDaemon, helper);
|
||||||
|
|
||||||
Intent i = new Intent(INTENT_ACTION_REFRESH);
|
Intent i = new Intent(INTENT_ACTION_REFRESH);
|
||||||
sendBroadcast(i);
|
sendBroadcast(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException | JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(ColorApplication.TAG, "Loaded " + ledDHelpers.size() + " Daemons from preferences");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,11 +19,11 @@
|
|||||||
package com.idlegandalf.ledd;
|
package com.idlegandalf.ledd;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.idlegandalf.ledd.fragments.SettingsFragment;
|
import com.idlegandalf.ledd.fragments.SettingsFragment;
|
||||||
|
|
||||||
public class SettingsActivity extends ActionBarActivity {
|
public class SettingsActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@@ -28,6 +28,6 @@ public interface AddControllerCallback extends BaseCallback {
|
|||||||
*/
|
*/
|
||||||
void onControllerAdded(Controller controller);
|
void onControllerAdded(Controller controller);
|
||||||
|
|
||||||
void onAddFailed(String msg, String detail);
|
void onAddFailed(int code, String msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,4 +23,6 @@ import com.idlegandalf.ledd.components.LedStripe;
|
|||||||
|
|
||||||
public interface AddStripeCallback extends BaseCallback {
|
public interface AddStripeCallback extends BaseCallback {
|
||||||
void onAddSuccessfully(LedStripe stripe);
|
void onAddSuccessfully(LedStripe stripe);
|
||||||
|
|
||||||
|
void onAddFailed(int code, String msg);
|
||||||
}
|
}
|
||||||
|
@@ -23,5 +23,5 @@ import com.idlegandalf.ledd.components.LedStripe;
|
|||||||
public interface RecieveColorCallback extends BaseCallback {
|
public interface RecieveColorCallback extends BaseCallback {
|
||||||
void onColorRecieved(LedStripe stripe);
|
void onColorRecieved(LedStripe stripe);
|
||||||
|
|
||||||
void onRecievFailed(String msg);
|
void onRecievFailed(int code, String msg);
|
||||||
}
|
}
|
||||||
|
@@ -26,5 +26,5 @@ import java.util.List;
|
|||||||
public interface StripesCallback extends BaseCallback {
|
public interface StripesCallback extends BaseCallback {
|
||||||
void onSuccess(List<LedStripe> stripes);
|
void onSuccess(List<LedStripe> stripes);
|
||||||
|
|
||||||
void onGetFailed(String message);
|
void onGetFailed(int code, String message);
|
||||||
}
|
}
|
||||||
|
@@ -19,11 +19,11 @@
|
|||||||
package com.idlegandalf.ledd.components;
|
package com.idlegandalf.ledd.components;
|
||||||
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||||
|
|
||||||
public abstract class AnswerTask {
|
public abstract class AnswerTask {
|
||||||
public abstract void onConnectionFailed(String message);
|
public abstract void onConnectionFailed(String message);
|
||||||
|
|
||||||
public abstract void onResponse(JSONObject response);
|
public abstract void onResponse(JSONRPC2Response response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,16 +18,16 @@
|
|||||||
|
|
||||||
package com.idlegandalf.ledd.components;
|
package com.idlegandalf.ledd.components;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class LedDRequest {
|
public class LedDRequest {
|
||||||
JSONObject request;
|
JSONRPC2Request request;
|
||||||
AnswerTask task;
|
AnswerTask task;
|
||||||
|
|
||||||
public LedDRequest(JSONObject request, AnswerTask task) {
|
public LedDRequest(JSONRPC2Request request, AnswerTask task) {
|
||||||
this.request = request;
|
this.request = request;
|
||||||
this.task = task;
|
this.task = task;
|
||||||
}
|
}
|
||||||
|
@@ -55,4 +55,9 @@ public class LedStripe {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.RGB = RGB;
|
this.RGB = RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s<-%s@%s (r=%d;g=%d;b=%d)", name, controller.getAddress(), ledDDaemon, channelRed, channelGreen, channelBlue);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -18,33 +18,26 @@
|
|||||||
|
|
||||||
package com.idlegandalf.ledd.components;
|
package com.idlegandalf.ledd.components;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||||
import org.json.JSONObject;
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||||
|
|
||||||
import java.util.UUID;
|
import org.json.JSONException;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class Sendable {
|
public class Sendable {
|
||||||
LedDDaemon recipient;
|
LedDDaemon recipient;
|
||||||
JSONObject message;
|
JSONRPC2Request request;
|
||||||
String ref;
|
|
||||||
AnswerTask onAnswer;
|
AnswerTask onAnswer;
|
||||||
|
|
||||||
public Sendable(JSONObject msg, AnswerTask task, LedDDaemon ledDDaemon) throws JSONException {
|
public Sendable(JSONRPC2Request request, AnswerTask task, LedDDaemon recipient) throws JSONException {
|
||||||
this(msg, UUID.randomUUID().toString(), task, ledDDaemon);
|
this.request = request;
|
||||||
}
|
|
||||||
|
|
||||||
public Sendable(JSONObject msg, String ref, AnswerTask task, LedDDaemon recipient) throws JSONException {
|
|
||||||
this.message = msg;
|
|
||||||
this.ref = ref;
|
|
||||||
this.message.put("ref", ref);
|
|
||||||
this.onAnswer = task;
|
this.onAnswer = task;
|
||||||
this.recipient = recipient;
|
this.recipient = recipient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onResponse(JSONObject object) {
|
public void onResponse(JSONRPC2Response object) {
|
||||||
if (onAnswer != null) {
|
if (onAnswer != null) {
|
||||||
onAnswer.onResponse(object);
|
onAnswer.onResponse(object);
|
||||||
}
|
}
|
||||||
|
@@ -21,9 +21,6 @@ package com.idlegandalf.ledd.components;
|
|||||||
|
|
||||||
import com.idlegandalf.ledd.helper.LedDHelper;
|
import com.idlegandalf.ledd.helper.LedDHelper;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class StripeGroup {
|
public class StripeGroup {
|
||||||
@@ -60,7 +57,7 @@ public class StripeGroup {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRGB(int r, int g, int b, LedDHelper api) throws JSONException, IOException {
|
public void setRGB(int r, int g, int b, LedDHelper api) {
|
||||||
for (int i = 0; i < mStripes.size(); i++) {
|
for (int i = 0; i < mStripes.size(); i++) {
|
||||||
//mStripes.get(i).setRGB(r, g, b, api);
|
//mStripes.get(i).setRGB(r, g, b, api);
|
||||||
}
|
}
|
||||||
|
@@ -39,9 +39,6 @@ import com.idlegandalf.ledd.components.Controller;
|
|||||||
import com.idlegandalf.ledd.components.LedDDaemon;
|
import com.idlegandalf.ledd.components.LedDDaemon;
|
||||||
import com.idlegandalf.ledd.helper.LedDHelper;
|
import com.idlegandalf.ledd.helper.LedDHelper;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.ParsePosition;
|
import java.text.ParsePosition;
|
||||||
|
|
||||||
@@ -64,6 +61,13 @@ public class AddControllerDialog extends DialogFragment implements DialogInterfa
|
|||||||
EditText channelText;
|
EditText channelText;
|
||||||
LedDDaemon dDaemon;
|
LedDDaemon dDaemon;
|
||||||
|
|
||||||
|
private static boolean isNumeric(String str) {
|
||||||
|
NumberFormat formatter = NumberFormat.getInstance();
|
||||||
|
ParsePosition pos = new ParsePosition(0);
|
||||||
|
formatter.parse(str, pos);
|
||||||
|
return str.length() == pos.getIndex();
|
||||||
|
}
|
||||||
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
View v = View.inflate(getActivity(), R.layout.fragment_addcontroller, null);
|
View v = View.inflate(getActivity(), R.layout.fragment_addcontroller, null);
|
||||||
ButterKnife.bind(this, v);
|
ButterKnife.bind(this, v);
|
||||||
@@ -168,216 +172,49 @@ public class AddControllerDialog extends DialogFragment implements DialogInterfa
|
|||||||
c.setI2c_device(Integer.parseInt(i2cText.getText().toString()));
|
c.setI2c_device(Integer.parseInt(i2cText.getText().toString()));
|
||||||
c.setChannels(Integer.parseInt(channelText.getText().toString()));
|
c.setChannels(Integer.parseInt(channelText.getText().toString()));
|
||||||
|
|
||||||
LedDHelper helper = null;
|
LedDHelper helper = ColorApplication.getInstance().getHelperForDaemon(dDaemon);
|
||||||
try {
|
|
||||||
helper = ColorApplication.getInstance().getHelperForDaemon(dDaemon);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (helper != null) {
|
if (helper != null) {
|
||||||
try {
|
helper.addController(c, new AddControllerCallback() {
|
||||||
helper.addController(c, new AddControllerCallback() {
|
@Override
|
||||||
@Override
|
public void onControllerAdded(final Controller controller) {
|
||||||
public void onControllerAdded(final Controller controller) {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
@Override
|
||||||
@Override
|
public void run() {
|
||||||
public void run() {
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), String.format(getActivity().getString(R.string.snachbar_added_controller), controller.getId()), Snackbar.LENGTH_LONG).show();
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
}
|
||||||
.getChildAt(0), "Added Controller (" + controller.getId() + ")", Snackbar.LENGTH_LONG).show();
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dDaemon.getControllers().add(controller);
|
dDaemon.getControllers().add(controller);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAddFailed(final String msg, String detail) {
|
public void onAddFailed(final int code, final String msg) {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), getActivity().getString(R.string.snackbar_error) + msg, Snackbar.LENGTH_LONG).show();
|
||||||
.getChildAt(0), "Error: " + msg, Snackbar.LENGTH_LONG).show();
|
}
|
||||||
}
|
});
|
||||||
});
|
AddStripeDialog.instance.onResume();
|
||||||
AddStripeDialog.instance.onResume();
|
dismiss();
|
||||||
dismiss();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(final String message) {
|
public void onConnectionFailed(final String message) {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), String.format(getActivity().getString(R.string.snackbar_daemon_connection_failed), dDaemon, message), Snackbar.LENGTH_LONG).show();
|
||||||
.getChildAt(0), "Coudn't connect to" +
|
}
|
||||||
" daemon at " + dDaemon + ": " + message, Snackbar.LENGTH_LONG).show();
|
});
|
||||||
}
|
AddStripeDialog.instance.onResume();
|
||||||
});
|
dismiss();
|
||||||
AddStripeDialog.instance.onResume();
|
}
|
||||||
dismiss();
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShow(final DialogInterface dialog) {
|
|
||||||
|
|
||||||
final AlertDialog alertDialog = (AlertDialog) dialog;
|
|
||||||
|
|
||||||
addressText.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
addressLayout.setError(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
channelText.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
channelLayout.setError(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
i2cText.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
i2cLayout.setError(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
AddStripeDialog.instance.onResume();
|
|
||||||
alertDialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (i2cText.getText().toString().isEmpty() || !isNumeric(i2cText.getText().toString())) {
|
|
||||||
i2cLayout.setError("No valid i2c device number");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!addressText.getText().toString().contains("0x") || !addressText.getText().toString().split("x")[1].matches("-?[0-9a-fA-F]+")) {
|
|
||||||
addressLayout.setError("No valid hexdecimal address");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channelText.getText().toString().isEmpty() || !isNumeric(channelText.getText().toString()) && Integer.parseInt(channelText
|
|
||||||
.getText().toString()) <= 0) {
|
|
||||||
channelLayout.setError("No valid channel amount");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller c = new Controller();
|
|
||||||
c.setAddress(addressText.getText().toString());
|
|
||||||
c.setI2c_device(Integer.parseInt(i2cText.getText().toString()));
|
|
||||||
c.setChannels(Integer.parseInt(channelText.getText().toString()));
|
|
||||||
|
|
||||||
LedDHelper helper = null;
|
|
||||||
try {
|
|
||||||
helper = ColorApplication.getInstance().getHelperForDaemon(dDaemon);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (helper != null) {
|
|
||||||
try {
|
|
||||||
helper.addController(c, new AddControllerCallback() {
|
|
||||||
@Override
|
|
||||||
public void onControllerAdded(final Controller controller) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
|
||||||
.getChildAt(0), "Added Controller (" + controller.getId() + ")", Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dDaemon.getControllers().add(controller);
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAddFailed(final String msg, String detail) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
|
||||||
.getChildAt(0), "Error: " + msg, Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AddStripeDialog.instance.onResume();
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed(final String message) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
|
||||||
.getChildAt(0), "Coudn't connect to" +
|
|
||||||
" daemon at " + dDaemon + ": " + message, Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AddStripeDialog.instance.onResume();
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isNumeric(String str) {
|
|
||||||
NumberFormat formatter = NumberFormat.getInstance();
|
|
||||||
ParsePosition pos = new ParsePosition(0);
|
|
||||||
formatter.parse(str, pos);
|
|
||||||
return str.length() == pos.getIndex();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -45,9 +45,6 @@ import com.idlegandalf.ledd.R;
|
|||||||
import com.idlegandalf.ledd.callbacks.DiscoverCallback;
|
import com.idlegandalf.ledd.callbacks.DiscoverCallback;
|
||||||
import com.idlegandalf.ledd.components.LedDDaemon;
|
import com.idlegandalf.ledd.components.LedDDaemon;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -286,44 +283,32 @@ public class AddDaemonDialog extends DialogFragment implements DialogInterface.O
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addDaemon(final LedDDaemon ledDDaemon) {
|
private void addDaemon(final LedDDaemon ledDDaemon) {
|
||||||
try {
|
ColorApplication.getInstance().getHelperForDaemon(ledDDaemon).discover(new DiscoverCallback() {
|
||||||
ColorApplication.getInstance().getHelperForDaemon(ledDDaemon).discover(new DiscoverCallback() {
|
@Override
|
||||||
@Override
|
public void onConnectionFailed(final String message) {
|
||||||
public void onConnectionFailed(final String message) {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
@Override
|
||||||
@Override
|
public void run() {
|
||||||
public void run() {
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), String.format(getActivity().getString(R.string.snackbar_daemon_connection_failed), ledDDaemon, message), Snackbar.LENGTH_LONG).show();
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0),
|
|
||||||
"Coudn't connect to" +
|
|
||||||
" daemon at " + ledDDaemon + ": " + message, Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AddStripeDialog stripeAdd = (AddStripeDialog) getFragmentManager().findFragmentByTag("stripeAdd");
|
|
||||||
AddStripeDialog.instance.onResume();
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDiscoverSuccessfully(final String version) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0),
|
|
||||||
"Added LedD Daemon version: " + version, Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
((ColorActivity) getActivity()).refreshStripes();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
AddStripeDialog.instance.onResume();
|
});
|
||||||
dismiss();
|
AddStripeDialog.instance.onResume();
|
||||||
}
|
dismiss();
|
||||||
});
|
}
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
@Override
|
||||||
}
|
public void onDiscoverSuccessfully(final String version) {
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), getActivity().getString(R.string.snackbar_added_daemon_version) + version, Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
((ColorActivity) getActivity()).refreshStripes();
|
||||||
|
AddStripeDialog.instance.onResume();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,9 +50,6 @@ import com.idlegandalf.ledd.components.LedDDaemon;
|
|||||||
import com.idlegandalf.ledd.components.LedStripe;
|
import com.idlegandalf.ledd.components.LedStripe;
|
||||||
import com.idlegandalf.ledd.helper.LedDHelper;
|
import com.idlegandalf.ledd.helper.LedDHelper;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.ParsePosition;
|
import java.text.ParsePosition;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -259,50 +256,40 @@ public class AddStripeDialog extends DialogFragment implements DialogInterface.O
|
|||||||
stripe.setLedDDaemon((LedDDaemon) daemonSpinner.getSelectedItem());
|
stripe.setLedDDaemon((LedDDaemon) daemonSpinner.getSelectedItem());
|
||||||
stripe.setController((Controller) controllerSpinner.getSelectedItem());
|
stripe.setController((Controller) controllerSpinner.getSelectedItem());
|
||||||
|
|
||||||
LedDHelper helper = null;
|
LedDHelper helper = ColorApplication.getInstance().getHelperForDaemon((LedDDaemon) daemonSpinner.getSelectedItem());
|
||||||
try {
|
|
||||||
helper = ColorApplication.getInstance().getHelperForDaemon((LedDDaemon) daemonSpinner.getSelectedItem());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (helper != null) {
|
if (helper != null) {
|
||||||
try {
|
helper.addStripe(stripe, new AddStripeCallback() {
|
||||||
helper.addStripe(stripe, new AddStripeCallback() {
|
@Override
|
||||||
@Override
|
public void onAddSuccessfully(final LedStripe stripe) {
|
||||||
public void onAddSuccessfully(final LedStripe stripe) {
|
ColorActivity activity = ((ColorActivity) getActivity());
|
||||||
ColorActivity activity = ((ColorActivity) getActivity());
|
activity.refreshStripes();
|
||||||
try {
|
|
||||||
activity.refreshStripes();
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
} catch (IOException e) {
|
@Override
|
||||||
e.printStackTrace();
|
public void run() {
|
||||||
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), String.format(getActivity().getString(R.string.snackbar_added_stripe_id), stripe.getId()), Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
@Override
|
||||||
@Override
|
public void onAddFailed(int code, String msg) {
|
||||||
public void run() {
|
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
|
||||||
.getChildAt(0), "Added stripe (" + stripe.getId() + ")", Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onConnectionFailed(final String message) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
@Override
|
||||||
@Override
|
public void onConnectionFailed(final String message) {
|
||||||
public void run() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content))
|
@Override
|
||||||
.getChildAt(0), "Failed to add stripe: " + message, Snackbar.LENGTH_LONG).show();
|
public void run() {
|
||||||
}
|
Snackbar.make(((ViewGroup) getActivity().getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0), getActivity().getString(R.string.snackbar_failed_add_stripe) + message, Snackbar.LENGTH_LONG).show();
|
||||||
});
|
}
|
||||||
dismiss();
|
});
|
||||||
}
|
dismiss();
|
||||||
});
|
}
|
||||||
} catch (JSONException | IOException e) {
|
});
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -371,14 +358,20 @@ public class AddStripeDialog extends DialogFragment implements DialogInterface.O
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
ColorApplication.getInstance().onResume();
|
ColorApplication.getInstance().onResume();
|
||||||
if (daemonArrayAdapter != null) {
|
|
||||||
daemonArrayAdapter.clear();
|
|
||||||
daemonArrayAdapter.addAll(ColorApplication.getInstance().getDaemons());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controllerArrayAdapter != null && mDaemonSelected) {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
refreshController((LedDDaemon) daemonSpinner.getSelectedItem());
|
@Override
|
||||||
}
|
public void run() {
|
||||||
|
if (daemonArrayAdapter != null) {
|
||||||
|
daemonArrayAdapter.clear();
|
||||||
|
daemonArrayAdapter.addAll(ColorApplication.getInstance().getDaemons());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controllerArrayAdapter != null && mDaemonSelected) {
|
||||||
|
refreshController((LedDDaemon) daemonSpinner.getSelectedItem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testChannel(EditText text, ImageButton button) {
|
private void testChannel(EditText text, ImageButton button) {
|
||||||
@@ -398,19 +391,11 @@ public class AddStripeDialog extends DialogFragment implements DialogInterface.O
|
|||||||
}
|
}
|
||||||
text.setTag(toggle);
|
text.setTag(toggle);
|
||||||
|
|
||||||
LedDHelper helper = null;
|
LedDHelper helper = ColorApplication.getInstance().getHelperForDaemon((LedDDaemon) daemonSpinner.getSelectedItem());
|
||||||
try {
|
|
||||||
helper = ColorApplication.getInstance().getHelperForDaemon((LedDDaemon) daemonSpinner.getSelectedItem());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (helper != null) {
|
if (helper != null) {
|
||||||
try {
|
helper.testChannel((Controller) controllerSpinner.getSelectedItem(), Integer.parseInt(text.getText().toString()), val);
|
||||||
helper.testChannel((Controller) controllerSpinner.getSelectedItem(), Integer.parseInt(text.getText().toString()), val);
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,40 +403,31 @@ public class AddStripeDialog extends DialogFragment implements DialogInterface.O
|
|||||||
|
|
||||||
private void refreshController(final LedDDaemon ledDDaemon) {
|
private void refreshController(final LedDDaemon ledDDaemon) {
|
||||||
controllerArrayAdapter.clear();
|
controllerArrayAdapter.clear();
|
||||||
LedDHelper helper = null;
|
LedDHelper helper = ColorApplication.getInstance().getHelperForDaemon(ledDDaemon);
|
||||||
try {
|
|
||||||
helper = ColorApplication.getInstance().getHelperForDaemon(ledDDaemon);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (helper != null) {
|
if (helper != null) {
|
||||||
try {
|
helper.getStripes(new StripesCallback() {
|
||||||
helper.getStripes(new StripesCallback() {
|
@Override
|
||||||
@Override
|
public void onSuccess(List<LedStripe> stripes) {
|
||||||
public void onSuccess(List<LedStripe> stripes) {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
@Override
|
||||||
@Override
|
public void run() {
|
||||||
public void run() {
|
controllerArrayAdapter.addAll(ledDDaemon.getControllers());
|
||||||
controllerArrayAdapter.addAll(ledDDaemon.getControllers());
|
toggleAll(stripeMapping, true);
|
||||||
toggleAll(stripeMapping, true);
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGetFailed(String message) {
|
public void onGetFailed(int code, String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,14 +38,19 @@ import com.idlegandalf.ledd.components.LedDDaemon;
|
|||||||
import com.idlegandalf.ledd.components.LedDRequest;
|
import com.idlegandalf.ledd.components.LedDRequest;
|
||||||
import com.idlegandalf.ledd.components.LedStripe;
|
import com.idlegandalf.ledd.components.LedStripe;
|
||||||
import com.idlegandalf.ledd.services.ColorService;
|
import com.idlegandalf.ledd.services.ColorService;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
public class LedDHelper {
|
public class LedDHelper {
|
||||||
@@ -53,7 +58,7 @@ public class LedDHelper {
|
|||||||
final String ACTION_GETCOLOR = "get_color";
|
final String ACTION_GETCOLOR = "get_color";
|
||||||
final String ACTION_ADDCONTROLLER = "add_controller";
|
final String ACTION_ADDCONTROLLER = "add_controller";
|
||||||
final String ACTION_GETALLSTRIPES = "get_stripes";
|
final String ACTION_GETALLSTRIPES = "get_stripes";
|
||||||
final String ACTION_ADDSTRIPES = "add_stripe";
|
final String ACTION_ADDSTRIPE = "add_stripe";
|
||||||
final String ACTION_TESTCHANNEL = "test_channel";
|
final String ACTION_TESTCHANNEL = "test_channel";
|
||||||
final String ACTION_DISCOVER = "discover";
|
final String ACTION_DISCOVER = "discover";
|
||||||
private Context context;
|
private Context context;
|
||||||
@@ -78,7 +83,7 @@ public class LedDHelper {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public LedDHelper(LedDDaemon ledDDaemon, Context appl) throws IOException {
|
public LedDHelper(LedDDaemon ledDDaemon, Context appl) {
|
||||||
this.context = appl;
|
this.context = appl;
|
||||||
this.dRequests = new LinkedBlockingQueue<>();
|
this.dRequests = new LinkedBlockingQueue<>();
|
||||||
this.ledDDaemon = ledDDaemon;
|
this.ledDDaemon = ledDDaemon;
|
||||||
@@ -91,34 +96,35 @@ public class LedDHelper {
|
|||||||
* Add controller to ledd daemon
|
* Add controller to ledd daemon
|
||||||
*
|
*
|
||||||
* @param c controller object
|
* @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();
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
|
||||||
jnson.put("action", ACTION_ADDCONTROLLER);
|
params.put("channels", c.getChannels());
|
||||||
jnson.put("channels", c.getChannels());
|
params.put("i2c_dev", c.getI2c_device());
|
||||||
jnson.put("i2c_dev", c.getI2c_device());
|
params.put("address", c.getAddress());
|
||||||
jnson.put("address", c.getAddress());
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, new AnswerTask() {
|
JSONRPC2Request request = new JSONRPC2Request(ACTION_ADDCONTROLLER, params, UUID.randomUUID().toString());
|
||||||
|
|
||||||
|
addRequestToQueue(request, new AnswerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
callback.onAddFailed(message, "");
|
callback.onConnectionFailed(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONRPC2Response response) {
|
||||||
try {
|
if (response.indicatesSuccess()) {
|
||||||
if (response.getBoolean("success")) {
|
try {
|
||||||
c.setId(response.getInt("cid"));
|
JSONObject json = new JSONObject(response.getResult().toString());
|
||||||
|
c.setId(json.getInt("cid"));
|
||||||
callback.onControllerAdded(c);
|
callback.onControllerAdded(c);
|
||||||
} else {
|
} catch (JSONException e) {
|
||||||
callback.onAddFailed(response.getString("message"), response.getString("message_detail"));
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
e.printStackTrace();
|
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") JSONRPC2Error error = response.getError();
|
||||||
|
callback.onAddFailed(error.getCode(), error.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -126,28 +132,22 @@ public class LedDHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get stripes known to daemon
|
* 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();
|
addRequestToQueue(new JSONRPC2Request(ACTION_GETALLSTRIPES, UUID.randomUUID().toString()), new AnswerTask() {
|
||||||
|
|
||||||
jnson.put("action", ACTION_GETALLSTRIPES);
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, new AnswerTask() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
callback.onGetFailed(message);
|
callback.onConnectionFailed(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONRPC2Response response) {
|
||||||
try {
|
try {
|
||||||
if (response.getBoolean("success")) {
|
if (response.indicatesSuccess()) {
|
||||||
ledDDaemon.getControllers().clear();
|
ledDDaemon.getControllers().clear();
|
||||||
List<LedStripe> list = new ArrayList<>();
|
List<LedStripe> list = new ArrayList<>();
|
||||||
JSONArray jcontrollers = response.getJSONArray("controller");
|
JSONObject json = new JSONObject(response.getResult().toString());
|
||||||
|
JSONArray jcontrollers = json.getJSONArray("controller");
|
||||||
|
|
||||||
for (int i = 0; i < jcontrollers.length(); i++) {
|
for (int i = 0; i < jcontrollers.length(); i++) {
|
||||||
JSONObject row = jcontrollers.getJSONObject(i);
|
JSONObject row = jcontrollers.getJSONObject(i);
|
||||||
@@ -160,7 +160,7 @@ public class LedDHelper {
|
|||||||
JSONArray jstripes = row.getJSONArray("stripes");
|
JSONArray jstripes = row.getJSONArray("stripes");
|
||||||
|
|
||||||
for (int o = 0; o < jstripes.length(); o++) {
|
for (int o = 0; o < jstripes.length(); o++) {
|
||||||
JSONObject srow = jstripes.getJSONObject(i);
|
JSONObject srow = jstripes.getJSONObject(o);
|
||||||
LedStripe nStripe = new LedStripe();
|
LedStripe nStripe = new LedStripe();
|
||||||
nStripe.setId(srow.getInt("id"));
|
nStripe.setId(srow.getInt("id"));
|
||||||
nStripe.setRGB(srow.getBoolean("rgb"));
|
nStripe.setRGB(srow.getBoolean("rgb"));
|
||||||
@@ -178,8 +178,8 @@ public class LedDHelper {
|
|||||||
|
|
||||||
callback.onSuccess(list);
|
callback.onSuccess(list);
|
||||||
} else {
|
} else {
|
||||||
if (response.has("message")) callback.onGetFailed(response.getString("message"));
|
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") JSONRPC2Error error = response.getError();
|
||||||
else callback.onGetFailed("unknown error");
|
callback.onGetFailed(error.getCode(), error.getMessage());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -194,59 +194,51 @@ public class LedDHelper {
|
|||||||
* @param ledStripe Stripe
|
* @param ledStripe Stripe
|
||||||
*/
|
*/
|
||||||
public void setColor(LedStripe ledStripe) {
|
public void setColor(LedStripe ledStripe) {
|
||||||
|
Map<String, Object> hsv = new HashMap<>();
|
||||||
|
|
||||||
JSONObject jnson = new JSONObject();
|
hsv.put("h", ledStripe.getColor().getHue());
|
||||||
JSONObject hsv = new JSONObject();
|
hsv.put("s", ledStripe.getColor().getSaturation());
|
||||||
|
hsv.put("v", ledStripe.getColor().getValue());
|
||||||
|
|
||||||
try {
|
Map<String, Object> params = new HashMap<>();
|
||||||
hsv.put("h", ledStripe.getColor().getHue());
|
params.put("sid", ledStripe.getId());
|
||||||
hsv.put("s", ledStripe.getColor().getSaturation());
|
params.put("hsv", hsv);
|
||||||
|
|
||||||
hsv.put("v", ledStripe.getColor().getValue());
|
|
||||||
|
|
||||||
|
|
||||||
jnson.put("action", ACTION_SETCOLOR);
|
JSONRPC2Request request = new JSONRPC2Request(ACTION_SETCOLOR, params, UUID.randomUUID().toString());
|
||||||
jnson.put("sid", ledStripe.getId());
|
|
||||||
jnson.put("hsv", hsv);
|
|
||||||
|
|
||||||
} catch (JSONException e) {
|
addRequestToQueue(request, null);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get color using the stripeid
|
* Get color using the stripeid
|
||||||
*
|
*
|
||||||
* @param ledStripe Stripe
|
* @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();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
|
params.put("sid", ledStripe.getId());
|
||||||
|
|
||||||
jnson.put("action", ACTION_GETCOLOR);
|
addRequestToQueue(new JSONRPC2Request(ACTION_GETCOLOR, params, UUID.randomUUID().toString()), new AnswerTask() {
|
||||||
jnson.put("sid", ledStripe.getId());
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, new AnswerTask() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
callback.onRecievFailed(message);
|
callback.onConnectionFailed(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONRPC2Response response) {
|
||||||
try {
|
if (response.indicatesSuccess()) {
|
||||||
if (response.getBoolean("success")) {
|
try {
|
||||||
JSONArray hsv = response.getJSONArray("color");
|
JSONObject json = new JSONObject(response.getResult().toString());
|
||||||
|
JSONArray hsv = json.getJSONArray("color");
|
||||||
ledStripe.setColor(new HSV(hsv.getDouble(0), hsv.getDouble(1), hsv.getDouble(2)));
|
ledStripe.setColor(new HSV(hsv.getDouble(0), hsv.getDouble(1), hsv.getDouble(2)));
|
||||||
callback.onColorRecieved(ledStripe);
|
callback.onColorRecieved(ledStripe);
|
||||||
} else {
|
} catch (JSONException e) {
|
||||||
callback.onRecievFailed(response.getString("message"));
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
e.printStackTrace();
|
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") JSONRPC2Error error = response.getError();
|
||||||
|
callback.onRecievFailed(error.getCode(), error.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -258,24 +250,22 @@ public class LedDHelper {
|
|||||||
* @param c controller
|
* @param c controller
|
||||||
* @param channel channel number
|
* @param channel channel number
|
||||||
* @param value value (1= on, 0 = off)
|
* @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();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
|
|
||||||
jnson.put("action", ACTION_TESTCHANNEL);
|
params.put("cid", c.getId());
|
||||||
jnson.put("cid", c.getId());
|
params.put("channel", channel);
|
||||||
jnson.put("channel", channel);
|
params.put("value", value);
|
||||||
jnson.put("value", value);
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, new AnswerTask() {
|
addRequestToQueue(new JSONRPC2Request(ACTION_TESTCHANNEL, params, UUID.randomUUID().toString()), new AnswerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONRPC2Response response) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -283,26 +273,20 @@ public class LedDHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about an ledd daemon
|
* 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();
|
addRequestToQueue(new JSONRPC2Request(ACTION_DISCOVER, UUID.randomUUID().toString()), new AnswerTask() {
|
||||||
|
|
||||||
jnson.put("action", ACTION_DISCOVER);
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, new AnswerTask() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
callback.onConnectionFailed(message);
|
callback.onConnectionFailed(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONRPC2Response response) {
|
||||||
try {
|
try {
|
||||||
if (response.getBoolean("success")) {
|
if (response.indicatesSuccess()) {
|
||||||
callback.onDiscoverSuccessfully(response.getString("version"));
|
JSONObject json = new JSONObject(response.getResult().toString());
|
||||||
|
callback.onDiscoverSuccessfully(json.getString("version"));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -313,39 +297,36 @@ public class LedDHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about an ledd daemon
|
* 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();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
|
HashMap<String, Object> mapping = new HashMap<>();
|
||||||
|
|
||||||
jnson.put("action", ACTION_ADDSTRIPES);
|
params.put("name", ledStripe.getName());
|
||||||
JSONObject stripe = new JSONObject();
|
params.put("rgb", ledStripe.isRGB());
|
||||||
|
|
||||||
stripe.put("name", ledStripe.getName());
|
|
||||||
stripe.put("rgb", ledStripe.isRGB());
|
|
||||||
|
|
||||||
JSONObject mapping = new JSONObject();
|
|
||||||
mapping.put("r", ledStripe.getChannelRed());
|
mapping.put("r", ledStripe.getChannelRed());
|
||||||
mapping.put("g", ledStripe.getChannelGreen());
|
mapping.put("g", ledStripe.getChannelGreen());
|
||||||
mapping.put("b", ledStripe.getChannelBlue());
|
mapping.put("b", ledStripe.getChannelBlue());
|
||||||
stripe.put("map", mapping);
|
params.put("map", mapping);
|
||||||
stripe.put("cid", ledStripe.getController().getId());
|
params.put("cid", ledStripe.getController().getId());
|
||||||
jnson.put("stripe", stripe);
|
|
||||||
|
|
||||||
addRequestToQueue(jnson, new AnswerTask() {
|
addRequestToQueue(new JSONRPC2Request(ACTION_ADDSTRIPE, params, UUID.randomUUID().toString()), new AnswerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(String message) {
|
public void onConnectionFailed(String message) {
|
||||||
callback.onConnectionFailed(message);
|
callback.onConnectionFailed(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONRPC2Response response) {
|
||||||
try {
|
try {
|
||||||
if (response.getBoolean("success")) {
|
if (response.indicatesSuccess()) {
|
||||||
ledStripe.setId(response.getInt("sid"));
|
JSONObject json = new JSONObject(response.getResult().toString());
|
||||||
|
ledStripe.setId(json.getInt("sid"));
|
||||||
callback.onAddSuccessfully(ledStripe);
|
callback.onAddSuccessfully(ledStripe);
|
||||||
|
} else {
|
||||||
|
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") JSONRPC2Error error = response.getError();
|
||||||
|
callback.onAddFailed(error.getCode(), error.getMessage());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -354,8 +335,8 @@ public class LedDHelper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRequestToQueue(JSONObject json, AnswerTask task) {
|
private void addRequestToQueue(JSONRPC2Request request, AnswerTask task) {
|
||||||
dRequests.add(new LedDRequest(json, task));
|
if (request != null) dRequests.add(new LedDRequest(request, task));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teardown() {
|
public void teardown() {
|
||||||
@@ -389,8 +370,6 @@ public class LedDHelper {
|
|||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
break;
|
break;
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,9 +33,11 @@ import com.koushikdutta.async.DataEmitter;
|
|||||||
import com.koushikdutta.async.Util;
|
import com.koushikdutta.async.Util;
|
||||||
import com.koushikdutta.async.callback.ConnectCallback;
|
import com.koushikdutta.async.callback.ConnectCallback;
|
||||||
import com.koushikdutta.async.callback.DataCallback;
|
import com.koushikdutta.async.callback.DataCallback;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2ParseException;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
@@ -65,11 +67,6 @@ public class ColorService extends Service {
|
|||||||
return mBinder;
|
return mBinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onUnbind(Intent intent) {
|
|
||||||
return super.onUnbind(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
worker.stop();
|
worker.stop();
|
||||||
@@ -85,24 +82,22 @@ public class ColorService extends Service {
|
|||||||
DataCallback dataCallback = new DataCallback() {
|
DataCallback dataCallback = new DataCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
|
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
|
||||||
JSONObject resp = null;
|
JSONRPC2Response reqIn = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resp = new JSONObject(new String(bb.getAllByteArray()));
|
reqIn = JSONRPC2Response.parse(new String(bb.getAllByteArray()));
|
||||||
} catch (JSONException e) {
|
|
||||||
|
} catch (JSONRPC2ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp != null) {
|
if (reqIn != null) {
|
||||||
try {
|
if (sendableHashMap.containsKey(reqIn.getID().toString())) {
|
||||||
if (sendableHashMap.containsKey(resp.getString("ref"))) {
|
sendableHashMap.get(reqIn.getID().toString()).onResponse(reqIn);
|
||||||
sendableHashMap.get(resp.getString("ref")).onResponse(resp);
|
sendableHashMap.remove(reqIn.getID().toString());
|
||||||
sendableHashMap.remove(resp.getString("ref"));
|
if (timeoutHashMap.containsKey(reqIn.getID().toString()) && timeoutHashMap.get(reqIn.getID().toString()) != null)
|
||||||
if (timeoutHashMap.containsKey(resp.getString("ref")) && timeoutHashMap.get(resp.getString("ref")) != null)
|
timeoutHashMap.get(reqIn.getID().toString()).cancel(false);
|
||||||
timeoutHashMap.get(resp.getString("ref")).cancel(false);
|
timeoutHashMap.remove(reqIn.getID().toString());
|
||||||
timeoutHashMap.remove(resp.getString("ref"));
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,36 +117,46 @@ public class ColorService extends Service {
|
|||||||
final T item = workQueue.take();
|
final T item = workQueue.take();
|
||||||
|
|
||||||
if (item instanceof Sendable) {
|
if (item instanceof Sendable) {
|
||||||
if (socketHashMap.containsKey(((Sendable) item).getRecipient()) && socketHashMap.get(((Sendable) item).getRecipient())
|
final Sendable sendable = (Sendable) item;
|
||||||
.getServer().isRunning()) {
|
if (socketHashMap.containsKey(sendable.getRecipient())) {
|
||||||
|
if (socketHashMap.get(sendable.getRecipient()) == null) {
|
||||||
|
// if server is not running yet, readd item to queue
|
||||||
|
workQueue.add(item);
|
||||||
|
continue;
|
||||||
|
} else if (!socketHashMap.get(sendable.getRecipient()).getServer().isRunning()) {
|
||||||
|
// connection probably closed or was interrupted -> reconnect
|
||||||
|
socketHashMap.remove(sendable.getRecipient());
|
||||||
|
workQueue.add(item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Util.writeAll(socketHashMap.get(((Sendable) item).getRecipient()), (((Sendable) item).getMessage().toString() + "\n")
|
Util.writeAll(socketHashMap.get(sendable.getRecipient()), (sendable.getRequest().toString() + "\n").getBytes("UTF-8"),
|
||||||
.getBytes
|
null);
|
||||||
("UTF-8"), null);
|
sendableHashMap.put((String) sendable.getRequest().getID(), sendable);
|
||||||
sendableHashMap.put(((Sendable) item).getRef(), (Sendable) item);
|
|
||||||
if (!poolExecutor.isTerminating() && !poolExecutor.isTerminated())
|
if (!poolExecutor.isTerminating() && !poolExecutor.isTerminated())
|
||||||
timeoutHashMap.put(((Sendable) item).getRef(), poolExecutor.schedule(new Runnable() {
|
timeoutHashMap.put((String) sendable.getRequest().getID(), poolExecutor.schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
((Sendable) item).onNoResponse();
|
sendable.onNoResponse();
|
||||||
timeoutHashMap.remove(((Sendable) item).getRef());
|
timeoutHashMap.remove(sendable.getRequest().getID());
|
||||||
sendableHashMap.remove(((Sendable) item).getRef());
|
sendableHashMap.remove(sendable.getRequest().getID());
|
||||||
}
|
}
|
||||||
}, 1000, TimeUnit.MILLISECONDS));
|
}, 1000, TimeUnit.MILLISECONDS));
|
||||||
} else {
|
} else {
|
||||||
AsyncServer.getDefault().connectSocket(new InetSocketAddress(((Sendable) item).getRecipient().getAddress(), ((Sendable)
|
socketHashMap.put(sendable.getRecipient(), null);
|
||||||
item).getRecipient().getPort()), new ConnectCallback() {
|
AsyncServer.getDefault().connectSocket(new InetSocketAddress(sendable.getRecipient().getAddress(), sendable
|
||||||
|
.getRecipient().getPort()), new ConnectCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectCompleted(Exception ex, final AsyncSocket socket) {
|
public void onConnectCompleted(Exception ex, final AsyncSocket socket) {
|
||||||
if (ex == null) {
|
if (ex == null) {
|
||||||
socket.setDataCallback(dataCallback);
|
socket.setDataCallback(dataCallback);
|
||||||
|
|
||||||
socketHashMap.put(((Sendable) item).getRecipient(), socket);
|
socketHashMap.put(sendable.getRecipient(), socket);
|
||||||
|
|
||||||
//if (!workQueue.contains(item)) -> needs equals implementaion
|
//if (!workQueue.contains(item)) -> needs equals implementation
|
||||||
workQueue.add(item);
|
workQueue.add(item);
|
||||||
} else {
|
} else {
|
||||||
((Sendable) item).onConnectionFailed(ex.getMessage());
|
sendable.onConnectionFailed(ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -172,10 +177,16 @@ public class ColorService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ColorBinder extends Binder {
|
public class ColorBinder extends Binder {
|
||||||
public String queueSend(LedDDaemon rec, JSONObject msg, AnswerTask answerTask) throws JSONException {
|
public void queueSend(LedDDaemon rec, JSONRPC2Request request, AnswerTask answerTask) {
|
||||||
Sendable sendable = new Sendable(msg, answerTask, rec);
|
Sendable sendable = null;
|
||||||
queue.add(sendable);
|
try {
|
||||||
return sendable.getRef();
|
sendable = new Sendable(request, answerTask, rec);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (sendable != null) {
|
||||||
|
queue.add(sendable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 953 B |
Before Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 721 B |
BIN
app/src/main/res/drawable-hdpi/ic_clear_black_48dp.png
Normal file
After Width: | Height: | Size: 309 B |
BIN
app/src/main/res/drawable-hdpi/ic_clear_white_48dp.png
Normal file
After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 594 B |
Before Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 517 B |
BIN
app/src/main/res/drawable-mdpi/ic_clear_black_48dp.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
app/src/main/res/drawable-mdpi/ic_clear_white_48dp.png
Normal file
After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 963 B |
BIN
app/src/main/res/drawable-xhdpi/ic_clear_black_48dp.png
Normal file
After Width: | Height: | Size: 377 B |
BIN
app/src/main/res/drawable-xhdpi/ic_clear_white_48dp.png
Normal file
After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_clear_black_48dp.png
Normal file
After Width: | Height: | Size: 511 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_clear_white_48dp.png
Normal file
After Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 624 B |
Before Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_clear_black_48dp.png
Normal file
After Width: | Height: | Size: 665 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_clear_white_48dp.png
Normal file
After Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 551 B |
@@ -1,23 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ LEDD Project
|
|
||||||
~ Copyright (C) 2015 LEDD Team
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ (at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/fragmentContainer"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
@@ -37,20 +37,41 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:minHeight="?android:attr/actionBarSize"/>
|
android:minHeight="?android:attr/actionBarSize">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/switch_onoff"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"/>
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
<com.larswerkman.holocolorpicker.ColorPicker
|
<com.larswerkman.holocolorpicker.ColorPicker
|
||||||
android:id="@+id/picker"
|
android:id="@+id/picker"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="25dp"/>
|
android:layout_marginTop="25dp"
|
||||||
|
app:color_center_radius="140dp"
|
||||||
|
app:color_wheel_radius="180dp"
|
||||||
|
app:color_wheel_thickness="30dp"/>
|
||||||
|
|
||||||
<com.larswerkman.holocolorpicker.SVBar
|
<com.larswerkman.holocolorpicker.SaturationBar
|
||||||
android:id="@+id/svbar"
|
android:id="@+id/saturationbar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="25dp"/>
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
app:bar_thickness="15dp"/>
|
||||||
|
|
||||||
|
<com.larswerkman.holocolorpicker.ValueBar
|
||||||
|
android:id="@+id/valuebar"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
app:bar_thickness="15dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
android:layout_marginLeft="7dp"
|
android:layout_marginLeft="7dp"
|
||||||
android:layout_toRightOf="@id/img_host"
|
android:layout_toRightOf="@id/img_host"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Add Controller"
|
android:text="@string/text_add_controller"
|
||||||
android:textAppearance="?android:textAppearanceMedium"
|
android:textAppearance="?android:textAppearanceMedium"
|
||||||
/>
|
/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
android:id="@+id/input_i2c"
|
android:id="@+id/input_i2c"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="i2c device number"
|
android:hint="@string/hint_i2c_device"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:minWidth="350dp"/>
|
android:minWidth="350dp"/>
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
android:id="@+id/input_address"
|
android:id="@+id/input_address"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="controller address in hex format"
|
android:hint="@string/hint_controller_address"
|
||||||
android:minWidth="350dp"/>
|
android:minWidth="350dp"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
android:id="@+id/input_channel"
|
android:id="@+id/input_channel"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="channels"
|
android:hint="@string/hint_channels"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:minWidth="350dp"/>
|
android:minWidth="350dp"/>
|
||||||
|
|
||||||
|
@@ -80,7 +80,7 @@
|
|||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="or"
|
android:text="@string/text_or"
|
||||||
android:textAppearance="?android:textAppearanceMedium"/>
|
android:textAppearance="?android:textAppearanceMedium"/>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
android:id="@+id/input_ip"
|
android:id="@+id/input_ip"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="ip address[:port]"
|
android:hint="@string/hint_daemon_ip_port"
|
||||||
android:minWidth="250dp"/>
|
android:minWidth="250dp"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
android:layout_marginLeft="7dp"
|
android:layout_marginLeft="7dp"
|
||||||
android:layout_toRightOf="@id/img_host"
|
android:layout_toRightOf="@id/img_host"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Choose Daemon"
|
android:text="@string/text_choose_daemon"
|
||||||
android:textAppearance="?android:textAppearanceSmall"
|
android:textAppearance="?android:textAppearanceSmall"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
android:layout_marginLeft="7dp"
|
android:layout_marginLeft="7dp"
|
||||||
android:layout_toRightOf="@id/img_controller"
|
android:layout_toRightOf="@id/img_controller"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Choose Controller"
|
android:text="@string/text_choose_controller"
|
||||||
android:textAppearance="?android:textAppearanceSmall"
|
android:textAppearance="?android:textAppearanceSmall"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
android:layout_marginLeft="7dp"
|
android:layout_marginLeft="7dp"
|
||||||
android:layout_toRightOf="@id/img_stripe"
|
android:layout_toRightOf="@id/img_stripe"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Stripe Properties"
|
android:text="@string/text_stripe_properties"
|
||||||
android:textAppearance="?android:textAppearanceSmall"
|
android:textAppearance="?android:textAppearanceSmall"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
android:id="@+id/input_stripe_name"
|
android:id="@+id/input_stripe_name"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="Stripe name"
|
android:hint="@string/hint_stripe_name"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:minEms="12"/>
|
android:minEms="12"/>
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
@@ -180,7 +180,7 @@
|
|||||||
android:layout_marginLeft="9dp"
|
android:layout_marginLeft="9dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Channel Mapping"
|
android:text="@string/text_channel_mapping"
|
||||||
android:textAppearance="?android:textAppearanceSmall"
|
android:textAppearance="?android:textAppearanceSmall"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="2"
|
android:ems="2"
|
||||||
android:hint="R"
|
android:hint="@string/hint_channel_r"
|
||||||
android:inputType="number"/>
|
android:inputType="number"/>
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="2"
|
android:ems="2"
|
||||||
android:hint="G"
|
android:hint="@string/hint_channel_g"
|
||||||
android:inputType="number"/>
|
android:inputType="number"/>
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="2"
|
android:ems="2"
|
||||||
android:hint="B"
|
android:hint="@string/hint_channel_b"
|
||||||
android:inputType="number"/>
|
android:inputType="number"/>
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="textHost"
|
android:text=""
|
||||||
android:textAppearance="?android:textAppearanceMedium"
|
android:textAppearance="?android:textAppearanceMedium"
|
||||||
android:textColor="@color/primaryColorDark"/>
|
android:textColor="@color/primaryColorDark"/>
|
||||||
|
|
||||||
|
@@ -17,19 +17,27 @@
|
|||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="192dp"
|
android:layout_height="192dp"
|
||||||
android:background="?attr/colorPrimaryDark"
|
android:background="?attr/colorPrimaryDark"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:padding="16dp"
|
||||||
android:padding="16dp"
|
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
android:text="-- stripes infos go here --"
|
android:text="-- stripes infos go here --"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
||||||
|
|
||||||
</LinearLayout>
|
<ImageButton
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:src="@drawable/ic_clear_white_48dp"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ LEDD Project
|
|
||||||
~ Copyright (C) 2015 LEDD Team
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ (at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/activity_bar"
|
|
||||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="-8dp" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/activity_frame"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="fill_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@@ -17,6 +17,4 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<menu>
|
<menu>
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@@ -23,13 +23,13 @@
|
|||||||
android:id="@+id/nv_add_stripe"
|
android:id="@+id/nv_add_stripe"
|
||||||
android:icon="@drawable/ic_add_circle_black_48dp"
|
android:icon="@drawable/ic_add_circle_black_48dp"
|
||||||
android:orderInCategory="51"
|
android:orderInCategory="51"
|
||||||
android:title="Add Stripe"/>
|
android:title="@string/text_add_stripe"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nv_settings"
|
android:id="@+id/nv_settings"
|
||||||
android:icon="@drawable/ic_tune_black_48dp"
|
android:icon="@drawable/ic_tune_black_48dp"
|
||||||
android:orderInCategory="52"
|
android:orderInCategory="52"
|
||||||
android:title="Settings"/>
|
android:title="@string/test_settings"/>
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -19,9 +19,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
|
||||||
<dimen name="nd_icon">30dp</dimen>
|
|
||||||
<dimen name="space_before_icon">7dp</dimen>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -20,8 +20,31 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">LedD</string>
|
<string name="app_name">LedD</string>
|
||||||
<string name="button_label">OK</string>
|
<string name="text_add_controller">Add Controller</string>
|
||||||
<string name="pref_name">Pick a color</string>
|
<string name="hint_i2c_device">i2c device number</string>
|
||||||
<string name="pref_summary">DialogPreference with Color Picker.</string>
|
<string name="hint_controller_address">controller address in hex format</string>
|
||||||
|
<string name="hint_channels">channels</string>
|
||||||
|
<string name="text_or">or</string>
|
||||||
|
<string name="hint_daemon_ip_port">ip address[:port]</string>
|
||||||
|
<string name="text_choose_daemon">Choose Daemon</string>
|
||||||
|
<string name="text_choose_controller">Choose Controller</string>
|
||||||
|
<string name="text_stripe_properties">Stripe Properties</string>
|
||||||
|
<string name="hint_stripe_name">Stripe name</string>
|
||||||
|
<string name="text_channel_mapping">Channel Mapping</string>
|
||||||
|
<string name="hint_channel_r">R</string>
|
||||||
|
<string name="hint_channel_g">G</string>
|
||||||
|
<string name="hint_channel_b">B</string>
|
||||||
|
<string name="text_add_stripe">Add Stripe</string>
|
||||||
|
<string name="test_settings">Settings</string>
|
||||||
|
<string name="snackbar_no_wlan">We currently only support WLAN, please connect to one</string>
|
||||||
|
<string name="snackbar_stripes_reloaded">LED stripes reloaded</string>
|
||||||
|
<string name="snackbar_no_connection_stripes">Couldn\'t get stripes from daemon: </string>
|
||||||
|
<string name="snackbar_connection_failed">Couldn\'t connect to daemon: </string>
|
||||||
|
<string name="snachbar_added_controller">Added Controller (Id=%1$d)</string>
|
||||||
|
<string name="snackbar_error">Error: </string>
|
||||||
|
<string name="snackbar_daemon_connection_failed">Couldn\'t connect to daemon at %1$s: %2$s</string>
|
||||||
|
<string name="snackbar_added_daemon_version">Added LedD Daemon version: </string>
|
||||||
|
<string name="snackbar_added_stripe_id">Added Stripe (Id=%1$d)</string>
|
||||||
|
<string name="snackbar_failed_add_stripe">Failed to add Stripe: </string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|