Skip to content

Commit

Permalink
v0.1.139
Browse files Browse the repository at this point in the history
- #44 Weather - more info
- #43 Geofence wrong subtitle
- #35 Improve quality of icons on tablets
  • Loading branch information
galadril committed Nov 25, 2015
1 parent 2a35b85 commit fc4745e
Show file tree
Hide file tree
Showing 285 changed files with 721 additions and 380 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId 'nl.hnogames.domoticz'
minSdkVersion 17
targetSdkVersion 23
versionCode 21
versionName '0.1.138'
versionCode 22
versionName '0.1.139'
}
buildTypes {
release {
Expand Down
79 changes: 39 additions & 40 deletions app/src/main/java/nl/hnogames/domoticz/Adapters/DevicesAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public DevicesAdapter(Context context,

super();

mSharedPrefs=new SharedPrefUtil(context);
mSharedPrefs = new SharedPrefUtil(context);

this.context = context;
domoticz = new Domoticz(context);
Expand Down Expand Up @@ -151,14 +151,14 @@ private View setSwitchRowId(DevicesInfo mExtendedStatusInfo, ViewHolder holder)


private View setOnOffSwitchRowId(ViewHolder holder) {
if(mSharedPrefs.showExtraData())
if (mSharedPrefs.showExtraData())
layoutResourceId = R.layout.switch_row_on_off;
else layoutResourceId = R.layout.switch_row_on_off_small;

LayoutInflater inflater = ((Activity) context).getLayoutInflater();
View row = inflater.inflate(layoutResourceId, null);

holder.extrapanel = (LinearLayout)row.findViewById(R.id.extra_panel);
holder.extrapanel = (LinearLayout) row.findViewById(R.id.extra_panel);
holder.onOffSwitch = (Switch) row.findViewById(R.id.switch_button);
holder.signal_level = (TextView) row.findViewById(R.id.switch_signal_level);
holder.iconRow = (ImageView) row.findViewById(R.id.rowIcon);
Expand All @@ -168,16 +168,16 @@ private View setOnOffSwitchRowId(ViewHolder holder) {
holder.buttonLog = (Button) row.findViewById(R.id.log_button);
holder.buttonTimer = (Button) row.findViewById(R.id.timer_button);

if(holder.buttonLog!=null)
if (holder.buttonLog != null)
holder.buttonLog.setVisibility(View.GONE);
if(holder.buttonTimer!=null)
if (holder.buttonTimer != null)
holder.buttonTimer.setVisibility(View.GONE);

return row;
}

private View setMotionSwitchRowId(ViewHolder holder) {
if(mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_motion;
if (mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_motion;
else layoutResourceId = R.layout.switch_row_motion_small;

LayoutInflater inflater = ((Activity) context).getLayoutInflater();
Expand All @@ -192,15 +192,15 @@ private View setMotionSwitchRowId(ViewHolder holder) {
holder.buttonLog = (Button) row.findViewById(R.id.log_button);
holder.buttonTimer = (Button) row.findViewById(R.id.timer_button);

if(holder.buttonLog!=null)
if (holder.buttonLog != null)
holder.buttonLog.setVisibility(View.GONE);
if(holder.buttonTimer!=null)
if (holder.buttonTimer != null)
holder.buttonTimer.setVisibility(View.GONE);
return row;
}

private View setDefaultRowId(ViewHolder holder) {
if(mSharedPrefs.showExtraData()) layoutResourceId = R.layout.dashboard_row_default;
if (mSharedPrefs.showExtraData()) layoutResourceId = R.layout.dashboard_row_default;
else layoutResourceId = R.layout.dashboard_row_default_small;

LayoutInflater inflater = ((Activity) context).getLayoutInflater();
Expand All @@ -215,7 +215,7 @@ private View setDefaultRowId(ViewHolder holder) {
}

private View setPushOnOffSwitchRowId(ViewHolder holder) {
if(mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_pushon;
if (mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_pushon;
else layoutResourceId = R.layout.switch_row_pushon_small;

LayoutInflater inflater = ((Activity) context).getLayoutInflater();
Expand All @@ -230,17 +230,17 @@ private View setPushOnOffSwitchRowId(ViewHolder holder) {
holder.buttonLog = (Button) row.findViewById(R.id.log_button);
holder.buttonTimer = (Button) row.findViewById(R.id.timer_button);

if(holder.buttonLog!=null)
if (holder.buttonLog != null)
holder.buttonLog.setVisibility(View.GONE);
if(holder.buttonTimer!=null)
if (holder.buttonTimer != null)
holder.buttonTimer.setVisibility(View.GONE);

return row;
}

private View setBlindsRowId(ViewHolder holder) {

if(mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_blinds;
if (mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_blinds;
else layoutResourceId = R.layout.switch_row_blinds_small;


Expand All @@ -260,7 +260,7 @@ private View setBlindsRowId(ViewHolder holder) {

private View setDimmerRowId(ViewHolder holder) {

if(mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_dimmer;
if (mSharedPrefs.showExtraData()) layoutResourceId = R.layout.switch_row_dimmer;
else layoutResourceId = R.layout.switch_row_dimmer_small;

LayoutInflater inflater = ((Activity) context).getLayoutInflater();
Expand All @@ -277,9 +277,9 @@ private View setDimmerRowId(ViewHolder holder) {
holder.buttonLog = (Button) row.findViewById(R.id.log_button);
holder.buttonTimer = (Button) row.findViewById(R.id.timer_button);

if(holder.buttonLog!=null)
if (holder.buttonLog != null)
holder.buttonLog.setVisibility(View.GONE);
if(holder.buttonTimer!=null)
if (holder.buttonTimer != null)
holder.buttonTimer.setVisibility(View.GONE);

return row;
Expand Down Expand Up @@ -314,9 +314,9 @@ private void setSwitchRowData(DevicesInfo mExtendedStatusInfo,
setPushOnOffSwitchRowData(mExtendedStatusInfo, holder, false);
break;

case Domoticz.Device.Type.Value.BLINDS:
setBlindsRowData(mExtendedStatusInfo, holder);
break;
case Domoticz.Device.Type.Value.BLINDS:
setBlindsRowData(mExtendedStatusInfo, holder);
break;

case Domoticz.Device.Type.Value.DIMMER:
setDimmerRowData(mExtendedStatusInfo, holder);
Expand All @@ -331,17 +331,17 @@ private void setSwitchRowData(DevicesInfo mExtendedStatusInfo,
private void setDefaultRowData(DevicesInfo mExtendedStatusInfo,
ViewHolder holder) {
holder.isProtected = mExtendedStatusInfo.isProtected();
if(holder.switch_name!=null)
if (holder.switch_name != null)
holder.switch_name.setText(mExtendedStatusInfo.getName());

String text = context.getString(R.string.last_update) + ": " +
String.valueOf(mExtendedStatusInfo.getLastUpdate().substring(mExtendedStatusInfo.getLastUpdate().indexOf(" ") + 1));
if(holder.signal_level!=null)
if (holder.signal_level != null)
holder.signal_level.setText(text);

text = context.getString(R.string.data) + ": " +
String.valueOf(mExtendedStatusInfo.getData());
if(holder.switch_battery_level!=null)
if (holder.switch_battery_level != null)
holder.switch_battery_level.setText(text);
Picasso.with(context).load(domoticz.getDrawableIcon(mExtendedStatusInfo.getTypeImg())).into(holder.iconRow);
}
Expand All @@ -350,25 +350,25 @@ private void setOnOffSwitchRowData(DevicesInfo mExtendedStatusInfo,
ViewHolder holder) {

holder.isProtected = mExtendedStatusInfo.isProtected();
if(holder.switch_name!=null)
if (holder.switch_name != null)
holder.switch_name.setText(mExtendedStatusInfo.getName());

String text = context.getString(R.string.last_update) + ": " +
String.valueOf(mExtendedStatusInfo.getLastUpdate().substring(mExtendedStatusInfo.getLastUpdate().indexOf(" ") + 1));
if(holder.signal_level!=null)
if (holder.signal_level != null)
holder.signal_level.setText(text);

text = context.getString(R.string.data) + ": " +
String.valueOf(mExtendedStatusInfo.getData());
if(holder.switch_battery_level!=null)
if (holder.switch_battery_level != null)
holder.switch_battery_level.setText(text);

if (holder.isProtected)
holder.onOffSwitch.setEnabled(false);

Picasso.with(context).load(domoticz.getDrawableIcon(mExtendedStatusInfo.getTypeImg())).into(holder.iconRow);

if(holder.onOffSwitch!=null) {
if (holder.onOffSwitch != null) {
holder.onOffSwitch.setId(mExtendedStatusInfo.getIdx());
holder.onOffSwitch.setChecked(mExtendedStatusInfo.getStatusBoolean());
holder.onOffSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
Expand All @@ -379,8 +379,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
});
}

if(holder.buttonLog!=null)
{
if (holder.buttonLog != null) {
holder.buttonLog.setId(mExtendedStatusInfo.getIdx());
holder.buttonLog.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -393,17 +392,17 @@ public void onClick(View v) {

private void setPushOnOffSwitchRowData(DevicesInfo mExtendedStatusInfo, ViewHolder holder, boolean action) {
holder.isProtected = mExtendedStatusInfo.isProtected();
if(holder.switch_name!=null)
if (holder.switch_name != null)
holder.switch_name.setText(mExtendedStatusInfo.getName());

String text = context.getString(R.string.last_update) + ": " +
String.valueOf(mExtendedStatusInfo.getLastUpdate().substring(mExtendedStatusInfo.getLastUpdate().indexOf(" ") + 1));
if(holder.signal_level!=null)
if (holder.signal_level != null)
holder.signal_level.setText(text);

text = context.getString(R.string.data) + ": " +
String.valueOf(mExtendedStatusInfo.getData());
if(holder.switch_battery_level!=null)
if (holder.switch_battery_level != null)
holder.switch_battery_level.setText(text);

if (holder.isProtected)
Expand All @@ -430,7 +429,7 @@ public void onClick(View v) {
handleOnButtonClick(v.getId(), false);
}
});
if(holder.buttonLog!=null) {
if (holder.buttonLog != null) {
holder.buttonLog.setId(mExtendedStatusInfo.getIdx());
holder.buttonLog.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -445,22 +444,22 @@ private void setBlindsRowData(DevicesInfo mExtendedStatusInfo,
ViewHolder holder) {
holder.isProtected = mExtendedStatusInfo.isProtected();

if(holder.switch_name!=null)
if (holder.switch_name != null)
holder.switch_name.setText(mExtendedStatusInfo.getName());

String text = context.getString(R.string.last_update) + ": " +
String.valueOf(mExtendedStatusInfo.getLastUpdate().substring(mExtendedStatusInfo.getLastUpdate().indexOf(" ") + 1));
if(holder.signal_level!=null)
if (holder.signal_level != null)
holder.signal_level.setText(text);

text = context.getString(R.string.status) + ": " +
mExtendedStatusInfo.getStatus();
if(holder.switch_status!=null)
if (holder.switch_status != null)
holder.switch_status.setText(text);

text = context.getString(R.string.data) + ": " +
String.valueOf(mExtendedStatusInfo.getData());
if(holder.switch_battery_level!=null)
if (holder.switch_battery_level != null)
holder.switch_battery_level.setText(text);


Expand Down Expand Up @@ -499,17 +498,17 @@ private void setDimmerRowData(final DevicesInfo mExtendedStatusInfo,

holder.isProtected = mExtendedStatusInfo.isProtected();

if(holder.switch_name!=null)
if (holder.switch_name != null)
holder.switch_name.setText(mExtendedStatusInfo.getName());

String text = context.getString(R.string.last_update) + ": " +
String.valueOf(mExtendedStatusInfo.getLastUpdate().substring(mExtendedStatusInfo.getLastUpdate().indexOf(" ") + 1));
if(holder.signal_level!=null)
if (holder.signal_level != null)
holder.signal_level.setText(text);

text = context.getString(R.string.data) + ": " +
String.valueOf(mExtendedStatusInfo.getData());
if(holder.switch_battery_level!=null)
if (holder.switch_battery_level != null)
holder.switch_battery_level.setText(text);

holder.switch_dimmer_level.setId(mExtendedStatusInfo.getIdx() + ID_TEXTVIEW);
Expand Down Expand Up @@ -580,7 +579,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
holder.dimmer.setVisibility(View.VISIBLE);
}

if( holder.buttonLog!=null) {
if (holder.buttonLog != null) {
holder.buttonLog.setId(mExtendedStatusInfo.getIdx());
holder.buttonLog.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
public class LocationAdapter extends BaseAdapter {

private static final String TAG = LocationAdapter.class.getSimpleName();

Context context;
public ArrayList<LocationInfo> data = null;
Context context;
private SharedPrefUtil prefs;

private LocationClickListener listener;
Expand All @@ -42,7 +41,7 @@ public LocationAdapter(Context context,

@Override
public int getCount() {
if(data==null)
if (data == null)
return 0;

return data.size();
Expand Down Expand Up @@ -84,7 +83,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.longitude.setText(context.getString(R.string.longitude) + ": " + mLocationInfo.getLocation().longitude);
holder.radius.setText(context.getString(R.string.radius) + ": " + mLocationInfo.getRange());

if(mLocationInfo.getSwitchidx()>0)
if (mLocationInfo.getSwitchidx() > 0)
holder.connectedSwitch.setText(context.getString(R.string.connectedswitch) + ": " + mLocationInfo.getSwitchidx());
else
holder.connectedSwitch.setText(context.getString(R.string.connectedswitch) + ": N/A");
Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/nl/hnogames/domoticz/Adapters/LogAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,23 @@ public View getView(int position, View convertView, ViewGroup parent) {
String dateTime = mLogInfo.getMessage().substring(0, mLogInfo.getMessage().indexOf(" ")).trim();
String message = mLogInfo.getMessage().substring(mLogInfo.getMessage().indexOf(" ") + 1).trim();

layoutResourceId = R.layout.logs_row_default;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(layoutResourceId, parent, false);
layoutResourceId = R.layout.logs_row_default;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(layoutResourceId, parent, false);

holder.name = (TextView) convertView.findViewById(R.id.logs_name);
holder.datetime = (TextView) convertView.findViewById(R.id.logs_datetime);
holder.message = (TextView) convertView.findViewById(R.id.logs_message);
holder.iconRow = (ImageView) convertView.findViewById(R.id.rowIcon);

if(message.indexOf(":")>0) {
if (message.indexOf(":") > 0) {
holder.name.setText(message.substring(0, message.indexOf(":")).trim());
holder.message.setText(message.substring(message.indexOf(":") + 1).trim());
}
else{
if(message.startsWith("(")) {
holder.name.setText(message.substring(0, message.indexOf(")")).replace("(","").trim());
} else {
if (message.startsWith("(")) {
holder.name.setText(message.substring(0, message.indexOf(")")).replace("(", "").trim());
holder.message.setText(message.substring(message.indexOf(")") + 1).trim());
}
else
} else
holder.name.setText(message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void onBindViewHolder(ViewHolder holder, int position) {
// This method returns the number of items present in the list
@Override
public int getItemCount() {
if(mNavTitles!=null)
if (mNavTitles != null)
return mNavTitles.length + 1; // the number of items in the list will be +1 the titles including the header view.
else
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
Picasso.with(context).load(domoticz.getDrawableIcon(mTemperatureInfo.getTypeImg())).into(holder.iconRow);

holder.name.setText(mTemperatureInfo.getName());
holder.data.append(": "+mTemperatureInfo.getData());
holder.hardware.append(": "+mTemperatureInfo.getHardwareName());
holder.data.append(": " + mTemperatureInfo.getData());
holder.hardware.append(": " + mTemperatureInfo.getHardwareName());

convertView.setTag(holder);
return convertView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void onClick(View view) {

holder.name.setText(mUtilitiesInfo.getName());
holder.data.append(": " + mUtilitiesInfo.getData());
holder.hardware.append(": "+mUtilitiesInfo.getHardwareName());
holder.hardware.append(": " + mUtilitiesInfo.getHardwareName());

Picasso.with(context).load(domoticz.getDrawableIcon(mUtilitiesInfo.getTypeImg())).into(holder.iconRow);
}
Expand Down
Loading

0 comments on commit fc4745e

Please sign in to comment.