Skip to content

Commit 9fefc19

Browse files
authored
Merge pull request #490 from domoticz/alpha-development
Alpha development
2 parents 2dee65c + 805cca3 commit 9fefc19

File tree

721 files changed

+6291
-4610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

721 files changed

+6291
-4610
lines changed

app/build.gradle

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ android {
4545
throw new GradleException("Could not read version.properties!")
4646
}
4747

48+
compileOptions {
49+
sourceCompatibility JavaVersion.VERSION_1_7
50+
targetCompatibility JavaVersion.VERSION_1_7
51+
incremental = false;
52+
}
53+
4854
//noinspection GroovyAssignabilityCheck
4955
buildTypes {
5056
release {
5157
minifyEnabled false
5258
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
5359
lintOptions {
5460
disable 'MissingTranslation'
61+
checkReleaseBuilds false
62+
abortOnError false
5563
}
5664
}
5765
}
@@ -139,7 +147,6 @@ repositories {
139147
}
140148
}
141149

142-
143150
allprojects {
144151
repositories {
145152
jcenter()
@@ -181,20 +188,20 @@ dependencies {
181188
implementation 'com.google.code.gson:gson:2.8.4'
182189
implementation 'com.android.volley:volley:1.1.0'
183190
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
184-
implementation 'com.larswerkman:lobsterpicker:1.0.1'
185191

186-
implementation 'com.github.zurche:plain-pie:v0.2.2'
187-
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
192+
implementation 'com.github.zurche:plain-pie:v0.2.9'
193+
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
188194

189195
implementation 'com.github.dexafree:MaterialList:v3.2.2'
190196
implementation 'com.github.hotchemi:android-rate:1.0.1'
191197
implementation 'com.squareup.picasso:picasso:2.5.2'
192198
implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
193199
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
194200
implementation 'com.github.jd-alexander:LikeButton:0.2.3'
195-
implementation 'jp.wasabeef:recyclerview-animators:2.2.4'
201+
implementation 'jp.wasabeef:recyclerview-animators:2.3.0'
196202
implementation 'com.github.javiersantos:PiracyChecker:1.1'
197203
implementation 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
204+
198205
implementation("com.mikepenz:materialdrawer:6.0.9@aar") {
199206
transitive = true
200207
}
@@ -205,9 +212,9 @@ dependencies {
205212
implementation 'com.github.k0shk0sh:PermissionHelper:1.1.0'
206213
implementation 'com.github.zagum:SpeechRecognitionView:1.0.2'
207214
implementation 'com.afollestad:digitus:0.3.0'
215+
implementation "com.github.skydoves:colorpickerview:2.0.1"
208216

209217
implementation project(':libs:MemorizingTrustManager')
210-
211218
implementation project(path: ':materialIntro_library')
212219
implementation project(path: ':SeekArc_library')
213220
implementation project(path: ':domoticzapi')

app/src/debug/AndroidManifest.xml

Lines changed: 172 additions & 141 deletions
Large diffs are not rendered by default.

app/src/main/AndroidManifest.xml

Lines changed: 171 additions & 140 deletions
Large diffs are not rendered by default.

app/src/main/java/nl/hnogames/domoticz/Adapters/CamerasAdapter.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
package nl.hnogames.domoticz.Adapters;
2323

2424
import android.content.Context;
25-
import android.graphics.Color;
2625
import android.support.annotation.NonNull;
26+
import android.support.v4.content.ContextCompat;
2727
import android.support.v7.widget.RecyclerView;
2828
import android.view.LayoutInflater;
2929
import android.view.View;
@@ -73,9 +73,13 @@ public DataObjectHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewTy
7373
.inflate(R.layout.camera_row, parent, false);
7474

7575
if (mSharedPrefs.darkThemeEnabled()) {
76-
((android.support.v7.widget.CardView) view.findViewById(R.id.row_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F"));
76+
if ((view.findViewById(R.id.card_global_wrapper)) != null)
77+
view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(mContext, R.color.card_background_dark));
78+
if ((view.findViewById(R.id.row_wrapper)) != null)
79+
(view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(mContext, R.color.card_background_dark));
80+
if ((view.findViewById(R.id.row_global_wrapper)) != null)
81+
(view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(mContext, R.color.card_background_dark));
7782
}
78-
7983
return new DataObjectHolder(view);
8084
}
8185

app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import android.content.Context;
2525
import android.content.res.Resources;
2626
import android.content.res.TypedArray;
27-
import android.graphics.Color;
27+
import android.support.design.chip.Chip;
2828
import android.support.v4.content.ContextCompat;
2929
import android.support.v7.widget.RecyclerView;
3030
import android.view.LayoutInflater;
@@ -35,7 +35,6 @@
3535
import android.widget.Button;
3636
import android.widget.CompoundButton;
3737
import android.widget.Filter;
38-
import android.widget.ImageButton;
3938
import android.widget.ImageView;
4039
import android.widget.LinearLayout;
4140
import android.widget.SeekBar;
@@ -78,7 +77,7 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Data
7877

7978
public ArrayList<DevicesInfo> data = null;
8079
public ArrayList<DevicesInfo> filteredData = null;
81-
private boolean showAsList = false;
80+
private boolean showAsList;
8281
private Domoticz domoticz;
8382
private Context context;
8483
private switchesClickListener listener;
@@ -98,7 +97,6 @@ public DashboardAdapter(Context context,
9897

9998
this.context = context;
10099
domoticz = new Domoticz(context, AppController.getInstance().getRequestQueue());
101-
102100
mConfigInfo = serverUtil.getActiveServer().getConfigInfo(context);
103101
this.listener = listener;
104102

@@ -149,33 +147,19 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) {
149147
.inflate(R.layout.dashboard_row, parent, false);
150148

151149
if (mSharedPrefs.darkThemeEnabled()) {
152-
((android.support.v7.widget.CardView) row.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F"));
150+
if ((row.findViewById(R.id.card_global_wrapper)) != null)
151+
row.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark));
153152
if ((row.findViewById(R.id.row_wrapper)) != null)
154-
(row.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark));
153+
(row.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark));
155154
if ((row.findViewById(R.id.row_global_wrapper)) != null)
156-
(row.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark));
157-
if ((row.findViewById(R.id.day_button)) != null)
158-
(row.findViewById(R.id.day_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
159-
if ((row.findViewById(R.id.year_button)) != null)
160-
(row.findViewById(R.id.year_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
161-
if ((row.findViewById(R.id.month_button)) != null)
162-
(row.findViewById(R.id.month_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
163-
if ((row.findViewById(R.id.week_button)) != null)
164-
(row.findViewById(R.id.week_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
165-
if ((row.findViewById(R.id.log_button)) != null)
166-
(row.findViewById(R.id.log_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
167-
if ((row.findViewById(R.id.timer_button)) != null)
168-
(row.findViewById(R.id.timer_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
169-
if ((row.findViewById(R.id.notifications_button)) != null)
170-
(row.findViewById(R.id.notifications_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
155+
(row.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark));
171156
if ((row.findViewById(R.id.on_button)) != null)
172-
(row.findViewById(R.id.on_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark));
157+
(row.findViewById(R.id.on_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark));
173158
if ((row.findViewById(R.id.off_button)) != null)
174-
(row.findViewById(R.id.off_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark));
159+
(row.findViewById(R.id.off_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark));
175160
if ((row.findViewById(R.id.color_button)) != null)
176-
(row.findViewById(R.id.color_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status));
161+
(row.findViewById(R.id.color_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark_status));
177162
}
178-
179163
return new DataObjectHolder(row);
180164
}
181165

@@ -187,8 +171,9 @@ public void onBindViewHolder(DataObjectHolder holder, final int position) {
187171
if (!this.mSharedPrefs.darkThemeEnabled()) {
188172
holder.pieView.setInnerBackgroundColor(ContextCompat.getColor(context, R.color.white));
189173
holder.pieView.setTextColor(ContextCompat.getColor(context, R.color.black));
190-
holder.pieView.setPercentageTextSize(17);
191174
}
175+
holder.pieView.setPercentageTextSize(16);
176+
holder.pieView.setPercentageBackgroundColor(ContextCompat.getColor(context, R.color.material_orange_600));
192177

193178
setSwitchRowData(extendedStatusInfo, holder);
194179
holder.itemView.setOnClickListener(new View.OnClickListener() {
@@ -204,6 +189,12 @@ public boolean onLongClick(View v) {
204189
return true;
205190
}
206191
});
192+
holder.infoIcon.setOnClickListener(new View.OnClickListener() {
193+
@Override
194+
public void onClick(View v) {
195+
listener.onItemLongClicked(position);
196+
}
197+
});
207198
}
208199
}
209200

@@ -254,6 +245,7 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
254245
case DomoticzValues.Device.Type.Value.ON_OFF:
255246
case DomoticzValues.Device.Type.Value.MEDIAPLAYER:
256247
case DomoticzValues.Device.Type.Value.DOORLOCK:
248+
case DomoticzValues.Device.Type.Value.DOORLOCKINVERTED:
257249
case DomoticzValues.Device.Type.Value.DOORCONTACT:
258250
switch (mDeviceInfo.getSwitchType()) {
259251
case DomoticzValues.Device.Type.Name.SECURITY:
@@ -308,7 +300,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
308300
case DomoticzValues.Device.Type.Value.DIMMER:
309301
case DomoticzValues.Device.Type.Value.BLINDPERCENTAGE:
310302
case DomoticzValues.Device.Type.Value.BLINDPERCENTAGEINVERTED:
311-
if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB)) {
303+
if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) ||
304+
mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) {
312305
if (mSharedPrefs.showSwitchesAsButtons()) {
313306
setButtons(holder, Buttons.DIMMER_BUTTONS);
314307
setDimmerOnOffButtonRowData(mDeviceInfo, holder, true);
@@ -507,7 +500,7 @@ private void setSecurityPanelSwitchRowData(DevicesInfo mDeviceInfo, DataObjectHo
507500
holder.buttonOn.setText(context.getString(R.string.button_arm));
508501

509502
if (mSharedPrefs.darkThemeEnabled())
510-
holder.buttonOn.setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark));
503+
holder.buttonOn.setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark));
511504
else
512505
holder.buttonOn.setBackground(ContextCompat.getDrawable(context, R.drawable.button_on));
513506

@@ -1692,6 +1685,14 @@ public void setButtons(DataObjectHolder holder, int button) {
16921685
holder.signal_level.setVisibility(View.GONE);
16931686
holder.switch_battery_level.setVisibility(View.GONE);
16941687
}
1688+
if (!mSharedPrefs.showExtraData()) {
1689+
holder.infoIcon.setVisibility(View.GONE);
1690+
} else {
1691+
if (showAsList) {
1692+
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) holder.iconRow.getLayoutParams();
1693+
p.leftMargin = -15;
1694+
}
1695+
}
16951696

16961697
switch (button) {
16971698
case Buttons.SWITCH:
@@ -1810,40 +1811,42 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder {
18101811

18111812
TextView switch_name, signal_level, switch_status, switch_battery_level, switch_dimmer_level;
18121813
Switch onOffSwitch, dimmerOnOffSwitch;
1813-
ImageButton buttonUp, buttonDown, buttonStop;
1814-
Button buttonOn, buttonLog, buttonTimer, buttonColor, buttonSetStatus, buttonSet, buttonOff;
1814+
ImageView buttonUp, buttonDown, buttonStop;
1815+
Button buttonOn, buttonColor, buttonSetStatus, buttonSet, buttonOff;
1816+
Chip buttonLog, buttonTimer;
18151817
Boolean isProtected;
18161818
ImageView iconRow, iconMode;
18171819
SeekBar dimmer;
18181820
Spinner spSelector;
18191821
LinearLayout extraPanel;
18201822
PieView pieView;
1823+
ImageView infoIcon;
18211824

18221825
public DataObjectHolder(View itemView) {
18231826
super(itemView);
18241827

1825-
extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel);
1826-
pieView = (PieView) itemView.findViewById(R.id.pieView);
1827-
buttonOn = (Button) itemView.findViewById(R.id.on_button);
1828-
buttonOff = (Button) itemView.findViewById(R.id.off_button);
1829-
onOffSwitch = (Switch) itemView.findViewById(R.id.switch_button);
1830-
signal_level = (TextView) itemView.findViewById(R.id.switch_signal_level);
1831-
iconRow = (ImageView) itemView.findViewById(R.id.rowIcon);
1832-
switch_name = (TextView) itemView.findViewById(R.id.switch_name);
1833-
switch_battery_level = (TextView) itemView.findViewById(R.id.switch_battery_level);
1834-
1835-
switch_dimmer_level = (TextView) itemView.findViewById(R.id.switch_dimmer_level);
1836-
dimmerOnOffSwitch = (Switch) itemView.findViewById(R.id.switch_dimmer_switch);
1837-
dimmer = (SeekBar) itemView.findViewById(R.id.switch_dimmer);
1838-
spSelector = (Spinner) itemView.findViewById(R.id.spSelector);
1839-
buttonColor = (Button) itemView.findViewById(R.id.color_button);
1840-
buttonLog = (Button) itemView.findViewById(R.id.log_button);
1841-
buttonTimer = (Button) itemView.findViewById(R.id.timer_button);
1842-
buttonUp = (ImageButton) itemView.findViewById(R.id.switch_button_up);
1843-
buttonStop = (ImageButton) itemView.findViewById(R.id.switch_button_stop);
1844-
buttonDown = (ImageButton) itemView.findViewById(R.id.switch_button_down);
1845-
buttonSet = (Button) itemView.findViewById(R.id.set_button);
1846-
buttonSetStatus = (Button) itemView.findViewById(R.id.set_button);
1828+
extraPanel = itemView.findViewById(R.id.extra_panel);
1829+
pieView = itemView.findViewById(R.id.pieView);
1830+
buttonOn = itemView.findViewById(R.id.on_button);
1831+
buttonOff = itemView.findViewById(R.id.off_button);
1832+
onOffSwitch = itemView.findViewById(R.id.switch_button);
1833+
signal_level = itemView.findViewById(R.id.switch_signal_level);
1834+
iconRow = itemView.findViewById(R.id.rowIcon);
1835+
switch_name = itemView.findViewById(R.id.switch_name);
1836+
switch_battery_level = itemView.findViewById(R.id.switch_battery_level);
1837+
infoIcon = itemView.findViewById(R.id.widget_info_icon);
1838+
switch_dimmer_level = itemView.findViewById(R.id.switch_dimmer_level);
1839+
dimmerOnOffSwitch = itemView.findViewById(R.id.switch_dimmer_switch);
1840+
dimmer = itemView.findViewById(R.id.switch_dimmer);
1841+
spSelector = itemView.findViewById(R.id.spSelector);
1842+
buttonColor = itemView.findViewById(R.id.color_button);
1843+
buttonLog = itemView.findViewById(R.id.log_button);
1844+
buttonTimer = itemView.findViewById(R.id.timer_button);
1845+
buttonUp = itemView.findViewById(R.id.switch_button_up);
1846+
buttonStop = itemView.findViewById(R.id.switch_button_stop);
1847+
buttonDown = itemView.findViewById(R.id.switch_button_down);
1848+
buttonSet = itemView.findViewById(R.id.set_button);
1849+
buttonSetStatus = itemView.findViewById(R.id.set_button);
18471850

18481851
if (buttonLog != null)
18491852
buttonLog.setVisibility(View.GONE);

app/src/main/java/nl/hnogames/domoticz/Adapters/EventsAdapter.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
package nl.hnogames.domoticz.Adapters;
2323

2424
import android.content.Context;
25-
import android.graphics.Color;
2625
import android.support.v4.content.ContextCompat;
2726
import android.support.v7.widget.RecyclerView;
2827
import android.view.LayoutInflater;
@@ -85,11 +84,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) {
8584
.inflate(R.layout.event_row_default, parent, false);
8685

8786
if (mSharedPrefs.darkThemeEnabled()) {
88-
((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F"));
87+
if ((view.findViewById(R.id.card_global_wrapper)) != null)
88+
view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark));
8989
if ((view.findViewById(R.id.row_wrapper)) != null)
90-
(view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark));
90+
(view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark));
9191
if ((view.findViewById(R.id.row_global_wrapper)) != null)
92-
(view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark));
92+
(view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark));
9393
}
9494

9595
return new DataObjectHolder(view);
@@ -155,11 +155,10 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder
155155

156156
public DataObjectHolder(View itemView) {
157157
super(itemView);
158-
name = (TextView) itemView.findViewById(R.id.logs_name);
159-
message = (TextView) itemView.findViewById(R.id.logs_message);
160-
iconRow = (ImageView) itemView.findViewById(R.id.rowIcon);
161-
buttonON = (Switch) itemView.findViewById(R.id.switch_button);
162-
158+
name = itemView.findViewById(R.id.logs_name);
159+
message = itemView.findViewById(R.id.logs_message);
160+
iconRow = itemView.findViewById(R.id.rowIcon);
161+
buttonON = itemView.findViewById(R.id.switch_button);
163162
itemView.setOnClickListener(this);
164163
}
165164

0 commit comments

Comments
 (0)