updated libs

added library management
changed some edittext to the right class
This commit is contained in:
Giovanni Harting 2016-04-30 20:17:07 +02:00
parent 239429cb5e
commit 58980c494e
17 changed files with 122 additions and 129 deletions

View File

@ -24,26 +24,30 @@ buildscript {
flatDir {
dirs 'libs'
}
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.github.JakeWharton:sdk-manager-plugin:master'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
buildToolsVersion '23.0.3'
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.idlegandalf.ledd"
minSdkVersion 18
@ -57,26 +61,27 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
zipAlignEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.koushikdutta.async:androidasync:2.1.7'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:design:23.3.0'
compile 'com.larswerkman:HoloColorPicker:1.5@aar'
compile 'com.google.guava:guava:19.0'
compile 'com.thetransactioncompany:jsonrpc2-base:1.38'
compile('com.mikepenz:materialdrawer:5.1.5@aar') {
compile('com.mikepenz:materialdrawer:5.2.2@aar') {
transitive = true
}
provided 'org.projectlombok:lombok:1.16.8'

View File

@ -41,7 +41,7 @@ import android.widget.LinearLayout;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.idlegandalf.ledd.callbacks.RecieveColorCallback;
import com.idlegandalf.ledd.callbacks.ReceiveColorCallback;
import com.idlegandalf.ledd.callbacks.StripesCallback;
import com.idlegandalf.ledd.components.HSV;
import com.idlegandalf.ledd.components.LedDDaemon;
@ -62,27 +62,28 @@ import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.SecondarySwitchDrawerItem;
import com.mikepenz.materialdrawer.model.SwitchDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
import hugo.weaving.DebugLog;
public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerItemClickListener, Drawer.OnDrawerItemLongClickListener, OnCheckedChangeListener {
@Bind(R.id.main_layout)
@BindView(R.id.main_layout)
LinearLayout scrollView;
@Bind(R.id.toolbar)
@BindView(R.id.toolbar)
Toolbar toolbar;
@Bind(R.id.picker)
@BindView(R.id.picker)
ColorPicker colorPicker;
@Bind(R.id.saturationbar)
@BindView(R.id.saturationbar)
SaturationBar saturationBar;
@Bind(R.id.valuebar)
@BindView(R.id.valuebar)
ValueBar valueBar;
Drawer mDrawer;
private List<IDrawerItem> mDaemons;
@ -152,7 +153,7 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
menuProfiles.withSubItems(new SecondaryDrawerItem().withName("Add Profile").withTag("add_profile").withSelectable(false).withIcon(R.drawable.ic_add_circle_outline_black_48dp));
// enable Homebutton navigation to drawer
// enable HomeButton navigation to drawer
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
mDrawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);
@ -384,7 +385,7 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
List<IDrawerItem> mStripes = new ArrayList<>();
for (LedStripe stripe : ledStripes) {
final SecondarySwitchDrawerItem sItem = new SecondarySwitchDrawerItem()
final SwitchDrawerItem sItem = new SecondarySwitchDrawerItem()
.withName(stripe.getName())
.withTag(stripe.getId())
.withIcon(R.drawable.ic_wb_iridescent_black_48dp)
@ -410,14 +411,14 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
});
for (LedStripe stripe : ledStripes) {
stripe.getColor(new RecieveColorCallback() {
stripe.getColor(new ReceiveColorCallback() {
@Override
public void onConnectionFailed(String message) {
}
@Override
public void onColorRecieved(LedStripe stripe) {
public void onColorReceived(LedStripe stripe) {
if (stripe.isOn()) {
IDrawerItem sItem = findItemForStripe(stripe);
@ -436,7 +437,7 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
}
@Override
public void onRecievFailed(int code, String msg) {
public void onReceiveFailed(int code, String msg) {
}
@ -473,9 +474,9 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
toolbar.setTitle(stripe.getName());
autoColorSet = true;
mDrawer.closeDrawer();
mCurrentStripe.getColor(new RecieveColorCallback() {
mCurrentStripe.getColor(new ReceiveColorCallback() {
@Override
public void onColorRecieved(final LedStripe stripe) {
public void onColorReceived(final LedStripe stripe) {
final HSV cColor = stripe.getColor();
final int color = Color.HSVToColor(new float[]{(float) cColor.getHue(), (float) cColor.getSaturation(), (float) cColor.getValue()});
@ -496,7 +497,7 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
}
@Override
public void onRecievFailed(int code, String msg) {
public void onReceiveFailed(int code, String msg) {
autoColorSet = false;
}
@ -507,16 +508,6 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
});
}
protected class refreshDaemonsListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ColorApplication.INTENT_ACTION_REFRESH)) {
refreshStripes();
}
}
}
@Nullable
@DebugLog
private IDrawerItem findItemForStripe(LedStripe stripe) {
@ -532,4 +523,14 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
return null;
}
protected class refreshDaemonsListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ColorApplication.INTENT_ACTION_REFRESH)) {
refreshStripes();
}
}
}
}

View File

@ -20,8 +20,8 @@ package com.idlegandalf.ledd.callbacks;
import com.idlegandalf.ledd.components.LedStripe;
public interface RecieveColorCallback extends BaseCallback {
void onColorRecieved(LedStripe stripe);
public interface ReceiveColorCallback extends BaseCallback {
void onColorReceived(LedStripe stripe);
void onRecievFailed(int code, String msg);
void onReceiveFailed(int code, String msg);
}

View File

@ -22,7 +22,7 @@ import android.graphics.Color;
import android.support.annotation.Nullable;
import com.idlegandalf.ledd.ColorApplication;
import com.idlegandalf.ledd.callbacks.RecieveColorCallback;
import com.idlegandalf.ledd.callbacks.ReceiveColorCallback;
import com.idlegandalf.ledd.helper.LedDHelper;
import hugo.weaving.DebugLog;
@ -91,20 +91,20 @@ public class LedStripe {
}
@DebugLog
public void getColor(@Nullable final RecieveColorCallback callback) {
public void getColor(@Nullable final ReceiveColorCallback callback) {
checkHelper();
helper.getColor(this, new RecieveColorCallback() {
helper.getColor(this, new ReceiveColorCallback() {
@Override
public void onColorRecieved(LedStripe stripe) {
public void onColorReceived(LedStripe stripe) {
color = stripe.getColor();
if (callback != null)
callback.onColorRecieved(LedStripe.this);
callback.onColorReceived(LedStripe.this);
}
@Override
public void onRecievFailed(int code, String msg) {
if (callback != null) callback.onRecievFailed(code, msg);
public void onReceiveFailed(int code, String msg) {
if (callback != null) callback.onReceiveFailed(code, msg);
}
@Override

View File

@ -42,22 +42,22 @@ import com.idlegandalf.ledd.helper.LedDHelper;
import java.text.NumberFormat;
import java.text.ParsePosition;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
public class AddControllerDialog extends DialogFragment implements DialogInterface.OnShowListener {
@Bind(R.id.input_i2c_layout)
@BindView(R.id.input_i2c_layout)
TextInputLayout i2cLayout;
@Bind(R.id.input_i2c)
@BindView(R.id.input_i2c)
EditText i2cText;
@Bind(R.id.input_address_layout)
@BindView(R.id.input_address_layout)
TextInputLayout addressLayout;
@Bind(R.id.input_address)
@BindView(R.id.input_address)
EditText addressText;
@Bind(R.id.input_channel_layout)
@BindView(R.id.input_channel_layout)
TextInputLayout channelLayout;
@Bind(R.id.input_channel)
@BindView(R.id.input_channel)
EditText channelText;
LedDDaemon dDaemon;

View File

@ -49,18 +49,18 @@ import java.net.Inet4Address;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
public class AddDaemonDialog extends DialogFragment implements DialogInterface.OnShowListener, NsdManager.DiscoveryListener {
private final String SERVICE_TYPE = "_ledd._tcp.";
@Bind(R.id.input_ip)
@BindView(R.id.input_ip)
EditText ip;
@Bind(R.id.input_ip_layout)
@BindView(R.id.input_ip_layout)
TextInputLayout ip_lay;
@Bind(R.id.host_container)
@BindView(R.id.host_container)
LinearLayout hostContainer;
List<LedDDaemon> ledDDaemons = new ArrayList<>();
NsdManager mNsdManager;

View File

@ -40,18 +40,18 @@ import com.idlegandalf.ledd.components.Profile;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
import hugo.weaving.DebugLog;
public class AddProfileDialog extends DialogFragment implements DialogInterface.OnShowListener {
@Bind(R.id.input_profile_name_layout)
@BindView(R.id.input_profile_name_layout)
TextInputLayout nameLayout;
@Bind(R.id.input_profile_name)
@BindView(R.id.input_profile_name)
EditText nameText;
@Bind(R.id.container_linlay)
@BindView(R.id.container_linlay)
LinearLayout checkboxContainer;
List<LedStripe> mStripes;
List<CheckBox> mCheckboxes;

View File

@ -54,42 +54,42 @@ import java.text.NumberFormat;
import java.text.ParsePosition;
import java.util.List;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class AddStripeDialog extends DialogFragment implements DialogInterface.OnShowListener {
public static AddStripeDialog instance;
@Bind(R.id.spinner_daemon)
@BindView(R.id.spinner_daemon)
Spinner daemonSpinner;
@Bind(R.id.spinner_controller)
@BindView(R.id.spinner_controller)
Spinner controllerSpinner;
@Bind(R.id.choose_controller_lay)
@BindView(R.id.choose_controller_lay)
RelativeLayout controllerLayout;
@Bind(R.id.input_stripe_name_lay)
@BindView(R.id.input_stripe_name_lay)
TextInputLayout stripeNameLay;
@Bind(R.id.input_stripe_name)
@BindView(R.id.input_stripe_name)
EditText stripeNameText;
@Bind(R.id.input_channel_r_lay)
@BindView(R.id.input_channel_r_lay)
TextInputLayout channelRLay;
@Bind(R.id.input_channel_r)
@BindView(R.id.input_channel_r)
EditText channelR;
@Bind(R.id.input_channel_g_lay)
@BindView(R.id.input_channel_g_lay)
TextInputLayout channelGLay;
@Bind(R.id.input_channel_g)
@BindView(R.id.input_channel_g)
EditText channelG;
@Bind(R.id.input_channel_b_lay)
@BindView(R.id.input_channel_b_lay)
TextInputLayout channelBLay;
@Bind(R.id.input_channel_b)
@BindView(R.id.input_channel_b)
EditText channelB;
@Bind(R.id.stripe_mapping_lay)
@BindView(R.id.stripe_mapping_lay)
LinearLayout stripeMapping;
@Bind(R.id.imgbuttn_togglechannel_r)
@BindView(R.id.imgbuttn_togglechannel_r)
ImageButton channelRBttn;
@Bind(R.id.imgbuttn_togglechannel_g)
@BindView(R.id.imgbuttn_togglechannel_g)
ImageButton channelGBttn;
@Bind(R.id.imgbuttn_togglechannel_b)
@BindView(R.id.imgbuttn_togglechannel_b)
ImageButton channelBBttn;
ArrayAdapter<LedDDaemon> daemonArrayAdapter;
ArrayAdapter<Controller> controllerArrayAdapter;

View File

@ -29,7 +29,7 @@ import com.idlegandalf.ledd.ColorApplication;
import com.idlegandalf.ledd.callbacks.AddControllerCallback;
import com.idlegandalf.ledd.callbacks.AddStripeCallback;
import com.idlegandalf.ledd.callbacks.DiscoverCallback;
import com.idlegandalf.ledd.callbacks.RecieveColorCallback;
import com.idlegandalf.ledd.callbacks.ReceiveColorCallback;
import com.idlegandalf.ledd.callbacks.StripesCallback;
import com.idlegandalf.ledd.components.AnswerTask;
import com.idlegandalf.ledd.components.Controller;
@ -215,7 +215,7 @@ public class LedDHelper {
*
* @param ledStripe Stripe
*/
public void getColor(final LedStripe ledStripe, final RecieveColorCallback callback) {
public void getColor(final LedStripe ledStripe, final ReceiveColorCallback callback) {
HashMap<String, Object> params = new HashMap<>();
params.put("sid", ledStripe.getId());
@ -234,17 +234,17 @@ public class LedDHelper {
if (hsv.length() == 3) {
System.out.println(hsv);
ledStripe.setColor(new HSV(hsv.getDouble(0), hsv.getDouble(1), hsv.getDouble(2)));
callback.onColorRecieved(ledStripe);
callback.onColorReceived(ledStripe);
} else {
callback.onRecievFailed(-1, "HSV was empty");
callback.onReceiveFailed(-1, "HSV was empty");
}
} catch (JSONException e) {
e.printStackTrace();
callback.onRecievFailed(-1, "Unhandeled JSON Exception");
callback.onReceiveFailed(-1, "Unhandeled JSON Exception");
}
} else {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") JSONRPC2Error error = response.getError();
callback.onRecievFailed(error.getCode(), error.getMessage());
callback.onReceiveFailed(error.getCode(), error.getMessage());
}
}
});

View File

@ -58,7 +58,7 @@
android:layout_marginTop="15dp"
app:errorEnabled="true">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_i2c"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -75,7 +75,7 @@
android:layout_marginTop="5dp"
app:errorEnabled="true">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -91,7 +91,7 @@
android:layout_marginTop="5dp"
app:errorEnabled="true">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_channel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View File

@ -89,7 +89,7 @@
android:layout_height="wrap_content"
app:errorEnabled="true">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_ip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ LEDD Project
~ Copyright (C) 2015 LEDD Team
~
@ -18,16 +17,15 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:minWidth="350dp"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="15dp">
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:minWidth="350dp"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="15dp">
<RelativeLayout
android:layout_width="wrap_content"
@ -37,7 +35,7 @@
android:id="@+id/img_host"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_save_black_48dp"/>
android:src="@drawable/ic_save_black_48dp" />
<TextView
android:layout_width="wrap_content"
@ -48,21 +46,20 @@
android:layout_toRightOf="@id/img_host"
android:gravity="center"
android:text="Add Profile"
android:textAppearance="?android:textAppearanceMedium"
/>
android:textAppearance="?android:textAppearanceMedium" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Choose stripes to include"
android:layout_marginTop="20dp"/>
android:layout_marginTop="20dp"
android:text="Choose stripes to include" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" >
android:layout_marginTop="10dp">
<LinearLayout
android:id="@+id/container_linlay"
@ -79,13 +76,13 @@
android:layout_marginTop="5dp"
app:errorEnabled="true">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_profile_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Profile name"
android:inputType="text"
android:minWidth="350dp"/>
android:minWidth="350dp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>

View File

@ -2,6 +2,5 @@
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
/>
android:layout_marginBottom="5dp" />

View File

@ -165,7 +165,7 @@
android:layout_marginTop="15dp"
app:errorEnabled="true">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_stripe_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -201,7 +201,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_channel_r"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -226,7 +226,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="10dp">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_channel_g"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -251,7 +251,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="10dp">
<EditText
<android.support.design.widget.TextInputEditText
android:id="@+id/input_channel_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -15,18 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta7'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
@ -34,4 +29,4 @@ allprojects {
repositories {
jcenter()
}
}
}

View File

@ -1,6 +1,6 @@
#Sun Nov 30 16:28:30 CET 2014
#Sat Apr 30 20:15:11 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip

10
gradlew vendored Normal file → Executable file
View File

@ -42,11 +42,6 @@ case "`uname`" in
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -114,6 +109,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`