Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/beta-development'
Browse files Browse the repository at this point in the history
  • Loading branch information
galadril committed Jan 23, 2017
2 parents 9088969 + c5dd82d commit d00f684
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 54 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ This is a Android client for Domoticz and is available for download in the Play
-----
**Domoticz** is a very light weight home automation system that lets you monitor and configure various devices like: lights, switches, various sensors/meters like temperature, rainfall, wind, Ultraviolet (UV) radiation, electricity usage/production, gas consumption, water consumption and much more. Notifications/alerts can be sent to any mobile device.

For Beta registration or more information check:
http://hnogames.nl/domoticz.html


# Google Play Store
-----
You can download Domoticz from the Google Play Store. There is a premium and free version! Premium features are Geofencing, Android Wear and Widgets.

**Free:**
[![google-play-badge](https://cloud.githubusercontent.com/assets/14561640/11994769/a4f0bd22-aa44-11e5-9151-b09c19971c7c.png)](https://play.google.com/store/apps/details?id=nl.hnogames.domoticz)
[![google-play-badge](https://cloud.githubusercontent.com/assets/14561640/22199304/96017fa6-e15a-11e6-99bd-6fd3412eac8e.png)](https://play.google.com/store/apps/details?id=nl.hnogames.domoticz)

**Premium:**
[![google-play-badge](https://cloud.githubusercontent.com/assets/14561640/11994769/a4f0bd22-aa44-11e5-9151-b09c19971c7c.png)](https://play.google.com/store/apps/details?id=nl.hnogames.domoticz.premium)
[![google-play-badge](https://cloud.githubusercontent.com/assets/14561640/22199304/96017fa6-e15a-11e6-99bd-6fd3412eac8e.png)](https://play.google.com/store/apps/details?id=nl.hnogames.domoticz.premium)

# Geofencing
-----
Expand Down
13 changes: 11 additions & 2 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@
android:label="@string/app_name_domoticz"
android:theme="@style/AppThemeMain"
tools:replace="android:icon, android:label, android:theme, android:name" >

<activity android:name=".Service.NFCServiceActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data
Expand Down Expand Up @@ -216,10 +220,12 @@
</receiver>

<service android:name=".Widgets.SecurityWidgetProvider$UpdateSecurityWidgetService" />

<receiver android:name=".Service.BootUpReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>

Expand All @@ -240,10 +246,13 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://www.domoticz.com/open” -->
<!-- Accepts URIs that begin with "http://www.domoticz.com/open” or https -->
<data android:scheme="http"
android:host="www.domoticz.com"
android:pathPrefix="/open" />
<data android:scheme="https"
android:host="www.domoticz.com"
android:pathPrefix="/open" />
<!-- note that the leading "/" is required for pathPrefix-->
<!-- Accepts URIs that begin with "domoticz://open” -->
<data android:scheme="domoticz"
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@
android:label="@string/app_name_domoticz"
android:theme="@style/AppThemeMain"
tools:replace="android:icon, android:label, android:theme, android:name" >

<activity android:name=".Service.NFCServiceActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data
Expand Down Expand Up @@ -220,6 +224,8 @@
<receiver android:name=".Service.BootUpReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>

Expand All @@ -240,10 +246,13 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://www.domoticz.com/open” -->
<!-- Accepts URIs that begin with "http://www.domoticz.com/open” or https -->
<data android:scheme="http"
android:host="www.domoticz.com"
android:pathPrefix="/open" />
<data android:scheme="https"
android:host="www.domoticz.com"
android:pathPrefix="/open" />
<!-- note that the leading "/" is required for pathPrefix-->
<!-- Accepts URIs that begin with "domoticz://open” -->
<data android:scheme="domoticz"
Expand Down Expand Up @@ -386,4 +395,4 @@
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public void onError(Exception error) {
if (getActivity() instanceof MainActivity)
((MainActivity) getActivity()).Talk(R.string.security_wrong_code);
} //else
// errorHandling(error, coordinatorLayout);
// errorHandling(error, coordinatorLayout);
}
});
}
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ public View onCreateView(LayoutInflater inflater,
chart.setDrawGridBackground(false);
chart.setHighlightPerDragEnabled(true);

if(range.equals("day"))
{
if (range.equals("day")) {
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
Expand All @@ -169,8 +168,7 @@ public String getFormattedValue(float value, AxisBase axis) {
return String.format("%02d", calendar.get(Calendar.HOUR)) + ":" + String.format("%02d", calendar.get(Calendar.MINUTE));
}
});
}
else {
} else {
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ public void onError(Exception error) {
if (getActivity() instanceof MainActivity)
((MainActivity) getActivity()).Talk(R.string.security_wrong_code);
} //else
// errorHandling(error);
// errorHandling(error);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ protected void onCreate(Bundle savedInstanceState) {
if (mSharedPrefs.darkThemeEnabled()) {
coordinatorLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.background_dark));
}

createListView();
initSwitches();
createLocationRequest();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/nl/hnogames/domoticz/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public void onReceiveDevice(DevicesInfo mDevicesInfo) {
int jsonUrl = DomoticzValues.Json.Url.Set.SWITCHES;
int jsonValue = 0;

if(mDevicesInfo == null)
if (mDevicesInfo == null)
return;

if (inputJSONAction < 0) {
Expand Down
15 changes: 12 additions & 3 deletions app/src/main/java/nl/hnogames/domoticz/Service/BootUpReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,29 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.design.widget.Snackbar;
import android.util.Log;

import nl.hnogames.domoticz.R;
import nl.hnogames.domoticz.Utils.SharedPrefUtil;
import nl.hnogames.domoticz.Utils.UsefulBits;
import nl.hnogames.domoticz.Utils.WidgetUtils;

public class BootUpReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SharedPrefUtil mSharedPrefUtil = new SharedPrefUtil(context);

if(context == null)
return;
WidgetUtils.RefreshWidgets(context);
startGeofenceService(context);
}

private void startGeofenceService(Context context) {
SharedPrefUtil mSharedPrefUtil = new SharedPrefUtil(context);

if (mSharedPrefUtil.isGeofenceEnabled()) {
mSharedPrefUtil.enableGeoFenceService();
mSharedPrefUtil.setGeofencingStarted(true);
Log.i("BOOT", "Bootup received, starting geofences");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ public SecurityPanelDialog(Context c, Domoticz mDomoticz, DevicesInfo panelInfo)
.buttonRippleColorRes(R.color.white);
} else
mdb = new MaterialDialog.Builder(mContext);

mdb.customView(R.layout.dialog_security, true)
.theme(mSharedPrefs.darkThemeEnabled() ? Theme.DARK : Theme.LIGHT)
.negativeText(android.R.string.cancel);

mdb.dismissListener(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void onHandleIntent(Intent intent) {
try {
updateAppWidget(appWidgetManager, incomingAppWidgetId);
} catch (NullPointerException e) {
if(e != null && !UsefulBits.isEmpty(e.getMessage()))
if (e != null && !UsefulBits.isEmpty(e.getMessage()))
Log.e(SecurityWidgetProvider.class.getSimpleName(), e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ public void initListViews() {
@Override
public void onReceiveDevices(final ArrayList<DevicesInfo> mDevicesInfo) {
ArrayList<DevicesInfo> mNewDevicesInfo = new ArrayList<DevicesInfo>();
for (DevicesInfo d : mDevicesInfo)
{
if(SmallWidgetSupported(d))
for (DevicesInfo d : mDevicesInfo) {
if (SmallWidgetSupported(d))
mNewDevicesInfo.add(d);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private int withButtons(DevicesInfo s) {

case DomoticzValues.Device.Type.Value.BLINDS:
case DomoticzValues.Device.Type.Value.BLINDINVERTED:
if(DomoticzValues.canHandleStopButton(s))
if (DomoticzValues.canHandleStopButton(s))
withButton = BUTTON_BLINDS;
else
withButton = BUTTON_ONOFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

package nl.hnogames.domoticz.Widgets;

import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -75,8 +74,7 @@ public void onReceive(final Context context, Intent intent) {
iStart.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
iStart.putExtra("QRCODE", true);
context.startActivity(iStart);
}
else {
} else {
loadPasswordandValue();

if (intent.getAction().equals("nl.hnogames.domoticz.Service.WIDGET_TOGGLE_ACTION")) {
Expand All @@ -98,7 +96,7 @@ public void onReceive(final Context context, Intent intent) {
private boolean isOnOffSwitch(DevicesInfo mExtendedStatusInfo) {
if (mExtendedStatusInfo == null)
return false;
if(smallWidget)
if (smallWidget)
return true;

if (mExtendedStatusInfo.getSwitchTypeVal() == 0 &&
Expand All @@ -121,7 +119,7 @@ private boolean isOnOffSwitch(DevicesInfo mExtendedStatusInfo) {
return true;
case DomoticzValues.Device.Type.Value.BLINDS:
case DomoticzValues.Device.Type.Value.BLINDINVERTED:
if(DomoticzValues.canHandleStopButton(mExtendedStatusInfo))
if (DomoticzValues.canHandleStopButton(mExtendedStatusInfo))
return false;
else
return true;
Expand Down Expand Up @@ -164,12 +162,10 @@ private boolean isPushOffSwitch(DevicesInfo mExtendedStatusInfo) {
return false;
}

private void loadPasswordandValue()
{
private void loadPasswordandValue() {
password = mSharedPrefs.getWidgetPassword(widgetID);
value = mSharedPrefs.getWidgetValue(widgetID);
if(UsefulBits.isEmpty(value) && UsefulBits.isEmpty(password))
{
if (UsefulBits.isEmpty(value) && UsefulBits.isEmpty(password)) {
password = mSharedPrefs.getSmallWidgetPassword(widgetID);
value = mSharedPrefs.getSmallWidgetValue(widgetID);
}
Expand All @@ -179,7 +175,7 @@ private void processSwitch(final Context context, int idx) {

final Domoticz domoticz = new Domoticz(context, AppController.getInstance().getRequestQueue());
boolean isScene = mSharedPrefs.getWidgetisScene(widgetID);
if(smallWidget)
if (smallWidget)
isScene = mSharedPrefs.getSmallWidgetisScene(widgetID);
Log.i("PROCESS SWITCH", "Device: " + idx + " " + isScene);

Expand Down Expand Up @@ -225,7 +221,7 @@ public void onError(Exception error) {

@Override
public void onReceiveScene(final SceneInfo scene) {
Log.i("SCENE TOGGLE", "Device: " + scene.getName() );
Log.i("SCENE TOGGLE", "Device: " + scene.getName());

if (scene != null) {
if (DomoticzValues.Scene.Type.SCENE.equalsIgnoreCase(scene.getType())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected void onHandleIntent(Intent intent) {
try {
updateAppWidget(appWidgetManager, incomingAppWidgetId);
} catch (NullPointerException e) {
if(e != null && !UsefulBits.isEmpty(e.getMessage()))
if (e != null && !UsefulBits.isEmpty(e.getMessage()))
Log.e(WidgetProviderLarge.class.getSimpleName(), e.getMessage());
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ public void onReceiveDevice(DevicesInfo s) {

views.setTextViewText(R.id.desc, text);
if (withButtons == BUTTON_1 && s.getStatus() != null) {
if(s.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.PUSH_ON_BUTTON)
if (s.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.PUSH_ON_BUTTON)
views.setTextViewText(R.id.on_button, context.getString(R.string.button_state_on));
else if (s.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.PUSH_OFF_BUTTON)
views.setTextViewText(R.id.on_button, context.getString(R.string.button_state_off));
Expand Down Expand Up @@ -395,7 +395,7 @@ private int withButtons(DevicesInfo s) {

case DomoticzValues.Device.Type.Value.BLINDS:
case DomoticzValues.Device.Type.Value.BLINDINVERTED:
if(DomoticzValues.canHandleStopButton(s))
if (DomoticzValues.canHandleStopButton(s))
withButton = BUTTON_3;
else
withButton = BUTTON_2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.RemoteViews;

import java.util.ArrayList;
Expand Down Expand Up @@ -85,6 +84,7 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager,
public static class UpdateWidgetService extends IntentService {
private static final int WITHBUTTON = 1;
private RemoteViews views;

public UpdateWidgetService() {
super("UpdateWidgetService");
}
Expand All @@ -100,7 +100,7 @@ protected void onHandleIntent(Intent intent) {
try {
updateAppWidget(appWidgetManager, incomingAppWidgetId);
} catch (NullPointerException e) {
if(e != null && !UsefulBits.isEmpty(e.getMessage()))
if (e != null && !UsefulBits.isEmpty(e.getMessage()))
Log.e(WidgetProviderSmall.class.getSimpleName(), e.getMessage());
}
}
Expand Down Expand Up @@ -210,14 +210,14 @@ public void onReceiveScene(SceneInfo s) {
return;

if (s.getStatusInString() != null) {
views.setTextViewText(R.id.title, s.getName());
views.setTextViewText(R.id.desc, s.getStatusInString());
views.setOnClickPendingIntent(R.id.rowIcon, buildButtonPendingIntent(
UpdateWidgetService.this,
appWidgetId,
idx,
!s.getStatusInBoolean(),
true));
views.setTextViewText(R.id.title, s.getName());
views.setTextViewText(R.id.desc, s.getStatusInString());
views.setOnClickPendingIntent(R.id.rowIcon, buildButtonPendingIntent(
UpdateWidgetService.this,
appWidgetId,
idx,
!s.getStatusInBoolean(),
true));
}

views.setImageViewResource(R.id.rowIcon, DomoticzIcons.getDrawableIcon(s.getType(), null, null, false, false, null));
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/dialog_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/appwidget_bg_clickable"
android:orientation="vertical">

<RelativeLayout
Expand Down
8 changes: 4 additions & 4 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Fri Jan 20 14:28:48 CET 2017
VERSION_BUILD=2066
VERSION_PATCH=358
VERSION_CODE=175
#Mon Jan 23 16:33:15 CET 2017
VERSION_BUILD=2104
VERSION_PATCH=360
VERSION_CODE=177
Loading

0 comments on commit d00f684

Please sign in to comment.